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

[PATCH] x86/cpuid: Fix HLE and RTM handling (again)


  • To: Xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
  • Date: Mon, 7 Jun 2021 13:41:16 +0100
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Jan Beulich <JBeulich@xxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Mon, 07 Jun 2021 12:41:43 +0000
  • Ironport-hdrordr: A9a23:pjRvOqA++2VDlGnlHemL55DYdb4zR+YMi2TDtnoBKiC9Hfb0qy nDppsmPHzP6Ar5OktLpTnoAsDpfZq7z/BICOEqVotKNzOLhILHFuBfxLqn7gSlPhbT2YdmpM VdWpk7JdHrD2FAq4LQ/Am8Hr8bsb262ZHtqOvFzU5Xa0VPZ7t75wl0MQqVe3cGITV7OQ==
  • Ironport-sdr: fiVjXspTC+it6lcBUkjP2Oto3/hNkUH99pmvJs7QBmN9c3U0HLGyIMxwSVGXnQKf39T6r2RRCE uK/WCtExn2HTB9t8rfyS7m/Ni86TSMH1FuNjbj7tOoEtbTGA+31YIJ03CknguXtMN5PL5NK4JU TgvAxOQudR3x103kWk4oaDiTygLToZ+aWzxBIduxlGYiqzqRdHhZNr7ToNnPVPrtxNb92BbRYk mlZvbtRSwZN00ZwhTg4Z5zY1eYfRfXYwbP9svncVLjSuWo+Fh4CHv+l2BXCSGqfkIA42T35Mjn UdU=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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,
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")
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reported-by: Edwin Török <edvin.torok@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Wei Liu <wl@xxxxxxx>
---
 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 f3c8950aa3..958caf35da 100644
--- a/xen/arch/x86/cpuid.c
+++ b/xen/arch/x86/cpuid.c
@@ -672,9 +672,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);
 
-- 
2.11.0




 


Rackspace

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