File xsa471-08.patch of Package xen.39650
# Commit 30f8fed68f3c2e63594ff9202b3d05b971781e36
# Date 2025-06-30 12:41:33 +0100
# Author Andrew Cooper <andrew.cooper3@citrix.com>
# Committer Andrew Cooper <andrew.cooper3@citrix.com>
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@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
--- a/xen/arch/x86/cpu-policy.c
+++ b/xen/arch/x86/cpu-policy.c
@@ -500,17 +500,14 @@ static void __init guest_common_default_
* 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