From patchwork Wed Feb 28 22:06:14 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 130079 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp272082lja; Wed, 28 Feb 2018 14:09:47 -0800 (PST) X-Google-Smtp-Source: AH8x227GrerUmQoExKn7dWVTpJaJph6cg8urUkgnHG/bbXZ+owrKTvd+rFcs6cb288zyL+kuM0IU X-Received: by 2002:a17:902:968b:: with SMTP id n11-v6mr19414953plp.168.1519855787467; Wed, 28 Feb 2018 14:09:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519855787; cv=none; d=google.com; s=arc-20160816; b=QrTpOv4ZrFUYjTMlGLBEhVjf9grLtdBkgSf9N3wWUh8s7oBiM/9xszmcXzsVnrTYxX d66iQ+NUL7cQ0k6WqbNdgsUfdg+HtbLPqQsEek65G6goMcpmF4Kx4WmS3RaZKhqzyXlf i0AIJDdkQMiQE0rRTwQQW/KO3hDeiFP9rbJhnaMzYbzwSRzuIMZFHVzrh/ssP0krIsU0 STzxLd0RmLsoQnoCDwBC0szfwoh7j0AmW3NmN1sYEvWmBMoTCR68Qjqs4UBKjs7R1Y9A 2FKG6dy/Q9LTGLASEvjXZ3UkGzFvMzRFq0TdgQlN5aqQiP8yL4C1qakiuopRG7eO8nCe C+ug== 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 q14-v6si1957649plk.632.2018.02.28.14.09.47; Wed, 28 Feb 2018 14:09:47 -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 S935475AbeB1WJn (ORCPT + 28 others); Wed, 28 Feb 2018 17:09:43 -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(-) -- 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;