]> xenbits.xensource.com Git - people/jgross/xen.git/commitdiff
x86/mm: avoid playing with directmap when self-snoop can be relied upon
authorJan Beulich <jbeulich@suse.com>
Fri, 23 Oct 2020 08:06:20 +0000 (10:06 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 23 Oct 2020 08:06:20 +0000 (10:06 +0200)
The set of systems affected by XSA-345 would have been smaller is we had
this in place already: When the processor is capable of dealing with
mismatched cacheability, there's no extra work we need to carry out.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
xen/arch/x86/mm.c

index 6d2262a3f0a384c8a00ec00ad593e4d834194d0d..b2f35b3e7d2fbf263e9a00e0240c1d92c576b4cd 100644 (file)
@@ -795,6 +795,9 @@ static int update_xen_mappings(unsigned long mfn, unsigned int cacheattr)
     unsigned long xen_va =
         XEN_VIRT_START + ((mfn - PFN_DOWN(xen_phys_start)) << PAGE_SHIFT);
 
+    if ( boot_cpu_has(X86_FEATURE_XEN_SELFSNOOP) )
+        return 0;
+
     if ( unlikely(alias) && cacheattr )
         err = map_pages_to_xen(xen_va, _mfn(mfn), 1, 0);
     if ( !err )
@@ -802,6 +805,7 @@ static int update_xen_mappings(unsigned long mfn, unsigned int cacheattr)
                      PAGE_HYPERVISOR | cacheattr_to_pte_flags(cacheattr));
     if ( unlikely(alias) && !cacheattr && !err )
         err = map_pages_to_xen(xen_va, _mfn(mfn), 1, PAGE_HYPERVISOR);
+
     return err;
 }