Unverified Commit c3619cad authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!8908 Refactor hbmdev a bit

Merge Pull Request from: @ci-robot 
 
PR sync from: Zhang Zekun <zhangzekun11@huawei.com>
https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/L4NZXQHEJREMVR3CWXHFOHZKFUT4NAYL/ 
Refactoring some mechanism in hbmdev:
1. Memory node on the hbmdev need to be offlined before
poweroff the device.
2. Use AML code to trigger the hbmdev poweroff process

Zhang Zekun (3):
  soc: hisilicon: hisi_hbmdev: Notify the device in the ACPI
  soc: hisilicon: Don't poweroff if memblocks don't offlined
  arm64: config: Open the hbmdev related config


-- 
2.17.1
 
https://gitee.com/openeuler/kernel/issues/I9W022 
 
Link:https://gitee.com/openeuler/kernel/pulls/8908

 

Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarJialin Zhang <zhangjialin11@huawei.com>
parents c577a49c 2ae741c4
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -6110,8 +6110,9 @@ CONFIG_QCOM_KRYO_L2_ACCESSORS=y
# Hisilicon SoC drivers
#
CONFIG_KUNPENG_HCCS=m
# CONFIG_HISI_HBMDEV is not set
# CONFIG_HISI_HBMCACHE is not set
CONFIG_HISI_HBMDEV=m
CONFIG_HISI_HBMCACHE=m
CONFIG_HISI_HBMDEV_ACLS=y
CONFIG_HISI_L3T=m
CONFIG_HISI_L0=m
# end of Hisilicon SoC drivers
+0 −1
Original line number Diff line number Diff line
@@ -1188,7 +1188,6 @@ acpi_status acpi_hotplug_schedule(struct acpi_device *adev, u32 src)
	}
	return AE_OK;
}
EXPORT_SYMBOL_GPL(acpi_hotplug_schedule);

bool acpi_queue_hotplug_work(struct work_struct *work)
{
+11 −23
Original line number Diff line number Diff line
@@ -264,30 +264,16 @@ static int memdev_power_on(struct acpi_device *adev)
	return 0;
}

static int eject_device(struct acpi_device *acpi_device, void *not_used)
static int memdev_power_off(struct acpi_device *adev)
{
	acpi_object_type unused;
	acpi_handle handle = adev->handle;
	acpi_status status;

	status = acpi_get_type(acpi_device->handle, &unused);
	if (ACPI_FAILURE(status) || !acpi_device->flags.ejectable)
	status = acpi_evaluate_object(handle, "_OFF", NULL, NULL);
	if (ACPI_FAILURE(status)) {
		return -ENODEV;

	get_device(&acpi_device->dev);
	status = acpi_hotplug_schedule(acpi_device, ACPI_OST_EC_OSPM_EJECT);
	if (ACPI_SUCCESS(status))
		return 0;

	put_device(&acpi_device->dev);
	acpi_evaluate_ost(acpi_device->handle, ACPI_OST_EC_OSPM_EJECT,
			  ACPI_OST_SC_NON_SPECIFIC_FAILURE, NULL);

	return status == AE_NO_MEMORY ? -ENOMEM : -EAGAIN;
	}

static int memdev_power_off(struct acpi_device *adev)
{
	return acpi_dev_for_each_child(adev, eject_device, NULL);
	return 0;
}

static ssize_t state_store(struct device *dev, struct device_attribute *attr,
@@ -315,14 +301,16 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_WO(state);

static int hbmdev_find(struct acpi_device *adev, void *arg)
static int hbmdev_setup(struct acpi_device *adev, void *arg)
{
	const char *hid = acpi_device_hid(adev);
	bool *found = arg;

	if (!strcmp(hid, ACPI_MEMORY_DEVICE_HID)) {
		acpi_scan_lock_acquire();
		adev->handler->hotplug.demand_offline = true;
		acpi_scan_lock_release();
		*found = true;
		return -1;
	}

	return 0;
@@ -337,7 +325,7 @@ static bool has_hbmdev(struct device *dev)
	if (strcmp(hid, ACPI_GENERIC_CONTAINER_DEVICE_HID))
		return found;

	acpi_dev_for_each_child(adev, hbmdev_find, &found);
	acpi_dev_for_each_child(adev, hbmdev_setup, &found);

	return found;
}