aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYasunori Goto <y-goto@jp.fujitsu.com>2007-11-14 19:59:20 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-11-14 21:45:39 -0500
commit887c3cb18865a4f9e0786e5a5b3ef47ff469b956 (patch)
tree553024b7cfb9c06e71aafefc218165ecc015bd10
parent5fce25a9df4865bdd5e3dc4853b269dc1677a02a (diff)
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: Yasunori Goto <y-goto@jp.fujitsu.com> Signed-off-by: Badari 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: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--arch/ia64/kernel/efi.c6
-rw-r--r--kernel/resource.c2
-rw-r--r--mm/memory_hotplug.c2
3 files changed, 4 insertions, 6 deletions
diff --git a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
index 5181bf551f3c..8e8f8b6193ee 100644
--- a/arch/ia64/kernel/efi.c
+++ b/arch/ia64/kernel/efi.c
@@ -1113,7 +1113,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1113 if (md->num_pages == 0) /* should not happen */ 1113 if (md->num_pages == 0) /* should not happen */
1114 continue; 1114 continue;
1115 1115
1116 flags = IORESOURCE_MEM; 1116 flags = IORESOURCE_MEM | IORESOURCE_BUSY;
1117 switch (md->type) { 1117 switch (md->type) {
1118 1118
1119 case EFI_MEMORY_MAPPED_IO: 1119 case EFI_MEMORY_MAPPED_IO:
@@ -1135,12 +1135,11 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1135 1135
1136 case EFI_ACPI_MEMORY_NVS: 1136 case EFI_ACPI_MEMORY_NVS:
1137 name = "ACPI Non-volatile Storage"; 1137 name = "ACPI Non-volatile Storage";
1138 flags |= IORESOURCE_BUSY;
1139 break; 1138 break;
1140 1139
1141 case EFI_UNUSABLE_MEMORY: 1140 case EFI_UNUSABLE_MEMORY:
1142 name = "reserved"; 1141 name = "reserved";
1143 flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED; 1142 flags |= IORESOURCE_DISABLED;
1144 break; 1143 break;
1145 1144
1146 case EFI_RESERVED_TYPE: 1145 case EFI_RESERVED_TYPE:
@@ -1149,7 +1148,6 @@ efi_initialize_iomem_resources(struct resource *code_resource,
1149 case EFI_ACPI_RECLAIM_MEMORY: 1148 case EFI_ACPI_RECLAIM_MEMORY:
1150 default: 1149 default:
1151 name = "reserved"; 1150 name = "reserved";
1152 flags |= IORESOURCE_BUSY;
1153 break; 1151 break;
1154 } 1152 }
1155 1153
diff --git a/kernel/resource.c b/kernel/resource.c
index a358142ff48f..2eb553d9b517 100644
--- a/kernel/resource.c
+++ b/kernel/resource.c
@@ -277,7 +277,7 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg,
277 int ret = -1; 277 int ret = -1;
278 res.start = (u64) start_pfn << PAGE_SHIFT; 278 res.start = (u64) start_pfn << PAGE_SHIFT;
279 res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1; 279 res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1;
280 res.flags = IORESOURCE_MEM; 280 res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
281 orig_end = res.end; 281 orig_end = res.end;
282 while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) { 282 while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) {
283 pfn = (unsigned long)(res.start >> PAGE_SHIFT); 283 pfn = (unsigned long)(res.start >> PAGE_SHIFT);
diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 987abe6375ed..9512a544d044 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -39,7 +39,7 @@ static struct resource *register_memory_resource(u64 start, u64 size)
39 res->name = "System RAM"; 39 res->name = "System RAM";
40 res->start = start; 40 res->start = start;
41 res->end = start + size - 1; 41 res->end = start + size - 1;
42 res->flags = IORESOURCE_MEM; 42 res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
43 if (request_resource(&iomem_resource, res) < 0) { 43 if (request_resource(&iomem_resource, res) < 0) {
44 printk("System RAM resource %llx - %llx cannot be added\n", 44 printk("System RAM resource %llx - %llx cannot be added\n",
45 (unsigned long long)res->start, (unsigned long long)res->end); 45 (unsigned long long)res->start, (unsigned long long)res->end);