|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [xen staging-4.17] x86/cpu-policy: Simplify logic in guest_common_default_feature_adjustments()
commit 63b21de0c6355bd79155a6eec6d8cc81c1a432ce
Author: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Fri Jun 27 14:46:01 2025 +0100
Commit: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Mon Jul 7 22:52:06 2025 +0100
x86/cpu-policy: Simplify logic in guest_common_default_feature_adjustments()
For features which are unconditionally set in the max policies, making the
default policy to match the host can be done with a conditional clear.
This is simpler than the unconditional clear, conditional set currently
performed.
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Reviewed-by: Jan Beulich <jbeulich@xxxxxxxx>
(cherry picked from commit 30f8fed68f3c2e63594ff9202b3d05b971781e36)
---
xen/arch/x86/cpu-policy.c | 25 ++++++++++---------------
1 file changed, 10 insertions(+), 15 deletions(-)
diff --git a/xen/arch/x86/cpu-policy.c b/xen/arch/x86/cpu-policy.c
index c813df35cb..42bd039e7c 100644
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -511,17 +511,14 @@ static void __init
guest_common_default_feature_adjustments(uint32_t *fs)
* reasons, so reset the default policy back to the host values in
* case we're unaffected.
*/
- __clear_bit(X86_FEATURE_MD_CLEAR, fs);
- if ( cpu_has_md_clear )
- __set_bit(X86_FEATURE_MD_CLEAR, fs);
+ if ( !cpu_has_md_clear )
+ __clear_bit(X86_FEATURE_MD_CLEAR, fs);
- __clear_bit(X86_FEATURE_FB_CLEAR, fs);
- if ( cpu_has_fb_clear )
- __set_bit(X86_FEATURE_FB_CLEAR, fs);
+ if ( !cpu_has_fb_clear )
+ __clear_bit(X86_FEATURE_FB_CLEAR, fs);
- __clear_bit(X86_FEATURE_RFDS_CLEAR, fs);
- if ( cpu_has_rfds_clear )
- __set_bit(X86_FEATURE_RFDS_CLEAR, fs);
+ if ( !cpu_has_rfds_clear )
+ __clear_bit(X86_FEATURE_RFDS_CLEAR, fs);
/*
* The Gather Data Sampling microcode mitigation (August 2023) has an
@@ -541,13 +538,11 @@ static void __init
guest_common_default_feature_adjustments(uint32_t *fs)
* Topology information is at the toolstack's discretion so these are
* unconditionally set in max, but pick a default which matches the host.
*/
- __clear_bit(X86_FEATURE_HTT, fs);
- if ( cpu_has_htt )
- __set_bit(X86_FEATURE_HTT, fs);
+ if ( !cpu_has_htt )
+ __clear_bit(X86_FEATURE_HTT, fs);
- __clear_bit(X86_FEATURE_CMP_LEGACY, fs);
- if ( cpu_has_cmp_legacy )
- __set_bit(X86_FEATURE_CMP_LEGACY, fs);
+ if ( !cpu_has_cmp_legacy )
+ __clear_bit(X86_FEATURE_CMP_LEGACY, fs);
/*
* On certain hardware, speculative or errata workarounds can result in
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.17
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |