aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/apic.c
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2009-09-07 08:44:50 +0100
committerKeir Fraser <keir.fraser@citrix.com>2009-09-07 08:44:50 +0100
commitcda2f6c76132090176f4b88c84917861c21bd21c (patch)
tree387ba0fdfd857d89ec9501ad9c1f0e04adeb5b17 /xen/arch/x86/apic.c
parent1589882b8b25246268332a58135a2e66e20d63e2 (diff)
downloadxen-cda2f6c76132090176f4b88c84917861c21bd21c.tar.gz
xen-cda2f6c76132090176f4b88c84917861c21bd21c.tar.bz2
xen-cda2f6c76132090176f4b88c84917861c21bd21c.zip
vt-d: enhance the support of Interrupt Remapping EIM and x2APIC
1) Clear Interrupt Remapping(IR) unit's CFI (Compatibility Format Interrupt) to enhance security; 2) Move the iommu_setup() ahead and put it before we begin to use IOAPIC so we can make sure after we enable Interrupt Remapping, the later IOAPIC (and MSI) initialization would setup IOAPIC RTEs (and MSI) with remappable format; 3) Enable x2APIC only when all VT-d engines support IR with EIM (Extended Interrupt Mode). EIM enables external devices to deliver interrupts to logical processor with >8-bit APIC ID. Signed-off-by: Dexuan Cui <dexuan.cui@intel.com>
Diffstat (limited to 'xen/arch/x86/apic.c')
-rw-r--r--xen/arch/x86/apic.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/xen/arch/x86/apic.c b/xen/arch/x86/apic.c
index b0d6392cda..47d614269e 100644
--- a/xen/arch/x86/apic.c
+++ b/xen/arch/x86/apic.c
@@ -848,6 +848,9 @@ void enable_x2apic(void)
{
u32 lo, hi;
+ if ( !iommu_supports_eim() )
+ return;
+
rdmsr(MSR_IA32_APICBASE, lo, hi);
if ( !(lo & MSR_IA32_APICBASE_EXTD) )
{
@@ -858,7 +861,13 @@ void enable_x2apic(void)
else
printk("x2APIC mode enabled by BIOS.\n");
- x2apic_enabled = 1;
+ if ( !x2apic_enabled )
+ {
+ x2apic_enabled = 1;
+ genapic = &apic_x2apic;
+ printk(KERN_INFO "Switched to APIC driver %s.\n",
+ genapic->name);
+ }
}
void __init init_apic_mappings(void)
@@ -889,6 +898,8 @@ __next:
*/
if (boot_cpu_physical_apicid == -1U)
boot_cpu_physical_apicid = get_apic_id();
+ x86_cpu_to_apicid[0] = get_apic_id();
+ cpu_2_logical_apicid[0] = get_logical_apic_id();
init_ioapic_mappings();
}