From patchwork Wed Apr 25 23:31: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: 134393 Delivered-To: patch@linaro.org Received: by 10.46.151.6 with SMTP id r6csp1533807lji; Wed, 25 Apr 2018 17:27:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+8N9w7VCVgnpL6Yi5LIRPpmkptW+x+KyhhMSf8teAvT7K0Mis2YQv4DLEnMI5dY9gbJ65E X-Received: by 2002:a17:902:8b84:: with SMTP id ay4-v6mr31104179plb.57.1524702468684; Wed, 25 Apr 2018 17:27:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524702468; cv=none; d=google.com; s=arc-20160816; b=l7Yj/OG8+cD6+TmUle+slmu4x0vW98d9Ea+dmqeyWk4D2CPyIzErM8XnoypYRf6XCv WMcmgSG9VgTScAsawG49JiIdhORGD3e1B0Kme+lc0SNSjgsB3aKS+LnslkSO0oA3rChy CEB3q6dJ/Fp8ZynorPni2dVE0nXiynMCeDSjr7b8l6rRf17F1UY0Lt0rNPKeJgMswTp5 OSyqQkR3zGq5FqJMks2581pH96sOWMssdlzFCDI9/jUkQUBZ5ZKLe9SodbW5Qx5pT9ZQ XMslvmSEPTLe0xT2tAJP10E7iYZHja5YPUjheWTcx5htgv7lO48YbXEjzxvJlmv2Eca+ tYPw== 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=PTPvWz+szEH3kdCZzEjVMTEpBS0YbWS5logb5GbXD/c=; b=VlfW5DJj+sO/n1BNHdPw8pS5U6RMDTuxaiVDa5gKWhHmkpIf+UW7cnsViaJNw5kRiM BTZ9lmP+EpxvE8iW8kIJ96hkYl7YxfdNHj6hi4exNHvVxygQB1Pa8EMUPOlhdjvEqP9d 04SngB6FYS+3MwBqed2IqFmnEmawobB8+YKjqWZcL4wqJ+NRZoRvwe0Xi0QE0QPqd/Xy WyhpYthuSjku5wbs6pXQwydag0TTi8NgXPYzceDb7AU1XmOJ1KCL0MFtbl610gcyjx8g bRr8pbMm3QGXpw0vH6VZYOEVxdYIaKHvpNkdkqsBVqFuki5/puj8IcjuUlwL7/nR4jRN HPWA== 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 o24si9765348pgn.36.2018.04.25.17.27.48; Wed, 25 Apr 2018 17:27:48 -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 S1753599AbeDZA1q (ORCPT + 29 others); Wed, 25 Apr 2018 20:27:46 -0400 Received: from foss.arm.com ([217.140.101.70]:45726 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751867AbeDZA0S (ORCPT ); Wed, 25 Apr 2018 20:26:18 -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 0B6CD16BA; Wed, 25 Apr 2018 17:26:18 -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 ED98C3F590; Wed, 25 Apr 2018 17:26:16 -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 07/13] drivers: base cacheinfo: Add support for ACPI based firmware tables Date: Wed, 25 Apr 2018 18:31:15 -0500 Message-Id: <20180425233121.13270-8-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 Call ACPI cache parsing routines from base cacheinfo code if ACPI is enable. Also stub out cache_setup_acpi() so that individual architectures can enable ACPI topology parsing. Signed-off-by: Jeremy Linton --- drivers/base/cacheinfo.c | 14 ++++++++++---- include/linux/cacheinfo.h | 10 ++++++++++ 2 files changed, 20 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..70ef44669fa3 100644 --- a/include/linux/cacheinfo.h +++ b/include/linux/cacheinfo.h @@ -97,6 +97,16 @@ 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 +static inline int acpi_find_last_cache_level(unsigned int cpu) +{ + /* ACPI kernels should be built with PPTT support */ + 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);