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

[xen stable-4.16] x86/cpuid: Clobber CPUID leaves 0x800000{1d..20} in policies



commit 5a4935bff50d51cf26a4ae2a1c08663e853e47dc
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Apr 8 14:57:54 2022 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Fri Apr 8 14:57:54 2022 +0200

    x86/cpuid: Clobber CPUID leaves 0x800000{1d..20} in policies
    
    c/s 1a914256dca5 increased the AMD max leaf from 0x8000001c to 0x80000021, 
but
    did not adjust anything in the calculate_*_policy() chain.  As a result, on
    hardware supporting these leaves, we read the real hardware values into the
    raw policy, then copy into host, and all the way into the PV/HVM default
    policies.
    
    All 4 of these leaves have enable bits (first two by TopoExt, next by SEV,
    next by PQOS), so any software following the rules is fine and will leave 
them
    alone.  However, leaf 0x8000001d takes a subleaf input and at least two
    userspace utilities have been observed to loop indefinitely under Xen 
(clearly
    waiting for eax to report "no more cache levels").
    
    Such userspace is buggy, but Xen's behaviour isn't great either.
    
    In the short term, clobber all information in these leaves.  This is a giant
    bodge, but there are complexities with implementing all of these leaves
    properly.
    
    Fixes: 1a914256dca5 ("x86/cpuid: support LFENCE always serialising CPUID 
bit")
    Link: https://github.com/QubesOS/qubes-issues/issues/7392
    Reported-by: fosslinux <fosslinux@aussies.space>
    Reported-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: d4012d50082c2eae2f3cbe7770be13b9227fbc3f
    master date: 2022-04-07 11:36:45 +0100
---
 xen/arch/x86/cpuid.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index c7f07ef7a6..ff335f1639 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -291,8 +291,15 @@ static void recalculate_misc(struct cpuid_policy *p)
 
         zero_leaves(p->extd.raw, 0xb, 0x18);
 
+        /* 0x19 - TLB details.  Pass through. */
+        /* 0x1a - Perf hints.   Pass through. */
+
         p->extd.raw[0x1b] = EMPTY_LEAF; /* IBS - not supported. */
         p->extd.raw[0x1c] = EMPTY_LEAF; /* LWP - not supported. */
+        p->extd.raw[0x1d] = EMPTY_LEAF; /* TopoExt Cache */
+        p->extd.raw[0x1e] = EMPTY_LEAF; /* TopoExt APIC ID/Core/Node */
+        p->extd.raw[0x1f] = EMPTY_LEAF; /* SEV */
+        p->extd.raw[0x20] = EMPTY_LEAF; /* Platform QoS */
         break;
     }
 }
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.16



 


Rackspace

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