Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b5b6c9e9 authored by Catalin Marinas's avatar Catalin Marinas
Browse files

arm64: Avoid cache flushing in flush_dcache_page()



The flush_dcache_page() function is called when the kernel modified a
page cache page. Since the D-cache on AArch64 does not have aliases
this function can simply mark the page as dirty for later flushing via
set_pte_at()/__sync_icache_dcache() if the page is executable (to ensure
the I-D cache coherency).

Signed-off-by: default avatarCatalin Marinas <catalin.marinas@arm.com>
Reported-by: default avatarWill Deacon <will.deacon@arm.com>
Acked-by: default avatarWill Deacon <will.deacon@arm.com>
parent d25749af
Loading
Loading
Loading
Loading
+4 −18
Original line number Diff line number Diff line
@@ -94,29 +94,15 @@ void __sync_icache_dcache(pte_t pte, unsigned long addr)
}

/*
 * Ensure cache coherency between kernel mapping and userspace mapping of this
 * page.
 * This function is called when a page has been modified by the kernel. Mark
 * it as dirty for later flushing when mapped in user space (if executable,
 * see __sync_icache_dcache).
 */
void flush_dcache_page(struct page *page)
{
	struct address_space *mapping;

	/*
	 * The zero page is never written to, so never has any dirty cache
	 * lines, and therefore never needs to be flushed.
	 */
	if (page == ZERO_PAGE(0))
		return;

	mapping = page_mapping(page);
	if (mapping && mapping_mapped(mapping)) {
		__flush_dcache_page(page);
		__flush_icache_all();
		set_bit(PG_dcache_clean, &page->flags);
	} else {
	if (test_bit(PG_dcache_clean, &page->flags))
		clear_bit(PG_dcache_clean, &page->flags);
}
}
EXPORT_SYMBOL(flush_dcache_page);

/*