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

[xen staging] x86/PSR: move CPUID level check



commit 511eb31bd0545c9072bed88de6f41c5802f94a33
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Aug 28 13:35:22 2025 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Aug 28 13:35:22 2025 +0200

    x86/PSR: move CPUID level check
    
    At the first (and maybe second) glance the call to setup_clear_cpu_cap()
    (which is __init) from psr_cpu_init() (which isn't) looks wrong. The
    earlier cpu_has_pqe makes it safe, though. Nevertheless we can do better,
    by simply moving the check ahead of the BSP invocation of the function.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
 xen/arch/x86/psr.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/psr.c b/xen/arch/x86/psr.c
index 9c7aab9f40..cce7020868 100644
--- a/xen/arch/x86/psr.c
+++ b/xen/arch/x86/psr.c
@@ -1583,12 +1583,6 @@ static void psr_cpu_init(void)
     if ( !psr_alloc_feat_enabled() || !cpu_has_pqe )
         goto assoc_init;
 
-    if ( boot_cpu_data.cpuid_level < PSR_CPUID_LEVEL_CAT )
-    {
-        setup_clear_cpu_cap(X86_FEATURE_PQE);
-        goto assoc_init;
-    }
-
     socket = cpu_to_socket(cpu);
     info = socket_info + socket;
     if ( info->feat_init )
@@ -1708,6 +1702,9 @@ static int __init cf_check psr_presmp_init(void)
     if ( psr_cpu_prepare() )
         psr_free();
 
+    if ( boot_cpu_data.cpuid_level < PSR_CPUID_LEVEL_CAT )
+        setup_clear_cpu_cap(X86_FEATURE_PQE);
+
     psr_cpu_init();
     if ( psr_cmt_enabled() || psr_alloc_feat_enabled() )
         register_cpu_notifier(&cpu_nfb);
--
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®.