debuggers.hg

changeset 21020:3b475d9ed6b5

vtd: interrupt remapping: be more defensive

1) A buggy BIOS may not report IOAPIC in DRHD. Currently we still try
to enable IR while the IOAPIC RTEs are still in non-remappable format
and the host would hang. The patch detects this case and will not try
to enable IR.

2) Currently HPET's MSI mode doesn't work if IR is enabled because we
have no code to allocate IRTE for it. Luckily this HW configuration is
rather rarely at present, we can just work it around by only using
HPET's IOAPIC mode for now.

Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Feb 24 10:59:37 2010 +0000 (2010-02-24)
parents 46149b7d5df2
children 9c0793e75f54
files xen/arch/x86/hpet.c xen/drivers/passthrough/vtd/iommu.c
line diff
     1.1 --- a/xen/arch/x86/hpet.c	Wed Feb 24 10:58:03 2010 +0000
     1.2 +++ b/xen/arch/x86/hpet.c	Wed Feb 24 10:59:37 2010 +0000
     1.3 @@ -380,6 +380,14 @@ static int hpet_fsb_cap_lookup(void)
     1.4      unsigned int num_chs, num_chs_used;
     1.5      int i;
     1.6  
     1.7 +    /* TODO. */
     1.8 +    if ( iommu_intremap )
     1.9 +    {
    1.10 +        printk(XENLOG_INFO "HPET's MSI mode hasn't been supported when "
    1.11 +            "Interrupt Remapping is enabled.\n");
    1.12 +        return 0;
    1.13 +    }
    1.14 +
    1.15      id = hpet_read32(HPET_ID);
    1.16  
    1.17      num_chs = ((id & HPET_ID_NUMBER) >> HPET_ID_NUMBER_SHIFT);
     2.1 --- a/xen/drivers/passthrough/vtd/iommu.c	Wed Feb 24 10:58:03 2010 +0000
     2.2 +++ b/xen/drivers/passthrough/vtd/iommu.c	Wed Feb 24 10:59:37 2010 +0000
     2.3 @@ -1827,6 +1827,23 @@ static int init_vtd_hw(void)
     2.4  
     2.5      if ( iommu_intremap )
     2.6      {
     2.7 +        int apic;
     2.8 +        for ( apic = 0; apic < nr_ioapics; apic++ )
     2.9 +        {
    2.10 +            if ( ioapic_to_iommu(IO_APIC_ID(apic)) == NULL )
    2.11 +            {
    2.12 +                iommu_intremap = 0;
    2.13 +                dprintk(XENLOG_ERR VTDPREFIX,
    2.14 +                    "ioapic_to_iommu: ioapic 0x%x (id: 0x%x) is NULL! "
    2.15 +                    "Will not try to enable Interrupt Remapping.\n",
    2.16 +                    apic, IO_APIC_ID(apic));
    2.17 +                break;
    2.18 +            }
    2.19 +        }
    2.20 +    }
    2.21 +
    2.22 +    if ( iommu_intremap )
    2.23 +    {
    2.24          for_each_drhd_unit ( drhd )
    2.25          {
    2.26              iommu = drhd->iommu;