mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Acked-by: Dan Williams <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Ard Biesheuvel <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Brian Gerst <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Jakub Sitnicki <[email protected]> Cc: Jan Kara <[email protected]> Cc: Jiang Liu <[email protected]> Cc: Kees Cook <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Konstantin Khlebnikov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Luis R. Rodriguez <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Naoya Horiguchi <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: Toshi Kani <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: [email protected] Cc: linux-mm <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
This commit is contained in:
parent
05fee7cfab
commit
1c29f25bf5
3 changed files with 24 additions and 18 deletions
|
|
@ -47,7 +47,7 @@ static void *try_ram_remap(resource_size_t offset, size_t size)
|
|||
* being mapped does not have i/o side effects and the __iomem
|
||||
* annotation is not applicable.
|
||||
*
|
||||
* MEMREMAP_WB - matches the default mapping for "System RAM" on
|
||||
* MEMREMAP_WB - matches the default mapping for System RAM on
|
||||
* the architecture. This is usually a read-allocate write-back cache.
|
||||
* Morever, if MEMREMAP_WB is specified and the requested remap region is RAM
|
||||
* 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)
|
|||
* MEMREMAP_WT - establish a mapping whereby writes either bypass the
|
||||
* cache or are written through to memory and never exist in a
|
||||
* cache-dirty state with respect to program visibility. Attempts to
|
||||
* map "System RAM" with this mapping type will fail.
|
||||
* map System RAM with this mapping type will fail.
|
||||
*/
|
||||
void *memremap(resource_size_t offset, size_t size, unsigned long flags)
|
||||
{
|
||||
int is_ram = region_intersects(offset, size, "System RAM");
|
||||
int is_ram = region_intersects(offset, size,
|
||||
IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE);
|
||||
void *addr = NULL;
|
||||
|
||||
if (is_ram == REGION_MIXED) {
|
||||
|
|
@ -76,7 +77,7 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
|
|||
* MEMREMAP_WB is special in that it can be satisifed
|
||||
* from the direct map. Some archs depend on the
|
||||
* capability of memremap() to autodetect cases where
|
||||
* the requested range is potentially in "System RAM"
|
||||
* the requested range is potentially in System RAM.
|
||||
*/
|
||||
if (is_ram == REGION_INTERSECTS)
|
||||
addr = try_ram_remap(offset, size);
|
||||
|
|
@ -88,7 +89,7 @@ void *memremap(resource_size_t offset, size_t size, unsigned long flags)
|
|||
* If we don't have a mapping yet and more request flags are
|
||||
* pending then we will be attempting to establish a new virtual
|
||||
* address mapping. Enforce that this mapping is not aliasing
|
||||
* "System RAM"
|
||||
* System RAM.
|
||||
*/
|
||||
if (!addr && is_ram == REGION_INTERSECTS && flags) {
|
||||
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,
|
|||
struct percpu_ref *ref, struct vmem_altmap *altmap)
|
||||
{
|
||||
int is_ram = region_intersects(res->start, resource_size(res),
|
||||
"System RAM");
|
||||
IORESOURCE_SYSTEM_RAM, IORES_DESC_NONE);
|
||||
resource_size_t key, align_start, align_size;
|
||||
struct dev_pagemap *pgmap;
|
||||
struct page_map *page_map;
|
||||
|
|
|
|||
Loading…
Reference in a new issue