Received: by 2002:ac2:48a3:0:0:0:0:0 with SMTP id u3csp557191lfg; Fri, 11 Mar 2022 13:11:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJy5wTV2n9murs7bkOkaPxroakzkqPi1PSBX3tUZ46rS96qyAyO1VCyaORy2GwQm8C95yiwU X-Received: by 2002:a63:af06:0:b0:378:3582:a49f with SMTP id w6-20020a63af06000000b003783582a49fmr10073945pge.125.1647033060772; Fri, 11 Mar 2022 13:11:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1647033060; cv=none; d=google.com; s=arc-20160816; b=SjL0ipcWUV/gmWlOqWC7No6tE87TAihk9IL8YJfhT++BdEBzYlH7jBQ1pVvY3aeos4 NG345aZ5cVj2Nt93wGGB86NRPPqXr0vRSX4O+DAWXpRtNI5DwHH2nfBQ7cT9nE7qjFwd 2v+CzLvIqlMh4uTCi/ShaXBAfXdM2+ivuxMZ3TuHrRSZdmTbzgbTmJoK9j3TLgw1TQqX taX3WtrRTorChJ2UYLrjV0KbhIWQg04eDY4jv4J1HQYBjCSTv7FCFGpzd2wCatH1Mp38 h3PBAXIMNyvHkYtK+MASQI6SqbT3l6p+tHJRxkkZwSMqndrnZ/g4kogsIqK4b8wvRGKw yYCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=MnvdPZ80oxbH8K7d6rSGzAz4dQa1aQRKScGuq0WI9fU=; b=kFSTYYcx0NMhIq2ESeMidX97hgOcUZriJbmRATCVHfVT6Rr8nwZchoQ4dvvxz4d1iP h2ulrWrygPEhRBTJxq59sufz0dW6r9A6fRsni1lM7enC8uSr+MptmdkR+CDYvWSsbe8v j08Wgw5Pv9ISAuU4Cgs/HMnrK6kXnfmrcC02yRwhOz7UfFPVJo5ovimrl7AbX88aOYEp J/xSbzXW7erUgBpvhzLJCYDnRIqJsW5NEqMPimFcjrJSAfSQlzIPsoKqyo3jybK2LFXa OE5LiApC3RIZ4VKL58IAap13sAN75niUFoQ1UgTbK39n2cj0MWHqKDWzPjxD7pkajeUe IiGw== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id u64-20020a638543000000b003803079e000si8224709pgd.433.2022.03.11.13.10.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Mar 2022 13:11:00 -0800 (PST) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=fujitsu.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 669481EAE4; Fri, 11 Mar 2022 12:52:47 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347880AbiCKKYC (ORCPT + 99 others); Fri, 11 Mar 2022 05:24:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347845AbiCKKXp (ORCPT ); Fri, 11 Mar 2022 05:23:45 -0500 Received: from esa12.hc1455-7.c3s2.iphmx.com (esa12.hc1455-7.c3s2.iphmx.com [139.138.37.100]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9D5C25E3 for ; Fri, 11 Mar 2022 02:22:40 -0800 (PST) X-IronPort-AV: E=McAfee;i="6200,9189,10282"; a="45621061" X-IronPort-AV: E=Sophos;i="5.90,173,1643641200"; d="scan'208";a="45621061" Received: from unknown (HELO yto-r4.gw.nic.fujitsu.com) ([218.44.52.220]) by esa12.hc1455-7.c3s2.iphmx.com with ESMTP; 11 Mar 2022 19:21:35 +0900 Received: from yto-m2.gw.nic.fujitsu.com (yto-nat-yto-m2.gw.nic.fujitsu.com [192.168.83.65]) by yto-r4.gw.nic.fujitsu.com (Postfix) with ESMTP id 0D870E05CA for ; Fri, 11 Mar 2022 19:21:35 +0900 (JST) Received: from yto-om1.fujitsu.com (yto-om1.o.css.fujitsu.com [10.128.89.162]) by yto-m2.gw.nic.fujitsu.com (Postfix) with ESMTP id E3BF8FD120 for ; Fri, 11 Mar 2022 19:21:33 +0900 (JST) Received: from cn-r05-10.example.com (n3235113.np.ts.nmh.cs.fujitsu.co.jp [10.123.235.113]) by yto-om1.fujitsu.com (Postfix) with ESMTP id AA667406139C9; Fri, 11 Mar 2022 19:21:33 +0900 (JST) From: Kohei Tarumizu To: catalin.marinas@arm.com, will@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, hpa@zytor.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: tarumizu.kohei@fujitsu.com Subject: [PATCH v2 5/8] arm64: Create cache sysfs directory without ACPI PPTT for hardware prefetch control Date: Fri, 11 Mar 2022 19:19:37 +0900 Message-Id: <20220311101940.3403607-6-tarumizu.kohei@fujitsu.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20220311101940.3403607-1-tarumizu.kohei@fujitsu.com> References: <20220311101940.3403607-1-tarumizu.kohei@fujitsu.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patch create a cache sysfs directory without ACPI PPTT if the CONFIG_HWPF_CONTROL is true. Hardware prefetch control driver need cache sysfs directory and cache level/type information. In ARM processor, these information can be obtained from the register even without PPTT. Therefore, we set the cpu_map_populated to true to create cache sysfs directory if the machine doesn't have PPTT. Signed-off-by: Kohei Tarumizu --- arch/arm64/kernel/cacheinfo.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c index 587543c6c51c..039ec32d0b3d 100644 --- a/arch/arm64/kernel/cacheinfo.c +++ b/arch/arm64/kernel/cacheinfo.c @@ -43,6 +43,21 @@ static void ci_leaf_init(struct cacheinfo *this_leaf, this_leaf->type = type; } +#if defined(CONFIG_HWPF_CONTROL) +static bool acpi_has_pptt(void) +{ + struct acpi_table_header *table; + acpi_status status; + + status = acpi_get_table(ACPI_SIG_PPTT, 0, &table); + if (ACPI_FAILURE(status)) + return false; + + acpi_put_table(table); + return true; +} +#endif + int init_cache_level(unsigned int cpu) { unsigned int ctype, level, leaves, fw_level; @@ -95,5 +110,19 @@ int populate_cache_leaves(unsigned int cpu) ci_leaf_init(this_leaf++, type, level); } } + +#if defined(CONFIG_HWPF_CONTROL) + /* + * Hardware prefetch functions need cache sysfs directory and cache + * level/type information. In ARM processor, these information can be + * obtained from registers even without PPTT. Therefore, we set the + * cpu_map_populated to true to create cache sysfs directory, if the + * machine doesn't have PPTT. + **/ + if (!acpi_disabled) + if (!acpi_has_pptt()) + this_cpu_ci->cpu_map_populated = true; +#endif + return 0; } -- 2.27.0