* refs/heads/tmp-64b5644 Linux 4.4.173 fs: don't scan the inode cache before SB_BORN is set mm: migrate: don't rely on __PageMovable() of newpage after unlocking it drivers: core: Remove glue dirs from sysfs earlier cifs: Always resolve hostname before reconnecting mm, oom: fix use-after-free in oom_kill_process kernel/exit.c: release ptraced tasks before zap_pid_ns_processes mmc: sdhci-iproc: handle mmc_of_parse() errors during probe platform/x86: asus-nb-wmi: Drop mapping of 0x33 and 0x34 scan codes platform/x86: asus-nb-wmi: Map 0x35 to KEY_SCREENLOCK gfs2: Revert "Fix loop in gfs2_rbm_find" arm64: hyp-stub: Forbid kprobing of the hyp-stub ARM: cns3xxx: Fix writing to wrong PCI config registers after alignment fs/dcache: Fix incorrect nr_dentry_unused accounting in shrink_dcache_sb() CIFS: Do not count -ENODATA as failure for query directory l2tp: fix reading optional fields of L2TPv3 l2tp: remove l2specific_len dependency in l2tp_core ucc_geth: Reset BQL queue when stopping device net/rose: fix NULL ax25_cb kernel panic netrom: switch to sock timer API net/mlx4_core: Add masking for a few queries on HCA caps l2tp: copy 4 more bytes to linear part if necessary ipv6: Consider sk_bound_dev_if when binding a socket to an address fs: add the fsnotify call to vfs_iter_write s390/smp: Fix calling smp_call_ipl_cpu() from ipl CPU Revert "loop: Fold __loop_release into loop_release" Revert "loop: Get rid of loop_index_mutex" Revert "loop: Fix double mutex_unlock(&loop_ctl_mutex) in loop_control_ioctl()" f2fs: read page index before freeing arm64: mm: remove page_mapping check in __sync_icache_dcache irqchip/gic-v3-its: Align PCI Multi-MSI allocation on their size perf unwind: Take pgoff into account when reporting elf to libdwfl perf unwind: Unwind with libdw doesn't take symfs into account vt: invoke notifier on screen size change can: bcm: check timer values before ktime conversion can: dev: __can_get_echo_skb(): fix bogous check for non-existing skb by removing it x86/kaslr: Fix incorrect i8254 outb() parameters KVM: x86: Fix single-step debugging Input: xpad - add support for SteelSeries Stratus Duo CIFS: Fix possible hang during async MTU reads and writes tty/n_hdlc: fix __might_sleep warning tty: Handle problem if line discipline does not have receive_buf staging: rtl8188eu: Add device code for D-Link DWA-121 rev B1 char/mwave: fix potential Spectre v1 vulnerability s390/smp: fix CPU hotplug deadlock with CPU rescan s390/early: improve machine detection ARC: perf: map generic branches to correct hardware condition ASoC: atom: fix a missing check of snd_pcm_lib_malloc_pages USB: serial: pl2303: add new PID to support PL2303TB USB: serial: simple: add Motorola Tetra TPG2200 device id net: bridge: Fix ethernet header pointer before check skb forwardable net_sched: refetch skb protocol for each filter net: ipv4: Fix memory leak in network namespace dismantle openvswitch: Avoid OOB read when parsing flow nlattrs net: Fix usage of pskb_trim_rcsum UPSTREAM: binder: filter out nodes when showing binder procs ANDROID: cuttlefish_defconfig: Enable CONFIG_RTC_HCTOSYS Conflicts: mm/migrate.c Change-Id: I7986dc89d88607986d00d56f01812fe806d7f4dc Signed-off-by: Srinivasarao P <spathi@codeaurora.org>
117 lines
3.1 KiB
C
117 lines
3.1 KiB
C
/*
|
|
* Based on arch/arm/mm/flush.c
|
|
*
|
|
* Copyright (C) 1995-2002 Russell King
|
|
* Copyright (C) 2012 ARM Ltd.
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <linux/export.h>
|
|
#include <linux/mm.h>
|
|
#include <linux/pagemap.h>
|
|
|
|
#include <asm/cacheflush.h>
|
|
#include <asm/cachetype.h>
|
|
#include <asm/tlbflush.h>
|
|
|
|
#include "mm.h"
|
|
|
|
void flush_cache_range(struct vm_area_struct *vma, unsigned long start,
|
|
unsigned long end)
|
|
{
|
|
if (vma->vm_flags & VM_EXEC)
|
|
__flush_icache_all();
|
|
}
|
|
|
|
static void sync_icache_aliases(void *kaddr, unsigned long len)
|
|
{
|
|
unsigned long addr = (unsigned long)kaddr;
|
|
|
|
if (icache_is_aliasing()) {
|
|
__clean_dcache_area_pou(kaddr, len);
|
|
__flush_icache_all();
|
|
} else {
|
|
flush_icache_range(addr, addr + len);
|
|
}
|
|
}
|
|
|
|
static void flush_ptrace_access(struct vm_area_struct *vma, struct page *page,
|
|
unsigned long uaddr, void *kaddr,
|
|
unsigned long len)
|
|
{
|
|
if (vma->vm_flags & VM_EXEC)
|
|
sync_icache_aliases(kaddr, len);
|
|
}
|
|
|
|
/*
|
|
* Copy user data from/to a page which is mapped into a different processes
|
|
* address space. Really, we want to allow our "user space" model to handle
|
|
* this.
|
|
*
|
|
* Note that this code needs to run on the current CPU.
|
|
*/
|
|
void copy_to_user_page(struct vm_area_struct *vma, struct page *page,
|
|
unsigned long uaddr, void *dst, const void *src,
|
|
unsigned long len)
|
|
{
|
|
preempt_disable();
|
|
memcpy(dst, src, len);
|
|
flush_ptrace_access(vma, page, uaddr, dst, len);
|
|
preempt_enable();
|
|
}
|
|
|
|
void __sync_icache_dcache(pte_t pte, unsigned long addr)
|
|
{
|
|
struct page *page = pte_page(pte);
|
|
|
|
if (!test_and_set_bit(PG_dcache_clean, &page->flags))
|
|
sync_icache_aliases(page_address(page),
|
|
PAGE_SIZE << compound_order(page));
|
|
else if (icache_is_aivivt())
|
|
__flush_icache_all();
|
|
}
|
|
|
|
/*
|
|
* 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)
|
|
{
|
|
if (test_bit(PG_dcache_clean, &page->flags))
|
|
clear_bit(PG_dcache_clean, &page->flags);
|
|
}
|
|
EXPORT_SYMBOL(flush_dcache_page);
|
|
|
|
/*
|
|
* Additional functions defined in assembly.
|
|
*/
|
|
EXPORT_SYMBOL(flush_cache_all);
|
|
EXPORT_SYMBOL(flush_icache_range);
|
|
|
|
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
|
|
#ifdef CONFIG_HAVE_RCU_TABLE_FREE
|
|
void pmdp_splitting_flush(struct vm_area_struct *vma, unsigned long address,
|
|
pmd_t *pmdp)
|
|
{
|
|
pmd_t pmd = pmd_mksplitting(*pmdp);
|
|
|
|
VM_BUG_ON(address & ~PMD_MASK);
|
|
set_pmd_at(vma->vm_mm, address, pmdp, pmd);
|
|
|
|
/* dummy IPI to serialise against fast_gup */
|
|
kick_all_cpus_sync();
|
|
}
|
|
#endif /* CONFIG_HAVE_RCU_TABLE_FREE */
|
|
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
|