parisc: Avoid flushing cache on cache-less machines

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>
This commit is contained in:
Helge Deller 2022-03-18 22:59:59 +01:00
parent 9b046d0245
commit 411fadd62c

View File

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