From patchwork Sat Aug 5 00:11:57 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 109467 Delivered-To: patch@linaro.org Received: by 10.182.109.195 with SMTP id hu3csp1999847obb; Fri, 4 Aug 2017 17:12:06 -0700 (PDT) X-Received: by 10.98.104.1 with SMTP id d1mr4210124pfc.197.1501891926318; Fri, 04 Aug 2017 17:12:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1501891926; cv=none; d=google.com; s=arc-20160816; b=1A/S51jCNdJGa7tEo5bYUMRw+j35wT+7O62LoR5WIrXOFUn1JDvpPtuBWVrjp0cEpg pGuj0aIpVQX5lwXV2uk3LtsoUIBeIUI2L7ecwZIuRsY5/X4Ng2+AISb+3rB2zlY6RBf5 8k2RmaAWo7go7+5H37Niw9VPJ7i864rlQGRxEAqhpio4Vj4qL2qwphQ7/zLsltN+N9J2 NXW/pMCoW/4Dr2H6A69dN5GEYywHCUMcKusT6M5T5U1OgS5bYQ722TQf2g5nvabiywzR y3747wiIfvSGSHoaBf7uSkTaDMCVROwIUtGggy2NqiXSdvK4k2NyyHGocEospP5xJZoy ChKA== 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=zVVd6+kUIBRXa/FFiRNUYLWP16BNlm8k9VcuzT49VWA=; b=DUEF9+6jDCI/3vBZhcC37C4HIG8s24xQEEfVqifNqoOwS4nx+SQqcAIKS7GBVAof+4 J71ne5XS7B7h8F+OHA4hvu/cnHIwTgQXEAjYgNlpHBZangL5YL1JWuf73B/Cj0cDUcAw 6nbFYylDjlS8YK9d6di38/nNQoBPE7eF2Z30ro6pTyDiP68EDikwxbZETEfkCkmfi7iq r5xvnEzFN5iKYyenrC9foqUVeRgxiL6/nh532O2fAaT1Y/gXL7ER7FDMMWi9ILZ/NPMb A+mAwny14cyZ2xL6qDsYK5SdJXMQ12rNdGqRXEYEPpzv79s363IqHIoQ7rjTkKpTazm5 lzgw== 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 a59si1847411plc.837.2017.08.04.17.12.05; Fri, 04 Aug 2017 17:12:06 -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 S1753318AbdHEAME (ORCPT + 7 others); Fri, 4 Aug 2017 20:12:04 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:32990 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753330AbdHEAMC (ORCPT ); Fri, 4 Aug 2017 20:12:02 -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 F1EFF15B2; Fri, 4 Aug 2017 17:12:01 -0700 (PDT) Received: from beelzebub.ast.arm.com (beelzebub.austin.arm.com [10.118.12.119]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 8D85A3F577; Fri, 4 Aug 2017 17:12:01 -0700 (PDT) From: Jeremy Linton To: linux-arm-kernel@lists.infradead.org Cc: linux-acpi@vger.kernel.org, sudeep.holla@arm.com, hanjun.guo@linaro.org, lorenzo.pieralisi@arm.com, will.deacon@arm.com, catalin.marinas@arm.com Subject: [RFC 2/4] arm64: cacheinfo: Add support for ACPI/PPTT generated topology Date: Fri, 4 Aug 2017 19:11:57 -0500 Message-Id: <20170805001159.12769-3-jeremy.linton@arm.com> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170805001159.12769-1-jeremy.linton@arm.com> References: <20170805001159.12769-1-jeremy.linton@arm.com> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org The ACPI specification now includes a tree based description of the cache hierarchy. On arm64 the first step is assuring that we allocate sufficient levels to contain all the individual cache descriptions beyond what is described by the individual cores. Lets initially just stub that out with a routine which indicates that there aren't further levels beyond what is reported by the cores. Signed-off-by: Jeremy Linton --- arch/arm64/kernel/cacheinfo.c | 23 ++++++++++++++++++----- include/linux/cacheinfo.h | 1 + 2 files changed, 19 insertions(+), 5 deletions(-) -- 2.9.4 -- To unsubscribe from this list: send the line "unsubscribe linux-acpi" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c index 380f2e2..2e2cf0d 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 @@ -44,9 +45,17 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, this_leaf->type = type; } +#ifndef CONFIG_ACPI +int acpi_find_last_cache_level(unsigned int cpu) +{ + /*ACPI kernels should be built with PPTT support*/ + return 0; +} +#endif + 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 +68,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; diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 6a524bf..e9233c7 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -98,6 +98,7 @@ int func(unsigned int cpu) \ struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu); int init_cache_level(unsigned int cpu); int populate_cache_leaves(unsigned int cpu); +int acpi_find_last_cache_level(unsigned int cpu); const struct attribute_group *cache_get_priv_group(struct cacheinfo *this_leaf);