aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/resource.c
diff options
context:
space:
mode:
authorToshi Kani <toshi.kani@hpe.com>2016-01-26 15:57:19 -0500
committerIngo Molnar <mingo@kernel.org>2016-01-30 03:49:56 -0500
commit43ee493bde78da00deaf5737925365c691a036ad (patch)
treeacc53b7c3d8d87559258a4d58bdd7a96ce35518a /kernel/resource.c
parenta3650d53ba16ec412185abb98f231e9ba6bcdc65 (diff)
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. Signed-off-by: Toshi Kani <toshi.kani@hpe.com> Signed-off-by: Borislav Petkov <bp@suse.de> Cc: Andrew Morton <akpm@linux-foundation.org> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Dan Williams <dan.j.williams@intel.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jakub Sitnicki <jsitnicki@gmail.com> Cc: Jiang Liu <jiang.liu@linux.intel.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Luis R. Rodriguez <mcgrof@suse.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Toshi Kani <toshi.kani@hp.com> Cc: linux-arch@vger.kernel.org Cc: linux-mm <linux-mm@kvack.org> Link: http://lkml.kernel.org/r/1453841853-11383-4-git-send-email-bp@alien8.de Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'kernel/resource.c')
-rw-r--r--kernel/resource.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/kernel/resource.c b/kernel/resource.c
index 96afc8027487..61512e972ece 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -949,6 +949,7 @@ static void __init __reserve_region_with_split(struct resource *root,
949 res->start = start; 949 res->start = start;
950 res->end = end; 950 res->end = end;
951 res->flags = IORESOURCE_BUSY; 951 res->flags = IORESOURCE_BUSY;
952 res->desc = IORES_DESC_NONE;
952 953
953 while (1) { 954 while (1) {
954 955
@@ -983,6 +984,7 @@ static void __init __reserve_region_with_split(struct resource *root,
983 next_res->start = conflict->end + 1; 984 next_res->start = conflict->end + 1;
984 next_res->end = end; 985 next_res->end = end;
985 next_res->flags = IORESOURCE_BUSY; 986 next_res->flags = IORESOURCE_BUSY;
987 next_res->desc = IORES_DESC_NONE;
986 } 988 }
987 } else { 989 } else {
988 res->start = conflict->end + 1; 990 res->start = conflict->end + 1;
@@ -1074,6 +1076,7 @@ struct resource * __request_region(struct resource *parent,
1074 res->end = start + n - 1; 1076 res->end = start + n - 1;
1075 res->flags = resource_type(parent) | resource_ext_type(parent); 1077 res->flags = resource_type(parent) | resource_ext_type(parent);
1076 res->flags |= IORESOURCE_BUSY | flags; 1078 res->flags |= IORESOURCE_BUSY | flags;
1079 res->desc = IORES_DESC_NONE;
1077 1080
1078 write_lock(&resource_lock); 1081 write_lock(&resource_lock);
1079 1082
@@ -1238,6 +1241,7 @@ int release_mem_region_adjustable(struct resource *parent,
1238 new_res->start = end + 1; 1241 new_res->start = end + 1;
1239 new_res->end = res->end; 1242 new_res->end = res->end;
1240 new_res->flags = res->flags; 1243 new_res->flags = res->flags;
1244 new_res->desc = res->desc;
1241 new_res->parent = res->parent; 1245 new_res->parent = res->parent;
1242 new_res->sibling = res->sibling; 1246 new_res->sibling = res->sibling;
1243 new_res->child = NULL; 1247 new_res->child = NULL;
@@ -1413,6 +1417,7 @@ static int __init reserve_setup(char *str)
1413 res->start = io_start; 1417 res->start = io_start;
1414 res->end = io_start + io_num - 1; 1418 res->end = io_start + io_num - 1;
1415 res->flags = IORESOURCE_BUSY; 1419 res->flags = IORESOURCE_BUSY;
1420 res->desc = IORES_DESC_NONE;
1416 res->child = NULL; 1421 res->child = NULL;
1417 if (request_resource(res->start >= 0x10000 ? &iomem_resource : &ioport_resource, res) == 0) 1422 if (request_resource(res->start >= 0x10000 ? &iomem_resource : &ioport_resource, res) == 0)
1418 reserved = x+1; 1423 reserved = x+1;