Received: by 10.192.165.148 with SMTP id m20csp1353609imm; Wed, 25 Apr 2018 17:29:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx48miXS0f4NWI2mTCnB4U63+lvaaY8OPiUmXCp/4VvkJ/komJ0vIM1WYULzU3bM3Xg4PThni X-Received: by 10.98.192.80 with SMTP id x77mr28575388pff.67.1524702574543; Wed, 25 Apr 2018 17:29:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524702574; cv=none; d=google.com; s=arc-20160816; b=xAvBixk6pb3r+xYxJKcVx7jZ6JbXRd+UFNQCTXONCKM+X5ABKRjwiA3CFjBpc+K1mA 0s18H3+PnCCcy/31zSblwIMXGxW3BRz5KL5t6nKsw2/zBSWJLaYig4lrc6RM5L2qfsE6 bDLMXozl5KH3YiJuNQjRSDFhgXmAREH5A8Av/hL9YB9thY94inFAahjq37f8yze1g+ly E+ujrspu17pZFPRT8nQLy09n5mNCuupSrQDicXqVvnhhBtWOy/C0sfUR6fPzFTqTymJD 1slo9QvROFKctJdcY2qMFr0lWGEsWxP6HNN7t+Oxh5WPOF32ZUCH2pfiCI6s0ZLWFU8l LOCA== 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 f9si2848129pgt.625.2018.04.25.17.29.20; Wed, 25 Apr 2018 17:29:34 -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 S1753576AbeDZA1p (ORCPT + 99 others); Wed, 25 Apr 2018 20:27:45 -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(-) 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); -- 2.13.6