Received: by 10.223.185.116 with SMTP id b49csp6710945wrg; Wed, 28 Feb 2018 14:11:48 -0800 (PST) X-Google-Smtp-Source: AH8x224jsTVHOI7vJdLv+cgktITNyOXZrU9B+S9jR8qsZ2sVaE+WjXgAfMj887ra3uPObgVz5jNj X-Received: by 2002:a17:902:724a:: with SMTP id c10-v6mr19358761pll.98.1519855908044; Wed, 28 Feb 2018 14:11:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519855908; cv=none; d=google.com; s=arc-20160816; b=nDezwan/S8fHBPrTDyzEykOQlHkEgvH7qC/Ynnas5Z6j/SDBZV7gaptZ2/Ge48MSY1 TZZFT3v7KNuod59jdnyvhm+z9XfDw6BR/Au1pIE9o+5MZlJ9WGDC5gDBqYWC/7jMnvhH q/UEED9CEAFmDmdEL5XYUxk8eLeFDJLZN50xo7nEVrefwBL7K2ArhOytcwlPy1uF65dK z/CneIt1/U3uTZ72nluvq4VtEgxCnaI2q84u4Nrxam5i4L/CTvb5o1qXw5BzcpL00VTq QiiKF2OxN4FkI6z6YoOgcrgDkI/pLdXu4GmcaBoDbMXUR3lNNEsepvzs28T++VuSSLav uv8g== 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=gYJcPau5DwzOr52kAGNEYhGRTTtgDf9MaGTWv2DO+Go=; b=pc+1E7Egex+sVD9OXYUhG0UaM0C4LQZh8gGd2EwuIvRye8dRNo2tf2t5nUlXDuRmES Qw/L+Zb7/iANhAfe/FUOMGTzKsJsqpz+jebzex9l1kBIQuVSAZxLejvy+JUz3P3ZPLuW U3aAOuagJhcyAa9pN6dvJPbtNryj9/uqUNnkyY8cvv9soFjo/VlvfgL2k0wdcPA+nrxc mg8iOJRMz91oWzR+ZDIsGtFcc+raOVe9uSuxAgE0n6l6yUa8SfSpIOZdDGx9XH15hNNX 9ZB3M8NhH7gMKiCNOOykvxnqTRWEDCseC3V28u7pSZOtMrIbApgB8eqj+j3PJd3UGYzQ qLBA== 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 e18si1861402pfi.130.2018.02.28.14.11.33; Wed, 28 Feb 2018 14:11:48 -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 S935472AbeB1WJm (ORCPT + 99 others); Wed, 28 Feb 2018 17:09:42 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58080 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935105AbeB1WH0 (ORCPT ); Wed, 28 Feb 2018 17:07:26 -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 83AC31610; Wed, 28 Feb 2018 14:07:26 -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 8C4133F246; Wed, 28 Feb 2018 14:07:25 -0800 (PST) From: Jeremy Linton To: linux-acpi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, 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, Jeremy Linton Subject: [PATCH v7 08/13] arm64: Add support for ACPI based firmware tables Date: Wed, 28 Feb 2018 16:06:14 -0600 Message-Id: <20180228220619.6992-9-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180228220619.6992-1-jeremy.linton@arm.com> References: <20180228220619.6992-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(-) 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