diff mbox series

[v7,01/10] lib/x86: Bump max basic leaf in {pv,hvm}_max_policy

Message ID 20241021154600.11745-2-alejandro.vallejo@cloud.com (mailing list archive)
State New
Headers show
Series x86: Expose consistent topology to guests | expand

Commit Message

Alejandro Vallejo Oct. 21, 2024, 3:45 p.m. UTC
Bump it to ARRAY_SIZE() so toolstack is able to extend a policy past
host limits (i.e: to emulate a feature not present in the host)

Signed-off-by: Alejandro Vallejo <alejandro.vallejo@cloud.com>
---
v7:
  * Replaces v6/patch1("Relax checks about policy compatibility")
  * Bumps basic.max_leaf to ARRAY_SIZE(basic.raw) to pass the
    compatibility checks rather than tweaking the checker.
---
 xen/arch/x86/cpu-policy.c | 6 ++++++
 1 file changed, 6 insertions(+)
diff mbox series

Patch

diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index b6d9fad56773..715a66d2a978 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -585,6 +585,9 @@  static void __init calculate_pv_max_policy(void)
      */
     p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
 
+    /* Toolstack may populate leaves not present in the basic host leaves */
+    p->basic.max_leaf = ARRAY_SIZE(p->basic.raw) - 1;
+
     x86_cpu_policy_to_featureset(p, fs);
 
     for ( i = 0; i < ARRAY_SIZE(fs); ++i )
@@ -672,6 +675,9 @@  static void __init calculate_hvm_max_policy(void)
      */
     p->feat.max_subleaf = ARRAY_SIZE(p->feat.raw) - 1;
 
+    /* Toolstack may populate leaves not present in the basic host leaves */
+    p->basic.max_leaf = ARRAY_SIZE(p->basic.raw) - 1;
+
     x86_cpu_policy_to_featureset(p, fs);
 
     mask = hvm_hap_supported() ?