diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 0beba0d..267f3ca 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -242,6 +242,7 @@ extern const char * const x86_power_flags[32]; #define cpu_has_x2apic boot_cpu_has(X86_FEATURE_X2APIC) #define cpu_has_xsave boot_cpu_has(X86_FEATURE_XSAVE) #define cpu_has_hypervisor boot_cpu_has(X86_FEATURE_HYPERVISOR) +#define cpu_has_selfsnoop boot_cpu_has(X86_FEATURE_SELFSNOOP) #if defined(CONFIG_X86_INVLPG) || defined(CONFIG_X86_64) # define cpu_has_invlpg 1 diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index d71e1b6..bbca9d2 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -875,10 +875,10 @@ static int change_page_attr_set_clr(unsigned long *addr, int numpages, goto out; /* - * No need to flush, when we did not set any of the caching - * attributes: + * No need to flush when CPU supports self snoop or + * when we did not set any of the caching attributes: */ - cache = cache_attr(mask_set); + cache = cpu_has_selfsnoop ? 0 : cache_attr(mask_set); /* * On success we use clflush, when the CPU supports it to