Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp1348120ybp; Thu, 17 Oct 2019 11:24:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqymR8soQezeA930obkK1tGVS1cszyWAJGSjKOaEiQGm6wi2y99tPe9VPcmAKRPHpCWJTVxk X-Received: by 2002:a17:906:5381:: with SMTP id g1mr4827529ejo.159.1571336691235; Thu, 17 Oct 2019 11:24:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571336691; cv=none; d=google.com; s=arc-20160816; b=fG1/MsQQP+Hj5BGwue0C70rMydXU/DVTtvlMwlR+3X6h5R74gQse0kh0t0tMpkxwIH GZMa9kBeZuy9Ru3g329K5/5FU+g5gUopajKzClmjdG7K42gQdA44ckhpWo2m1kSFd2DC H/RotWZTUnf1BRMWNwmL7WtqG6Gj6xc/7/SzgcQWnfEYMT6RgJMhdIT9bYfdmGSClqYo LrbIYp3IXa+5QO7iC1Zb9aS1W+SKe4tVTtGKRqpsX0vNsfKvdr5BmCbtaNJNvKB8LyOy ZJm1UG3YM13BP3BSO0GX1aoLwHeP3LAc+nYGeeHOuznPkuHIE7gLPzaCbhy6j6vbdKQi S7XQ== 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=0MBK9igZm5/OPEhc03R2ryGAft7wgmkQzUTWpZiNOyDuKkD3fylHv6omfLpuKFN1FR A7EnQO4HnQ2b1lCwI2IiKDhjzZgk49tVrHNR9rdlka4R4GQXVhFcwtpwAeUW2c1Ss53N N2lgDCczwJMMasMuBhFS8mClGzeAUJh0cHBYiWtxRxmv4XJrCra7K16WUhUzR7HxaUxH SOq73aWSvUE5/HFFCZU73DN7+dyWLKcH9eUOtYa0FZqWVJxGzIcrKwdCSia2SHcYAhGz XHTEQ5Qmd99gbi8zSUMD+YerC7PM4Dn06FNzq3UuGfdWjuebAmlEo82YqVGX3t3/jTB/ BDSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eGjPv8OR; 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 e2si1946206edv.369.2019.10.17.11.24.28; Thu, 17 Oct 2019 11:24:51 -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; dkim=pass header.i=@kernel.org header.s=default header.b=eGjPv8OR; 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 S2404447AbfJPWDY (ORCPT + 99 others); Wed, 16 Oct 2019 18:03:24 -0400 Received: from mail.kernel.org ([198.145.29.99]:54254 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438509AbfJPV71 (ORCPT ); Wed, 16 Oct 2019 17:59:27 -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 5B577222C4; Wed, 16 Oct 2019 21:59:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1571263166; bh=jphSXo0H1nebo1iEBpk4uSYr10SEphXsBJeMQa/Sj7Y=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eGjPv8ORLePAQGE8i7hsA5SEdvSP6KpHcPpvCAmjihe+6bfJt3jzEhNIQ0Ys7onqj OsFm1XUZ/f7PgyTV3Zbynpx9M4lJisCwNhsW54IyjiC7ZCB8pc5/cmpR/5HkbR80gu 6LLqB7NUCnQlIHUZT/X5M6BCBGpmTBAPLlKGC5Io= 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 5.3 094/112] arm64: topology: Use PPTT to determine if PE is a thread Date: Wed, 16 Oct 2019 14:51:26 -0700 Message-Id: <20191016214905.788832630@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191016214844.038848564@linuxfoundation.org> References: <20191016214844.038848564@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Signed-off-by: Sasha Levin --- arch/arm64/kernel/topology.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) 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; -- 2.20.1