Add IORESOUCE_BUSY flag for System RAM
authorYasunori Goto <y-goto@jp.fujitsu.com>
Thu, 15 Nov 2007 00:59:20 +0000 (16:59 -0800)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Thu, 15 Nov 2007 02:45:39 +0000 (18:45 -0800)
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>
arch/ia64/kernel/efi.c
kernel/resource.c
mm/memory_hotplug.c

index 5181bf551f3c30edbf45d27d6ea3353fb0b43298..8e8f8b6193eea5038fb9bff9a53baa03b7694f7b 100644 (file)
@@ -1113,7 +1113,7 @@ efi_initialize_iomem_resources(struct resource *code_resource,
                if (md->num_pages == 0) /* should not happen */
                        continue;
 
-               flags = IORESOURCE_MEM;
+               flags = IORESOURCE_MEM | IORESOURCE_BUSY;
                switch (md->type) {
 
                        case EFI_MEMORY_MAPPED_IO:
@@ -1135,12 +1135,11 @@ efi_initialize_iomem_resources(struct resource *code_resource,
 
                        case EFI_ACPI_MEMORY_NVS:
                                name = "ACPI Non-volatile Storage";
-                               flags |= IORESOURCE_BUSY;
                                break;
 
                        case EFI_UNUSABLE_MEMORY:
                                name = "reserved";
-                               flags |= IORESOURCE_BUSY | IORESOURCE_DISABLED;
+                               flags |= IORESOURCE_DISABLED;
                                break;
 
                        case EFI_RESERVED_TYPE:
@@ -1149,7 +1148,6 @@ efi_initialize_iomem_resources(struct resource *code_resource,
                        case EFI_ACPI_RECLAIM_MEMORY:
                        default:
                                name = "reserved";
-                               flags |= IORESOURCE_BUSY;
                                break;
                }
 
index a358142ff48f34ca2dd0653f8bb1fc7c6f2c3fe0..2eb553d9b517153d8d938b34d60718b948b6bac0 100644 (file)
@@ -277,7 +277,7 @@ walk_memory_resource(unsigned long start_pfn, unsigned long nr_pages, void *arg,
        int ret = -1;
        res.start = (u64) start_pfn << PAGE_SHIFT;
        res.end = ((u64)(start_pfn + nr_pages) << PAGE_SHIFT) - 1;
-       res.flags = IORESOURCE_MEM;
+       res.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
        orig_end = res.end;
        while ((res.start < res.end) && (find_next_system_ram(&res) >= 0)) {
                pfn = (unsigned long)(res.start >> PAGE_SHIFT);
index 987abe6375ed0ca65ee9b31b45433d583ce9db0b..9512a544d0449ebcb789de665d9e8fc8ee0fdc8b 100644 (file)
@@ -39,7 +39,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;
+       res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
        if (request_resource(&iomem_resource, res) < 0) {
                printk("System RAM resource %llx - %llx cannot be added\n",
                (unsigned long long)res->start, (unsigned long long)res->end);