From patchwork Fri May 11 23:58:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeremy Linton X-Patchwork-Id: 135571 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp1526831lji; Fri, 11 May 2018 17:00:44 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqq0hQJIf7Cf7x/7gYgg/cUob9/0Wa91ZU9PAfrcMJvEFVIovFE7sCjostIOZMFE72W/ghw X-Received: by 2002:a65:484c:: with SMTP id i12-v6mr397082pgs.162.1526083244640; Fri, 11 May 2018 17:00:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526083244; cv=none; d=google.com; s=arc-20160816; b=yRLbEMmzqumTqSbXkqwGw/gmg89EyqhOn8+bPRxs5dXFItcR57F6JyVvbmbXcrlrKo MIQaZfvUSDKx6Rq4EW8o+B5vAa1EWlhwKUOAWyr5//QYSue+jINlZvFvR9UvaRCwval6 bKEzBsHS9apMcUrThlsMM2W176txKMeXf1iV0nKej/jUlJM/e3IniaFZW7+J5OXdGpFs q3p8rvczBjz5eN74tEQ63zVp1srzyIoVRBWtCGO170D1hVkFTsCKc1lVx+WV0Q7rHmB3 lVVi/9STSPKx3oV4yTy8Gt0GAx/rEvsxJ6SZPzlGZ5JKJpkY8srzeKQ3Gp/eNNP8xrxT d36Q== 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=G8RoyA6JUCJ5uM5SN8vKVFtdmlJHzHZYyC8RjTzFmm8=; b=y8lXG2FUOiGhbUCXyXiZKwK7Vjr1YNBLP13vLFI9AmskIxqpBPy2NFh89z7qmdYyEr /+f1gT4VJlmA3Oi1ZoHJJ4UZH9VV0r/NN+ZkwKmu0l5DZZBYuLvmnNMCZBFjzpvBlJOF 7Vh1u0TM1fXuFs3GFC90yONEtdszXxrtMv7RxcPQiBTmFqFJqiAOt2LNKe1u8eRAI9wT wzejHcNLXCpEAPmUA4xExBHPybjFLdR7Sc/r6LC7bKxNSVK9q/laZlu+M5JpMWX0GTAk Ylj//O8LCMZzteH5HQ8gdyHGCObEibBKALBAZngKRn7Jr1isDPiJlsomLKAy8zrWK4Wy cG+w== 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 m12-v6si3536685pgc.599.2018.05.11.17.00.44; Fri, 11 May 2018 17:00:44 -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 S1752136AbeELAAm (ORCPT + 29 others); Fri, 11 May 2018 20:00:42 -0400 Received: from foss.arm.com ([217.140.101.70]:50336 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751955AbeEKX7J (ORCPT ); Fri, 11 May 2018 19:59:09 -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 A00D415B2; Fri, 11 May 2018 16:59:09 -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 971253F53D; Fri, 11 May 2018 16:59:08 -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@codeaurora.org, ard.biesheuvel@linaro.org, Jeremy Linton Subject: [PATCH v9 07/12] drivers: base cacheinfo: Add support for ACPI based firmware tables Date: Fri, 11 May 2018 18:58:02 -0500 Message-Id: <20180511235807.30834-8-jeremy.linton@arm.com> X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180511235807.30834-1-jeremy.linton@arm.com> References: <20180511235807.30834-1-jeremy.linton@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Call ACPI cache parsing routines from base cacheinfo code if ACPI is enabled. Also stub out cache_setup_acpi and acpi_find_last_cache_level so that individual architectures can enable ACPI topology parsing. Signed-off-by: Jeremy Linton Tested-by: Ard Biesheuvel Tested-by: Vijaya Kumar K Tested-by: Xiongfeng Wang Tested-by: Tomasz Nowicki Acked-by: Sudeep Holla Acked-by: Ard Biesheuvel --- drivers/base/cacheinfo.c | 14 ++++++++++---- include/linux/cacheinfo.h | 17 +++++++++++++++++ 2 files changed, 27 insertions(+), 4 deletions(-) -- 2.13.6 diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c index 597aacb233fc..2880e2ab01f5 100644 --- a/drivers/base/cacheinfo.c +++ b/drivers/base/cacheinfo.c @@ -206,7 +206,7 @@ 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 */ @@ -214,6 +214,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); @@ -227,8 +232,8 @@ static int cache_shared_cpu_map_setup(unsigned int cpu) 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; + ret = cache_setup_acpi(cpu); + if (ret) return ret; @@ -279,7 +284,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_token); + if (of_have_populated_dt()) + of_node_put(this_leaf->fw_token); } } diff --git a/include/linux/cacheinfo.h b/include/linux/cacheinfo.h index 0c6f658054d2..89397e30e269 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -97,6 +97,23 @@ 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 cache_setup_acpi(unsigned int cpu); +#ifndef CONFIG_ACPI +/* + * acpi_find_last_cache_level is only called on ACPI enabled + * platforms using the PPTT for topology. This means that if + * the platform supports other firmware configuration methods + * we need to stub out the call when ACPI is disabled. + * ACPI enabled platforms not using PPTT won't be making calls + * to this function so we need not worry about them. + */ +static inline int acpi_find_last_cache_level(unsigned int cpu) +{ + return 0; +} +#else +int acpi_find_last_cache_level(unsigned int cpu); +#endif const struct attribute_group *cache_get_priv_group(struct cacheinfo *this_leaf);