From patchwork Tue Mar 26 22:39:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 161233 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp5766161jan; Tue, 26 Mar 2019 15:40:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgMBM7k0WLoJMFnrcbGOkuILVmX08WwmXOAqQtXTsxMk6yOq2TcBcpJowPSoGS5SEB+O5w X-Received: by 2002:a65:62d6:: with SMTP id m22mr31889770pgv.443.1553640007114; Tue, 26 Mar 2019 15:40:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553640007; cv=none; d=google.com; s=arc-20160816; b=GeA8d5Ml4cIqmd6LUiMwW8mZOspH3qAeH+9jLiKq2OkFS+L3G1xGPqfXLoPeR3iMea ZoR0biPdx0y4L+39zxF1ZJi/0U9cigHrtZfCLuQW5OvYoftlS/SZpkS7bEV045e2iKzC rSho/CDrIMskTxdpEKLfaYPCtMkixZXcbV1kforUEFsWhT/oK2oU13wi/NVwKF+z5dG2 agcXByQGGFAcXuxCIeZ9o1cM2mA8yJqJz+S6mjKz+1JXNxw6bpCfOvR3j25bP4mokTnV BHPXYdV5P4wCQpZmpxJegYFfrprQacV6fSLHXBcIYzmTeM1Jqpz/IBuaBFD4Lg7QC3wM L4Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=5bqBHOeQS0gDMFENg7zJG5tqRoVyjsr4QLO+wlepYV0=; b=MFLPMpEVYL8OPgVv18pDbUuJkUWCJYZozu5sd0iYL03/JcM33cprqEfgoEsPOo+Zwt eU+q0KzftRlqTVNkNN/VgIgCRZCcNNx+HoiyFDXtc5i4AZXZ3jv9DIsuWPjt0Kvi07IJ fVOLiO1yZGeFwea0hPbk8Xq0jUQuRS1Bw2qwsCSLi1VOEJo+pGkYZy3U3GQMp9Jz5ezY f0zBV8rz4NCe8mx4qb9/V2q/tUlI85kJSfPeKbmoFJp08MdeLDj5ooMgz9UIcuvC6uk9 KHJa1vBbKG55gbIeyvT0s0TXeeuzLuHbOFsmxixm7irewEo/E5/s18tcW7/UVKEzHETE 68fA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b9si16243084pfd.228.2019.03.26.15.40.06; Tue, 26 Mar 2019 15:40:07 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731868AbfCZWj4 (ORCPT + 31 others); Tue, 26 Mar 2019 18:39:56 -0400 Received: from foss.arm.com ([217.140.101.70]:44482 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726782AbfCZWjy (ORCPT ); Tue, 26 Mar 2019 18:39:54 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 852C71596; Tue, 26 Mar 2019 15:39:54 -0700 (PDT) Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.29.246]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id E6DC03F614; Tue, 26 Mar 2019 15:39:53 -0700 (PDT) From: Jeremy Linton To: linux-arm-kernel@lists.infradead.org Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, will.deacon@arm.com, rjw@rjwysocki.net, lenb@kernel.org, mark.rutland@arm.com, sudeep.holla@arm.com, james.morse@arm.com, lorenzo.pieralisi@arm.com, linuxarm@huawei.com, Jeremy Linton Subject: [PATCH 1/4] ACPI/PPTT: Add function to return ACPI 6.3 Identical tokens Date: Tue, 26 Mar 2019 17:39:35 -0500 Message-Id: <20190326223938.5365-2-jeremy.linton@arm.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190326223938.5365-1-jeremy.linton@arm.com> References: <20190326223938.5365-1-jeremy.linton@arm.com> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org ACPI 6.3 adds a flag to indicate that child nodes are all identical cores. This is useful to authoritatively determine if a set of (possibly offline) cores are identical or not. Since the flag doesn't give us a unique id we can generate one and use it to create bitmaps of sibling nodes, or simply in a loop to determine if a subset of cores are identical. Signed-off-by: Jeremy Linton --- drivers/acpi/pptt.c | 26 ++++++++++++++++++++++++++ include/linux/acpi.h | 5 +++++ 2 files changed, 31 insertions(+) -- 2.20.1 diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index 065c4fc245d1..472c95ec816b 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -660,3 +660,29 @@ int find_acpi_cpu_topology_package(unsigned int cpu) return find_acpi_cpu_topology_tag(cpu, PPTT_ABORT_PACKAGE, ACPI_PPTT_PHYSICAL_PACKAGE); } + +/** + * find_acpi_cpu_topology_hetero_id() - Determine a unique implementation + * @cpu: Kernel logical cpu number + * + * Determine a unique heterogeneous ID for the given CPU. CPUs with the same + * implementation should have matching IDs. Since this is a tree we can only + * detect implementations where the heterogeneous flag is the parent to all + * matching cores. AKA if a two socket machine has two different core types + * in each socket this will end up being represented as four unique core types + * rather than two. + * + * The returned ID can be used to group peers with identical implementation. + * + * The search terminates when a level is found with the identical implementation + * flag set or we reach a root node. + * + * Return: -ENOENT if the PPTT doesn't exist, or the cpu cannot be found. + * Otherwise returns a value which represents a group of identical cores + * similar to this cpu. + */ +int find_acpi_cpu_topology_hetero_id(unsigned int cpu) +{ + return find_acpi_cpu_topology_tag(cpu, PPTT_ABORT_PACKAGE, + ACPI_PPTT_ACPI_IDENTICAL); +} diff --git a/include/linux/acpi.h b/include/linux/acpi.h index d5dcebd7aad3..1444fb042898 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -1309,6 +1309,7 @@ static inline int lpit_read_residency_count_address(u64 *address) #ifdef CONFIG_ACPI_PPTT int find_acpi_cpu_topology(unsigned int cpu, int level); int find_acpi_cpu_topology_package(unsigned int cpu); +int find_acpi_cpu_topology_hetero_id(unsigned int cpu); int find_acpi_cpu_cache_topology(unsigned int cpu, int level); #else static inline int find_acpi_cpu_topology(unsigned int cpu, int level) @@ -1319,6 +1320,10 @@ static inline int find_acpi_cpu_topology_package(unsigned int cpu) { return -EINVAL; } +static int find_acpi_cpu_topology_hetero_id(unsigned int cpu) +{ + return -EINVAL; +} static inline int find_acpi_cpu_cache_topology(unsigned int cpu, int level) { return -EINVAL;