]> git.karo-electronics.de Git - karo-tx-linux.git/commit
x86/apic: Enable x2APIC physical mode on native hardware too, when there are fewer...
authorYouquan Song <youquan.song@intel.com>
Fri, 12 Jul 2013 01:22:39 +0000 (21:22 -0400)
committerIngo Molnar <mingo@kernel.org>
Tue, 23 Jul 2013 09:15:42 +0000 (11:15 +0200)
commit3d1acb49d22fbbae96524040e9e2d4cbbb3adbef
treea0edb316cc9ac4784e5a0271b07dd7e23f3e9cb0
parent82982d729319e975115d88cae4927dffb02bfea7
x86/apic: Enable x2APIC physical mode on native hardware too, when there are fewer than 256 CPUs

x2APIC extends APICID from 8 bits to 32 bits, but the device
interrupt routed from IOAPIC or delivered in MSI mode will keep
8 bits destination APICID.  In order to support x2APIC, the VT-d
interrupt remapping is introduced to translate the destination
APICID to 32 bits in x2APIC mode and keep the device compatible
in this way.

x2APIC support both logical and physical mode in destination
mode.

In logical destination mode, the 32 bits Logical APICID
has 2 sub-fields: 16 bits cluster ID and 16 bits logical ID within
the cluster and it is required VT-d interrupt remapping in x2APIC
cluster mode.

In physical destination mode, the 8 bits physical id is
compatible with 32  bits physical id when CPU number < 256.

When interrupt remapping initialization fails on platforms with
CPU number < 256, the current kernel only enables x2APIC physical
mode in virtualization environment, while we could also can enable
x2APIC physcial mode in native kernel this situation.

In this case the device interrupt will use 8 bits destination
APICID in physical mode and be compatible with x2APIC physical
when < 256 CPUs.

So we can benefit from x2APIC vs xAPIC MMIO:

 - x2APIC MSR read/write is faster than xAPIC mmio

 - x2APIC only ICR write to deliver interrupt without polling ICR deliver
   status bit and xAPIC need poll to read ICR deliver status bit.

 - x2APIC 64 bits ICR access instead of xAPIC two 32 bits access.

Signed-off-by: Youquan Song <youquan.song@intel.com>
Cc: Youquan Song <youquan.song@linux.intel.com>
Cc: hpa@linux.intel.com
Cc: yinghai@kernel.org
Link: http://lkml.kernel.org/r/1373592159-459-1-git-send-email-youquan.song@intel.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/kernel/apic/apic.c