[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging] x86/cpu-policy: Filter out OS{XSAVE,PKE} in calculate_raw_cpu_policy()



commit 3e47cfe9ee1a7b0b196cee303a6ce939473689c7
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Tue Jan 13 13:13:43 2026 +0000
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Tue Jan 13 15:47:02 2026 +0000

    x86/cpu-policy: Filter out OS{XSAVE,PKE} in calculate_raw_cpu_policy()
    
    They're dynamic too, and don't have named fields because no (other) logic in
    Xen ought to operate on them.  In particular, OSPKE being visible depending 
on
    whether we're in HVM or PV vCPU context when scanning.
    
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/cpu-policy.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index 372d11f2ff..5273fe0ae4 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -345,9 +345,13 @@ void calculate_raw_cpu_policy(void)
     ASSERT(p->x86_vendor == boot_cpu_data.vendor);
 
     /*
-     * Clear the truly dynamic fields.  These vary with the in-context XCR0
-     * and MSR_XSS, and aren't interesting fields in the raw policy.
+     * Clear the truly dynamic fields.
+     *
+     * - The OS* bits are forwards from CR4.
+     * - The xstate fields are calculated from XCR0 and MSR_XSS.
      */
+    p->basic.raw[1].c &= ~cpufeat_mask(X86_FEATURE_OSXSAVE);
+    p->feat.raw[0].c  &= ~cpufeat_mask(X86_FEATURE_OSPKE);
     p->xstate.raw[0].b = 0;
     p->xstate.raw[1].b = 0;
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.