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

[xen staging-4.13] x86/cpuid: Fix HLE and RTM handling (again)



commit 9eece400c626655b826d5b1b4933e65af3073ab8
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Jul 15 09:40:02 2021 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jul 15 09:40:02 2021 +0200

    x86/cpuid: Fix HLE and RTM handling (again)
    
    For reasons which are my fault, but I don't recall why, the
    FDP_EXCP_ONLY/NO_FPU_SEL adjustment uses the whole special_features[] array
    element, not the two relevant bits.
    
    HLE and RTM were recently added to the list of special features, causing 
them
    to be always set in guest view, irrespective of the toolstacks choice on the
    matter.
    
    Rewrite the logic to refer to the features specifically, rather than relying
    on the contents of the special_features[] array.
    
    Fixes: 8fe24090d9 ("x86/cpuid: Rework HLE and RTM handling")
    Reported-by: Edwin Török <edvin.torok@xxxxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
    master commit: 60fa12dbf1d4d2c4ffe1ef34b495b24aa7e41aa0
    master date: 2021-06-07 15:43:35 +0100
---
 xen/arch/x86/cpuid.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/xen/arch/x86/cpuid.c b/xen/arch/x86/cpuid.c
index 27132f91a6..18bb0faf34 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -563,9 +563,11 @@ void recalculate_cpuid_policy(struct domain *d)
     sanitise_featureset(fs);
 
     /* Fold host's FDP_EXCP_ONLY and NO_FPU_SEL into guest's view. */
-    fs[FEATURESET_7b0] &= ~special_features[FEATURESET_7b0];
+    fs[FEATURESET_7b0] &= ~(cpufeat_mask(X86_FEATURE_FDP_EXCP_ONLY) |
+                            cpufeat_mask(X86_FEATURE_NO_FPU_SEL));
     fs[FEATURESET_7b0] |= (host_cpuid_policy.feat._7b0 &
-                           special_features[FEATURESET_7b0]);
+                           (cpufeat_mask(X86_FEATURE_FDP_EXCP_ONLY) |
+                            cpufeat_mask(X86_FEATURE_NO_FPU_SEL)));
 
     cpuid_featureset_to_policy(fs, p);
 
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.13



 


Rackspace

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