diff options
author | Toshi Kani <toshi.kani@hpe.com> | 2016-01-26 15:57:28 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2016-01-30 03:49:58 -0500 |
commit | 1c29f25bf5d6c557017f619b638c619cbbf798c4 (patch) | |
tree | c386106beb5a9dde06fbbdc3c81e47c7f91e77da /kernel/memremap.c | |
parent | 05fee7cfab7fa9d57e71f00bdd8fcff0cf5044a0 (diff) |
memremap: Change region_intersects() to take @flags and @desc
Change region_intersects() to identify a target with @flags and
@desc, instead of @name with strcmp().
Change the callers of region_intersects(), memremap() and
devm_memremap(), to set IORESOURCE_SYSTEM_RAM in @flags and
IORES_DESC_NONE in @desc when searching System RAM.
Also, export region_intersects() so that the ACPI EINJ error
injection driver can call this function in a later patch.
Signed-off-by: Toshi Kani <toshi.kani@hpe.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Dan Williams <dan.j.williams@intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Denys Vlasenko <dvlasenk@redhat.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Jakub Sitnicki <jsitnicki@gmail.com>
Cc: Jan Kara <jack@suse.cz>
Cc: Jiang Liu <jiang.liu@linux.intel.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Konstantin Khlebnikov <koct9i@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Luis R. Rodriguez <mcgrof@suse.com>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Toshi Kani <toshi.kani@hp.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Cc: linux-arch@vger.kernel.org
Cc: linux-mm <linux-mm@kvack.org>
Link: http://lkml.kernel.org/r/1453841853-11383-13-git-send-email-bp@alien8.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/memremap.c')
-rw-r--r-- | kernel/memremap.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/kernel/memremap.c b/kernel/memremap.c index e517a16cb426..293309cac061 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c | |||
@@ -47,7 +47,7 @@ static void *try_ram_remap(resource_size_t offset, size_t size) | |||
47 | * being mapped does not have i/o side effects and the __iomem | 47 | * being mapped does not have i/o side effects and the __iomem |
48 | * annotation is not applicable. | 48 | * annotation is not applicable. |
49 | * | 49 | * |
50 | * MEMREMAP_WB - matches the default mapping for "System RAM" on | 50 | * MEMREMAP_WB - matches the default mapping for System RAM on |
51 | * the architecture. This is usually a read-allocate write-back cache. | 51 | * the architecture. This is usually a read-allocate write-back cache. |
52 | * Morever, if MEMREMAP_WB is specified and the requested remap region is RAM | 52 | * Morever, if MEMREMAP_WB is specified and the requested remap region is RAM |
53 | * memremap() will bypass establishing a new mapping and instead return | 53 | * memremap() will bypass establishing a new mapping and instead return |
@@ -56,11 +56,12 @@ static void *try_ram_remap(resource_size_t offset, size_t size) | |||
56 | * MEMREMAP_WT - establish a mapping whereby writes either bypass the | 56 | * MEMREMAP_WT - establish a mapping whereby writes either bypass the |
57 | * cache or are written through to memory and never exist in a | 57 | * cache or are written through to memory and never exist in a |
58 | * cache-dirty state with respect to program visibility. Attempts to | 58 | * cache-dirty state with respect to program visibility. Attempts to |
59 | * map "System RAM" with this mapping type will fail. | 59 | * map System RAM with this mapping type will fail. |
60 | */ | 60 | */ |
61 | void *memremap(resource_size_t offset, size_t size, unsigned long flags) | 61 | void *memremap(resource_size_t offset, size_t size, unsigned long flags) |
62 | { | 62 | { |
63 | int is_ram = region_intersects(offset, size, "System RAM"); | 63 | int is_ram = region_intersects(offset, size, |
64 | IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE); | ||
64 | void *addr = NULL; | 65 | void *addr = NULL; |
65 | 66 | ||
66 | if (is_ram == REGION_MIXED) { | 67 | if (is_ram == REGION_MIXED) { |
@@ -76,7 +77,7 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags) | |||
76 | * MEMREMAP_WB is special in that it can be satisifed | 77 | * MEMREMAP_WB is special in that it can be satisifed |
77 | * from the direct map. Some archs depend on the | 78 | * from the direct map. Some archs depend on the |
78 | * capability of memremap() to autodetect cases where | 79 | * capability of memremap() to autodetect cases where |
79 | * the requested range is potentially in "System RAM" | 80 | * the requested range is potentially in System RAM. |
80 | */ | 81 | */ |
81 | if (is_ram == REGION_INTERSECTS) | 82 | if (is_ram == REGION_INTERSECTS) |
82 | addr = try_ram_remap(offset, size); | 83 | addr = try_ram_remap(offset, size); |
@@ -88,7 +89,7 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags) | |||
88 | * If we don't have a mapping yet and more request flags are | 89 | * If we don't have a mapping yet and more request flags are |
89 | * pending then we will be attempting to establish a new virtual | 90 | * pending then we will be attempting to establish a new virtual |
90 | * address mapping. Enforce that this mapping is not aliasing | 91 | * address mapping. Enforce that this mapping is not aliasing |
91 | * "System RAM" | 92 | * System RAM. |
92 | */ | 93 | */ |
93 | if (!addr && is_ram == REGION_INTERSECTS && flags) { | 94 | if (!addr && is_ram == REGION_INTERSECTS && flags) { |
94 | WARN_ONCE(1, "memremap attempted on ram %pa size: %#lx\n", | 95 | WARN_ONCE(1, "memremap attempted on ram %pa size: %#lx\n", |
@@ -266,7 +267,7 @@ void *devm_memremap_pages(struct device *dev, struct resource *res, | |||
266 | struct percpu_ref *ref, struct vmem_altmap *altmap) | 267 | struct percpu_ref *ref, struct vmem_altmap *altmap) |
267 | { | 268 | { |
268 | int is_ram = region_intersects(res->start, resource_size(res), | 269 | int is_ram = region_intersects(res->start, resource_size(res), |
269 | "System RAM"); | 270 | IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE); |
270 | resource_size_t key, align_start, align_size; | 271 | resource_size_t key, align_start, align_size; |
271 | struct dev_pagemap *pgmap; | 272 | struct dev_pagemap *pgmap; |
272 | struct page_map *page_map; | 273 | struct page_map *page_map; |