summaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/memory_hotplug.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index cd23c081924d..f767582af4f8 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -101,28 +101,24 @@ u64 max_mem_size = U64_MAX;
101/* add this memory to iomem resource */ 101/* add this memory to iomem resource */
102static struct resource *register_memory_resource(u64 start, u64 size) 102static struct resource *register_memory_resource(u64 start, u64 size)
103{ 103{
104 struct resource *res, *conflict; 104 struct resource *res;
105 unsigned long flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY;
106 char *resource_name = "System RAM";
105 107
106 if (start + size > max_mem_size) 108 if (start + size > max_mem_size)
107 return ERR_PTR(-E2BIG); 109 return ERR_PTR(-E2BIG);
108 110
109 res = kzalloc(sizeof(struct resource), GFP_KERNEL); 111 /*
110 if (!res) 112 * Request ownership of the new memory range. This might be
111 return ERR_PTR(-ENOMEM); 113 * a child of an existing resource that was present but
112 114 * not marked as busy.
113 res->name = "System RAM"; 115 */
114 res->start = start; 116 res = __request_region(&iomem_resource, start, size,
115 res->end = start + size - 1; 117 resource_name, flags);
116 res->flags = IORESOURCE_SYSTEM_RAM | IORESOURCE_BUSY; 118
117 conflict = request_resource_conflict(&iomem_resource, res); 119 if (!res) {
118 if (conflict) { 120 pr_debug("Unable to reserve System RAM region: %016llx->%016llx\n",
119 if (conflict->desc == IORES_DESC_DEVICE_PRIVATE_MEMORY) { 121 start, start + size);
120 pr_debug("Device unaddressable memory block "
121 "memory hotplug at %#010llx !\n",
122 (unsigned long long)start);
123 }
124 pr_debug("System RAM resource %pR cannot be added\n", res);
125 kfree(res);
126 return ERR_PTR(-EEXIST); 122 return ERR_PTR(-EEXIST);
127 } 123 }
128 return res; 124 return res;