[Patch] 5/5 in support of hot-add memory x86_64 fix acpi motherboard.c

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello All,
  This patch fixes an issue I encountered while doing hot-add memroy on
my platform (IBM Summit).     

  My system loads to acpi memory hot plug driver just fine during boot.
It installs and registers acpi_memory_device_driver and it's handler.
When the hot add memory event occurs the handler is called. this is the
relevant call path

acpi_memory_get_device
acpi_bus_add
acpi_add_single_object
acpi_bus_find_driver
acpi_bus_driver_init
driver->ops.add

  The algorithm it try to match devices from acpi_bus_drivers.  It looks
for drivers that are on the right bus and calls acpi_bus_driver_init.
If it gets a good return value for acpi_bus_driver_init it thinks it
found the device and returns.  The problem is the motherboard driver
driver->ops.add is getting called and it ALWAYS returns AE_OK. 

  The device that is passed back up the call chain is the wrong one (the
motherboard device) and whole things break down. 

  My solution is the make the motherboard value fail to return a AE_OK
for devices it does not expect (like my hot-add memory event).  

Without this patch I cannot do real hot-add memory with my hardware.  

Thanks to KAMEZAWA Hiroyuki for helping to debug the issue and Patrick
Mochel for providing input.   

This was built against 2.6.18-rc2.

Signed-off-by:  Keith Mannthey <[email protected]>
diff -urN orig/drivers/acpi/motherboard.c work/drivers/acpi/motherboard.c
--- orig/drivers/acpi/motherboard.c	2006-07-28 13:57:35.000000000 -0400
+++ work/drivers/acpi/motherboard.c	2006-07-28 16:39:22.000000000 -0400
@@ -87,6 +87,7 @@
 		}
 	} else {
 		/* Memory mapped IO? */
+		 return -EINVAL;
 	}
 
 	if (requested_res)
@@ -96,11 +97,16 @@
 
 static int acpi_motherboard_add(struct acpi_device *device)
 {
+	acpi_status status;
 	if (!device)
 		return -EINVAL;
-	acpi_walk_resources(device->handle, METHOD_NAME__CRS,
+
+	status = acpi_walk_resources(device->handle, METHOD_NAME__CRS,
 			    acpi_reserve_io_ranges, NULL);
 
+	if (ACPI_FAILURE(status)) 
+		return -ENODEV;
+	
 	return 0;
 }
 

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux