|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 5/6] x86/cpuid: Don't offer HVM hypervisor leaves to PV guests
Xen leaf 4 is HVM-only. Report a lower max_leaf to PV guests, so they don't
go and investigate a leaf which will return all zeros.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
---
xen/arch/x86/traps.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/xen/arch/x86/traps.c b/xen/arch/x86/traps.c
index 4f29c3a..51bcd97 100644
--- a/xen/arch/x86/traps.c
+++ b/xen/arch/x86/traps.c
@@ -911,12 +911,16 @@ void cpuid_hypervisor_leaves(const struct vcpu *v,
uint32_t leaf,
uint32_t idx = leaf - base;
unsigned int limit = is_viridian_domain(d) ? p->hv2_limit : p->hv_limit;
+ /* Current, HVM max leaf is 4 and PV max leaf is 3. */
+ unsigned int max_leaf = has_hvm_container_domain(d) ? 4 : 3;
+ BUILD_BUG_ON(XEN_CPUID_MAX_NUM_LEAVES != 4);
+
if ( limit == 0 )
/* Default number of leaves */
- limit = XEN_CPUID_MAX_NUM_LEAVES;
+ limit = max_leaf;
else
- /* Clamp toolstack value between 2 and MAX_NUM_LEAVES. */
- limit = min(max(limit, 2u), XEN_CPUID_MAX_NUM_LEAVES + 0u);
+ /* Clamp toolstack value between 2 and max_leaf. */
+ limit = min(max(limit, 2u), max_leaf);
if ( idx > limit )
return;
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |