Re: [PATCH v6 2/2] KVM: x86/xen: update Xen CPUID Leaf 4 (tsc info) sub-leaves, if present
From: Sean Christopherson
Date: Wed Jan 04 2023 - 14:40:24 EST
On Tue, Dec 20, 2022, Paul Durrant wrote:
> @@ -143,6 +148,8 @@ int kvm_xen_hypercall(struct kvm_vcpu *vcpu);
> #include <asm/xen/interface.h>
> #include <xen/interface/vcpu.h>
>
> +#define XEN_SIGNATURE "XenVMMXenVMM"
arch/x86/include/asm/xen/hypervisor.h also open codes the signature. Rather than
add a KVM-specific define, what about putting in xen/cpuid.h? (I've had a version
of this series sitting in my todo pile for far too long, sorry).
--
From: Sean Christopherson <seanjc@xxxxxxxxxx>
Date: Mon, 11 Jul 2022 15:18:42 -0700
Subject: [PATCH] xen: Add a #define to provide Xen's CPUID signature as a
string
Add XEN_SIGNATURE instead of open coding it in xen_cpuid_base() so
that KVM can reuse the definition when querying a VM's CPUID.
No functional change intended.
Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
---
arch/x86/include/asm/xen/cpuid.h | 1 +
arch/x86/include/asm/xen/hypervisor.h | 3 ++-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/include/asm/xen/cpuid.h b/arch/x86/include/asm/xen/cpuid.h
index 6daa9b0c8d11..38f1bd153f42 100644
--- a/arch/x86/include/asm/xen/cpuid.h
+++ b/arch/x86/include/asm/xen/cpuid.h
@@ -49,6 +49,7 @@
* EBX-EDX: "XenVMMXenVMM" signature, allowing positive identification
* of a Xen host.
*/
+#define XEN_SIGNATURE "XenVMMXenVMM"
#define XEN_CPUID_SIGNATURE_EBX 0x566e6558 /* "XenV" */
#define XEN_CPUID_SIGNATURE_ECX 0x65584d4d /* "MMXe" */
#define XEN_CPUID_SIGNATURE_EDX 0x4d4d566e /* "nVMM" */
diff --git a/arch/x86/include/asm/xen/hypervisor.h b/arch/x86/include/asm/xen/hypervisor.h
index 16f548a661cf..32ff6583b3d9 100644
--- a/arch/x86/include/asm/xen/hypervisor.h
+++ b/arch/x86/include/asm/xen/hypervisor.h
@@ -37,10 +37,11 @@ extern struct shared_info *HYPERVISOR_shared_info;
extern struct start_info *xen_start_info;
#include <asm/processor.h>
+#include <asm/xen/cpuid.h>
static inline uint32_t xen_cpuid_base(void)
{
- return hypervisor_cpuid_base("XenVMMXenVMM", 2);
+ return hypervisor_cpuid_base(XEN_SIGNATURE, 2);
}
struct pci_dev;
base-commit: 91dc252b0dbb6879e4067f614df1e397fec532a1
--