https://github.com/torvalds/linux
Revision cea6575fdccfc0624ca42f656e16e6b4d9bb48a5 authored by James Clark on 26 November 2020, 14:13:21 UTC, committed by Arnaldo Carvalho de Melo on 24 December 2020, 13:04:24 UTC
Currently this is a duplicate of perf_cpu_map so that it can be used as
a drop in replacement.

In a later commit it will be changed from a map of ints to use the new
cpu_aggr_id struct.

No functional changes.

Signed-off-by: James Clark <james.clark@arm.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Acked-by: Jiri Olsa <jolsa@redhat.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Tested-by: John Garry <john.garry@huawei.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Richter <tmricht@linux.ibm.com>
Link: https://lore.kernel.org/r/20201126141328.6509-6-james.clark@arm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
1 parent 2760f5a
Raw File
Tip revision: cea6575fdccfc0624ca42f656e16e6b4d9bb48a5 authored by James Clark on 26 November 2020, 14:13:21 UTC
perf cpumap: Add new map type for aggregation
Tip revision: cea6575
devmem_is_allowed.c
// SPDX-License-Identifier: GPL-2.0-only
/*
 * A generic version of devmem_is_allowed.
 *
 * Based on arch/arm64/mm/mmap.c
 *
 * Copyright (C) 2020 Google, Inc.
 * Copyright (C) 2012 ARM Ltd.
 */

#include <linux/mm.h>
#include <linux/ioport.h>

/*
 * devmem_is_allowed() checks to see if /dev/mem access to a certain address
 * is valid. The argument is a physical page number.  We mimic x86 here by
 * disallowing access to system RAM as well as device-exclusive MMIO regions.
 * This effectively disable read()/write() on /dev/mem.
 */
int devmem_is_allowed(unsigned long pfn)
{
	if (iomem_is_exclusive(pfn << PAGE_SHIFT))
		return 0;
	if (!page_is_ram(pfn))
		return 1;
	return 0;
}
back to top