Commit 27443370 authored by Zhang Zekun's avatar Zhang Zekun Committed by Zhong Jinghua
Browse files

ACPI: memhotplug: export the state of each hotplug device

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I67QNJ


CVE: NA

---------------------------------------------------------

Export the state of a hotplug memory device, and driviers
can use this information to manipulate the hotplug memory
device.

Signed-off-by: default avatarZhang Zekun <zhangzekun11@huawei.com>
Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
parent 039ec3f7
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -56,6 +56,9 @@ struct acpi_memory_device {
	struct list_head res_list;
};

struct acpi_device *hotplug_mdev[MAX_NUMNODES];
EXPORT_SYMBOL_GPL(hotplug_mdev);

static acpi_status
acpi_memory_get_resource(struct acpi_resource *resource, void *context)
{
@@ -217,6 +220,8 @@ static int acpi_memory_enable_device(struct acpi_memory_device *mem_device)
		 * Add num_enable even if add_memory() returns -EEXIST, so the
		 * device is bound to this driver.
		 */

		hotplug_mdev[node] = mem_device->device;
		num_enabled++;
	}
	if (!num_enabled) {
@@ -240,6 +245,7 @@ static void acpi_memory_remove_memory(struct acpi_memory_device *mem_device)
	struct acpi_memory_info *info, *n;
	int nid = acpi_get_node(handle);

	hotplug_mdev[nid] = NULL;
	list_for_each_entry_safe(info, n, &mem_device->res_list, list) {
		if (!info->enabled)
			continue;
+2 −0
Original line number Diff line number Diff line
@@ -316,6 +316,8 @@ extern void set_zone_contiguous(struct zone *zone);
extern void clear_zone_contiguous(struct zone *zone);

#ifdef CONFIG_MEMORY_HOTPLUG
extern struct acpi_device *hotplug_mdev[MAX_NUMNODES];

extern void __ref free_area_init_core_hotplug(int nid);
extern int __add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);
extern int add_memory(int nid, u64 start, u64 size, mhp_t mhp_flags);