From patchwork Sat Jan 13 00:59:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 124396 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp71818qgn; Fri, 12 Jan 2018 17:00:57 -0800 (PST) X-Google-Smtp-Source: ACJfBos6xUq8+hhZtXJjAN4MF0t7+4PPouHTC2NLMLSX8EGfl+vGRF1NSvTLQ5X1apzgxStXhlGm X-Received: by 10.84.133.226 with SMTP id f89mr27486863plf.407.1515805256952; Fri, 12 Jan 2018 17:00:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515805256; cv=none; d=google.com; s=arc-20160816; b=bUpeZnUAt6QbtJd47NSwM1p9j748eifIcwMDSGHyUe6PW9+wKLFFy+eC69MFtg08GD EtaOADva/00by6xEgELP8PSy6LrfDbQtjWmxS9b9vko4jCazvh3NLBDQyhlbcIf7+nhw J+JYD/IRDz351jGF+UNIG9U7kKp/Gc12N9zejWOlPoF5b0vxW8BvH+qYJmn5zkV2qca3 BgVGKKM5ZjR0ZssoBSdA9CQaMSabjB//v7/UeMkGOK8p0FfhbrulHgP61mp4LMzs3cJk cF2jj6UYEOYPTT5aR+EDlvX/n0BaHrwnUaN/jB0aQoPVhbAjqqWktc8WE/KXHVuP0Nph WmWA== 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=4WJ4ctztS40/WgvdffS8lR1G8Ybg0+buUC1kJGkhzfY=; b=ZeXidPwsZ1gAi5KaggvQyYuSEee6/hEYvzggslBXj+5yuegJ5AyOk4+tNd/h0DxTJd 5sFv3Nt4l4r/xucEQ3B82Y8Z/cT4A0QpjKt5FX+sjqThTv0dRrAjA2Zw83g2gvOCQXtX QA4rqR2m0+zk0EuBzjG1LmVrR/CuHkbQCFbRWr9Csq3ZvkNNKVpg5Vf1ZcnvFgJ7ev9w 5PPmvsc5/jv01dv+edGkIzrWb3qPo8POrby7iC909XKMfjBOm/jllDL39gD2b6toB4Bg rFESSec6HadELmPo8YGJjf5AGZqJ2OR7LDaVbeTVaZTxKJBcOpi6rllEkhvD5k2+w1jD ro8Q== 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 o3si16380564pld.695.2018.01.12.17.00.56; Fri, 12 Jan 2018 17:00:56 -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 S965530AbeAMBAx (ORCPT + 28 others); Fri, 12 Jan 2018 20:00:53 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:53878 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965443AbeAMBAv (ORCPT ); Fri, 12 Jan 2018 20:00:51 -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 8173315A2; Fri, 12 Jan 2018 17:00:50 -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 8A5F13F487; Fri, 12 Jan 2018 17:00:49 -0800 (PST) From: Jeremy Linton To: linux-acpi@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, sudeep.holla@arm.com, hanjun.guo@linaro.org, lorenzo.pieralisi@arm.com, rjw@rjwysocki.net, will.deacon@arm.com, catalin.marinas@arm.com, gregkh@linuxfoundation.org, viresh.kumar@linaro.org, mark.rutland@arm.com, linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org, jhugo@codeaurora.org, wangxiongfeng2@huawei.com, Jonathan.Zhang@cavium.com, ahs3@redhat.com, Jayachandran.Nair@cavium.com, austinwc@codeaurora.org, lenb@kernel.org, vkilari@codeaurora.org, morten.rasmussen@arm.com, Jeremy Linton Subject: [PATCH v6 07/12] drivers: base cacheinfo: Add support for ACPI based firmware tables Date: Fri, 12 Jan 2018 18:59:15 -0600 Message-Id: <20180113005920.28658-8-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20180113005920.28658-1-jeremy.linton@arm.com> References: <20180113005920.28658-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a entry to to struct cacheinfo to maintain a reference to the PPTT node which can be used to match identical caches across cores. Also stub out cache_setup_acpi() so that individual architectures can enable ACPI topology parsing. Signed-off-by: Jeremy Linton --- drivers/acpi/pptt.c | 1 + drivers/base/cacheinfo.c | 20 +++++++++++++------- include/linux/cacheinfo.h | 9 +++++++++ 3 files changed, 23 insertions(+), 7 deletions(-) -- 2.13.5 diff --git a/drivers/acpi/pptt.c b/drivers/acpi/pptt.c index 2c4b3ed862a8..4f5ab19c3a08 100644 --- a/drivers/acpi/pptt.c +++ b/drivers/acpi/pptt.c @@ -329,6 +329,7 @@ static void update_cache_properties(struct cacheinfo *this_leaf, { int valid_flags = 0; + this_leaf->fw_unique = cpu_node; if (found_cache->flags & ACPI_PPTT_SIZE_PROPERTY_VALID) { this_leaf->size = found_cache->size; valid_flags++; diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 217aa90fb036..ee51e33cc37c 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -208,16 +208,16 @@ static int cache_setup_of_node(unsigned int cpu) if (index != cache_leaves(cpu)) /* not all OF nodes populated */ return -ENOENT; - return 0; } + #else static inline int cache_setup_of_node(unsigned int cpu) { return 0; } static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, struct cacheinfo *sib_leaf) { /* - * For non-DT systems, assume unique level 1 cache, system-wide + * For non-DT/ACPI systems, assume unique level 1 caches, system-wide * shared caches for all other levels. This will be used only if * arch specific code has not populated shared_cpu_map */ @@ -225,6 +225,11 @@ static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, } #endif +int __weak cache_setup_acpi(unsigned int cpu) +{ + return -ENOTSUPP; +} + static int cache_shared_cpu_map_setup(unsigned int cpu) { struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); @@ -235,11 +240,11 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) if (this_cpu_ci->cpu_map_populated) return 0; - if (of_have_populated_dt()) + if (!acpi_disabled) + ret = cache_setup_acpi(cpu); + else if (of_have_populated_dt()) ret = cache_setup_of_node(cpu); - else if (!acpi_disabled) - /* No cache property/hierarchy support yet in ACPI */ - ret = -ENOTSUPP; + if (ret) return ret; @@ -290,7 +295,8 @@ static void cache_shared_cpu_map_remove(unsigned int cpu) cpumask_clear_cpu(cpu, &sib_leaf->shared_cpu_map); cpumask_clear_cpu(sibling, &this_leaf->shared_cpu_map); } - of_node_put(this_leaf->fw_unique); + if (of_have_populated_dt()) + of_node_put(this_leaf->fw_unique); } } diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 6f2e6c87b64c..65b0ae30016e 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -98,6 +98,15 @@ struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu); int init_cache_level(unsigned int cpu); int populate_cache_leaves(unsigned int cpu); void cache_of_set_props(struct cacheinfo *this_leaf, struct device_node *np); +int cache_setup_acpi(unsigned int cpu); +int acpi_find_last_cache_level(unsigned int cpu); +#ifndef CONFIG_ACPI +int acpi_find_last_cache_level(unsigned int cpu) +{ + /*ACPI kernels should be built with PPTT support*/ + return 0; +} +#endif const struct attribute_group *cache_get_priv_group(struct cacheinfo *this_leaf);