Skip to content

Commit e07e98d

Browse files
roygerjgross1
authored andcommitted
xen/x86: detect support for extended destination ID
Xen allows the usage of some previously reserved bits in the IO-APIC RTE and the MSI address fields in order to store high bits for the target APIC ID. Such feature is already implemented by QEMU/KVM and HyperV, so in order to enable it just add the handler that checks for it's presence. Signed-off-by: Roger Pau Monné <[email protected]> Reviewed-by: Juergen Gross <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Juergen Gross <[email protected]>
1 parent f34c4f2 commit e07e98d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

arch/x86/include/asm/xen/cpuid.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,13 @@
100100
/* Memory mapped from other domains has valid IOMMU entries */
101101
#define XEN_HVM_CPUID_IOMMU_MAPPINGS (1u << 2)
102102
#define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) /* vcpu id is present in EBX */
103+
#define XEN_HVM_CPUID_DOMID_PRESENT (1u << 4) /* domid is present in ECX */
104+
/*
105+
* Bits 55:49 from the IO-APIC RTE and bits 11:5 from the MSI address can be
106+
* used to store high bits for the Destination ID. This expands the Destination
107+
* ID field from 8 to 15 bits, allowing to target APIC IDs up 32768.
108+
*/
109+
#define XEN_HVM_CPUID_EXT_DEST_ID (1u << 5)
103110

104111
/*
105112
* Leaf 6 (0x40000x05)

arch/x86/xen/enlighten_hvm.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ static __init bool xen_x2apic_available(void)
248248
return x2apic_supported();
249249
}
250250

251+
static bool __init msi_ext_dest_id(void)
252+
{
253+
return cpuid_eax(xen_cpuid_base() + 4) & XEN_HVM_CPUID_EXT_DEST_ID;
254+
}
255+
251256
static __init void xen_hvm_guest_late_init(void)
252257
{
253258
#ifdef CONFIG_XEN_PVH
@@ -310,6 +315,7 @@ struct hypervisor_x86 x86_hyper_xen_hvm __initdata = {
310315
.init.x2apic_available = xen_x2apic_available,
311316
.init.init_mem_mapping = xen_hvm_init_mem_mapping,
312317
.init.guest_late_init = xen_hvm_guest_late_init,
318+
.init.msi_ext_dest_id = msi_ext_dest_id,
313319
.runtime.pin_vcpu = xen_pin_vcpu,
314320
.ignore_nopv = true,
315321
};

0 commit comments

Comments
 (0)