From patchwork Wed Oct 16 21:51:21 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 176526 Delivered-To: patch@linaro.org Received: by 2002:a92:7e96:0:0:0:0:0 with SMTP id q22csp38489ill; Wed, 16 Oct 2019 14:57:52 -0700 (PDT) X-Google-Smtp-Source: APXvYqzZ9IxZ4ypRwvGU23Ku7pSjJpjE/l8gqElbl9kId+47XTMhMV2g3om5kdKkceeuav+pxjM+ X-Received: by 2002:a17:906:11d8:: with SMTP id o24mr524477eja.224.1571263072377; Wed, 16 Oct 2019 14:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571263072; cv=none; d=google.com; s=arc-20160816; b=i+x+clsAlOAUJTkD/ZZyCDY3mUDHo66qzUuAqxCwbBzyAvyOZXlaNDgFD5Wv7C4EiL j2SiFc4+tdLeKQo8bHlMGMzJQkuhiJuN5vF3BcrbKVK1+a8a5SY7MsXrQ8WDMHnezMWB 3422VVTg60JohJusvSVZK5c8H2cn139dcHIv1034VQfsd8IqnYQBt1XYgMJaCOWXhTmj tPGBNfTb9WwIgaxXkP1e8j+YpoXpt8hFZAi3tDNT5lMx/iZIpHrEr5yVvjTlkb1AaxWR YYJ4r4tBr6uj5y1J3w0Jv+4oLdnDeYjogJpZYsd2edoCMFwD7h2uVRPK+b/u5Ju/f7xX FCLA== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=v7SvRnaYBF1zqdCdCxNau9gUx/Hd17Zolw8epLLo0mA=; b=yTifVaoJjCq6AXpolHQ8culC+TYujm40z4yjpoR07CwUuZXCoSGfELBjofWHDBn4Yg DRNqr6oQ3rBcrKoOGJ7BmDSed869ZZqPTs665XMNrwqvDHZ9y2slmfBtUXTR8ng9g5BO tG/wjtFuo0ZajyZNTdZBHn1eB/o34kWO61vIuxVKxWu8z38LhVy25qp3RZIEy3ZbgwIK g5JkpNbqgnBXGZ6NqubYYoSQJMKTreEJH/XrxO8E5blEbcqznJZ94IFidxsLmaNK9xxZ c01AIS04J0xIOIDEvtgGbITzq1xjk+qC7rAa3KjcNvrbe5A5NL9DCFmkkY2ZpIVu2QGm lMmw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X3sqMyLX; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 b34si203449edb.439.2019.10.16.14.57.52; Wed, 16 Oct 2019 14:57:52 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=X3sqMyLX; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2395542AbfJPV5v (ORCPT + 13 others); Wed, 16 Oct 2019 17:57:51 -0400 Received: from mail.kernel.org ([198.145.29.99]:50816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2395540AbfJPV5u (ORCPT ); Wed, 16 Oct 2019 17:57:50 -0400 Received: from localhost (unknown [192.55.54.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 24C7821928; Wed, 16 Oct 2019 21:57:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263070; bh=jphSXo0H1nebo1iEBpk4uSYr10SEphXsBJeMQa/Sj7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X3sqMyLXMEsxH0/HYrJODRXuU0tTuQn6e2DTcH62XUmKGlV1oCBJynFkG98W5zwuj NsbiIaC62ArILMWeAeNN/u6yMbtn8ADE3rQoCqtoEhQChDW2ryVjZoAEEzfIGg6JHK ZZ3VC1iqOjNU8p46r9H5yEcncj8p/mMxD42FAFTY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jeremy Linton , Sudeep Holla , Robert Richter , Will Deacon , John Garry , Sasha Levin Subject: [PATCH 4.19 70/81] arm64: topology: Use PPTT to determine if PE is a thread Date: Wed, 16 Oct 2019 14:51:21 -0700 Message-Id: <20191016214846.320148933@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214805.727399379@linuxfoundation.org> References: <20191016214805.727399379@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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 Signed-off-by: Sasha Levin --- arch/arm64/kernel/topology.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) -- 2.20.1 diff --git a/arch/arm64/kernel/topology.c b/arch/arm64/kernel/topology.c index 0825c4a856e33..6106c49f84bc8 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;