|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH v4 9/9] x86/cpuid: Advertise XEN_HVM_CPUID_EXT_DEST_ID when device model opts in
Set the XEN_HVM_CPUID_EXT_DEST_ID bit in the HVM hypervisor CPUID leaf
based on the domain-level ext_dest_id flag, which is locked at domain
creation time by taking the AND across all registered ioreq servers that
set XEN_DMOP_IOREQ_SERVER_EXT_DEST_ID. This guarantees that the bit is
only advertised when every active device model will use
XEN_DMOP_bind_pt_msi_irq for passthrough MSIs, so Xen can decode the
extended destination bits from the raw MSI address internally.
After creation_finished the locked d->arch.hvm.ext_dest_id is used
directly, providing a stable and migration-safe value independent of
whether ioreq servers have been re-registered yet. Before
creation_finished the dynamic per-server check is used so toolstack
queries during domain setup reflect the current state.
An old device model that never sets XEN_DMOP_IOREQ_SERVER_EXT_DEST_ID
will keep the bit clear, preserving backwards compatibility with guests
that only use 8-bit APIC destination IDs. A device model that opts in
enables support for x2APIC destination IDs above 255.
Signed-off-by: Julian Vetter <julian.vetter@xxxxxxxxxx>
---
Changes in v4:
- Corresponds to v3 patch 7, updated for the new negotiation mechanism
introduced in patch 8. The bit now reflects the levelled result
computed at arch_domain_creation_finished()
- Before creation_finished(): the dynamic hvm_ext_dest_id_enabled()
check is used (so toolstack CPUID queries during domain setup see
the current state)
- After creation_finished(): the locked d->arch.hvm.ext_dest_id is used
directly for migration-safe value that does not depend
on whether ioreq servers have been re-registered on the
destination host yet
---
xen/arch/x86/cpuid.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 6e9b15c9c3..828aaa9f5b 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -1,3 +1,4 @@
+#include <xen/ioreq.h>
#include <xen/sched.h>
#include <xen/types.h>
#include <xen/version.h>
@@ -148,6 +149,18 @@ static void cpuid_hypervisor_leaves(const struct vcpu *v,
uint32_t leaf,
res->a |= XEN_HVM_CPUID_DOMID_PRESENT;
res->c = d->domain_id;
+ /*
+ * Advertise extended destination ID support. Once domain creation has
+ * finished the locked domain flag is authoritative (ensuring a
+ * consistent view across migration, before the device model
+ * re-registers its ioreq servers on the destination). Before
+ * creation_finished the dynamic per-server check is used so that
+ * toolstack queries during domain setup reflect the current state.
+ */
+ if ( d->creation_finished ? d->arch.hvm.ext_dest_id
+ : hvm_ext_dest_id_enabled(d) )
+ res->a |= XEN_HVM_CPUID_EXT_DEST_ID;
+
/*
* Per-vCPU event channel upcalls are implemented and work
* correctly with PIRQs routed over event channels.
--
2.53.0
--
Julian Vetter | Vates Hypervisor & Kernel Developer
XCP-ng & Xen Orchestra - Vates solutions
web: https://vates.tech
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |