Print this page
4443 apic_intrmap_init comment could use an update


1482                         send_dirintf = pops->psm_send_ipi;
1483                 }
1484                 apic_poweron_cnt++;
1485         } else {
1486                 ASSERT(apic_poweron_cnt > 0);
1487                 apic_poweron_cnt--;
1488                 if (apic_poweron_cnt == 0) {
1489                         pops->psm_send_ipi = x2apic_send_ipi;
1490                         send_dirintf = pops->psm_send_ipi;
1491                 }
1492         }
1493         lock_clear(&apic_mode_switch_lock);
1494         intr_restore(iflag);
1495 }
1496 
1497 void
1498 apic_intrmap_init(int apic_mode)
1499 {
1500         int suppress_brdcst_eoi = 0;
1501 
1502         if (psm_vt_ops != NULL) {
1503                 /*
1504                  * Since X2APIC requires the use of interrupt remapping
1505                  * (though this is not documented explicitly in the Intel
1506                  * documentation (yet)), initialize interrupt remapping
1507                  * support before initializing the X2APIC unit.












1508                  */


1509                 if (((apic_intrmap_ops_t *)psm_vt_ops)->
1510                     apic_intrmap_init(apic_mode) == DDI_SUCCESS) {
1511 
1512                         apic_vt_ops = psm_vt_ops;
1513 
1514                         /*
1515                          * We leverage the interrupt remapping engine to
1516                          * suppress broadcast EOI; thus we must send the
1517                          * directed EOI with the directed-EOI handler.
1518                          */
1519                         if (apic_directed_EOI_supported() == 0) {
1520                                 suppress_brdcst_eoi = 1;
1521                         }
1522 
1523                         apic_vt_ops->apic_intrmap_enable(suppress_brdcst_eoi);
1524 
1525                         if (apic_detect_x2apic()) {
1526                                 apic_enable_x2apic();
1527                         }
1528 




1482                         send_dirintf = pops->psm_send_ipi;
1483                 }
1484                 apic_poweron_cnt++;
1485         } else {
1486                 ASSERT(apic_poweron_cnt > 0);
1487                 apic_poweron_cnt--;
1488                 if (apic_poweron_cnt == 0) {
1489                         pops->psm_send_ipi = x2apic_send_ipi;
1490                         send_dirintf = pops->psm_send_ipi;
1491                 }
1492         }
1493         lock_clear(&apic_mode_switch_lock);
1494         intr_restore(iflag);
1495 }
1496 
1497 void
1498 apic_intrmap_init(int apic_mode)
1499 {
1500         int suppress_brdcst_eoi = 0;
1501 

1502         /*
1503          * Intel Software Developer's Manual 3A, 10.12.7:
1504          *
1505          * Routing of device interrupts to local APIC units operating in
1506          * x2APIC mode requires use of the interrupt-remapping architecture
1507          * specified in the Intel Virtualization Technology for Directed
1508          * I/O, Revision 1.3.  Because of this, BIOS must enumerate support
1509          * for and software must enable this interrupt remapping with
1510          * Extended Interrupt Mode Enabled before it enabling x2APIC mode in
1511          * the local APIC units.
1512          *
1513          *
1514          * In other words, to use the APIC in x2APIC mode, we need interrupt
1515          * remapping.  Since we don't start up the IOMMU by default, we
1516          * won't be able to do any interrupt remapping and therefore have to
1517          * use the APIC in traditional 'local APIC' mode with memory mapped
1518          * I/O.
1519          */
1520 
1521         if (psm_vt_ops != NULL) {
1522                 if (((apic_intrmap_ops_t *)psm_vt_ops)->
1523                     apic_intrmap_init(apic_mode) == DDI_SUCCESS) {
1524 
1525                         apic_vt_ops = psm_vt_ops;
1526 
1527                         /*
1528                          * We leverage the interrupt remapping engine to
1529                          * suppress broadcast EOI; thus we must send the
1530                          * directed EOI with the directed-EOI handler.
1531                          */
1532                         if (apic_directed_EOI_supported() == 0) {
1533                                 suppress_brdcst_eoi = 1;
1534                         }
1535 
1536                         apic_vt_ops->apic_intrmap_enable(suppress_brdcst_eoi);
1537 
1538                         if (apic_detect_x2apic()) {
1539                                 apic_enable_x2apic();
1540                         }
1541