Received: by 2002:a05:6358:f14:b0:e5:3b68:ec04 with SMTP id b20csp947232rwj; Sat, 17 Dec 2022 22:20:43 -0800 (PST) X-Google-Smtp-Source: AA0mqf4V1rjkg+kWcFLA+3P3bkYuLwPEPm03xwnoslE8znkuh5dO/QydZem9PIQAPrgBaua4h1HC X-Received: by 2002:a05:6a20:7f96:b0:a8:a203:ec97 with SMTP id d22-20020a056a207f9600b000a8a203ec97mr61435656pzj.60.1671344443573; Sat, 17 Dec 2022 22:20:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671344443; cv=none; d=google.com; s=arc-20160816; b=QMPIktk0M0UB1VjeSCwzqwmyQ+lybKf+IQx/xx9ZYDaX1bj/zCisim8amptMK+bpXY l1iF0kj86bH2PbsqfmS2A2GiEGnioGRv39MLy7pVc+h+YsE0M/8tueJdp59qLtgeHoBv 95rm4MHeFGqVHwjfQTna6k03T59JzR04RyzILlF/CGw/p31GlLzL/lFE3TNkIMEGpd+/ kkePcxXiQoLhUpUSYy+9SFS2yWaRlsv6F7hbpLOai+CZJ/7yTHhWyZyHm8chLyuddomC jimA5L5f2Tc+Gl1+qO1hJ+/joimbkhb/fFIiIvmT0DfW510Z2yfSEGL8U6Z8/MoJ642k JZTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=4WsGIW0prujF8xnGwWysGoOLhN4qrtpWJqnT9WJSTvs=; b=FzIUgeQNdpCMlzZN+6MZkYnaGn0ll3+hJSiaJDTlAAVrkJ842FrOs5oLGchc+mR2Sk SqqyoKpTFNR2dz2/+mkhsVtryINN0pGmpgd2wqifzatScgxoCrbV/OLKB1Wk1BNhUhHy WYA34oPgmcSC7GblWhTJ8kib7r0mhCxzOl0M+FrVKs5P8xfJjMhO2A4EMB24XI5uKY5m sqBSEcSsmzIXLXneRSK2uFpJoLoVq9XbCGGKfZyA6Xvb4RCXewbY+VWCFel/Omio+IUH 3Wjm95un/WbXisKLF5z1OcJ3gKys7NStwFj5tiqakLNbyFI/HlChqtWgRfIQkE6chjrO 2SWw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=20KqTZ7p; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v69-20020a638948000000b004772e485146si7497041pgd.6.2022.12.17.22.20.35; Sat, 17 Dec 2022 22:20:43 -0800 (PST) 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; dkim=fail header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=20KqTZ7p; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230186AbiLRFPo (ORCPT + 69 others); Sun, 18 Dec 2022 00:15:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53536 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbiLRFPi (ORCPT ); Sun, 18 Dec 2022 00:15:38 -0500 Received: from mail-pl1-x631.google.com (mail-pl1-x631.google.com [IPv6:2607:f8b0:4864:20::631]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E3553DF06 for ; Sat, 17 Dec 2022 21:15:36 -0800 (PST) Received: by mail-pl1-x631.google.com with SMTP id 17so6143929pll.0 for ; Sat, 17 Dec 2022 21:15:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=4WsGIW0prujF8xnGwWysGoOLhN4qrtpWJqnT9WJSTvs=; b=20KqTZ7p9hZYfryC+Vfixvt3usjH4QB21HhVNGKbyBUuo9FRcdt5pDtUHZ0C4OB00k Pxkb4TBy4j5Ucx4LvEqYvxz/DBSczM93egGac/fvIai58XcwYxQmzbaOaTH5tfndBTxj JRi/iiyrq7N9LEDYbMOd0d/shMofzgLH7ExucYoWaDUQvs4RFnTKTKgOLHcox3BCkcz/ qlDlCjh4+wKxwbqjTtDSlSaAePBt7ceu4mPvnka+GHbiTPbBdhbiA/SQ5rGpvs+PtiGm YBbNd2hkCWttAqwAgUDSjtnqR+YIhmIQXXDUneGSDReHXU81LIFM9OiZ2/6KYcqPMIQp yPwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=4WsGIW0prujF8xnGwWysGoOLhN4qrtpWJqnT9WJSTvs=; b=Roz3Lf/hIZmjAXFlfpeOQ+2f0gc4e4GKraXaZfod0DTbhL+5cJU5xkfXY1ZhmfOdvX rAHEM2fuA58x8XqV1PgZsH7d15tLVYvRFADJhtFbMl3DOY7eQ1+xQd3zgqBl6P342NlU 8/nE23pUCIkW+P77evuFOilXUvJXB3a89VqpLEpfeW+Nz+OOPAhV4B5DR7aYoMxCfd9I XyUeFmNoH2rDoDIDB7EFvZQdJ21Eu2CAafvLvSGNk8Zc0CtsVhCkWgasQA3UN5DVWksr wiJT5UBkB+P7xMy0mWUGO8ysBd7mdKHz9szc5IW3sumxhJsIoncXk9AXXorSn+t1tgvx jcXA== X-Gm-Message-State: AFqh2kpHGaO65w7WpeOA/05jZFFaq+5oJrbTLNpPxan3enbyd4eZ6q1B ekdcK3vI8rmGKJDJGSrFSIF0Lw== X-Received: by 2002:a17:90a:2eca:b0:223:b920:28df with SMTP id h10-20020a17090a2eca00b00223b92028dfmr1736781pjs.29.1671340536313; Sat, 17 Dec 2022 21:15:36 -0800 (PST) Received: from fedora.flets-east.jp ([2400:4050:c360:8200:8ae8:3c4:c0da:7419]) by smtp.gmail.com with ESMTPSA id b1-20020a17090a6ac100b002139459e121sm7002417pjm.27.2022.12.17.21.15.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 17 Dec 2022 21:15:35 -0800 (PST) From: Akihiko Odaki Cc: Marc Zyngier , linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, Mathieu Poirier , Oliver Upton , Suzuki K Poulose , Alexandru Elisei , James Morse , Will Deacon , Catalin Marinas , asahi@lists.linux.dev, Alyssa Rosenzweig , Sven Peter , Hector Martin , Akihiko Odaki Subject: [PATCH v3 3/7] arm64/cache: Move CLIDR macro definitions Date: Sun, 18 Dec 2022 14:14:08 +0900 Message-Id: <20221218051412.384657-4-akihiko.odaki@daynix.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221218051412.384657-1-akihiko.odaki@daynix.com> References: <20221218051412.384657-1-akihiko.odaki@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,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 To: unlisted-recipients:; (no To-header on input) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The macros are useful for KVM which needs to manage how CLIDR is exposed to vcpu so move them to include/asm/cache.h, which KVM can refer to. Signed-off-by: Akihiko Odaki --- arch/arm64/include/asm/cache.h | 6 ++++++ arch/arm64/kernel/cacheinfo.c | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index c0b178d1bb4f..ab7133654a72 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -16,6 +16,12 @@ #define CLIDR_LOC(clidr) (((clidr) >> CLIDR_LOC_SHIFT) & 0x7) #define CLIDR_LOUIS(clidr) (((clidr) >> CLIDR_LOUIS_SHIFT) & 0x7) +/* Ctypen, bits[3(n - 1) + 2 : 3(n - 1)], for n = 1 to 7 */ +#define CLIDR_CTYPE_SHIFT(level) (3 * (level - 1)) +#define CLIDR_CTYPE_MASK(level) (7 << CLIDR_CTYPE_SHIFT(level)) +#define CLIDR_CTYPE(clidr, level) \ + (((clidr) & CLIDR_CTYPE_MASK(level)) >> CLIDR_CTYPE_SHIFT(level)) + /* * Memory returned by kmalloc() may be used for DMA, so we must make * sure that all such allocations are cache aligned. Otherwise, diff --git a/arch/arm64/kernel/cacheinfo.c b/arch/arm64/kernel/cacheinfo.c index 97c42be71338..daa7b3f55997 100644 --- a/arch/arm64/kernel/cacheinfo.c +++ b/arch/arm64/kernel/cacheinfo.c @@ -11,11 +11,6 @@ #include #define MAX_CACHE_LEVEL 7 /* Max 7 level supported */ -/* Ctypen, bits[3(n - 1) + 2 : 3(n - 1)], for n = 1 to 7 */ -#define CLIDR_CTYPE_SHIFT(level) (3 * (level - 1)) -#define CLIDR_CTYPE_MASK(level) (7 << CLIDR_CTYPE_SHIFT(level)) -#define CLIDR_CTYPE(clidr, level) \ - (((clidr) & CLIDR_CTYPE_MASK(level)) >> CLIDR_CTYPE_SHIFT(level)) int cache_line_size(void) { -- 2.38.1