tip-queue: 2016-01-26, mm stuff
Subsystems (24)
Borislav Petkov
maintainercover tip-queue: 2016-01-26, mm stuff
From: Borislav Petkov <[email protected]>
Hi,
so this is Toshi's work to make the io resource walking not take a resource name and the code do strcmp() but use proper resource descriptors (as unsigned longs) and compare them, see patch 3 for example.
They're a good cleanup, look good to me, Toshi and I have tested them successfully.
I'm sending them again to a wider audience because they touch a lot of places and we better let everyone know that we're doing this. And
+ if ((desc != IORES_DESC_NONE) && (desc != p->desc))
+ continue;
is much saner/better than
if (name && strcmp(p->name, name))
continue;
when iterating the resources' tree.
Ingo, if people haven't complained in a week or so, you could start picking them up. Unless someone else wants to pick them up, of course.
Thanks.
Toshi Kani (17):
resource: Add System RAM resource type
resource: Handle resource flags properly
resource: Add I/O resource descriptor
x86/e820: Set System RAM type and descriptor
ia64: Set System RAM type and descriptor
arch: Set IORESOURCE_SYSTEM_RAM flag for System RAM
kexec: Set IORESOURCE_SYSTEM_RAM for System RAM
xen, mm: Set IORESOURCE_SYSTEM_RAM to System RAM
drivers: Initialize resource entry to zero
resource: Change walk_system_ram() to use System RAM type arm/samsung: Change s3c_pm_run_res() to use System RAM type
memremap: Change region_intersects() to take @flags and @desc
resource: Add walk_iomem_res_desc()
x86, kexec, nvdimm: Use walk_iomem_res_desc() for iomem search x86/kexec: Remove walk_iomem_res() call with GART type
resource: Kill walk_iomem_res()
ACPI/EINJ: Allow memory error injection to NVDIMM
arch/arm/kernel/setup.c | 6 +-- arch/arm/plat-samsung/pm-check.c | 4 +- arch/arm64/kernel/setup.c | 6 +-- arch/avr32/kernel/setup.c | 6 +-- arch/ia64/kernel/efi.c | 13 ++++-- arch/ia64/kernel/setup.c | 6 +-- arch/m32r/kernel/setup.c | 4 +- arch/mips/kernel/setup.c | 10 ++-- arch/parisc/mm/init.c | 6 +-- arch/powerpc/mm/mem.c | 2 +- arch/s390/kernel/setup.c | 8 ++-- arch/score/kernel/setup.c | 2 +- arch/sh/kernel/setup.c | 8 ++-- arch/sparc/mm/init_64.c | 8 ++-- arch/tile/kernel/setup.c | 11 +++-- arch/unicore32/kernel/setup.c | 6 +-- arch/x86/kernel/crash.c | 41 ++--------------- arch/x86/kernel/e820.c | 38 +++++++++++++++- arch/x86/kernel/pmem.c | 4 +- arch/x86/kernel/setup.c | 6 +-- drivers/acpi/acpi_platform.c | 2 +- drivers/acpi/apei/einj.c | 15 ++++-- drivers/nvdimm/e820.c | 2 +- drivers/parisc/eisa_enumerator.c | 4 +- drivers/rapidio/rio.c | 8 ++-- drivers/sh/superhyway/superhyway.c | 2 +- drivers/xen/balloon.c | 2 +- include/linux/ioport.h | 33 +++++++++++++- include/linux/mm.h | 3 +- kernel/kexec_core.c | 8 ++-- kernel/kexec_file.c | 8 ++-- kernel/memremap.c | 13 +++--- kernel/resource.c | 93 ++++++++++++++++++++++---------------- mm/memory_hotplug.c | 2 +- 34 files changed, 231 insertions(+), 159 deletions(-)
Signature · 1 line
2.3.5
Borislav Petkov
maintainerPATCH 1/17 resource: Add System RAM resource type
From: Toshi Kani <[email protected]>
The IORESOURCE_MEM I/O resource type is used for all types of memory-mapped ranges, ex. System RAM, System ROM, Video RAM, Persistent Memory, PCI Bus, PCI MMCONFIG, ACPI Tables, IOAPIC, reserved, and so on.
This requires walk_system_ram_range(), walk_system_ram_res(), and region_intersects() to use strcmp() against string "System RAM" to search for System RAM ranges in the iomem table, which is inefficient. __ioremap_caller() and reserve_memtype() on x86, for instance, call walk_system_ram_range() for every request to check if a given range is in System RAM ranges.
However, adding a new I/O resource type for System RAM is not a viable option, see [1]. There are approx. 3800 references to IORESOURCE_MEM in the kernel/drivers, which makes it very difficult to distinguish their usages between new type and IORESOURCE_MEM.
The I/O resource types are also used by the PNP subsystem. Therefore, introduce an extended I/O resource type, IORESOURCE_SYSTEM_RAM, which consists of IORESOURCE_MEM and a new modifier flag IORESOURCE_SYSRAM, see [2].
To keep the code 'if (resource_type(r) == IORESOURCE_MEM)' still working for System RAM, resource_ext_type() is added for extracting extended type bits.
Link[1]: http://lkml.kernel.org/r/[email protected]
Link[2]: http://lkml.kernel.org/r/CA+55aFy4WQrWexC4u2LxX9Mw2NVoznw7p3Yh=iF4Xtf7zKWnRw@mail.gmail.com
--- include/linux/ioport.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/ioport.h +11 -0
@@ -49,12 +49,19 @@ struct resource {#define IORESOURCE_WINDOW 0x00200000/* forwarded by bridge */ #define IORESOURCE_MUXED 0x00400000/* Resource is software muxed */ +#define IORESOURCE_EXT_TYPE_BITS 0x01000000/* Resource extended types */ +#define IORESOURCE_SYSRAM 0x01000000/* System RAM (modifier) */ +#define IORESOURCE_EXCLUSIVE 0x08000000/* Userland may not map this resource */ +#define IORESOURCE_DISABLED 0x10000000#define IORESOURCE_UNSET 0x20000000/* No address assigned yet */ #define IORESOURCE_AUTO 0x40000000#define IORESOURCE_BUSY 0x80000000/* Driver has marked this resource busy */ +/* I/O resource extended types */ +#define IORESOURCE_SYSTEM_RAM (IORESOURCE_MEM|IORESOURCE_SYSRAM) +/* PnP IRQ specific bits (IORESOURCE_BITS) */ #define IORESOURCE_IRQ_HIGHEDGE (1<<0)#define IORESOURCE_IRQ_LOWEDGE (1<<1)
@@ -170,6 +177,10 @@ static inline unsigned long resource_type(const struct resource *res) {return res->flags &IORESOURCE_TYPE_BITS ; } +static inline unsigned long resource_ext_type (const struct resource *res) +{ +return res->flags &IORESOURCE_EXT_TYPE_BITS ; +}/* True iff r1 completely contains r2 */ static inline bool resource_contains (struct resource *r1,struct resource *r2) {
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] resource: Add System RAM resource type
resource: Add System RAM resource type
Commit-ID: 9babd5c8caa6e62c116efc3a64a09f65af4112b0 Gitweb: http://git.kernel.org/tip/9babd5c8caa6e62c116efc3a64a09f65af4112b0 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:17 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:56 +0100
resource: Add System RAM resource type
The IORESOURCE_MEM I/O resource type is used for all types of memory-mapped ranges, ex. System RAM, System ROM, Video RAM, Persistent Memory, PCI Bus, PCI MMCONFIG, ACPI Tables, IOAPIC, reserved, and so on.
This requires walk_system_ram_range(), walk_system_ram_res(), and region_intersects() to use strcmp() against string "System RAM" to search for System RAM ranges in the iomem table, which is inefficient. __ioremap_caller() and reserve_memtype() on x86, for instance, call walk_system_ram_range() for every request to check if a given range is in System RAM ranges.
However, adding a new I/O resource type for System RAM is not a viable option, see [1]. There are approx. 3800 references to IORESOURCE_MEM in the kernel/drivers, which makes it very difficult to distinguish their usages between new type and IORESOURCE_MEM.
The I/O resource types are also used by the PNP subsystem. Therefore, introduce an extended I/O resource type, IORESOURCE_SYSTEM_RAM, which consists of IORESOURCE_MEM and a new modifier flag IORESOURCE_SYSRAM, see [2].
To keep the code 'if (resource_type(r) == IORESOURCE_MEM)' still working for System RAM, resource_ext_type() is added for extracting extended type bits.
Link[1]: http://lkml.kernel.org/r/[email protected]
Link[2]: http://lkml.kernel.org/r/CA+55aFy4WQrWexC4u2LxX9Mw2NVoznw7p3Yh=iF4Xtf7zKWnRw@mail.gmail.com
--- include/linux/ioport.h | 11 +++++++++++ 1 file changed, 11 insertions(+)
include/linux/ioport.h +11 -0
@@ -49,12 +49,19 @@ struct resource {#define IORESOURCE_WINDOW 0x00200000/* forwarded by bridge */ #define IORESOURCE_MUXED 0x00400000/* Resource is software muxed */ +#define IORESOURCE_EXT_TYPE_BITS 0x01000000/* Resource extended types */ +#define IORESOURCE_SYSRAM 0x01000000/* System RAM (modifier) */ +#define IORESOURCE_EXCLUSIVE 0x08000000/* Userland may not map this resource */ +#define IORESOURCE_DISABLED 0x10000000#define IORESOURCE_UNSET 0x20000000/* No address assigned yet */ #define IORESOURCE_AUTO 0x40000000#define IORESOURCE_BUSY 0x80000000/* Driver has marked this resource busy */ +/* I/O resource extended types */ +#define IORESOURCE_SYSTEM_RAM (IORESOURCE_MEM|IORESOURCE_SYSRAM) +/* PnP IRQ specific bits (IORESOURCE_BITS) */ #define IORESOURCE_IRQ_HIGHEDGE (1<<0)#define IORESOURCE_IRQ_LOWEDGE (1<<1)
@@ -170,6 +177,10 @@ static inline unsigned long resource_type(const struct resource *res) {return res->flags &IORESOURCE_TYPE_BITS ; } +static inline unsigned long resource_ext_type (const struct resource *res) +{ +return res->flags &IORESOURCE_EXT_TYPE_BITS ; +}/* True iff r1 completely contains r2 */ static inline bool resource_contains (struct resource *r1,struct resource *r2) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 2/17 resource: Handle resource flags properly
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
I/O resource flags consist of I/O resource types and modifier bits. Therefore, checking an I/O resource type in 'flags' must be performed with a bitwise operation.
Fix find_next_iomem_res() and region_intersects() that simply compare 'flags' against a given value.
Also change __request_region() to set 'res->flags' from resource_type() and resource_ext_type() of the parent, so that children nodes will inherit the extended I/O resource type.
--- kernel/resource.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/resource.c +4 -3
@@ -358,7 +358,7 @@ static int find_next_iomem_res(struct resource *res, char *name,read_lock (&resource_lock);for (p = iomem_resource.child; p; p =next_resource (p, sibling_only)) { -if (p->flags != res->flags) +if ((p->flags & res->flags) != res->flags)continue ;if (name &&strcmp (p->name, name))continue ;
@@ -519,7 +519,8 @@ int region_intersects(resource_size_t start, size_t size, const char *name)read_lock (&resource_lock);for (p = iomem_resource.child; p ; p = p->sibling) { -bool is_type =strcmp (p->name, name) ==0 && p->flags == flags; +bool is_type =strcmp (p->name, name) ==0 && + ((p->flags & flags) == flags);if (start >= p->start && start <= p->end) is_type ? type++ : other++;
@@ -1071,7 +1072,7 @@ struct resource * __request_region(struct resource *parent, res->name = name; res->start = start; res->end = start + n -1 ; - res->flags =resource_type (parent); + res->flags =resource_type (parent) |resource_ext_type (parent); res->flags |=IORESOURCE_BUSY | flags;write_lock (&resource_lock);
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] resource: Handle resource flags properly
resource: Handle resource flags properly
Commit-ID: a3650d53ba16ec412185abb98f231e9ba6bcdc65 Gitweb: http://git.kernel.org/tip/a3650d53ba16ec412185abb98f231e9ba6bcdc65 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:18 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:56 +0100
resource: Handle resource flags properly
I/O resource flags consist of I/O resource types and modifier bits. Therefore, checking an I/O resource type in 'flags' must be performed with a bitwise operation.
Fix find_next_iomem_res() and region_intersects() that simply compare 'flags' against a given value.
Also change __request_region() to set 'res->flags' from resource_type() and resource_ext_type() of the parent, so that children nodes will inherit the extended I/O resource type.
--- kernel/resource.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kernel/resource.c +4 -3
@@ -358,7 +358,7 @@ static int find_next_iomem_res(struct resource *res, char *name,read_lock (&resource_lock);for (p = iomem_resource.child; p; p =next_resource (p, sibling_only)) { -if (p->flags != res->flags) +if ((p->flags & res->flags) != res->flags)continue ;if (name &&strcmp (p->name, name))continue ;
@@ -519,7 +519,8 @@ int region_intersects(resource_size_t start, size_t size, const char *name)read_lock (&resource_lock);for (p = iomem_resource.child; p ; p = p->sibling) { -bool is_type =strcmp (p->name, name) ==0 && p->flags == flags; +bool is_type =strcmp (p->name, name) ==0 && + ((p->flags & flags) == flags);if (start >= p->start && start <= p->end) is_type ? type++ : other++;
@@ -1071,7 +1072,7 @@ struct resource * __request_region(struct resource *parent, res->name = name; res->start = start; res->end = start + n -1 ; - res->flags =resource_type (parent); + res->flags =resource_type (parent) |resource_ext_type (parent); res->flags |=IORESOURCE_BUSY | flags;write_lock (&resource_lock);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 3/17 resource: Add I/O resource descriptor
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
walk_iomem_res() and region_intersects() still need to use strcmp() for searching a resource entry by @name in the iomem table.
This patch introduces I/O resource descriptor 'desc' in struct resource for the iomem search interfaces. Drivers can assign their unique descriptor to a range when they support the search interfaces.
Otherwise, 'desc' is set to IORES_DESC_NONE (0). This avoids changing most of the drivers as they typically allocate resource entries statically, or by calling alloc_resource(), kzalloc(), or alloc_bootmem_low(), which set the field to zero by default. A later patch will address some drivers that use kmalloc() without zero'ing the field.
Also change release_mem_region_adjustable() to set 'desc' when its resource entry gets separated. Other resource interfaces are also changed to initialize 'desc' explicitly although alloc_resource() sets it to 0.
--- include/linux/ioport.h | 18 ++++++++++++++++++ kernel/resource.c | 5 +++++ 2 files changed, 23 insertions(+)
include/linux/ioport.h +18 -0
@@ -20,6 +20,7 @@ struct resource {resource_size_t end;const char *name;unsigned long flags; +unsigned long desc;struct resource *parent, *sibling, *child; };
@@ -112,6 +113,22 @@ struct resource {/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */ #define IORESOURCE_PCI_FIXED (1<<4)/* Do not move resource */ +/* +* I/O Resource Descriptors +* +* Descriptors are used by walk_iomem_res_desc() and region_intersects() +* for searching a specific resource range in the iomem table. Assign +* a new descriptor when a resource range supports the search interfaces. +* Otherwise, resource.desc must be set to IORES_DESC_NONE (0). +*/ +enum { +IORES_DESC_NONE =0 , +IORES_DESC_CRASH_KERNEL =1 , +IORES_DESC_ACPI_TABLES =2 , +IORES_DESC_ACPI_NV_STORAGE =3 , +IORES_DESC_PERSISTENT_MEMORY =4 , +IORES_DESC_PERSISTENT_MEMORY_LEGACY =5 , +};/* helpers to define resources */ #define DEFINE_RES_NAMED (_start, _size, _name, _flags) \
@@ -120,6 +137,7 @@ struct resource { .end = (_start) + (_size) - 1, \ .name = (_name), \ .flags = (_flags), \ + .desc = IORES_DESC_NONE, \ }#define DEFINE_RES_IO_NAMED (_start, _size, _name) \
kernel/resource.c +5 -0
@@ -949,6 +949,7 @@ static void __init __reserve_region_with_split(struct resource *root, res->start = start; res->end = end; res->flags =IORESOURCE_BUSY ; + res->desc =IORES_DESC_NONE ;while (1 ) {
@@ -983,6 +984,7 @@ static void __init __reserve_region_with_split(struct resource *root, next_res->start = conflict->end +1 ; next_res->end = end; next_res->flags =IORESOURCE_BUSY ; + next_res->desc =IORES_DESC_NONE ; } }else { res->start = conflict->end +1 ;
@@ -1074,6 +1076,7 @@ struct resource * __request_region(struct resource *parent, res->end = start + n -1 ; res->flags =resource_type (parent) |resource_ext_type (parent); res->flags |=IORESOURCE_BUSY | flags; + res->desc =IORES_DESC_NONE ;write_lock (&resource_lock);
@@ -1238,6 +1241,7 @@ int release_mem_region_adjustable(struct resource *parent, new_res->start = end +1 ; new_res->end = res->end; new_res->flags = res->flags; + new_res->desc = res->desc; new_res->parent = res->parent; new_res->sibling = res->sibling; new_res->child =NULL ;
@@ -1413,6 +1417,7 @@ static int __init reserve_setup(char *str) res->start = io_start; res->end = io_start + io_num -1 ; res->flags =IORESOURCE_BUSY ; + res->desc =IORES_DESC_NONE ; res->child =NULL ;if (request_resource (res->start >=0x10000 ? &iomem_resource : &ioport_resource, res) ==0 ) reserved = x+1 ;
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] resource: Add I/O resource descriptor
resource: Add I/O resource descriptor
Commit-ID: 43ee493bde78da00deaf5737925365c691a036ad Gitweb: http://git.kernel.org/tip/43ee493bde78da00deaf5737925365c691a036ad Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:19 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:56 +0100
resource: Add I/O resource descriptor
walk_iomem_res() and region_intersects() still need to use strcmp() for searching a resource entry by @name in the iomem table.
This patch introduces I/O resource descriptor 'desc' in struct resource for the iomem search interfaces. Drivers can assign their unique descriptor to a range when they support the search interfaces.
Otherwise, 'desc' is set to IORES_DESC_NONE (0). This avoids changing most of the drivers as they typically allocate resource entries statically, or by calling alloc_resource(), kzalloc(), or alloc_bootmem_low(), which set the field to zero by default. A later patch will address some drivers that use kmalloc() without zero'ing the field.
Also change release_mem_region_adjustable() to set 'desc' when its resource entry gets separated. Other resource interfaces are also changed to initialize 'desc' explicitly although alloc_resource() sets it to 0.
--- include/linux/ioport.h | 18 ++++++++++++++++++ kernel/resource.c | 5 +++++ 2 files changed, 23 insertions(+)
include/linux/ioport.h +18 -0
@@ -20,6 +20,7 @@ struct resource {resource_size_t end;const char *name;unsigned long flags; +unsigned long desc;struct resource *parent, *sibling, *child; };
@@ -112,6 +113,22 @@ struct resource {/* PCI control bits. Shares IORESOURCE_BITS with above PCI ROM. */ #define IORESOURCE_PCI_FIXED (1<<4)/* Do not move resource */ +/* +* I/O Resource Descriptors +* +* Descriptors are used by walk_iomem_res_desc() and region_intersects() +* for searching a specific resource range in the iomem table. Assign +* a new descriptor when a resource range supports the search interfaces. +* Otherwise, resource.desc must be set to IORES_DESC_NONE (0). +*/ +enum { +IORES_DESC_NONE =0 , +IORES_DESC_CRASH_KERNEL =1 , +IORES_DESC_ACPI_TABLES =2 , +IORES_DESC_ACPI_NV_STORAGE =3 , +IORES_DESC_PERSISTENT_MEMORY =4 , +IORES_DESC_PERSISTENT_MEMORY_LEGACY =5 , +};/* helpers to define resources */ #define DEFINE_RES_NAMED (_start, _size, _name, _flags) \
@@ -120,6 +137,7 @@ struct resource { .end = (_start) + (_size) - 1, \ .name = (_name), \ .flags = (_flags), \ + .desc = IORES_DESC_NONE, \ }#define DEFINE_RES_IO_NAMED (_start, _size, _name) \
kernel/resource.c +5 -0
@@ -949,6 +949,7 @@ static void __init __reserve_region_with_split(struct resource *root, res->start = start; res->end = end; res->flags =IORESOURCE_BUSY ; + res->desc =IORES_DESC_NONE ;while (1 ) {
@@ -983,6 +984,7 @@ static void __init __reserve_region_with_split(struct resource *root, next_res->start = conflict->end +1 ; next_res->end = end; next_res->flags =IORESOURCE_BUSY ; + next_res->desc =IORES_DESC_NONE ; } }else { res->start = conflict->end +1 ;
@@ -1074,6 +1076,7 @@ struct resource * __request_region(struct resource *parent, res->end = start + n -1 ; res->flags =resource_type (parent) |resource_ext_type (parent); res->flags |=IORESOURCE_BUSY | flags; + res->desc =IORES_DESC_NONE ;write_lock (&resource_lock);
@@ -1238,6 +1241,7 @@ int release_mem_region_adjustable(struct resource *parent, new_res->start = end +1 ; new_res->end = res->end; new_res->flags = res->flags; + new_res->desc = res->desc; new_res->parent = res->parent; new_res->sibling = res->sibling; new_res->child =NULL ;
@@ -1413,6 +1417,7 @@ static int __init reserve_setup(char *str) res->start = io_start; res->end = io_start + io_num -1 ; res->flags =IORESOURCE_BUSY ; + res->desc =IORES_DESC_NONE ; res->child =NULL ;if (request_resource (res->start >=0x10000 ? &iomem_resource : &ioport_resource, res) ==0 ) reserved = x+1 ;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 4/17 x86/e820: Set System RAM type and descriptor
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Change e820_reserve_resources() to set 'flags' and 'desc' from e820 types.
Set E820_RESERVED_KERN and E820_RAM's (System RAM) io resource type to IORESOURCE_SYSTEM_RAM.
Do the same for "Kernel data", "Kernel code", and "Kernel bss", which are child nodes of System RAM.
I/O resource descriptor is set to 'desc' for entries that are (and will be) target ranges of walk_iomem_res() and region_intersects().
--- arch/x86/kernel/e820.c | 38 +++++++++++++++++++++++++++++++++++++- arch/x86/kernel/setup.c | 6 +++--- 2 files changed, 40 insertions(+), 4 deletions(-)
arch/x86/kernel/e820.c +37 -1
@@ -925,6 +925,41 @@ static const char *e820_type_to_string(int e820_type) } } +static unsigned long e820_type_to_iomem_type (int e820_type) +{ +switch (e820_type) { +case E820_RESERVED_KERN : +case E820_RAM : +return IORESOURCE_SYSTEM_RAM ; +case E820_ACPI : +case E820_NVS : +case E820_UNUSABLE : +case E820_PRAM : +case E820_PMEM : +default : +return IORESOURCE_MEM ; + } +} + +static unsigned long e820_type_to_iores_desc (int e820_type) +{ +switch (e820_type) { +case E820_ACPI : +return IORES_DESC_ACPI_TABLES ; +case E820_NVS : +return IORES_DESC_ACPI_NV_STORAGE ; +case E820_PMEM : +return IORES_DESC_PERSISTENT_MEMORY ; +case E820_PRAM : +return IORES_DESC_PERSISTENT_MEMORY_LEGACY ; +case E820_RESERVED_KERN : +case E820_RAM : +case E820_UNUSABLE : +default : +return IORES_DESC_NONE ; + } +} +static bool do_mark_busy (u32 type,struct resource *res) {/* this is the legacy bios/dos rom-shadow + mmio region */
@@ -967,7 +1002,8 @@ void __init e820_reserve_resources(void) res->start = e820.map[i].addr; res->end = end; - res->flags =IORESOURCE_MEM ; + res->flags =e820_type_to_iomem_type (e820.map[i].type); + res->desc =e820_type_to_iores_desc (e820.map[i].type);/* * don't register the region that could be conflicted with
arch/x86/kernel/setup.c +3 -3
@@ -152,21 +152,21 @@ static struct resource data_resource = { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_MEM + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM };static struct resource code_resource = { .name ="Kernel code" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource bss_resource = { .name ="Kernel bss" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] x86/e820: Set System RAM type and descriptor
x86/e820: Set System RAM type and descriptor
Commit-ID: f33b14a4b96b185634848046f54fb0d5028566a9 Gitweb: http://git.kernel.org/tip/f33b14a4b96b185634848046f54fb0d5028566a9 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:20 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:57 +0100
x86/e820: Set System RAM type and descriptor
Change e820_reserve_resources() to set 'flags' and 'desc' from e820 types.
Set E820_RESERVED_KERN and E820_RAM's (System RAM) io resource type to IORESOURCE_SYSTEM_RAM.
Do the same for "Kernel data", "Kernel code", and "Kernel bss", which are child nodes of System RAM.
I/O resource descriptor is set to 'desc' for entries that are (and will be) target ranges of walk_iomem_res() and region_intersects().
--- arch/x86/kernel/e820.c | 38 +++++++++++++++++++++++++++++++++++++- arch/x86/kernel/setup.c | 6 +++--- 2 files changed, 40 insertions(+), 4 deletions(-)
arch/x86/kernel/e820.c +37 -1
@@ -925,6 +925,41 @@ static const char *e820_type_to_string(int e820_type) } } +static unsigned long e820_type_to_iomem_type (int e820_type) +{ +switch (e820_type) { +case E820_RESERVED_KERN : +case E820_RAM : +return IORESOURCE_SYSTEM_RAM ; +case E820_ACPI : +case E820_NVS : +case E820_UNUSABLE : +case E820_PRAM : +case E820_PMEM : +default : +return IORESOURCE_MEM ; + } +} + +static unsigned long e820_type_to_iores_desc (int e820_type) +{ +switch (e820_type) { +case E820_ACPI : +return IORES_DESC_ACPI_TABLES ; +case E820_NVS : +return IORES_DESC_ACPI_NV_STORAGE ; +case E820_PMEM : +return IORES_DESC_PERSISTENT_MEMORY ; +case E820_PRAM : +return IORES_DESC_PERSISTENT_MEMORY_LEGACY ; +case E820_RESERVED_KERN : +case E820_RAM : +case E820_UNUSABLE : +default : +return IORES_DESC_NONE ; + } +} +static bool do_mark_busy (u32 type,struct resource *res) {/* this is the legacy bios/dos rom-shadow + mmio region */
@@ -967,7 +1002,8 @@ void __init e820_reserve_resources(void) res->start = e820.map[i].addr; res->end = end; - res->flags =IORESOURCE_MEM ; + res->flags =e820_type_to_iomem_type (e820.map[i].type); + res->desc =e820_type_to_iores_desc (e820.map[i].type);/* * don't register the region that could be conflicted with
arch/x86/kernel/setup.c +3 -3
@@ -152,21 +152,21 @@ static struct resource data_resource = { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_MEM + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM };static struct resource code_resource = { .name ="Kernel code" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource bss_resource = { .name ="Kernel bss" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 5/17 ia64: Set System RAM type and descriptor
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Change efi_initialize_iomem_resources() to set 'flags' and 'desc' for EFI memory types. IORESOURCE_SYSRAM, a modifier bit, is set for System RAM as IORESOURCE_MEM is already set. IORESOURCE_SYSTEM_RAM is defined as (IORESOURCE_MEM|IORESOURCE_SYSRAM). I/O resource descriptor is set for "ACPI Non-volatile Storage" and "Persistent Memory".
Also set IORESOURCE_SYSTEM_RAM for "Kernel code", "Kernel data", and "Kernel bss".
--- arch/ia64/kernel/efi.c | 13 ++++++++++--- arch/ia64/kernel/setup.c | 6 +++--- 2 files changed, 13 insertions(+), 6 deletions(-)
arch/ia64/kernel/efi.c +10 -3
@@ -1178,7 +1178,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,efi_memory_desc_t *md;u64 efi_desc_size;char *name; -unsigned long flags; +unsigned long flags, desc; efi_map_start =__va (ia64_boot_param->efi_memmap); efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -1193,6 +1193,8 @@ efi_initialize_iomem_resources(struct resource *code_resource,continue ; flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + desc =IORES_DESC_NONE ; +switch (md->type) {case EFI_MEMORY_MAPPED_IO :
@@ -1207,14 +1209,17 @@ efi_initialize_iomem_resources(struct resource *code_resource,if (md->attribute &EFI_MEMORY_WP ) { name ="System ROM" ; flags |=IORESOURCE_READONLY ; - }else if (md->attribute ==EFI_MEMORY_UC ) + }else if (md->attribute ==EFI_MEMORY_UC ) { name ="Uncached RAM" ; -else + }else { name ="System RAM" ; + flags |=IORESOURCE_SYSRAM ; + }break ;case EFI_ACPI_MEMORY_NVS : name ="ACPI Non-volatile Storage" ; + desc =IORES_DESC_ACPI_NV_STORAGE ;break ;case EFI_UNUSABLE_MEMORY :
@@ -1224,6 +1229,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,case EFI_PERSISTENT_MEMORY : name ="Persistent Memory" ; + desc =IORES_DESC_PERSISTENT_MEMORY ;break ;case EFI_RESERVED_TYPE :
@@ -1246,6 +1252,7 @@ efi_initialize_iomem_resources(struct resource *code_resource, res->start = md->phys_addr; res->end = md->phys_addr +efi_md_size (md) -1 ; res->flags = flags; + res->desc = desc;if (insert_resource (&iomem_resource, res) <0 )kfree (res);
arch/ia64/kernel/setup.c +3 -3
@@ -80,17 +80,17 @@ unsigned long vga_console_membase;static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource bss_resource = { .name ="Kernel bss" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };unsigned long ia64_max_cacheline_size;
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] ia64: Set System RAM type and descriptor
ia64: Set System RAM type and descriptor
Commit-ID: 03cb525eb25018cf5f3da01d0f1391fc8b37805a Gitweb: http://git.kernel.org/tip/03cb525eb25018cf5f3da01d0f1391fc8b37805a Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:21 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:57 +0100
ia64: Set System RAM type and descriptor
Change efi_initialize_iomem_resources() to set 'flags' and 'desc' for EFI memory types. IORESOURCE_SYSRAM, a modifier bit, is set for System RAM as IORESOURCE_MEM is already set. IORESOURCE_SYSTEM_RAM is defined as (IORESOURCE_MEM|IORESOURCE_SYSRAM). I/O resource descriptor is set for "ACPI Non-volatile Storage" and "Persistent Memory".
Also set IORESOURCE_SYSTEM_RAM for "Kernel code", "Kernel data", and "Kernel bss".
--- arch/ia64/kernel/efi.c | 13 ++++++++++--- arch/ia64/kernel/setup.c | 6 +++--- 2 files changed, 13 insertions(+), 6 deletions(-)
arch/ia64/kernel/efi.c +10 -3
@@ -1178,7 +1178,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,efi_memory_desc_t *md;u64 efi_desc_size;char *name; -unsigned long flags; +unsigned long flags, desc; efi_map_start =__va (ia64_boot_param->efi_memmap); efi_map_end = efi_map_start + ia64_boot_param->efi_memmap_size;
@@ -1193,6 +1193,8 @@ efi_initialize_iomem_resources(struct resource *code_resource,continue ; flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + desc =IORES_DESC_NONE ; +switch (md->type) {case EFI_MEMORY_MAPPED_IO :
@@ -1207,14 +1209,17 @@ efi_initialize_iomem_resources(struct resource *code_resource,if (md->attribute &EFI_MEMORY_WP ) { name ="System ROM" ; flags |=IORESOURCE_READONLY ; - }else if (md->attribute ==EFI_MEMORY_UC ) + }else if (md->attribute ==EFI_MEMORY_UC ) { name ="Uncached RAM" ; -else + }else { name ="System RAM" ; + flags |=IORESOURCE_SYSRAM ; + }break ;case EFI_ACPI_MEMORY_NVS : name ="ACPI Non-volatile Storage" ; + desc =IORES_DESC_ACPI_NV_STORAGE ;break ;case EFI_UNUSABLE_MEMORY :
@@ -1224,6 +1229,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,case EFI_PERSISTENT_MEMORY : name ="Persistent Memory" ; + desc =IORES_DESC_PERSISTENT_MEMORY ;break ;case EFI_RESERVED_TYPE :
@@ -1246,6 +1252,7 @@ efi_initialize_iomem_resources(struct resource *code_resource, res->start = md->phys_addr; res->end = md->phys_addr +efi_md_size (md) -1 ; res->flags = flags; + res->desc = desc;if (insert_resource (&iomem_resource, res) <0 )kfree (res);
arch/ia64/kernel/setup.c +3 -3
@@ -80,17 +80,17 @@ unsigned long vga_console_membase;static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource bss_resource = { .name ="Kernel bss" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };unsigned long ia64_max_cacheline_size;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 6/17 arch: Set IORESOURCE_SYSTEM_RAM flag for System RAM
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Set IORESOURCE_SYSTEM_RAM in flags of resource ranges with "System RAM", "Kernel code", "Kernel data", and "Kernel bss".
Note that:
- IORESOURCE_SYSRAM (i.e. modifier bit) is set in flags when IORESOURCE_MEM is already set. IORESOURCE_SYSTEM_RAM is defined as (IORESOURCE_MEM|IORESOURCE_SYSRAM).
- Some archs do not set 'flags' for children nodes, such as "Kernel code". This patch does not change 'flags' in this case.
--- arch/arm/kernel/setup.c | 6 +++--- arch/arm64/kernel/setup.c | 6 +++--- arch/avr32/kernel/setup.c | 6 +++--- arch/m32r/kernel/setup.c | 4 ++-- arch/mips/kernel/setup.c | 10 ++++++---- arch/parisc/mm/init.c | 6 +++--- arch/powerpc/mm/mem.c | 2 +- arch/s390/kernel/setup.c | 8 ++++---- arch/score/kernel/setup.c | 2 +- arch/sh/kernel/setup.c | 8 ++++---- arch/sparc/mm/init_64.c | 8 ++++---- arch/tile/kernel/setup.c | 11 ++++++++--- arch/unicore32/kernel/setup.c | 6 +++--- 13 files changed, 45 insertions(+), 38 deletions(-)
arch/arm/kernel/setup.c +3 -3
@@ -176,13 +176,13 @@ static struct resource mem_res[] = { .name = "Kernel code", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM }, { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM } };
@@ -851,7 +851,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc) res->name ="System RAM" ; res->start =__pfn_to_phys (memblock_region_memory_base_pfn (region)); res->end =__pfn_to_phys (memblock_region_memory_end_pfn (region)) -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);
arch/arm64/kernel/setup.c +3 -3
@@ -73,13 +73,13 @@ static struct resource mem_res[] = { .name = "Kernel code", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM }, { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM } };
@@ -210,7 +210,7 @@ static void __init request_standard_resources(void) res->name ="System RAM" ; res->start =__pfn_to_phys (memblock_region_memory_base_pfn (region)); res->end =__pfn_to_phys (memblock_region_memory_end_pfn (region)) -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);
arch/avr32/kernel/setup.c +3 -3
@@ -49,13 +49,13 @@ static struct resource __initdata kernel_data = { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_MEM, + .flags = IORESOURCE_SYSTEM_RAM, };static struct resource __initdata kernel_code = { .name ="Kernel code" , .start =0 , .end =0 , - .flags =IORESOURCE_MEM , + .flags =IORESOURCE_SYSTEM_RAM , .sibling = &kernel_data, };
@@ -134,7 +134,7 @@ add_physical_memory(resource_size_t start, resource_size_t end) new->start = start; new->end = end; new->name ="System RAM" ; - new->flags =IORESOURCE_MEM ; + new->flags =IORESOURCE_SYSTEM_RAM ; *pprev = new; }
arch/m32r/kernel/setup.c +2 -2
@@ -70,14 +70,14 @@ static struct resource data_resource = { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_MEM + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM };static struct resource code_resource = { .name ="Kernel code" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };unsigned long memory_start;
arch/mips/kernel/setup.c +6 -4
@@ -732,21 +732,23 @@ static void __init resource_init(void) end =HIGHMEM_START -1 ; res =alloc_bootmem (sizeof (struct resource )); + + res->start = start; + res->end = end; + res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; +switch (boot_mem_map.map[i].type) {case BOOT_MEM_RAM :case BOOT_MEM_INIT_RAM :case BOOT_MEM_ROM_DATA : res->name ="System RAM" ; + res->flags |=IORESOURCE_SYSRAM ;break ;case BOOT_MEM_RESERVED :default : res->name ="reserved" ; } - res->start = start; - res->end = end; - - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);/*
arch/parisc/mm/init.c +3 -3
@@ -55,12 +55,12 @@ signed char pfnnid_map[PFNNID_MAP_MAX] __read_mostly;static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource pdcdata_resource = {
@@ -201,7 +201,7 @@ static void __init setup_bootmem(void) res->name ="System RAM" ; res->start = pmem_ranges[i].start_pfn <<PAGE_SHIFT ; res->end = res->start + (pmem_ranges[i].pages <<PAGE_SHIFT )-1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res); }
arch/powerpc/mm/mem.c +1 -1
@@ -541,7 +541,7 @@ static int __init add_system_ram_resources(void) res->name ="System RAM" ; res->start = base; res->end = base + size -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;WARN_ON (request_resource (&iomem_resource, res) <0 ); } }
arch/s390/kernel/setup.c +4 -4
@@ -378,17 +378,17 @@ static void __init setup_lowcore(void)static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource bss_resource = { .name ="Kernel bss" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource __initdata *standard_resources[] = {
@@ -412,7 +412,7 @@ static void __init setup_resources(void)for_each_memblock (memory, reg) { res =alloc_bootmem_low (sizeof (*res)); - res->flags =IORESOURCE_BUSY |IORESOURCE_MEM ; + res->flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM ; res->name ="System RAM" ; res->start = reg->base;
arch/score/kernel/setup.c +1 -1
@@ -101,7 +101,7 @@ static void __init resource_init(void) res->name ="System RAM" ; res->start =MEMORY_START ; res->end =MEMORY_START +MEMORY_SIZE -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);request_resource (res, &code_resource);
arch/sh/kernel/setup.c +4 -4
@@ -78,17 +78,17 @@ static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource bss_resource = { .name ="Kernel bss" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };unsigned long memory_start;
@@ -202,7 +202,7 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn, res->name ="System RAM" ; res->start = start; res->end = end -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;if (request_resource (&iomem_resource, res)) { pr_err("unable to request memory_resource 0x%lx 0x%lx\n",
arch/sparc/mm/init_64.c +4 -4
@@ -2863,17 +2863,17 @@ void hugetlb_setup(struct pt_regs *regs)static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource bss_resource = { .name ="Kernel bss" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static inline resource_size_t compute_kern_paddr (void *addr)
@@ -2909,7 +2909,7 @@ static int __init report_memory(void) res->name ="System RAM" ; res->start = pavail[i].phys_addr; res->end = pavail[i].phys_addr + pavail[i].reg_size -1 ; - res->flags =IORESOURCE_BUSY |IORESOURCE_MEM ; + res->flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM ;if (insert_resource (&iomem_resource, res) <0 ) {pr_warn ("Resource insertion failed.\n" );
arch/tile/kernel/setup.c +8 -3
@@ -1632,14 +1632,14 @@ static struct resource data_resource = { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_MEM + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM };static struct resource code_resource = { .name ="Kernel code" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };/*
@@ -1673,10 +1673,15 @@ insert_ram_resource(u64 start_pfn, u64 end_pfn, bool reserved)kzalloc (sizeof (struct resource ),GFP_ATOMIC );if (!res)return NULL ; - res->name = reserved ?"Reserved" :"System RAM" ; res->start = start_pfn <<PAGE_SHIFT ; res->end = (end_pfn <<PAGE_SHIFT ) -1 ; res->flags =IORESOURCE_BUSY |IORESOURCE_MEM ; +if (reserved) { + res->name ="Reserved" ; + }else { + res->name ="System RAM" ; + res->flags |=IORESOURCE_SYSRAM ; + }if (insert_resource (&iomem_resource, res)) {kfree (res);return NULL ;
arch/unicore32/kernel/setup.c +3 -3
@@ -72,13 +72,13 @@ static struct resource mem_res[] = { .name = "Kernel code", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM }, { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM } };
@@ -211,7 +211,7 @@ request_standard_resources(struct meminfo *mi) res->name ="System RAM" ; res->start = mi->bank[i].start; res->end = mi->bank[i].start + mi->bank[i].size -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] arch: Set IORESOURCE_SYSTEM_RAM flag for System RAM
arch: Set IORESOURCE_SYSTEM_RAM flag for System RAM
Commit-ID: 35d98e93fe6a7ab612f6b389ce42c1dc135d6eef Gitweb: http://git.kernel.org/tip/35d98e93fe6a7ab612f6b389ce42c1dc135d6eef Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:22 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:57 +0100
arch: Set IORESOURCE_SYSTEM_RAM flag for System RAM
Set IORESOURCE_SYSTEM_RAM in flags of resource ranges with "System RAM", "Kernel code", "Kernel data", and "Kernel bss".
Note that:
- IORESOURCE_SYSRAM (i.e. modifier bit) is set in flags when IORESOURCE_MEM is already set. IORESOURCE_SYSTEM_RAM is defined as (IORESOURCE_MEM|IORESOURCE_SYSRAM).
- Some archs do not set 'flags' for children nodes, such as "Kernel code". This patch does not change 'flags' in this case.
--- arch/arm/kernel/setup.c | 6 +++--- arch/arm64/kernel/setup.c | 6 +++--- arch/avr32/kernel/setup.c | 6 +++--- arch/m32r/kernel/setup.c | 4 ++-- arch/mips/kernel/setup.c | 10 ++++++---- arch/parisc/mm/init.c | 6 +++--- arch/powerpc/mm/mem.c | 2 +- arch/s390/kernel/setup.c | 8 ++++---- arch/score/kernel/setup.c | 2 +- arch/sh/kernel/setup.c | 8 ++++---- arch/sparc/mm/init_64.c | 8 ++++---- arch/tile/kernel/setup.c | 11 ++++++++--- arch/unicore32/kernel/setup.c | 6 +++--- 13 files changed, 45 insertions(+), 38 deletions(-)
arch/arm/kernel/setup.c +3 -3
@@ -176,13 +176,13 @@ static struct resource mem_res[] = { .name = "Kernel code", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM }, { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM } };
@@ -851,7 +851,7 @@ static void __init request_standard_resources(const struct machine_desc *mdesc) res->name ="System RAM" ; res->start =__pfn_to_phys (memblock_region_memory_base_pfn (region)); res->end =__pfn_to_phys (memblock_region_memory_end_pfn (region)) -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);
arch/arm64/kernel/setup.c +3 -3
@@ -73,13 +73,13 @@ static struct resource mem_res[] = { .name = "Kernel code", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM }, { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM } };
@@ -210,7 +210,7 @@ static void __init request_standard_resources(void) res->name ="System RAM" ; res->start =__pfn_to_phys (memblock_region_memory_base_pfn (region)); res->end =__pfn_to_phys (memblock_region_memory_end_pfn (region)) -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);
arch/avr32/kernel/setup.c +3 -3
@@ -49,13 +49,13 @@ static struct resource __initdata kernel_data = { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_MEM, + .flags = IORESOURCE_SYSTEM_RAM, };static struct resource __initdata kernel_code = { .name ="Kernel code" , .start =0 , .end =0 , - .flags =IORESOURCE_MEM , + .flags =IORESOURCE_SYSTEM_RAM , .sibling = &kernel_data, };
@@ -134,7 +134,7 @@ add_physical_memory(resource_size_t start, resource_size_t end) new->start = start; new->end = end; new->name ="System RAM" ; - new->flags =IORESOURCE_MEM ; + new->flags =IORESOURCE_SYSTEM_RAM ; *pprev = new; }
arch/m32r/kernel/setup.c +2 -2
@@ -70,14 +70,14 @@ static struct resource data_resource = { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_MEM + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM };static struct resource code_resource = { .name ="Kernel code" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };unsigned long memory_start;
arch/mips/kernel/setup.c +6 -4
@@ -732,21 +732,23 @@ static void __init resource_init(void) end =HIGHMEM_START -1 ; res =alloc_bootmem (sizeof (struct resource )); + + res->start = start; + res->end = end; + res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; +switch (boot_mem_map.map[i].type) {case BOOT_MEM_RAM :case BOOT_MEM_INIT_RAM :case BOOT_MEM_ROM_DATA : res->name ="System RAM" ; + res->flags |=IORESOURCE_SYSRAM ;break ;case BOOT_MEM_RESERVED :default : res->name ="reserved" ; } - res->start = start; - res->end = end; - - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);/*
arch/parisc/mm/init.c +3 -3
@@ -55,12 +55,12 @@ signed char pfnnid_map[PFNNID_MAP_MAX] __read_mostly;static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource pdcdata_resource = {
@@ -201,7 +201,7 @@ static void __init setup_bootmem(void) res->name ="System RAM" ; res->start = pmem_ranges[i].start_pfn <<PAGE_SHIFT ; res->end = res->start + (pmem_ranges[i].pages <<PAGE_SHIFT )-1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res); }
arch/powerpc/mm/mem.c +1 -1
@@ -541,7 +541,7 @@ static int __init add_system_ram_resources(void) res->name ="System RAM" ; res->start = base; res->end = base + size -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;WARN_ON (request_resource (&iomem_resource, res) <0 ); } }
arch/s390/kernel/setup.c +4 -4
@@ -374,17 +374,17 @@ static void __init setup_lowcore(void)static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource bss_resource = { .name ="Kernel bss" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource __initdata *standard_resources[] = {
@@ -408,7 +408,7 @@ static void __init setup_resources(void)for_each_memblock (memory, reg) { res =alloc_bootmem_low (sizeof (*res)); - res->flags =IORESOURCE_BUSY |IORESOURCE_MEM ; + res->flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM ; res->name ="System RAM" ; res->start = reg->base;
arch/score/kernel/setup.c +1 -1
@@ -101,7 +101,7 @@ static void __init resource_init(void) res->name ="System RAM" ; res->start =MEMORY_START ; res->end =MEMORY_START +MEMORY_SIZE -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);request_resource (res, &code_resource);
arch/sh/kernel/setup.c +4 -4
@@ -78,17 +78,17 @@ static char __initdata command_line[COMMAND_LINE_SIZE] = { 0, };static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };static struct resource bss_resource = { .name ="Kernel bss" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM , + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , };unsigned long memory_start;
@@ -202,7 +202,7 @@ void __init __add_active_range(unsigned int nid, unsigned long start_pfn, res->name ="System RAM" ; res->start = start; res->end = end -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;if (request_resource (&iomem_resource, res)) { pr_err("unable to request memory_resource 0x%lx 0x%lx\n",
arch/sparc/mm/init_64.c +4 -4
@@ -2863,17 +2863,17 @@ void hugetlb_setup(struct pt_regs *regs)static struct resource code_resource = { .name ="Kernel code" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource data_resource = { .name ="Kernel data" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static struct resource bss_resource = { .name ="Kernel bss" , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };static inline resource_size_t compute_kern_paddr (void *addr)
@@ -2909,7 +2909,7 @@ static int __init report_memory(void) res->name ="System RAM" ; res->start = pavail[i].phys_addr; res->end = pavail[i].phys_addr + pavail[i].reg_size -1 ; - res->flags =IORESOURCE_BUSY |IORESOURCE_MEM ; + res->flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM ;if (insert_resource (&iomem_resource, res) <0 ) {pr_warn ("Resource insertion failed.\n" );
arch/tile/kernel/setup.c +8 -3
@@ -1632,14 +1632,14 @@ static struct resource data_resource = { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_MEM + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM };static struct resource code_resource = { .name ="Kernel code" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM };/*
@@ -1673,10 +1673,15 @@ insert_ram_resource(u64 start_pfn, u64 end_pfn, bool reserved)kzalloc (sizeof (struct resource ),GFP_ATOMIC );if (!res)return NULL ; - res->name = reserved ?"Reserved" :"System RAM" ; res->start = start_pfn <<PAGE_SHIFT ; res->end = (end_pfn <<PAGE_SHIFT ) -1 ; res->flags =IORESOURCE_BUSY |IORESOURCE_MEM ; +if (reserved) { + res->name ="Reserved" ; + }else { + res->name ="System RAM" ; + res->flags |=IORESOURCE_SYSRAM ; + }if (insert_resource (&iomem_resource, res)) {kfree (res);return NULL ;
arch/unicore32/kernel/setup.c +3 -3
@@ -72,13 +72,13 @@ static struct resource mem_res[] = { .name = "Kernel code", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM }, { .name = "Kernel data", .start = 0, .end = 0, - .flags = IORESOURCE_MEM + .flags = IORESOURCE_SYSTEM_RAM } };
@@ -211,7 +211,7 @@ request_standard_resources(struct meminfo *mi) res->name ="System RAM" ; res->start = mi->bank[i].start; res->end = mi->bank[i].start + mi->bank[i].size -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;request_resource (&iomem_resource, res);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 7/17 kexec: Set IORESOURCE_SYSTEM_RAM for System RAM
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Set proper ioresource flags and types for crash kernel reservation areas.
--- kernel/kexec_core.c | 8 +++++--- kernel/kexec_file.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)
kernel/kexec_core.c +5 -3
@@ -66,13 +66,15 @@ struct resource crashk_res = { .name = "Crash kernel", .start = 0, .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_MEM + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM, + .desc = IORES_DESC_CRASH_KERNEL };struct resource crashk_low_res = { .name ="Crash kernel" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , + .desc =IORES_DESC_CRASH_KERNEL };int kexec_should_crash (struct task_struct *p)
@@ -959,7 +961,7 @@ int crash_shrink_memory(unsigned long new_size) ram_res->start = end; ram_res->end = crashk_res.end; - ram_res->flags =IORESOURCE_BUSY |IORESOURCE_MEM ; + ram_res->flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM ; ram_res->name ="System RAM" ; crashk_res.end = end -1 ;
kernel/kexec_file.c +1 -1
@@ -525,7 +525,7 @@ int kexec_add_buffer(struct kimage *image, char *buffer, unsigned long bufsz,/* Walk the RAM ranges and allocate a suitable range for the buffer */ if (image->type ==KEXEC_TYPE_CRASH ) ret =walk_iomem_res ("Crash kernel" , -IORESOURCE_MEM |IORESOURCE_BUSY , +IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY , crashk_res.start, crashk_res.end, kbuf, locate_mem_hole_callback);else
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] kexec: Set IORESOURCE_SYSTEM_RAM for System RAM
kexec: Set IORESOURCE_SYSTEM_RAM for System RAM
Commit-ID: 1a085d0727afaedb9506f04798516298b1676e11 Gitweb: http://git.kernel.org/tip/1a085d0727afaedb9506f04798516298b1676e11 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:23 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:57 +0100
kexec: Set IORESOURCE_SYSTEM_RAM for System RAM
Set proper ioresource flags and types for crash kernel reservation areas.
--- kernel/kexec_core.c | 8 +++++--- kernel/kexec_file.c | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-)
kernel/kexec_core.c +5 -3
@@ -66,13 +66,15 @@ struct resource crashk_res = { .name = "Crash kernel", .start = 0, .end = 0, - .flags = IORESOURCE_BUSY | IORESOURCE_MEM + .flags = IORESOURCE_BUSY | IORESOURCE_SYSTEM_RAM, + .desc = IORES_DESC_CRASH_KERNEL };struct resource crashk_low_res = { .name ="Crash kernel" , .start =0 , .end =0 , - .flags =IORESOURCE_BUSY |IORESOURCE_MEM + .flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM , + .desc =IORES_DESC_CRASH_KERNEL };int kexec_should_crash (struct task_struct *p)
@@ -959,7 +961,7 @@ int crash_shrink_memory(unsigned long new_size) ram_res->start = end; ram_res->end = crashk_res.end; - ram_res->flags =IORESOURCE_BUSY |IORESOURCE_MEM ; + ram_res->flags =IORESOURCE_BUSY |IORESOURCE_SYSTEM_RAM ; ram_res->name ="System RAM" ; crashk_res.end = end -1 ;
kernel/kexec_file.c +1 -1
@@ -525,7 +525,7 @@ int kexec_add_buffer(struct kimage *image, char *buffer, unsigned long bufsz,/* Walk the RAM ranges and allocate a suitable range for the buffer */ if (image->type ==KEXEC_TYPE_CRASH ) ret =walk_iomem_res ("Crash kernel" , -IORESOURCE_MEM |IORESOURCE_BUSY , +IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY , crashk_res.start, crashk_res.end, kbuf, locate_mem_hole_callback);else
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 8/17 xen, mm: Set IORESOURCE_SYSTEM_RAM to System RAM
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Set IORESOURCE_SYSTEM_RAM in struct resource.flags of "System RAM" entries.
--- drivers/xen/balloon.c | 2 +- mm/memory_hotplug.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/xen/balloon.c +1 -1
@@ -257,7 +257,7 @@ static struct resource *additional_memory_resource(phys_addr_t size)return NULL ; res->name ="System RAM" ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ; ret = allocate_resource(&iomem_resource, res, size, 0, -1,
mm/memory_hotplug.c +1 -1
@@ -138,7 +138,7 @@ static struct resource *register_memory_resource(u64 start, u64 size) res->name ="System RAM" ; res->start = start; res->end = start + size -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;if (request_resource (&iomem_resource, res) <0 ) {pr_debug ("System RAM resource %pR cannot be added\n" , res);kfree (res);
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] xen, mm: Set IORESOURCE_SYSTEM_RAM to System RAM
xen, mm: Set IORESOURCE_SYSTEM_RAM to System RAM
Commit-ID: 782b86641e5d471e9eb1cf0072c012d2f758e568 Gitweb: http://git.kernel.org/tip/782b86641e5d471e9eb1cf0072c012d2f758e568 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:24 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:58 +0100
xen, mm: Set IORESOURCE_SYSTEM_RAM to System RAM
Set IORESOURCE_SYSTEM_RAM in struct resource.flags of "System RAM" entries.
--- drivers/xen/balloon.c | 2 +- mm/memory_hotplug.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/xen/balloon.c +1 -1
@@ -257,7 +257,7 @@ static struct resource *additional_memory_resource(phys_addr_t size)return NULL ; res->name ="System RAM" ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ; ret = allocate_resource(&iomem_resource, res, size, 0, -1,
mm/memory_hotplug.c +1 -1
@@ -138,7 +138,7 @@ static struct resource *register_memory_resource(u64 start, u64 size) res->name ="System RAM" ; res->start = start; res->end = start + size -1 ; - res->flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res->flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ;if (request_resource (&iomem_resource, res) <0 ) {pr_debug ("System RAM resource %pR cannot be added\n" , res);kfree (res);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 9/17 drivers: Initialize resource entry to zero
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
I/O resource descriptor, 'desc' in struct resource, needs to be initialized to zero by default. Some drivers call kmalloc() to allocate a resource entry, but do not initialize it to zero by memset(). Change these drivers to call kzalloc(), instead.
--- drivers/acpi/acpi_platform.c | 2 +- drivers/parisc/eisa_enumerator.c | 4 ++-- drivers/rapidio/rio.c | 8 ++++---- drivers/sh/superhyway/superhyway.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
drivers/acpi/acpi_platform.c +1 -1
@@ -62,7 +62,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)if (count <0 ) {return NULL ; }else if (count >0 ) { - resources =kmalloc (count *sizeof (struct resource ), + resources =kzalloc (count *sizeof (struct resource ),GFP_KERNEL );if (!resources) {dev_err (&adev->dev,"No memory for resources\n" );
drivers/parisc/eisa_enumerator.c +2 -2
@@ -91,7 +91,7 @@ static int configure_memory(const unsigned char *buf,for (i=0 ;i<HPEE_MEMORY_MAX_ENT ;i++) { c =get_8 (buf+len); -if (NULL != (res =kmalloc (sizeof (struct resource ),GFP_KERNEL ))) { +if (NULL != (res =kzalloc (sizeof (struct resource ),GFP_KERNEL ))) {int result; res->name = name;
@@ -183,7 +183,7 @@ static int configure_port(const unsigned char *buf, struct resource *io_parent,for (i=0 ;i<HPEE_PORT_MAX_ENT ;i++) { c =get_8 (buf+len); -if (NULL != (res =kmalloc (sizeof (struct resource ),GFP_KERNEL ))) { +if (NULL != (res =kzalloc (sizeof (struct resource ),GFP_KERNEL ))) { res->name = board; res->start =get_16 (buf+len+1 ); res->end =get_16 (buf+len+1 )+(c&HPEE_PORT_SIZE_MASK )+1 ;
drivers/rapidio/rio.c +4 -4
@@ -117,7 +117,7 @@ int rio_request_inb_mbox(struct rio_mport *mport,if (mport->ops->open_inb_mbox ==NULL ) goto out; - res =kmalloc (sizeof (struct resource ),GFP_KERNEL ); + res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (res) {rio_init_mbox_res (res, mbox, mbox);
@@ -185,7 +185,7 @@ int rio_request_outb_mbox(struct rio_mport *mport,if (mport->ops->open_outb_mbox ==NULL ) goto out; - res =kmalloc (sizeof (struct resource ),GFP_KERNEL ); + res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (res) {rio_init_mbox_res (res, mbox, mbox);
@@ -285,7 +285,7 @@ int rio_request_inb_dbell(struct rio_mport *mport, {int rc =0 ; -struct resource *res =kmalloc (sizeof (struct resource ),GFP_KERNEL ); +struct resource *res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (res) {rio_init_dbell_res (res, start, end);
@@ -360,7 +360,7 @@ int rio_release_inb_dbell(struct rio_mport *mport, u16 start, u16 end)struct resource *rio_request_outb_dbell (struct rio_dev *rdev,u16 start,u16 end) { -struct resource *res =kmalloc (sizeof (struct resource ),GFP_KERNEL ); +struct resource *res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (res) {rio_init_dbell_res (res, start, end);
drivers/sh/superhyway/superhyway.c +1 -1
@@ -66,7 +66,7 @@ int superhyway_add_device(unsigned long base, struct superhyway_device *sdev,superhyway_read_vcr (dev, base, &dev->vcr);if (!dev->resource) { - dev->resource =kmalloc (sizeof (struct resource ),GFP_KERNEL ); + dev->resource =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (!dev->resource) {kfree (dev);return -ENOMEM ;
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] drivers: Initialize resource entry to zero
drivers: Initialize resource entry to zero
Commit-ID: 9a975bee4b3945b271bcff18a520d4863c210f8b Gitweb: http://git.kernel.org/tip/9a975bee4b3945b271bcff18a520d4863c210f8b Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:25 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:58 +0100
drivers: Initialize resource entry to zero
I/O resource descriptor, 'desc' in struct resource, needs to be initialized to zero by default. Some drivers call kmalloc() to allocate a resource entry, but do not initialize it to zero by memset(). Change these drivers to call kzalloc(), instead.
--- drivers/acpi/acpi_platform.c | 2 +- drivers/parisc/eisa_enumerator.c | 4 ++-- drivers/rapidio/rio.c | 8 ++++---- drivers/sh/superhyway/superhyway.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-)
drivers/acpi/acpi_platform.c +1 -1
@@ -62,7 +62,7 @@ struct platform_device *acpi_create_platform_device(struct acpi_device *adev)if (count <0 ) {return NULL ; }else if (count >0 ) { - resources =kmalloc (count *sizeof (struct resource ), + resources =kzalloc (count *sizeof (struct resource ),GFP_KERNEL );if (!resources) {dev_err (&adev->dev,"No memory for resources\n" );
drivers/parisc/eisa_enumerator.c +2 -2
@@ -91,7 +91,7 @@ static int configure_memory(const unsigned char *buf,for (i=0 ;i<HPEE_MEMORY_MAX_ENT ;i++) { c =get_8 (buf+len); -if (NULL != (res =kmalloc (sizeof (struct resource ),GFP_KERNEL ))) { +if (NULL != (res =kzalloc (sizeof (struct resource ),GFP_KERNEL ))) {int result; res->name = name;
@@ -183,7 +183,7 @@ static int configure_port(const unsigned char *buf, struct resource *io_parent,for (i=0 ;i<HPEE_PORT_MAX_ENT ;i++) { c =get_8 (buf+len); -if (NULL != (res =kmalloc (sizeof (struct resource ),GFP_KERNEL ))) { +if (NULL != (res =kzalloc (sizeof (struct resource ),GFP_KERNEL ))) { res->name = board; res->start =get_16 (buf+len+1 ); res->end =get_16 (buf+len+1 )+(c&HPEE_PORT_SIZE_MASK )+1 ;
drivers/rapidio/rio.c +4 -4
@@ -117,7 +117,7 @@ int rio_request_inb_mbox(struct rio_mport *mport,if (mport->ops->open_inb_mbox ==NULL ) goto out; - res =kmalloc (sizeof (struct resource ),GFP_KERNEL ); + res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (res) {rio_init_mbox_res (res, mbox, mbox);
@@ -185,7 +185,7 @@ int rio_request_outb_mbox(struct rio_mport *mport,if (mport->ops->open_outb_mbox ==NULL ) goto out; - res =kmalloc (sizeof (struct resource ),GFP_KERNEL ); + res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (res) {rio_init_mbox_res (res, mbox, mbox);
@@ -285,7 +285,7 @@ int rio_request_inb_dbell(struct rio_mport *mport, {int rc =0 ; -struct resource *res =kmalloc (sizeof (struct resource ),GFP_KERNEL ); +struct resource *res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (res) {rio_init_dbell_res (res, start, end);
@@ -360,7 +360,7 @@ int rio_release_inb_dbell(struct rio_mport *mport, u16 start, u16 end)struct resource *rio_request_outb_dbell (struct rio_dev *rdev,u16 start,u16 end) { -struct resource *res =kmalloc (sizeof (struct resource ),GFP_KERNEL ); +struct resource *res =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (res) {rio_init_dbell_res (res, start, end);
drivers/sh/superhyway/superhyway.c +1 -1
@@ -66,7 +66,7 @@ int superhyway_add_device(unsigned long base, struct superhyway_device *sdev,superhyway_read_vcr (dev, base, &dev->vcr);if (!dev->resource) { - dev->resource =kmalloc (sizeof (struct resource ),GFP_KERNEL ); + dev->resource =kzalloc (sizeof (struct resource ),GFP_KERNEL );if (!dev->resource) {kfree (dev);return -ENOMEM ;
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 10/17 resource: Change walk_system_ram() to use System RAM type
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Now that all System RAM resource entries have been initialized to IORESOURCE_SYSTEM_RAM type, change walk_system_ram_res() and walk_system_ram_range() to call find_next_iomem_res() by setting @res.flags to IORESOURCE_SYSTEM_RAM and @name to NULL. With this change, they walk through the iomem table to find System RAM ranges without the need to do strcmp() on the resource names.
No functional change is made to the interfaces.
--- kernel/resource.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
kernel/resource.c +13 -13
@@ -415,11 +415,11 @@ int walk_iomem_res(char *name, unsigned long flags, u64 start, u64 end, }/* -* This function calls callback against all memory range of "System RAM" -* which are marked as IORESOURCE_MEM and IORESOUCE_BUSY. -* Now, this function is only for "System RAM". This function deals with -* full ranges and not pfn. If resources are not pfn aligned, dealing -* with pfn can truncate ranges. +* This function calls the @func callback against all memory ranges of type +* System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY. +* Now, this function is only for System RAM, it deals with full ranges and +* not PFNs. If resources are not PFN-aligned, dealing with PFNs can truncate +* ranges. */ int walk_system_ram_res (u64 start,u64 end,void *arg,int (*func)(u64 ,u64 ,void *))
@@ -430,10 +430,10 @@ int walk_system_ram_res(u64 start, u64 end, void *arg, res.start = start; res.end = end; - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ; orig_end = res.end;while ((res.start < res.end) && - (!find_next_iomem_res (&res,"System RAM" , true))) { + (!find_next_iomem_res (&res,NULL , true))) { ret = (*func)(res.start, res.end, arg);if (ret)break ;
@@ -446,9 +446,9 @@ int walk_system_ram_res(u64 start, u64 end, void *arg,#if !defined(CONFIG_ARCH_HAS_WALK_MEMORY )/* -* This function calls callback against all memory range of "System RAM" -* which are marked as IORESOURCE_MEM and IORESOUCE_BUSY. -* Now, this function is only for "System RAM". +* This function calls the @func callback against all memory ranges of type +* System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY. +* It is to be used only for System RAM. */ int walk_system_ram_range (unsigned long start_pfn,unsigned long nr_pages,void *arg,int (*func)(unsigned long ,unsigned long ,void *))
@@ -460,10 +460,10 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, res.start = (u64 ) start_pfn <<PAGE_SHIFT ; res.end = ((u64)(start_pfn + nr_pages) <<PAGE_SHIFT ) -1 ; - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ; orig_end = res.end;while ((res.start < res.end) && - (find_next_iomem_res (&res,"System RAM" , true) >=0 )) { + (find_next_iomem_res (&res,NULL , true) >=0 )) { pfn = (res.start +PAGE_SIZE -1 ) >>PAGE_SHIFT ; end_pfn = (res.end +1 ) >>PAGE_SHIFT ;if (end_pfn > pfn)
@@ -484,7 +484,7 @@ static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg) }/* * This generic page_is_ram() returns true if specified address is -* registered as "System RAM" in iomem_resource list. +* registered as System RAM in iomem_resource list. */ int __weak page_is_ram (unsigned long pfn) {
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] resource: Change walk_system_ram() to use System RAM type
resource: Change walk_system_ram() to use System RAM type
Commit-ID: bd7e6cb30ced147292d854a54d4a1f5c5a05d927 Gitweb: http://git.kernel.org/tip/bd7e6cb30ced147292d854a54d4a1f5c5a05d927 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:26 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:58 +0100
resource: Change walk_system_ram() to use System RAM type
Now that all System RAM resource entries have been initialized to IORESOURCE_SYSTEM_RAM type, change walk_system_ram_res() and walk_system_ram_range() to call find_next_iomem_res() by setting @res.flags to IORESOURCE_SYSTEM_RAM and @name to NULL. With this change, they walk through the iomem table to find System RAM ranges without the need to do strcmp() on the resource names.
No functional change is made to the interfaces.
--- kernel/resource.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
kernel/resource.c +13 -13
@@ -415,11 +415,11 @@ int walk_iomem_res(char *name, unsigned long flags, u64 start, u64 end, }/* -* This function calls callback against all memory range of "System RAM" -* which are marked as IORESOURCE_MEM and IORESOUCE_BUSY. -* Now, this function is only for "System RAM". This function deals with -* full ranges and not pfn. If resources are not pfn aligned, dealing -* with pfn can truncate ranges. +* This function calls the @func callback against all memory ranges of type +* System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY. +* Now, this function is only for System RAM, it deals with full ranges and +* not PFNs. If resources are not PFN-aligned, dealing with PFNs can truncate +* ranges. */ int walk_system_ram_res (u64 start,u64 end,void *arg,int (*func)(u64 ,u64 ,void *))
@@ -430,10 +430,10 @@ int walk_system_ram_res(u64 start, u64 end, void *arg, res.start = start; res.end = end; - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ; orig_end = res.end;while ((res.start < res.end) && - (!find_next_iomem_res (&res,"System RAM" , true))) { + (!find_next_iomem_res (&res,NULL , true))) { ret = (*func)(res.start, res.end, arg);if (ret)break ;
@@ -446,9 +446,9 @@ int walk_system_ram_res(u64 start, u64 end, void *arg,#if !defined(CONFIG_ARCH_HAS_WALK_MEMORY )/* -* This function calls callback against all memory range of "System RAM" -* which are marked as IORESOURCE_MEM and IORESOUCE_BUSY. -* Now, this function is only for "System RAM". +* This function calls the @func callback against all memory ranges of type +* System RAM which are marked as IORESOURCE_SYSTEM_RAM and IORESOUCE_BUSY. +* It is to be used only for System RAM. */ int walk_system_ram_range (unsigned long start_pfn,unsigned long nr_pages,void *arg,int (*func)(unsigned long ,unsigned long ,void *))
@@ -460,10 +460,10 @@ int walk_system_ram_range(unsigned long start_pfn, unsigned long nr_pages, res.start = (u64 ) start_pfn <<PAGE_SHIFT ; res.end = ((u64)(start_pfn + nr_pages) <<PAGE_SHIFT ) -1 ; - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY ; orig_end = res.end;while ((res.start < res.end) && - (find_next_iomem_res (&res,"System RAM" , true) >=0 )) { + (find_next_iomem_res (&res,NULL , true) >=0 )) { pfn = (res.start +PAGE_SIZE -1 ) >>PAGE_SHIFT ; end_pfn = (res.end +1 ) >>PAGE_SHIFT ;if (end_pfn > pfn)
@@ -484,7 +484,7 @@ static int __is_ram(unsigned long pfn, unsigned long nr_pages, void *arg) }/* * This generic page_is_ram() returns true if specified address is -* registered as "System RAM" in iomem_resource list. +* registered as System RAM in iomem_resource list. */ int __weak page_is_ram (unsigned long pfn) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 11/17 arm/samsung: Change s3c_pm_run_res() to use System RAM type
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Change s3c_pm_run_res() to check with IORESOURCE_SYSTEM_RAM, instead of strcmp() with "System RAM", to walk through System RAM ranges in the iomem table.
No functional change is made to the interface.
--- arch/arm/plat-samsung/pm-check.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-samsung/pm-check.c +2 -2
@@ -53,8 +53,8 @@ static void s3c_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)if (ptr->child !=NULL )s3c_pm_run_res (ptr->child, fn, arg); -if ((ptr->flags &IORESOURCE_MEM ) && -strcmp (ptr->name,"System RAM" ) ==0 ) { +if ((ptr->flags &IORESOURCE_SYSTEM_RAM ) + ==IORESOURCE_SYSTEM_RAM ) {S3C_PMDBG ("Found system RAM at %08lx..%08lx\n" , (unsigned long )ptr->start, (unsigned long )ptr->end);
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] arm/samsung: Change s3c_pm_run_res() to use System RAM type
arm/samsung: Change s3c_pm_run_res() to use System RAM type
Commit-ID: 05fee7cfab7fa9d57e71f00bdd8fcff0cf5044a0 Gitweb: http://git.kernel.org/tip/05fee7cfab7fa9d57e71f00bdd8fcff0cf5044a0 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:27 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:58 +0100
arm/samsung: Change s3c_pm_run_res() to use System RAM type
Change s3c_pm_run_res() to check with IORESOURCE_SYSTEM_RAM, instead of strcmp() with "System RAM", to walk through System RAM ranges in the iomem table.
No functional change is made to the interface.
--- arch/arm/plat-samsung/pm-check.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/arm/plat-samsung/pm-check.c +2 -2
@@ -53,8 +53,8 @@ static void s3c_pm_run_res(struct resource *ptr, run_fn_t fn, u32 *arg)if (ptr->child !=NULL )s3c_pm_run_res (ptr->child, fn, arg); -if ((ptr->flags &IORESOURCE_MEM ) && -strcmp (ptr->name,"System RAM" ) ==0 ) { +if ((ptr->flags &IORESOURCE_SYSTEM_RAM ) + ==IORESOURCE_SYSTEM_RAM ) {S3C_PMDBG ("Found system RAM at %08lx..%08lx\n" , (unsigned long )ptr->start, (unsigned long )ptr->end);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 12/17 memremap: Change region_intersects() to take @flags and @desc
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
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.
--- include/linux/mm.h | 3 ++- kernel/memremap.c | 13 +++++++------ kernel/resource.c | 26 +++++++++++++++----------- 3 files changed, 24 insertions(+), 18 deletions(-)
include/linux/mm.h +2 -1
@@ -385,7 +385,8 @@ enum { REGION_MIXED, }; -int region_intersects (resource_size_t offset,size_t size,const char *type); +int region_intersects (resource_size_t offset,size_t size,unsigned long flags, +unsigned long desc);/* Support for virtually mapped pages */ struct page *vmalloc_to_page (const void *addr);
kernel/memremap.c +7 -6
@@ -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;
kernel/resource.c +15 -11
@@ -496,31 +496,34 @@ EXPORT_SYMBOL_GPL(page_is_ram);* region_intersects() - determine intersection of region with known resources * @start: region start address * @size: size of region -* @name: name of resource (in iomem_resource) +* @flags: flags of resource (in iomem_resource) +* @desc: descriptor of resource (in iomem_resource) or IORES_DESC_NONE * * Check if the specified region partially overlaps or fully eclipses a -* resource identified by @name. Return REGION_DISJOINT if the region -* does not overlap @name, return REGION_MIXED if the region overlaps -* @type and another resource, and return REGION_INTERSECTS if the -* region overlaps @type and no other defined resource. Note, that -* REGION_INTERSECTS is also returned in the case when the specified -* region overlaps RAM and undefined memory holes. +* resource identified by @flags and @desc (optional with IORES_DESC_NONE). +* Return REGION_DISJOINT if the region does not overlap @flags/@desc, +* return REGION_MIXED if the region overlaps @flags/@desc and another +* resource, and return REGION_INTERSECTS if the region overlaps @flags/@desc +* and no other defined resource. Note that REGION_INTERSECTS is also +* returned in the case when the specified region overlaps RAM and undefined +* memory holes. * * region_intersect() is used by memory remapping functions to ensure * the user is not remapping RAM and is a vast speed up over walking * through the resource table page by page. */ -int region_intersects (resource_size_t start,size_t size,const char *name) +int region_intersects (resource_size_t start,size_t size,unsigned long flags, +unsigned long desc) { -unsigned long flags =IORESOURCE_MEM |IORESOURCE_BUSY ;resource_size_t end = start + size -1 ;int type =0 ;int other =0 ;struct resource *p;read_lock (&resource_lock);for (p = iomem_resource.child; p ; p = p->sibling) { -bool is_type =strcmp (p->name, name) ==0 && - ((p->flags & flags) == flags); +bool is_type = (((p->flags & flags) == flags) && + ((desc ==IORES_DESC_NONE ) || + (desc == p->desc)));if (start >= p->start && start <= p->end) is_type ? type++ : other++;
@@ -539,6 +542,7 @@ int region_intersects(resource_size_t start, size_t size, const char *name)return REGION_DISJOINT ; } +EXPORT_SYMBOL_GPL (region_intersects);void __weak arch_remove_reservations (struct resource *avail) {
Signature · 1 line
2.3.5
Re: [PATCH 12/17] memremap: Change region_intersects() to take @flags and @desc
Quoted 9 lines · Borislav Petkov
From: Toshi Kani <[email protected]>
Change
region_intersects()to identify a target with @flags and @desc, instead of @name withstrcmp().Change the callers of
region_intersects(),memremap()anddevm_memremap(), to setIORESOURCE_SYSTEM_RAMin @flags andIORES_DESC_NONEin @desc when searching System RAM.
Quoted 7 lines
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]>Cc Andrew Morton <[email protected]>Cc Ard Biesheuvel <[email protected]>Cc Dan Williams <[email protected]>
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
tip-bot for Toshi Kani
merge bot[tip:core/resources] memremap: Change region_intersects() to take @flags and @desc
In reply to Borislav Petkovmemremap: Change region_intersects() to take @flags and @desc
Commit-ID: 1c29f25bf5d6c557017f619b638c619cbbf798c4 Gitweb: http://git.kernel.org/tip/1c29f25bf5d6c557017f619b638c619cbbf798c4 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:28 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:58 +0100
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.
--- include/linux/mm.h | 3 ++- kernel/memremap.c | 13 +++++++------ kernel/resource.c | 26 +++++++++++++++----------- 3 files changed, 24 insertions(+), 18 deletions(-)
include/linux/mm.h +2 -1
@@ -385,7 +385,8 @@ enum { REGION_MIXED, }; -int region_intersects (resource_size_t offset,size_t size,const char *type); +int region_intersects (resource_size_t offset,size_t size,unsigned long flags, +unsigned long desc);/* Support for virtually mapped pages */ struct page *vmalloc_to_page (const void *addr);
kernel/memremap.c +7 -6
@@ -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;
kernel/resource.c +15 -11
@@ -496,31 +496,34 @@ EXPORT_SYMBOL_GPL(page_is_ram);* region_intersects() - determine intersection of region with known resources * @start: region start address * @size: size of region -* @name: name of resource (in iomem_resource) +* @flags: flags of resource (in iomem_resource) +* @desc: descriptor of resource (in iomem_resource) or IORES_DESC_NONE * * Check if the specified region partially overlaps or fully eclipses a -* resource identified by @name. Return REGION_DISJOINT if the region -* does not overlap @name, return REGION_MIXED if the region overlaps -* @type and another resource, and return REGION_INTERSECTS if the -* region overlaps @type and no other defined resource. Note, that -* REGION_INTERSECTS is also returned in the case when the specified -* region overlaps RAM and undefined memory holes. +* resource identified by @flags and @desc (optional with IORES_DESC_NONE). +* Return REGION_DISJOINT if the region does not overlap @flags/@desc, +* return REGION_MIXED if the region overlaps @flags/@desc and another +* resource, and return REGION_INTERSECTS if the region overlaps @flags/@desc +* and no other defined resource. Note that REGION_INTERSECTS is also +* returned in the case when the specified region overlaps RAM and undefined +* memory holes. * * region_intersect() is used by memory remapping functions to ensure * the user is not remapping RAM and is a vast speed up over walking * through the resource table page by page. */ -int region_intersects (resource_size_t start,size_t size,const char *name) +int region_intersects (resource_size_t start,size_t size,unsigned long flags, +unsigned long desc) { -unsigned long flags =IORESOURCE_MEM |IORESOURCE_BUSY ;resource_size_t end = start + size -1 ;int type =0 ;int other =0 ;struct resource *p;read_lock (&resource_lock);for (p = iomem_resource.child; p ; p = p->sibling) { -bool is_type =strcmp (p->name, name) ==0 && - ((p->flags & flags) == flags); +bool is_type = (((p->flags & flags) == flags) && + ((desc ==IORES_DESC_NONE ) || + (desc == p->desc)));if (start >= p->start && start <= p->end) is_type ? type++ : other++;
@@ -539,6 +542,7 @@ int region_intersects(resource_size_t start, size_t size, const char *name)return REGION_DISJOINT ; } +EXPORT_SYMBOL_GPL (region_intersects);void __weak arch_remove_reservations (struct resource *avail) {
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 13/17 resource: Add walk_iomem_res_desc()
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Add a new interface, walk_iomem_res_desc(), which walks through the iomem table by identifying a target with @flags and @desc. This interface provides the same functionality as walk_iomem_res(), but does not use strcmp() to @name for better efficiency.
walk_iomem_res() is deprecated and will be removed in a later patch.
--- include/linux/ioport.h | 3 +++ kernel/resource.c | 66 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 59 insertions(+), 10 deletions(-)
include/linux/ioport.h +3 -0
@@ -268,6 +268,9 @@ extern int walk_system_ram_res(u64 start, u64 end, void *arg, int (*func)(u64, u64, void *));extern int +walk_iomem_res_desc (unsigned long desc,unsigned long flags,u64 start,u64 end, +void *arg,int (*func)(u64 ,u64 ,void *)); +extern int walk_iomem_res (char *name,unsigned long flags,u64 start,u64 end,void *arg,int (*func)(u64 ,u64 ,void *));
kernel/resource.c +56 -10
109 lines not on this page · raw message
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] resource: Add walk_iomem_res_desc()
resource: Add walk_iomem_res_desc()
Commit-ID: 3f33647c41962401272bb60dce67e6094d14dbf2 Gitweb: http://git.kernel.org/tip/3f33647c41962401272bb60dce67e6094d14dbf2 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:29 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:59 +0100
resource: Add walk_iomem_res_desc()
Add a new interface, walk_iomem_res_desc(), which walks through the iomem table by identifying a target with @flags and @desc. This interface provides the same functionality as walk_iomem_res(), but does not use strcmp() to @name for better efficiency.
walk_iomem_res() is deprecated and will be removed in a later patch.
--- include/linux/ioport.h | 3 +++ kernel/resource.c | 66 ++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 59 insertions(+), 10 deletions(-)
include/linux/ioport.h +3 -0
@@ -268,6 +268,9 @@ extern int walk_system_ram_res(u64 start, u64 end, void *arg, int (*func)(u64, u64, void *));extern int +walk_iomem_res_desc (unsigned long desc,unsigned long flags,u64 start,u64 end, +void *arg,int (*func)(u64 ,u64 ,void *)); +extern int walk_iomem_res (char *name,unsigned long flags,u64 start,u64 end,void *arg,int (*func)(u64 ,u64 ,void *));
kernel/resource.c +56 -10
109 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 14/17 x86, kexec, nvdimm: Use walk_iomem_res_desc() for iomem search
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
Change the callers of walk_iomem_res() scanning for the following resources by name to use walk_iomem_res_desc() instead.
"ACPI Tables"
"ACPI Non-volatile Storage"
"Persistent Memory (legacy)"
"Crash kernel"
Note, the caller of walk_iomem_res() with "GART" will be removed in a later patch.
--- arch/x86/kernel/crash.c | 4 ++-- arch/x86/kernel/pmem.c | 4 ++-- drivers/nvdimm/e820.c | 2 +- kernel/kexec_file.c | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-)
arch/x86/kernel/crash.c +2 -2
@@ -599,12 +599,12 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)/* Add ACPI tables */ cmd.type =E820_ACPI ; flags =IORESOURCE_MEM |IORESOURCE_BUSY ; -walk_iomem_res ("ACPI Tables" , flags,0 ,-1 , &cmd, +walk_iomem_res_desc (IORES_DESC_ACPI_TABLES , flags,0 ,-1 , &cmd, memmap_entry_callback);/* Add ACPI Non-volatile Storage */ cmd.type =E820_NVS ; -walk_iomem_res ("ACPI Non-volatile Storage" , flags,0 ,-1 , &cmd, +walk_iomem_res_desc (IORES_DESC_ACPI_NV_STORAGE , flags,0 ,-1 , &cmd, memmap_entry_callback);/* Add crashk_low_res region */
arch/x86/kernel/pmem.c +2 -2
@@ -13,11 +13,11 @@ static int found(u64 start, u64 end, void *data)static __init int register_e820_pmem (void ) { -char *pmem ="Persistent Memory (legacy)" ;struct platform_device *pdev;int rc; - rc =walk_iomem_res (pmem,IORESOURCE_MEM ,0 ,-1 ,NULL , found); + rc =walk_iomem_res_desc (IORES_DESC_PERSISTENT_MEMORY_LEGACY , +IORESOURCE_MEM ,0 ,-1 ,NULL , found);if (rc <=0 )return 0 ;
drivers/nvdimm/e820.c +1 -1
@@ -55,7 +55,7 @@ static int e820_pmem_probe(struct platform_device *pdev)for (p = iomem_resource.child; p ; p = p->sibling) {struct nd_region_desc ndr_desc; -if (strncmp (p->name,"Persistent Memory (legacy)" ,26 ) !=0 ) +if (p->desc !=IORES_DESC_PERSISTENT_MEMORY_LEGACY )continue ;memset (&ndr_desc,0 ,sizeof (ndr_desc));
kernel/kexec_file.c +4 -4
@@ -524,10 +524,10 @@ int kexec_add_buffer(struct kimage *image, char *buffer, unsigned long bufsz,/* Walk the RAM ranges and allocate a suitable range for the buffer */ if (image->type ==KEXEC_TYPE_CRASH ) - ret =walk_iomem_res ("Crash kernel" , -IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY , - crashk_res.start, crashk_res.end, kbuf, - locate_mem_hole_callback); + ret =walk_iomem_res_desc (crashk_res.desc, +IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY , + crashk_res.start, crashk_res.end, kbuf, + locate_mem_hole_callback);else ret =walk_system_ram_res (0 ,-1 , kbuf, locate_mem_hole_callback);
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] x86, kexec, nvdimm: Use walk_iomem_res_desc( ) for iomem search
x86, kexec, nvdimm: Use walk_iomem_res_desc() for iomem search
Commit-ID: f0f4711aa16b82016c0b6e59871934bbd71258da Gitweb: http://git.kernel.org/tip/f0f4711aa16b82016c0b6e59871934bbd71258da Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:30 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:59 +0100
x86, kexec, nvdimm: Use walk_iomem_res_desc() for iomem search
Change the callers of walk_iomem_res() scanning for the following resources by name to use walk_iomem_res_desc() instead.
"ACPI Tables"
"ACPI Non-volatile Storage"
"Persistent Memory (legacy)"
"Crash kernel"
Note, the caller of walk_iomem_res() with "GART" will be removed in a later patch.
--- arch/x86/kernel/crash.c | 4 ++-- arch/x86/kernel/pmem.c | 4 ++-- drivers/nvdimm/e820.c | 2 +- kernel/kexec_file.c | 8 ++++---- 4 files changed, 9 insertions(+), 9 deletions(-)
arch/x86/kernel/crash.c +2 -2
@@ -599,12 +599,12 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)/* Add ACPI tables */ cmd.type =E820_ACPI ; flags =IORESOURCE_MEM |IORESOURCE_BUSY ; -walk_iomem_res ("ACPI Tables" , flags,0 ,-1 , &cmd, +walk_iomem_res_desc (IORES_DESC_ACPI_TABLES , flags,0 ,-1 , &cmd, memmap_entry_callback);/* Add ACPI Non-volatile Storage */ cmd.type =E820_NVS ; -walk_iomem_res ("ACPI Non-volatile Storage" , flags,0 ,-1 , &cmd, +walk_iomem_res_desc (IORES_DESC_ACPI_NV_STORAGE , flags,0 ,-1 , &cmd, memmap_entry_callback);/* Add crashk_low_res region */
arch/x86/kernel/pmem.c +2 -2
@@ -13,11 +13,11 @@ static int found(u64 start, u64 end, void *data)static __init int register_e820_pmem (void ) { -char *pmem ="Persistent Memory (legacy)" ;struct platform_device *pdev;int rc; - rc =walk_iomem_res (pmem,IORESOURCE_MEM ,0 ,-1 ,NULL , found); + rc =walk_iomem_res_desc (IORES_DESC_PERSISTENT_MEMORY_LEGACY , +IORESOURCE_MEM ,0 ,-1 ,NULL , found);if (rc <=0 )return 0 ;
drivers/nvdimm/e820.c +1 -1
@@ -55,7 +55,7 @@ static int e820_pmem_probe(struct platform_device *pdev)for (p = iomem_resource.child; p ; p = p->sibling) {struct nd_region_desc ndr_desc; -if (strncmp (p->name,"Persistent Memory (legacy)" ,26 ) !=0 ) +if (p->desc !=IORES_DESC_PERSISTENT_MEMORY_LEGACY )continue ;memset (&ndr_desc,0 ,sizeof (ndr_desc));
kernel/kexec_file.c +4 -4
@@ -524,10 +524,10 @@ int kexec_add_buffer(struct kimage *image, char *buffer, unsigned long bufsz,/* Walk the RAM ranges and allocate a suitable range for the buffer */ if (image->type ==KEXEC_TYPE_CRASH ) - ret =walk_iomem_res ("Crash kernel" , -IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY , - crashk_res.start, crashk_res.end, kbuf, - locate_mem_hole_callback); + ret =walk_iomem_res_desc (crashk_res.desc, +IORESOURCE_SYSTEM_RAM |IORESOURCE_BUSY , + crashk_res.start, crashk_res.end, kbuf, + locate_mem_hole_callback);else ret =walk_system_ram_res (0 ,-1 , kbuf, locate_mem_hole_callback);
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 15/17 x86/kexec: Remove walk_iomem_res() call with GART type
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
There is no longer any driver inserting a "GART" region in the kernel since
707d4eefbdb3 ("Revert "[PATCH] Insert GART region into resource map"").
Remove the call to walk_iomem_res() with "GART" type, its callback function, and GART-specific variables set by the callback.
--- arch/x86/kernel/crash.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-)
arch/x86/kernel/crash.c +1 -36
@@ -57,10 +57,9 @@ struct crash_elf_data {struct kimage *image;/* * Total number of ram ranges we have after various adjustments for -* GART, crash reserved region etc. +* crash reserved region, etc. */ unsigned int max_nr_ranges; -unsigned long gart_start, gart_end;/* Pointer to elf header */ void *ehdr;
@@ -201,17 +200,6 @@ static int get_nr_ram_ranges_callback(u64 start, u64 end, void *arg)return 0 ; } -static int get_gart_ranges_callback (u64 start,u64 end,void *arg) -{ -struct crash_elf_data *ced = arg; - - ced->gart_start = start; - ced->gart_end = end; - -/* Not expecting more than 1 gart aperture */ -return 1 ; -} -/* Gather all the required information to prepare elf headers for ram regions */ static void fill_up_crash_elf_data(struct crash_elf_data *ced,
@@ -226,22 +214,6 @@ static void fill_up_crash_elf_data(struct crash_elf_data *ced, ced->max_nr_ranges = nr_ranges; -/* -* We don't create ELF headers for GART aperture as an attempt -* to dump this memory in second kernel leads to hang/crash. -* If gart aperture is present, one needs to exclude that region -* and that could lead to need of extra phdr. -*/ -walk_iomem_res ("GART" ,IORESOURCE_MEM ,0 ,-1 , - ced, get_gart_ranges_callback); - -/* -* If we have gart region, excluding that could potentially split -* a memory range, resulting in extra header. Account for that. -*/ -if (ced->gart_end) - ced->max_nr_ranges++; -/* Exclusion of crash region could split memory ranges */ ced->max_nr_ranges++;
@@ -350,13 +322,6 @@ static int elf_header_exclude_ranges(struct crash_elf_data *ced,return ret; } -/* Exclude GART region */ -if (ced->gart_end) { - ret =exclude_mem_range (cmem, ced->gart_start, ced->gart_end); -if (ret) -return ret; - } -return ret; }
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] x86/kexec: Remove walk_iomem_res() call with GART type
x86/kexec: Remove walk_iomem_res() call with GART type
Commit-ID: f296f2634920d205b93d878b48d87bb7e0a4c256 Gitweb: http://git.kernel.org/tip/f296f2634920d205b93d878b48d87bb7e0a4c256 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:31 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:59 +0100
x86/kexec: Remove walk_iomem_res() call with GART type
There is no longer any driver inserting a "GART" region in the kernel since
707d4eefbdb3 ("Revert "[PATCH] Insert GART region into resource map"").
Remove the call to walk_iomem_res() with "GART" type, its callback function, and GART-specific variables set by the callback.
--- arch/x86/kernel/crash.c | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-)
arch/x86/kernel/crash.c +1 -36
@@ -57,10 +57,9 @@ struct crash_elf_data {struct kimage *image;/* * Total number of ram ranges we have after various adjustments for -* GART, crash reserved region etc. +* crash reserved region, etc. */ unsigned int max_nr_ranges; -unsigned long gart_start, gart_end;/* Pointer to elf header */ void *ehdr;
@@ -201,17 +200,6 @@ static int get_nr_ram_ranges_callback(u64 start, u64 end, void *arg)return 0 ; } -static int get_gart_ranges_callback (u64 start,u64 end,void *arg) -{ -struct crash_elf_data *ced = arg; - - ced->gart_start = start; - ced->gart_end = end; - -/* Not expecting more than 1 gart aperture */ -return 1 ; -} -/* Gather all the required information to prepare elf headers for ram regions */ static void fill_up_crash_elf_data(struct crash_elf_data *ced,
@@ -226,22 +214,6 @@ static void fill_up_crash_elf_data(struct crash_elf_data *ced, ced->max_nr_ranges = nr_ranges; -/* -* We don't create ELF headers for GART aperture as an attempt -* to dump this memory in second kernel leads to hang/crash. -* If gart aperture is present, one needs to exclude that region -* and that could lead to need of extra phdr. -*/ -walk_iomem_res ("GART" ,IORESOURCE_MEM ,0 ,-1 , - ced, get_gart_ranges_callback); - -/* -* If we have gart region, excluding that could potentially split -* a memory range, resulting in extra header. Account for that. -*/ -if (ced->gart_end) - ced->max_nr_ranges++; -/* Exclusion of crash region could split memory ranges */ ced->max_nr_ranges++;
@@ -350,13 +322,6 @@ static int elf_header_exclude_ranges(struct crash_elf_data *ced,return ret; } -/* Exclude GART region */ -if (ced->gart_end) { - ret =exclude_mem_range (cmem, ced->gart_start, ced->gart_end); -if (ret) -return ret; - } -return ret; }
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 16/17 resource: Kill walk_iomem_res()
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
walk_iomem_res_desc() replaced walk_iomem_res() and there is no caller to walk_iomem_res() any more. Kill it. Also remove @name from find_next_iomem_res() as it is no longer used.
--- include/linux/ioport.h | 3 --- kernel/resource.c | 49 +++++-------------------------------------------- 2 files changed, 5 insertions(+), 47 deletions(-)
include/linux/ioport.h +0 -3
@@ -270,9 +270,6 @@ walk_system_ram_res(u64 start, u64 end, void *arg,extern int walk_iomem_res_desc (unsigned long desc,unsigned long flags,u64 start,u64 end,void *arg,int (*func)(u64 ,u64 ,void *)); -extern int -walk_iomem_res (char *name,unsigned long flags,u64 start,u64 end,void *arg, -int (*func)(u64 ,u64 ,void *));/* True if any part of r1 overlaps r2 */ static inline bool resource_overlaps (struct resource *r1,struct resource *r2)
kernel/resource.c +5 -44
89 lines not on this page · raw message
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] resource: Kill walk_iomem_res()
resource: Kill walk_iomem_res()
Commit-ID: a8fc42530ddd19d7580fe8c9f2ea86220a97e94c Gitweb: http://git.kernel.org/tip/a8fc42530ddd19d7580fe8c9f2ea86220a97e94c Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:32 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:49:59 +0100
resource: Kill walk_iomem_res()
walk_iomem_res_desc() replaced walk_iomem_res() and there is no caller to walk_iomem_res() any more. Kill it. Also remove @name from find_next_iomem_res() as it is no longer used.
--- include/linux/ioport.h | 3 --- kernel/resource.c | 49 +++++-------------------------------------------- 2 files changed, 5 insertions(+), 47 deletions(-)
include/linux/ioport.h +0 -3
@@ -270,9 +270,6 @@ walk_system_ram_res(u64 start, u64 end, void *arg,extern int walk_iomem_res_desc (unsigned long desc,unsigned long flags,u64 start,u64 end,void *arg,int (*func)(u64 ,u64 ,void *)); -extern int -walk_iomem_res (char *name,unsigned long flags,u64 start,u64 end,void *arg, -int (*func)(u64 ,u64 ,void *));/* True if any part of r1 overlaps r2 */ static inline bool resource_overlaps (struct resource *r1,struct resource *r2)
kernel/resource.c +5 -44
89 lines not on this page · raw message
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Borislav Petkov
maintainerPATCH 17/17 ACPI/EINJ: Allow memory error injection to NVDIMM
In reply to Borislav PetkovFrom: Toshi Kani <[email protected]>
In the case of memory error injection, einj_error_inject() checks if a target address is System RAM. Change this check to allow injecting a memory error into NVDIMM memory by calling region_intersects() with IORES_DESC_PERSISTENT_MEMORY. This enables memory error testing on both System RAM and NVDIMM.
In addition, page_is_ram() is replaced with region_intersects() with IORESOURCE_SYSTEM_RAM, so that it can verify a target address range with the requested size.
--- drivers/acpi/apei/einj.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/acpi/apei/einj.c +11 -4
@@ -519,7 +519,7 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, u64 param3, u64 param4) { int rc; -unsigned long pfn; +u64 base_addr, size;/* If user manually set "flags", make sure it is legal */ if (flags && (flags &
@@ -545,10 +545,17 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,/* * Disallow crazy address masks that give BIOS leeway to pick * injection address almost anywhere. Insist on page or -* better granularity and that target address is normal RAM. +* better granularity and that target address is normal RAM or +* NVDIMM. */ - pfn =PFN_DOWN (param1 & param2); -if (!page_is_ram (pfn) || ((param2 &PAGE_MASK ) !=PAGE_MASK )) + base_addr = param1 & param2; + size = ~param2 +1 ; + +if (((param2 &PAGE_MASK ) !=PAGE_MASK ) || + ((region_intersects (base_addr, size,IORESOURCE_SYSTEM_RAM ,IORES_DESC_NONE ) + !=REGION_INTERSECTS ) && + (region_intersects (base_addr, size,IORESOURCE_MEM ,IORES_DESC_PERSISTENT_MEMORY ) + !=REGION_INTERSECTS )))return -EINVAL ; inject:
Signature · 1 line
2.3.5
tip-bot for Toshi Kani
merge bot[tip:core/resources] ACPI/EINJ: Allow memory error injection to NVDIMM
ACPI/EINJ: Allow memory error injection to NVDIMM
Commit-ID: 4650bac1fc45d64aef62ab99aa4db93d41dedbd9 Gitweb: http://git.kernel.org/tip/4650bac1fc45d64aef62ab99aa4db93d41dedbd9 Author: Toshi Kani <[email protected]> AuthorDate: Tue, 26 Jan 2016 21:57:33 +0100 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 30 Jan 2016 09:50:00 +0100
ACPI/EINJ: Allow memory error injection to NVDIMM
In the case of memory error injection, einj_error_inject() checks if a target address is System RAM. Change this check to allow injecting a memory error into NVDIMM memory by calling region_intersects() with IORES_DESC_PERSISTENT_MEMORY. This enables memory error testing on both System RAM and NVDIMM.
In addition, page_is_ram() is replaced with region_intersects() with IORESOURCE_SYSTEM_RAM, so that it can verify a target address range with the requested size.
--- drivers/acpi/apei/einj.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/acpi/apei/einj.c +11 -4
@@ -519,7 +519,7 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2, u64 param3, u64 param4) { int rc; -unsigned long pfn; +u64 base_addr, size;/* If user manually set "flags", make sure it is legal */ if (flags && (flags &
@@ -545,10 +545,17 @@ static int einj_error_inject(u32 type, u32 flags, u64 param1, u64 param2,/* * Disallow crazy address masks that give BIOS leeway to pick * injection address almost anywhere. Insist on page or -* better granularity and that target address is normal RAM. +* better granularity and that target address is normal RAM or +* NVDIMM. */ - pfn =PFN_DOWN (param1 & param2); -if (!page_is_ram (pfn) || ((param2 &PAGE_MASK ) !=PAGE_MASK )) + base_addr = param1 & param2; + size = ~param2 +1 ; + +if (((param2 &PAGE_MASK ) !=PAGE_MASK ) || + ((region_intersects (base_addr, size,IORESOURCE_SYSTEM_RAM ,IORES_DESC_NONE ) + !=REGION_INTERSECTS ) && + (region_intersects (base_addr, size,IORESOURCE_MEM ,IORES_DESC_PERSISTENT_MEMORY ) + !=REGION_INTERSECTS )))return -EINVAL ; inject:
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>