From patchwork Fri May 11 23:58:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 135570 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1526392lji; Fri, 11 May 2018 17:00:18 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpF1zh4+NgfCZnLJxn+0QQ7/vixv5AEyUuhj5AbALTby5nvX3P3JfPUt87XRoy7fZZTtar4 X-Received: by 2002:a62:e50d:: with SMTP id n13-v6mr844247pff.125.1526083218715; Fri, 11 May 2018 17:00:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526083218; cv=none; d=google.com; s=arc-20160816; b=xstMjKgsS3uR2HHIyC0IHm0Tv5IGMo6mmXx5YlM9J8nPH1O0BSIFVKj2LQUp4I51rr wiVR6cjm2ZhYPPEZz3Ia+GlMkZjKiNwNaXG0WAXU4I11weSKjvhPoMXZnQYffSl3Hk34 9CMPG3WvnpLiMJytO+hq62/WkD0M20HA9SCNi+d6mCy2YNZrsUXS8b1bhKjjD1WeTo+F OEnGHFichzxtUHWD2C1wDHoabIimzElo3TyPFD/29IuNhxWXyPP99wfb01h77PV1sll9 pFvKPKgSaLJ5fFdb+u43pk2SjdduD1nOtM0XWuG1y/dWn4/6AJKgoxuht0k7ai2CtKYj JbHw== 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=r0R89/oaVUYtoarW9PUGEEZtoOJYcJjvSBR+IoYm+hw=; b=nJrI5hirxbOUXx1vxURMCspqlI0s79RGo4I76L8ebgcBNrH2LCKlXRu05H8UVW8S5Z De2JtOgH7ldrOziYrgCjzYNWeRgD5uK/6mTii6C724I6aitJGUi+vk/GPlRVC3GGV3/t 1/ccz3z1mdTs7S/h86gKG3aZug6JhXWwBg7ww4e4Co1u5tOAVkoiuBdvhGFmnI6EfSh4 g3WwzBSH6oZIUBZYSJawhzqiNmfDfWoLYMIEcm2x8irk55rzsNE3qCA8K9V16TEbxmDq WhRZRdegVwu2o1qbBrDAD8PDKcDMQR0rZ1zQ21t3C8fboU4duKooycHxJhE6PneU+NNm iH8w== 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 g92-v6si4135835plg.256.2018.05.11.17.00.18; Fri, 11 May 2018 17:00:18 -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 S1752122AbeELAAP (ORCPT + 29 others); Fri, 11 May 2018 20:00:15 -0400 Received: from foss.arm.com ([217.140.101.70]:50372 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751739AbeEKX7L (ORCPT ); Fri, 11 May 2018 19:59:11 -0400 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 F3B051435; Fri, 11 May 2018 16:59:10 -0700 (PDT) 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 EAC3A3F53D; Fri, 11 May 2018 16:59:09 -0700 (PDT) From: Jeremy Linton To: linux-acpi@vger.kernel.org Cc: Sudeep.Holla@arm.com, linux-arm-kernel@lists.infradead.org, Lorenzo.Pieralisi@arm.com, hanjun.guo@linaro.org, rjw@rjwysocki.net, Will.Deacon@arm.com, Catalin.Marinas@arm.com, gregkh@linuxfoundation.org, Mark.Rutland@arm.com, linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org, wangxiongfeng2@huawei.com, vkilari@codeaurora.org, ahs3@redhat.com, Dietmar.Eggemann@arm.com, Morten.Rasmussen@arm.com, palmer@sifive.com, lenb@kernel.org, john.garry@huawei.com, austinwc@codeaurora.org, tnowicki@caviumnetworks.com, jhugo@codeaurora.org, ard.biesheuvel@linaro.org, Jeremy Linton Subject: [PATCH v9 08/12] arm64: Add support for ACPI based firmware tables Date: Fri, 11 May 2018 18:58:03 -0500 Message-Id: <20180511235807.30834-9-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180511235807.30834-1-jeremy.linton@arm.com> References: <20180511235807.30834-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. 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 Tested-by: Ard Biesheuvel Tested-by: Vijaya Kumar K Tested-by: Xiongfeng Wang Tested-by: Tomasz Nowicki Reviewed-by: Sudeep Holla Acked-by: Ard Biesheuvel --- arch/arm64/kernel/cacheinfo.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) -- 2.13.6 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;