From patchwork Thu Aug 8 20:40:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 170841 Delivered-To: patch@linaro.org Received: by 2002:a92:512:0:0:0:0:0 with SMTP id q18csp9073330ile; Thu, 8 Aug 2019 13:41:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyoFQXPului8FpGICvmmIcDVdBep76TVUkHB9vL1aBB4cUj5PogQyvUnuWTR7vRdAm1H/z+ X-Received: by 2002:a65:4507:: with SMTP id n7mr13811284pgq.86.1565296907490; Thu, 08 Aug 2019 13:41:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565296907; cv=none; d=google.com; s=arc-20160816; b=srVjyKSuiF7VCr3ONW5AFgu9O0iUqAY+pU9HL4kZF4SE9hHDL5WCjhzGlpHnLfIN1j NEcpvZKj7oVDypOEtHLn0TMxPEAFSzjkJI/yuhHhMaxUMMiYC72tyKstjuTK6D95h+xm XWpQ9fg34AfjmyJzXaIdUZq/rxlYbR1J4yD7Qtl53mLHMicvQ8vKdQEWJqkXJT8SLqwF xLSqs/BsGqMLaPqjfOq2Z0pst59e/gicE8q0m85KWBxYu+Yb7sCdkCM9eUi/bGSrOVxc NE0Z0ABHpgXoFkvWP6o6/9ypfejIzyLco4/QrYOTEeRQM3acUd0DVINOHo5VWLgJja5t 54vg== 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=ETU28lWYG+B+d7IDdeuXq8Y6Typt9VFEx8iAJ52eCHs=; b=cEoaPSylgF5Zi4hsxBx9NFDBQjprWJi2ee67yDoQvvtjE0+u7N5ELAoxnSPPHGvvkQ ZjsxyWJUz9VztBz4qyddy9wy4u/G8wSsOcPECKh6Qnx0/dgtQQyhWpBqXMVPdtbinjVQ V0UMgZDoyF8vulSQTubLxH1EsGXo1FC+Hiecdk1HT9K1SMapL4IclWde5kEMWLFqoMpm GX5bPhFKI+Re/qJmi415LPCypKMlz1by2X1gMcAPueeOXoB+NVlnpF8CADGSFPturoHI PucDjdALcxHZHLgKD1zK2pqOn5IltUXipxKNW6+WjH9IC9/Fbu4+F2btr5RL/jZDEkPX je5w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-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 y16si55793905pgj.169.2019.08.08.13.41.47; Thu, 08 Aug 2019 13:41:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-acpi-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-acpi-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-acpi-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390328AbfHHUlq (ORCPT + 7 others); Thu, 8 Aug 2019 16:41:46 -0400 Received: from foss.arm.com ([217.140.110.172]:38438 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390148AbfHHUlq (ORCPT ); Thu, 8 Aug 2019 16:41:46 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 04C6F1688; Thu, 8 Aug 2019 13:41:46 -0700 (PDT) Received: from mammon-tx2.austin.arm.com (mammon-tx2.austin.arm.com [10.118.30.64]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id F1CF03F694; Thu, 8 Aug 2019 13:41:45 -0700 (PDT) From: Jeremy Linton To: linux-arm-kernel@lists.infradead.org Cc: linux-acpi@vger.kernel.org, catalin.marinas@arm.com, will@kernel.org, rjw@rjwysocki.net, lenb@kernel.org, lorenzo.pieralisi@arm.com, sudeep.holla@arm.com, rric@kernel.org, Jeremy Linton Subject: [PATCH v4 2/2] arm64: topology: Use PPTT to determine if PE is a thread Date: Thu, 8 Aug 2019 15:40:07 -0500 Message-Id: <20190808204007.30110-3-jeremy.linton@arm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190808204007.30110-1-jeremy.linton@arm.com> References: <20190808204007.30110-1-jeremy.linton@arm.com> MIME-Version: 1.0 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org 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 --- arch/arm64/kernel/topology.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) -- 2.21.0 Reviewed-by: Robert Richter diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 0825c4a856e3..bad9c42ea825 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 int __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;