]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
parisc: Avoid flushing cache on cache-less machines
authorHelge Deller <deller@gmx.de>
Fri, 18 Mar 2022 21:59:59 +0000 (22:59 +0100)
committerHelge Deller <deller@gmx.de>
Fri, 18 Mar 2022 21:59:59 +0000 (22:59 +0100)
Avoid flushing caches in __flush_cache_page() and __purge_cache_page()
if the machine hasn't data or instruction caches - as e.g. in qemu.

Signed-off-by: Helge Deller <deller@gmx.de>
arch/parisc/kernel/cache.c

index 231cebb3fc0de0df9b368c810dbc7c77579298f3..d41fee3a98746ffbc21b27510fbeeeffac00a1ef 100644 (file)
@@ -315,6 +315,8 @@ static inline void
 __flush_cache_page(struct vm_area_struct *vma, unsigned long vmaddr,
                   unsigned long physaddr)
 {
+       if (!static_branch_likely(&parisc_has_cache))
+               return;
        preempt_disable();
        flush_dcache_page_asm(physaddr, vmaddr);
        if (vma->vm_flags & VM_EXEC)
@@ -326,6 +328,8 @@ static inline void
 __purge_cache_page(struct vm_area_struct *vma, unsigned long vmaddr,
                   unsigned long physaddr)
 {
+       if (!static_branch_likely(&parisc_has_cache))
+               return;
        preempt_disable();
        purge_dcache_page_asm(physaddr, vmaddr);
        if (vma->vm_flags & VM_EXEC)