From patchwork Thu Apr 13 09:14:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre Gondois X-Patchwork-Id: 8120 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp900200vqo; Thu, 13 Apr 2023 02:24:17 -0700 (PDT) X-Google-Smtp-Source: AKy350ZMT77y6UU09rHnmMN5WBK6dAAZLjJAN1I/ypY8WdCPy9T/3XLv3M0UOFIu/ZDpDfOifMAS X-Received: by 2002:a17:906:5255:b0:94a:8f4f:5755 with SMTP id y21-20020a170906525500b0094a8f4f5755mr1994607ejm.64.1681377856820; Thu, 13 Apr 2023 02:24:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681377856; cv=none; d=google.com; s=arc-20160816; b=iyx2TgfZJhtljaojzpuS2xHaBBdM6hQXvflPfH43UUCEqf5Iige03hUGQCKnA0tu15 T/+3ekFCPCQo6HeFvzXpsJKrLH2erNCBjk6Ac5MfMWRxVXW09tNbO6b9uKbnPJLj+ZlP Z8zJ16Tmbv7hemQjdJby7ik+9aRLFhZAq4eNiVQF9dyV9QBIRPKjYvDHBH+9SHfFqc/3 4QiXp51sYEZ+Zx/1eILqI8r5AOyMkvSV5ZWC2veaMFbvDP4ybxkqxLEcAFfcR4jTAtBq RwbPB2UBgXtwFo6GHboHypv638mLJ4gq+KEaY51CCGgsOyapNaN9i5RUE1ef1ROTVzxJ 8qKQ== 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 :message-id:date:subject:cc:to:from; bh=DSsDMzyoV2QP9T/piw7ZE82/7GeH+abkT4aizQrTXiE=; b=Iu7WGuRoRHxfFb2idvG30UoOuUHodVWh4XGlHJzD4MzZXjAFIJ1kcRw0CEdc85nPje s3NkFJdyXPXF8q/Yk5Lv7icmtvzz1h69dxweswmqFp8vJJcOjXWxEj9G8RlaU9BOR+mX czez05vMbp6oou2cN1qpfRsddkaqje5t+dc30hmawNMs44/qXZn8eAOf5wnFGxIJdikm SBBBVc/sME244Uv9x7JNdXexmh0afrS9Efl0Igtx1Fnt5AXcFb5cPrC8x7AwCnr73LQW kJsPgYNE3ImvSGMvHLTsmtZI4YPmgyhGXrj2pfefKrny6aBuD5nzsIc/eQLBL7dcj3NI ycpQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fg8-20020a1709069c4800b0094a76f68e57si1296181ejc.181.2023.04.13.02.23.53; Thu, 13 Apr 2023 02:24:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230032AbjDMJPD (ORCPT + 99 others); Thu, 13 Apr 2023 05:15:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230044AbjDMJPB (ORCPT ); Thu, 13 Apr 2023 05:15:01 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 5484C6EB7 for ; Thu, 13 Apr 2023 02:15:00 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4EF5ED75; Thu, 13 Apr 2023 02:15:44 -0700 (PDT) Received: from pierre123.nice.arm.com (pierre123.nice.arm.com [10.34.100.129]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 30DCF3F6C4; Thu, 13 Apr 2023 02:14:58 -0700 (PDT) From: Pierre Gondois To: linux-kernel@vger.kernel.org Cc: Radu Rendec , Alexandre Ghiti , Conor Dooley , Will Deacon , Pierre Gondois , Sudeep Holla , Greg Kroah-Hartman , "Rafael J. Wysocki" , Palmer Dabbelt , Gavin Shan Subject: [PATCH v3 0/4] cacheinfo: Correctly fallback to using clidr_el1's information Date: Thu, 13 Apr 2023 11:14:30 +0200 Message-Id: <20230413091436.230134-1-pierre.gondois@arm.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NONE autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763052467500832151?= X-GMAIL-MSGID: =?utf-8?q?1763052467500832151?= v3: cacheinfo: Check sib_leaf in cache_leaves_are_shared(): - Reformulate commit message - Fix rebase issue and move '&&' condition which was in the last patch to this patch. cacheinfo: Add use_arch[|_cache]_info field/function: - Put the function declaration in one line. arch_topology: Remove early cacheinfo error message: - New patch. v2: cacheinfo: Check sib_leaf in cache_leaves_are_shared() - Reformulate commit message - Add 'Fixes: f16d1becf96f ("cacheinfo: Use cache identifiers [...]' cacheinfo: Check cache properties are present in DT - Use of_property_present() - Add 'Reported-by: Alexandre Ghiti ' cacheinfo: Add use_arch[|_cache]_info field/function: - Make use_arch_cache_info() a static inline function The cache information can be extracted from either a Device Tree (DT), the PPTT ACPI table, or arch registers (clidr_el1 for arm64). When the DT is used but no cache properties are advertised, the current code doesn't correctly fallback to using arch information. Correct this. Also use the assumption that L1 data/instruction caches are private and L2/higher caches are shared when the cache information is coming form clidr_el1. As suggested by Alexandre, this serie should ideally go to 6.3 fixes. Pierre Gondois (4): cacheinfo: Check sib_leaf in cache_leaves_are_shared() cacheinfo: Check cache properties are present in DT arch_topology: Remove early cacheinfo error message cacheinfo: Add use_arch[|_cache]_info field/function drivers/base/arch_topology.c | 4 +-- drivers/base/cacheinfo.c | 48 +++++++++++++++++++++++++++++++++--- include/linux/cacheinfo.h | 10 ++++++++ 3 files changed, 55 insertions(+), 7 deletions(-)