diff mbox series

[RFC,3/4] x86/public: Expose physaddr_abi through Xen HVM CPUID leaf

Message ID 35adbbb83d59ee0beb7247e9adcdddd133b1dbd8.1744981654.git.teddy.astie@vates.tech (mailing list archive)
State New
Headers show
Series Physical address hypercall ABI ("HVMv2") | expand

Commit Message

Teddy Astie April 18, 2025, 2:18 p.m. UTC
The guest needs to know this information before attempting to make a hypercall
(especially ones to fetch XENFEAT_*).

Signed-off-by: Teddy Astie <teddy.astie@vates.tech>
---
 xen/arch/x86/cpuid.c                | 3 +++
 xen/include/public/arch-x86/cpuid.h | 2 ++
 2 files changed, 5 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 8dc68945f7..a721499920 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -153,6 +153,9 @@  static void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
          */
         res->a |= XEN_HVM_CPUID_UPCALL_VECTOR;
 
+        /* Indicate if the guest uses the physical addresses hypercall ABI. */
+        if ( is_hvm_physaddr_abi(v->domain) )
+            res->a |= XEN_HVM_CPUID_PHYS_ADDR_ABI;
         break;
 
     case 5: /* PV-specific parameters */
diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-x86/cpuid.h
index 3bb0dd249f..b8ceb833d7 100644
--- a/xen/include/public/arch-x86/cpuid.h
+++ b/xen/include/public/arch-x86/cpuid.h
@@ -106,6 +106,8 @@ 
  * bound to event channels.
  */
 #define XEN_HVM_CPUID_UPCALL_VECTOR    (1u << 6)
+/* Hypercalls are using physical addresses instead of linear ones. */
+#define XEN_HVM_CPUID_PHYS_ADDR_ABI    (1u << 7)
 
 /*
  * Leaf 6 (0x40000x05)