Received: by 10.192.165.148 with SMTP id m20csp1353815imm; Wed, 25 Apr 2018 17:29:49 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpSY3XDJqpGnS9Mgz1XpPDtPtrlVsQ5NhmKfc6THgKZLrUXs0wjcaSEjnoKYArOapF4yZ43 X-Received: by 2002:a17:902:b945:: with SMTP id h5-v6mr9402182pls.321.1524702589093; Wed, 25 Apr 2018 17:29:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524702589; cv=none; d=google.com; s=arc-20160816; b=qI3gU/CoOlh3E92FIHrEiZX3bf16xNZxW4FVnIfSilN7ZvKtyKZD1wqEJaG+imMbYq In0BQDw/zBJKIk37HiOwFoBJLq9nczGv1ipy5VZcC2lkOp7o2UL2VLprw/1hXhfwkht/ lK7laFBped6v2Dw2JJP/ZfPcBl/vN0RuubiK7EArm90w1tXAAqrAi6xCND/XuxyqhZQ7 52l/ylElwp7o+tzVnkKQ8RvWOxyqFcnw/Vm9O46hlIylsGYv2S97os0G4OVjwA9H/fTd QdyXLvGoGVJmUg1N0LEk5hCunk9cCSeq8D0ukQQ1OJmUKxlGIJtvPFcVpSAjjsR9Yh1+ H35g== 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=pw/1FJVVpEwBqN8kfTu2DwucS6iimCd0vcO/ASj9O94=; b=IKI/vUfBhSE8mSPrymz1dH3IHbUAXrZHsUgUEGHnUH2R0svo2XLa1o6TMoSEzg863+ AGqY6ORJK+m6DQAwkCRjMWvlSFpS405CaA+Dru3Na07Nc4JBlu0+jSwcsMhs29vXXCLh j01DgBqfi/Y4ce008IJB8FezgECIFvcaNVQmq6aX9R1qt1qGEkUZdCcIgeB5Xa0DLPby rAcGn5XpEq8dHfag5ktBSNjxG/oRAIVQuq9gWdUk+3hk/HVe+bsgjT6qbjff0Iy2Ve6o fsMPIg9b5CVGVaXopdswFuuqEaeuuOIPr+bamL2ouozw1MHzZzRn/9Ur9ECUFop6aWoL JEag== 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 b5-v6si16659816ple.584.2018.04.25.17.29.34; Wed, 25 Apr 2018 17:29:49 -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 S1753505AbeDZA1n (ORCPT + 99 others); Wed, 25 Apr 2018 20:27:43 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:45750 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751913AbeDZA0U (ORCPT ); Wed, 25 Apr 2018 20:26:20 -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 A001D16EA; Wed, 25 Apr 2018 17:26:19 -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 8D97F3F590; Wed, 25 Apr 2018 17:26:18 -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@qti.qualcomm.com, timur@qti.qualcomm.com, ard.biesheuvel@linaro.org, Jeremy Linton Subject: [PATCH v8 08/13] arm64: Add support for ACPI based firmware tables Date: Wed, 25 Apr 2018 18:31:16 -0500 Message-Id: <20180425233121.13270-9-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180425233121.13270-1-jeremy.linton@arm.com> References: <20180425233121.13270-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 Reviewed-by: Sudeep Holla --- arch/arm64/kernel/cacheinfo.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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; -- 2.13.6