From patchwork Thu Oct 10 13:29:50 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 175787 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2298807ill; Thu, 10 Oct 2019 06:33:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxO3pKgSP2lP8hPGl/eJaSxbL1WhCh8nUXhTncC22LZNzYv8jG2U7vWDAFyczk9s3GsvWNa X-Received: by 2002:a17:906:6a43:: with SMTP id n3mr8017923ejs.292.1570714424555; Thu, 10 Oct 2019 06:33:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570714424; cv=none; d=google.com; s=arc-20160816; b=pSzC0+aS2OjBFYm4MKPUUwgp/E7HLYUepGe+HR5VB9xSJqR97rxuN1TNvgpevrqy4m wtdm1I75TnliUsPysgI/POf4UW18GCgn0CASQbDx5eXgD+VerB6iVKa7pQjRBNtLLiLe eV+Wui4n0uYDP2ib/V1p85A1Ou1+WK7MSRCk4ybCabhUeCE1Mv+PfvbeAkDF3hHiAaq8 G+b+zh3j++Gj4YszRgljYYbgc0Wyvd4XCjx1qlN/v0IzbWedbaS7jiXxg5yDiICFqM/C t9EAMyFE3tRza8b8vqfNUmrM6E7Ru/+VOqrZdzpgXbgmG1MKa4fThzxvjeX/DYEDGJel 40/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=5G2uHoXK8fTfDOJekMA+CayciwuP9AAbrkqxDi0vXaM=; b=HR3xOcrQP+F4eJBy7efSnvgBrOUf+vUK7kpHugKqeBHasiq8hdZNYJTHxnY027ll71 56E0195MqkLfjQt+MAYmNM+vQe7y6HoMHS08USAkfS0ogNyQ1argbZlbOnQ7meQWbUYE 76ycJlLgANzkivW7w4IlpjhXSO0WlmoCAz1W795oZKVc8qN9LaoU64inig/pS5P0n0MO GUA2Rj+T1051G1HVp8fMqZPExzerKn5hrvZxu+mb8CUwC4tuTCb87d3JSvqhjO++jPUJ MtrrTkyMoT96mY6EmnK7XULGjr/eAiuxRt/C6Wxg+2Pbj8gAy6GsOBa9gfqDRyk3TfdD tgmA== 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 n9si3015682ejk.158.2019.10.10.06.33.44; Thu, 10 Oct 2019 06:33:44 -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 S2388267AbfJJNdk (ORCPT + 26 others); Thu, 10 Oct 2019 09:33:40 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3686 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2387992AbfJJNdj (ORCPT ); Thu, 10 Oct 2019 09:33:39 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 2EE84B697AC0BF877381; Thu, 10 Oct 2019 21:33:26 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Thu, 10 Oct 2019 21:33:18 +0800 From: John Garry To: , , , , , , , , CC: , , , , , , , "Rafael J . Wysocki" , John Garry Subject: [RFC PATCH 1/3] ACPICA: ACPI 6.3: PPTT add additional fields in Processor Structure Flags Date: Thu, 10 Oct 2019 21:29:50 +0800 Message-ID: <1570714192-236724-2-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1570714192-236724-1-git-send-email-john.garry@huawei.com> References: <1570714192-236724-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Erik Schmauss Commit b5eab512e7cffb2bb37c4b342b5594e9e75fd486 upstream. ACPICA commit c736ea34add19a3a07e0e398711847cd6b95affd Link: https://github.com/acpica/acpica/commit/c736ea34 Signed-off-by: Erik Schmauss Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki Signed-off-by: John Garry --- include/acpi/actbl2.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) -- 2.17.1 diff --git a/include/acpi/actbl2.h b/include/acpi/actbl2.h index c50ef7e6b942..1d4ef0621174 100644 --- a/include/acpi/actbl2.h +++ b/include/acpi/actbl2.h @@ -1472,8 +1472,11 @@ struct acpi_pptt_processor { /* Flags */ -#define ACPI_PPTT_PHYSICAL_PACKAGE (1) /* Physical package */ -#define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID (2) /* ACPI Processor ID valid */ +#define ACPI_PPTT_PHYSICAL_PACKAGE (1) +#define ACPI_PPTT_ACPI_PROCESSOR_ID_VALID (1<<1) +#define ACPI_PPTT_ACPI_PROCESSOR_IS_THREAD (1<<2) /* ACPI 6.3 */ +#define ACPI_PPTT_ACPI_LEAF_NODE (1<<3) /* ACPI 6.3 */ +#define ACPI_PPTT_ACPI_IDENTICAL (1<<4) /* ACPI 6.3 */ /* 1: Cache Type Structure */ From patchwork Thu Oct 10 13:29:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 175786 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp2298673ill; Thu, 10 Oct 2019 06:33:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9/ydKOOkxeBQ23GKSNi6HdgFt3gMQNlMwUVJHkmSQTwoc+C6oPEQpQzGkFYeTP69JayVr X-Received: by 2002:a17:906:184e:: with SMTP id w14mr8083688eje.10.1570714418685; Thu, 10 Oct 2019 06:33:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570714418; cv=none; d=google.com; s=arc-20160816; b=bc4fjfddUVBjzT/njhh8BGoEgBgz61buTZJj7HHABzjTreJ8qVWQSPMYqvb+CqdUV4 3xCUQOeSHEb1Fs40LN+cVUE8m2gsOF2hBA0BOSxAM4UQtZE6SzvCPxRHgX8MgYy47Fwr sOiaPyiX+cBfSHDmuiKJBmDinillte6Odx0ZyaEBSTb2dNJS0z/k4KrmX0HB7xZmhw3r tEcUONdk7ijMo2XRdFbE3EFbBYL6f1o5JiOPiUio1MpreiQk1FYynxjuHqiP8Ro/YP3q COCxGECfRN0iEZq39mZWwGYfrlC8mSXx+Pdx4i+k+gll7t0uKRDzNGmqqHqapraapuDl 8Q/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=1GJBlp9fqeZWMKei/o66iYBjYeBBD7mCnVqfrtASJ5U=; b=fvSb71c7HTglTo2rN8b9Wpip1xdcNcxcQ6TZLyRySSuD/tT3KonIuiq7ZL4afAw0kZ SslqVER/af5cxotDFH73DjD9TmAjaTx5d8BIAarbmGJ99BwT5i/vbUg/+rnA7f4kP7tP Lg3ATuo4Bw8oMCq8WAHyaB8dj2/qEE6m+73rVRV+UmF8vd/anJTGEhcJ+/nm6/4bRnHn YafK43b/qMSetUYdD6v/ShOqTfltyyUKgI8F+a/i/3yoh+9BoitGDGMvCu0J2E2QMweS CBjPOcVXt4ZyGpXM9mHfSW94AxB/WDFTxSOAomG0NxqVUq9sZrazQQkzzL/9Y9lEjyGt TOfw== 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 gh16si3075237ejb.150.2019.10.10.06.33.38; Thu, 10 Oct 2019 06:33:38 -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 S2388239AbfJJNdg (ORCPT + 26 others); Thu, 10 Oct 2019 09:33:36 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:3687 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727797AbfJJNdd (ORCPT ); Thu, 10 Oct 2019 09:33:33 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 35BE18FFC8C8BBB8F560; Thu, 10 Oct 2019 21:33:26 +0800 (CST) Received: from localhost.localdomain (10.67.212.75) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.439.0; Thu, 10 Oct 2019 21:33:19 +0800 From: John Garry To: , , , , , , , , CC: , , , , , , , John Garry Subject: [RFC PATCH 3/3] arm64: topology: Use PPTT to determine if PE is a thread Date: Thu, 10 Oct 2019 21:29:52 +0800 Message-ID: <1570714192-236724-4-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1570714192-236724-1-git-send-email-john.garry@huawei.com> References: <1570714192-236724-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.67.212.75] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Jeremy Linton Commit 98dc19902a0b2e5348e43d6a2c39a0a7d0fc639e upstream. ACPI 6.3 adds a thread flag to represent if a CPU/PE is actually a thread. Given that the MPIDR_MT bit may not represent this information consistently on homogeneous machines we should prefer the PPTT flag if its available. Signed-off-by: Jeremy Linton Reviewed-by: Sudeep Holla Reviewed-by: Robert Richter [will: made acpi_cpu_is_threaded() return 'bool'] Signed-off-by: Will Deacon Signed-off-by: John Garry --- arch/arm64/kernel/topology.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) -- 2.17.1 diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 0825c4a856e3..6106c49f84bc 100644 --- a/arch/arm64/kernel/topology.c +++ b/arch/arm64/kernel/topology.c @@ -340,17 +340,28 @@ void remove_cpu_topology(unsigned int cpu) } #ifdef CONFIG_ACPI +static bool __init acpi_cpu_is_threaded(int cpu) +{ + int is_threaded = acpi_pptt_cpu_is_thread(cpu); + + /* + * if the PPTT doesn't have thread information, assume a homogeneous + * machine and return the current CPU's thread state. + */ + if (is_threaded < 0) + is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK; + + return !!is_threaded; +} + /* * Propagate the topology information of the processor_topology_node tree to the * cpu_topology array. */ static int __init parse_acpi_topology(void) { - bool is_threaded; int cpu, topology_id; - is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK; - for_each_possible_cpu(cpu) { int i, cache_id; @@ -358,7 +369,7 @@ static int __init parse_acpi_topology(void) if (topology_id < 0) return topology_id; - if (is_threaded) { + if (acpi_cpu_is_threaded(cpu)) { cpu_topology[cpu].thread_id = topology_id; topology_id = find_acpi_cpu_topology(cpu, 1); cpu_topology[cpu].core_id = topology_id;