flush.c (b746a1a2860f4a918f32d10dc569115d282aaf2f) flush.c (f358afc52c3066f4e8cd7b3a2d75b31e822519e9)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/arch/arm/mm/flush.c
4 *
5 * Copyright (C) 1995-2002 Russell King
6 */
7#include <linux/module.h>
8#include <linux/mm.h>

--- 332 unchanged lines hidden (view full) ---

341 else if (mapping)
342 __flush_icache_all();
343 set_bit(PG_dcache_clean, &page->flags);
344 }
345}
346EXPORT_SYMBOL(flush_dcache_page);
347
348/*
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/arch/arm/mm/flush.c
4 *
5 * Copyright (C) 1995-2002 Russell King
6 */
7#include <linux/module.h>
8#include <linux/mm.h>

--- 332 unchanged lines hidden (view full) ---

341 else if (mapping)
342 __flush_icache_all();
343 set_bit(PG_dcache_clean, &page->flags);
344 }
345}
346EXPORT_SYMBOL(flush_dcache_page);
347
348/*
349 * Ensure cache coherency for the kernel mapping of this page. We can
350 * assume that the page is pinned via kmap.
351 *
352 * If the page only exists in the page cache and there are no user
353 * space mappings, this is a no-op since the page was already marked
354 * dirty at creation. Otherwise, we need to flush the dirty kernel
355 * cache lines directly.
356 */
357void flush_kernel_dcache_page(struct page *page)
358{
359 if (cache_is_vivt() || cache_is_vipt_aliasing()) {
360 struct address_space *mapping;
361
362 mapping = page_mapping_file(page);
363
364 if (!mapping || mapping_mapped(mapping)) {
365 void *addr;
366
367 addr = page_address(page);
368 /*
369 * kmap_atomic() doesn't set the page virtual
370 * address for highmem pages, and
371 * kunmap_atomic() takes care of cache
372 * flushing already.
373 */
374 if (!IS_ENABLED(CONFIG_HIGHMEM) || addr)
375 __cpuc_flush_dcache_area(addr, PAGE_SIZE);
376 }
377 }
378}
379EXPORT_SYMBOL(flush_kernel_dcache_page);
380
381/*
382 * Flush an anonymous page so that users of get_user_pages()
383 * can safely access the data. The expected sequence is:
384 *
385 * get_user_pages()
386 * -> flush_anon_page
387 * memcpy() to/from page
388 * if written to page, flush_dcache_page()
389 */

--- 30 unchanged lines hidden ---
349 * Flush an anonymous page so that users of get_user_pages()
350 * can safely access the data. The expected sequence is:
351 *
352 * get_user_pages()
353 * -> flush_anon_page
354 * memcpy() to/from page
355 * if written to page, flush_dcache_page()
356 */

--- 30 unchanged lines hidden ---