Commit 887c3cb1 authored by Yasunori Goto's avatar Yasunori Goto Committed by Linus Torvalds

Add IORESOUCE_BUSY flag for System RAM

i386 and x86-64 registers System RAM as IORESOURCE_MEM | IORESOURCE_BUSY.

But ia64 registers it as IORESOURCE_MEM only.
In addition, memory hotplug code registers new memory as IORESOURCE_MEM too.

This difference causes a failure of memory unplug of x86-64.  This patch
fixes it.

This patch adds IORESOURCE_BUSY to avoid potential overlap mapping by PCI
device.
Signed-off-by: default avatarYasunori Goto <y-goto@jp.fujitsu.com>
Signed-off-by: default avatarBadari Pulavarty <pbadari@us.ibm.com>
Cc: Luck, Tony" <tony.luck@intel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@elte.hu>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5fce25a9
...@@ -1113,7 +1113,7 @@ efi_initialize_iomem_resources(struct resource *code_resource, ...@@ -1113,7 +1113,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
if (md->num_pages == 0) /* should not happen */ if (md->num_pages == 0) /* should not happen */
continue; continue;
flags = IORESOURCE_MEM; flags = IORESOURCE_MEM | IORESOURCE_BUSY;
switch (md->type) { switch (md->type) {
case EFI_MEMORY_MAPPED_IO: case EFI_MEMORY_MAPPED_IO:
...@@ -1135,12 +1135,11 @@ efi_initialize_iomem_resources(struct resource *code_resource, ...@@ -1135,12 +1135,11 @@ efi_initialize_iomem_resources(struct resource *code_resource,
case EFI_ACPI_MEMORY_NVS: case EFI_ACPI_MEMORY_NVS:
name = "ACPI Non-volatile Storage"; name = "ACPI Non-volatile Storage";
flags |= IORESOURCE_BUSY;
break; break;
case EFI_UNUSABLE_MEMORY: case EFI_UNUSABLE_MEMORY:
name = "reserved"; name = "reserved";
flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED; flags |= IORESOURCE_DISABLED;
break; break;
case EFI_RESERVED_TYPE: case EFI_RESERVED_TYPE:
...@@ -1149,7 +1148,6 @@ efi_initialize_iomem_resources(struct resource *code_resource, ...@@ -1149,7 +1148,6 @@ efi_initialize_iomem_resources(struct resource *code_resource,
case EFI_ACPI_RECLAIM_MEMORY: case EFI_ACPI_RECLAIM_MEMORY:
default: default:
name = "reserved"; name = "reserved";
flags |= IORESOURCE_BUSY;
break; break;
} }
......
...@@ -277,7 +277,7 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg, ...@@ -277,7 +277,7 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg,
int ret = -1; int ret = -1;
res.start = (u64) start_pfn << PAGE_SHIFT; res.start = (u64) start_pfn << PAGE_SHIFT;
res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1; res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1;
res.flags = IORESOURCE_MEM; res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
orig_end = res.end; orig_end = res.end;
while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) { while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) {
pfn = (unsigned long)(res.start >> PAGE_SHIFT); pfn = (unsigned long)(res.start >> PAGE_SHIFT);
......
...@@ -39,7 +39,7 @@ static struct resource *register_memory_resource(u64 start, u64 size) ...@@ -39,7 +39,7 @@ static struct resource *register_memory_resource(u64 start, u64 size)
res->name = "System RAM"; res->name = "System RAM";
res->start = start; res->start = start;
res->end = start + size - 1; res->end = start + size - 1;
res->flags = IORESOURCE_MEM; res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
if (request_resource(&iomem_resource, res) < 0) { if (request_resource(&iomem_resource, res) < 0) {
printk("System RAM resource %llx - %llx cannot be added\n", printk("System RAM resource %llx - %llx cannot be added\n",
(unsigned long long)res->start, (unsigned long long)res->end); (unsigned long long)res->start, (unsigned long long)res->end);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment