From 17cbad5d45b6ae26dbcfe02deba597c83cd63a0d Mon Sep 17 00:00:00 2001 From: Uros Bizjak Date: Wed, 10 Jul 2019 15:01:44 +0200 Subject: [PATCH] Disable CPA cache flush for selfsnoop targets Signed-off-by: Uros Bizjak --- arch/x86/mm/pageattr.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 6a9a77a403c9..8893ef5f70cd 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -1725,10 +1725,11 @@ 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 = !!pgprot2cachemode(mask_set); + cache = !static_cpu_has(X86_FEATURE_SELFSNOOP) && + pgprot2cachemode(mask_set); /* * On error; flush everything to be sure. -- 2.21.0