Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1591743

[PATCH v3 4/5] acpi/processor: Implement DEVICE operator for processor enumeration

From Dou Liyang <douly.fnst@cn.fujitsu.com>
Newsgroups linux.kernel
Subject [PATCH v3 4/5] acpi/processor: Implement DEVICE operator for processor enumeration
Date 2017-03-03 09:30 +0100
Message-ID <tgQL8-6TG-9@gated-at.bofh.it> (permalink)
References <tgQBr-6J0-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


ACPI allows to declare processors either with the PROCESSOR or with the
DEVICE operator. The current implementation handles only the PROCESSOR
operator.

On a system which uses the DEVICE operator for processor enumeration the
evaluation fails.

Check for the ACPI type of the ACPI handle and evaluate PROCESSOR and
DEVICE types separately.

Signed-off-by: Dou Liyang <douly.fnst@cn.fujitsu.com>
Tested-by: Xiaolong Ye <xiaolong.ye@intel.com>
---
 drivers/acpi/acpi_processor.c | 39 ++++++++++++++++++++++++++++++++-------
 1 file changed, 32 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/acpi_processor.c b/drivers/acpi/acpi_processor.c
index 5d208a9..9a98d7e 100644
--- a/drivers/acpi/acpi_processor.c
+++ b/drivers/acpi/acpi_processor.c
@@ -633,25 +633,50 @@ static acpi_status __init acpi_processor_ids_walk(acpi_handle handle,
 						  void **rv)
 {
 	acpi_status status;
+	acpi_object_type acpi_type;
+	unsigned long long uid;
 	union acpi_object object = { 0 };
 	struct acpi_buffer buffer = { sizeof(union acpi_object), &object };
 
-	status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
+	status = acpi_get_type(handle, &acpi_type);
 	if (ACPI_FAILURE(status))
-		acpi_handle_info(handle, "Not get the processor object\n");
-	else
-		processor_validated_ids_update(object.processor.proc_id);
+		return false;
+
+	switch (acpi_type) {
+	case ACPI_TYPE_PROCESSOR:
+		status = acpi_evaluate_object(handle, NULL, NULL, &buffer);
+		if (ACPI_FAILURE(status))
+			goto err;
+		uid = object.processor.proc_id;
+		break;
+
+	case ACPI_TYPE_DEVICE:
+		status = acpi_evaluate_integer(handle, "_UID", NULL, &uid);
+		if (ACPI_FAILURE(status))
+			goto err;
+		break;
+	default:
+		goto err;
+	}
+
+	processor_validated_ids_update(uid);
+	return true;
+
+err:
+	acpi_handle_info(handle, "Invalid processor object\n");
+	return false;
 
-	return AE_OK;
 }
 
-static void __init acpi_processor_check_duplicates(void)
+void __init acpi_processor_check_duplicates(void)
 {
-	/* Search all processor nodes in ACPI namespace */
+	/* check the correctness for all processors in ACPI namespace */
 	acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT,
 						ACPI_UINT32_MAX,
 						acpi_processor_ids_walk,
 						NULL, NULL, NULL);
+	acpi_get_devices(ACPI_PROCESSOR_DEVICE_HID, acpi_processor_ids_walk,
+						NULL, NULL);
 }
 
 bool __init acpi_processor_validate_proc_id(int proc_id)
-- 
2.5.5

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v3 0/5] Do repair works for the mapping of cpuid <-> nodeid Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-03-03 09:20 +0100
  [PATCH v3 4/5] acpi/processor: Implement DEVICE operator for processor enumeration Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-03-03 09:30 +0100
    [tip:x86/acpi] acpi/processor: Implement DEVICE operator for  processor enumeration tip-bot for Dou Liyang <tipbot@zytor.com> - 2017-03-11 14:50 +0100
  Re: [PATCH v3 0/5] Do repair works for the mapping of cpuid <->  nodeid Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-03-03 09:40 +0100
    Re: [PATCH v3 0/5] Do repair works for the mapping of cpuid <->  nodeid Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-03-06 03:20 +0100
  [PATCH v3 1/5] Revert"x86/acpi: Set persistent cpuid <-> nodeid mapping when booting" Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-03-03 10:20 +0100
    [tip:x86/acpi] Revert "x86/acpi: Set persistent cpuid <-> nodeid  mapping when booting" tip-bot for Dou Liyang <tipbot@zytor.com> - 2017-03-11 14:50 +0100
  [PATCH v3 5/5] acpi/processor: Check for duplicate processor ids at hotplug time Dou Liyang <douly.fnst@cn.fujitsu.com> - 2017-03-03 12:50 +0100
    [tip:x86/acpi] acpi/processor: Check for duplicate processor ids at  hotplug time tip-bot for Dou Liyang <tipbot@zytor.com> - 2017-03-11 14:50 +0100

csiph-web