5/5 in support of hot-add memory x86_64 fix acpi motherboard.c
PATCH 1/1 5/5 in support of hot-add memory x86_64 fix acpi motherboard.c
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_deviceacpi_bus_addacpi_add_single_objectacpi_bus_find_driveracpi_bus_driver_initdriver->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.
drivers/acpi/motherboard.c +7 -1
@@ -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 ; }