]> xenbits.xensource.com Git - people/dariof/xen.git/commitdiff
x86: add new Xen cpuid node for max address width info
authorJuergen Gross <jgross@suse.com>
Thu, 28 Sep 2017 10:05:53 +0000 (12:05 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 28 Sep 2017 10:05:53 +0000 (12:05 +0200)
On very large hosts a pv-guest needs to know whether it will have to
handle frame numbers larger than 32 bits in order to select the
appropriate grant interface version.

Add a new Xen specific CPUID node to contain the maximum machine address
width similar to the x86 CPUID node 0x80000008 containing the maximum
physical address width. The maximum frame width needs to take memory
hotplug into account.

Signed-off-by: Juergen Gross <jgross@suse.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/traps.c
xen/include/public/arch-x86/cpuid.h

index d8feef2942e2963ee45b8a661ce23df530056fca..86506f3747b35f015a536a74209a98b011d3083e 100644 (file)
@@ -930,6 +930,13 @@ void cpuid_hypervisor_leaves(const struct vcpu *v, uint32_t leaf,
         res->b = v->vcpu_id;
         break;
 
+    case 5: /* PV-specific parameters */
+        if ( is_hvm_domain(d) || subleaf != 0 )
+            break;
+
+        res->b = flsl(get_upper_mfn_bound()) + PAGE_SHIFT;
+        break;
+
     default:
         ASSERT_UNREACHABLE();
     }
index d709340f18d089560b959835eabb7b6609542c7e..1c026f7f24c6dca829c51da04bf00fadfee5edd2 100644 (file)
 #define XEN_HVM_CPUID_IOMMU_MAPPINGS   (1u << 2)
 #define XEN_HVM_CPUID_VCPU_ID_PRESENT  (1u << 3) /* vcpu id is present in EBX */
 
-#define XEN_CPUID_MAX_NUM_LEAVES 4
+/*
+ * Leaf 6 (0x40000x05)
+ * PV-specific parameters
+ * Sub-leaf 0: EAX: max available sub-leaf
+ * Sub-leaf 0: EBX: bits 0-7: max machine address width
+ */
+
+/* Max. address width in bits taking memory hotplug into account. */
+#define XEN_CPUID_MACHINE_ADDRESS_WIDTH_MASK (0xffu << 0)
+
+#define XEN_CPUID_MAX_NUM_LEAVES 5
 
 #endif /* __XEN_PUBLIC_ARCH_X86_CPUID_H__ */