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

[xen stable-4.20] x86/cpu: populate CPUID 0x1.edx features early for self-snoop detection



commit 02806fc9671113b90e8740faec275ee2a6e1962d
Author:     Roger Pau Monné <roger.pau@xxxxxxxxxx>
AuthorDate: Tue Oct 21 15:20:02 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Oct 21 15:20:02 2025 +0200

    x86/cpu: populate CPUID 0x1.edx features early for self-snoop detection
    
    Otherwise the check for the SS feature in
    check_memory_type_self_snoop_errata() fails unconditionally, which leads to
    X86_FEATURE_XEN_SELFSNOOP never being set.
    
    We could also avoid this by not doing the reset_cpuinfo() for the BSP in
    identify_cpu(), because SS detection uses boot_cpu_data.  However that
    creates an imbalance on the state of the BSP versus the APs in the
    identify_cpu() code.
    
    I've opted for the less controversial solution of populating FEATURESET_1d
    in generic_identify(), as the value is already there.  The same is done for
    the AMD faulting probe code.  While there also populate the FEATURESET_1c
    element, as the value is in context.
    
    Fixes: f2663ca2e520 ("x86/cpu/intel: Clear cache self-snoop capability in 
CPUs with known errata")
    Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 382dd0d166cb85139d86ff26fd96af102ae4fef3
    master date: 2025-09-25 16:07:05 +0200
---
 xen/arch/x86/cpu/common.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/xen/arch/x86/cpu/common.c b/xen/arch/x86/cpu/common.c
index 4eacdaac0f..168cd3a9ee 100644
--- a/xen/arch/x86/cpu/common.c
+++ b/xen/arch/x86/cpu/common.c
@@ -438,6 +438,13 @@ static void generic_identify(struct cpuinfo_x86 *c)
        c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
        c->phys_proc_id = c->apicid;
 
+       /*
+        * Early init of Self Snoop support requires 0x1.edx, while there also
+        * set 0x1.ecx as the value is in context.
+        */
+       c->x86_capability[FEATURESET_1c] = ecx;
+       c->x86_capability[FEATURESET_1d] = edx;
+
        eax = cpuid_eax(0x80000000);
        if ((eax >> 16) == 0x8000)
                c->extended_cpuid_level = eax;
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.20



 


Rackspace

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