All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Dou Liyang <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, mingo@kernel.org,
	xiaolong.ye@intel.com, douly.fnst@cn.fujitsu.com,
	tglx@linutronix.de, hpa@zytor.com
Subject: [tip:x86/acpi] acpi/processor: Implement DEVICE operator for processor enumeration
Date: Sat, 11 Mar 2017 05:47:38 -0800	[thread overview]
Message-ID: <tip-8c8cb30f49b86333d8e036e1945cf1a78c03577e@git.kernel.org> (raw)
In-Reply-To: <1488528147-2279-5-git-send-email-douly.fnst@cn.fujitsu.com>

Commit-ID:  8c8cb30f49b86333d8e036e1945cf1a78c03577e
Gitweb:     http://git.kernel.org/tip/8c8cb30f49b86333d8e036e1945cf1a78c03577e
Author:     Dou Liyang <douly.fnst@cn.fujitsu.com>
AuthorDate: Fri, 3 Mar 2017 16:02:26 +0800
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Sat, 11 Mar 2017 14:41:20 +0100

acpi/processor: Implement DEVICE operator for processor enumeration

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>
Cc: rjw@rjwysocki.net
Cc: linux-acpi@vger.kernel.org
Cc: guzheng1@huawei.com
Cc: izumi.taku@jp.fujitsu.com
Cc: lenb@kernel.org
Link: http://lkml.kernel.org/r/1488528147-2279-5-git-send-email-douly.fnst@cn.fujitsu.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 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)

  reply	other threads:[~2017-03-11 13:47 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-03  8:02 [PATCH v3 0/5] Do repair works for the mapping of cpuid <-> nodeid Dou Liyang
2017-03-03  8:02 ` Dou Liyang
2017-03-03  8:02 ` [PATCH v3 1/5] Revert"x86/acpi: Set persistent cpuid <-> nodeid mapping when booting" Dou Liyang
2017-03-03  8:02   ` Dou Liyang
2017-03-11 13:45   ` [tip:x86/acpi] Revert "x86/acpi: " tip-bot for Dou Liyang
2017-03-03  8:02 ` [PATCH v3 2/5] Revert"x86/acpi: Enable MADT APIs to return disabled apicids" Dou Liyang
2017-03-03  8:02   ` Dou Liyang
2017-03-11 13:46   ` [tip:x86/acpi] " tip-bot for Dou Liyang
2017-03-03  8:02 ` [PATCH v3 3/5] x86/acpi: Restore the order of CPU IDs Dou Liyang
2017-03-03  8:02   ` Dou Liyang
2017-03-11 13:47   ` [tip:x86/acpi] " tip-bot for Dou Liyang
2017-03-03  8:02 ` [PATCH v3 4/5] acpi/processor: Implement DEVICE operator for processor enumeration Dou Liyang
2017-03-03  8:02   ` Dou Liyang
2017-03-11 13:47   ` tip-bot for Dou Liyang [this message]
2017-03-03  8:02 ` [PATCH v3 5/5] acpi/processor: Check for duplicate processor ids at hotplug time Dou Liyang
2017-03-03  8:02   ` Dou Liyang
2017-03-11 13:48   ` [tip:x86/acpi] " tip-bot for Dou Liyang
2017-03-03  8:32 ` [PATCH v3 0/5] Do repair works for the mapping of cpuid <-> nodeid Dou Liyang
2017-03-03  8:32   ` Dou Liyang
2017-03-06  2:11   ` Dou Liyang
2017-03-06  2:11     ` Dou Liyang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=tip-8c8cb30f49b86333d8e036e1945cf1a78c03577e@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=douly.fnst@cn.fujitsu.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=xiaolong.ye@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.