From patchwork Sat Jan 13 00:59:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 124401 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp72964qgn; Fri, 12 Jan 2018 17:02:21 -0800 (PST) X-Google-Smtp-Source: ACJfBov8wB1XxHsQYh/bse+26468NAGD4iZAKC9EXOkeKBbsvCNnNoYvHPQW65ET41dO6RYr/nHp X-Received: by 10.101.64.6 with SMTP id f6mr21599998pgp.58.1515805340904; Fri, 12 Jan 2018 17:02:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515805340; cv=none; d=google.com; s=arc-20160816; b=C3mw+r3Nir+9Z4JRI53KzZ9kf+921ul3cZBG8QoSJyBBHU/c1rldjejgriGbOfAAFk S+n59tPSOLWFwKCAlPU8sYL1VkV4wsc57ZVVjBWr5FVIMHMDT7OFu5UGHy39evspq2JN J4mdp157xHNZm4KQavPWrVM83fYBXkDozmC7cEm9F3VToCV3V/v7Kt2X61tBKwaokVPh YDfBLm7pzgYkDlnWeiai3RRXzCI2Zj9ei2C+wV/h2EEtdXX7DhRLOQaKESnuAZSIF3sy 5uMXiN5SH6yKpTTLar7o2UQwdZZa4yVsT0xkCvnCZYn6ZLa+I5kEZuXm3xgJ4a/Ps+vu uaRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Jn5QzMcAOiQk3vK8+6S2qzrFf4rulolq+gsNTRBEJN4=; b=Xh3W1YTXIIBQEc+huDLct87zhc/8nUY8Dvg87XICcW1NPpu7QB8D7p+8byoncUcYez Eecb/B4Y5G3cm84STRRw52HB7knSp55Bgkbfe07tkH7XmB6gm+UGFSGPLtO/7PiTzMn4 51VhXx3PtHgvj2WAx8+Vr7q+mjm8RGlLGUOoPrAy1dtpjcbjzraF83NunQ67l1KrxFmA y1U/QN4I6ZjWimsDM3zwCOFSQqm/6KAgZHI7Jt3IoD1QXyw+EaQrICyU0e8GedfIIYrV YLteH4IZwl7Y61y/eYEVIGQyPTLOS978MWq68B6br1gOOhYoxhvJzJhSOnY8WGeB3Aa0 B7Ig== 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 e189si16121410pfa.409.2018.01.12.17.02.20; Fri, 12 Jan 2018 17:02:20 -0800 (PST) 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 S965641AbeAMBCS (ORCPT + 28 others); Fri, 12 Jan 2018 20:02:18 -0500 Received: from foss.arm.com ([217.140.101.70]:53906 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965504AbeAMBAw (ORCPT ); Fri, 12 Jan 2018 20:00:52 -0500 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 0D7E615AD; Fri, 12 Jan 2018 17:00:52 -0800 (PST) Received: from beelzebub.austin.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 167493F487; Fri, 12 Jan 2018 17:00:51 -0800 (PST) From: Jeremy Linton To: linux-acpi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, hanjun.guo@linaro.org, lorenzo.pieralisi@arm.com, rjw@rjwysocki.net, will.deacon@arm.com, catalin.marinas@arm.com, gregkh@linuxfoundation.org, viresh.kumar@linaro.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, jhugo@codeaurora.org, wangxiongfeng2@huawei.com, Jonathan.Zhang@cavium.com, ahs3@redhat.com, Jayachandran.Nair@cavium.com, austinwc@codeaurora.org, lenb@kernel.org, vkilari@codeaurora.org, morten.rasmussen@arm.com, Jeremy Linton Subject: [PATCH v6 08/12] arm64: Add support for ACPI based firmware tables Date: Fri, 12 Jan 2018 18:59:16 -0600 Message-Id: <20180113005920.28658-9-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180113005920.28658-1-jeremy.linton@arm.com> References: <20180113005920.28658-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The /sys cache entries should support ACPI/PPTT generated cache topology information. Lets detect ACPI systems and call an arch specific cache_setup_acpi() routine to update the hardware probed cache topology. For arm64, if ACPI is enabled, determine the max number of cache levels and populate them using the PPTT table if one is available. Signed-off-by: Jeremy Linton --- arch/arm64/kernel/cacheinfo.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) -- 2.13.5 Acked-by: Sudeep Holla diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c index 380f2e2fbed5..0bf0a835122f 100644 --- a/arch/arm64/kernel/cacheinfo.c +++ b/arch/arm64/kernel/cacheinfo.c @@ -17,6 +17,7 @@ * along with this program. If not, see . */ +#include #include #include @@ -46,7 +47,7 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, static int __init_cache_level(unsigned int cpu) { - unsigned int ctype, level, leaves, of_level; + unsigned int ctype, level, leaves, fw_level; struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); for (level = 1, leaves = 0; level <= MAX_CACHE_LEVEL; level++) { @@ -59,15 +60,19 @@ static int __init_cache_level(unsigned int cpu) leaves += (ctype == CACHE_TYPE_SEPARATE) ? 2 : 1; } - of_level = of_find_last_cache_level(cpu); - if (level < of_level) { + if (acpi_disabled) + fw_level = of_find_last_cache_level(cpu); + else + fw_level = acpi_find_last_cache_level(cpu); + + if (level < fw_level) { /* * some external caches not specified in CLIDR_EL1 * the information may be available in the device tree * only unified external caches are considered here */ - leaves += (of_level - level); - level = of_level; + leaves += (fw_level - level); + level = fw_level; } this_cpu_ci->num_levels = level;