提交 27443370 编写于 作者: Z Zhang Zekun 提交者: Zhong Jinghua

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: NZhang Zekun <zhangzekun11@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
上级 039ec3f7
......@@ -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;
......
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册