From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 43E2FC25B08 for ; Wed, 17 Aug 2022 16:04:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=z97W+QnWGCNC/nGo+xvrECP+lkrRK+jmMXoiK84Ma44=; b=BrrVtVet5hwdzs 8dhqvy3ki+vG3tdVG74T/WDdvAC5nzWizoVIYvLP7s/jLzlJhKLgajFlFjgZMp6z/T3Sh5ts5WTwi 7rzls8/RElz4FdD9IlBcCQBPbo9tvO3r2Ifxw7PwUVGDQKmjZ8eSPmzq8GjkJh7/KjgJXypAPkOYv 87Vh7QlYTOYtjc84zUCwvEzoI9WxGPX6Ckli7AghCN207hHTlkFi5Sp0D9FFKUS3ZMoteakbO+Fx+ NVVGsb+82wKplLFCrN4W26t4eviyQLZQHd3X0NtWwWpP9IhgRgCQy2ufRoXKor4YUD18mA25MzGyx nS3U70yXkxO0OumUz3SA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOLVV-003Zt1-CL; Wed, 17 Aug 2022 16:03:01 +0000 Received: from ams.source.kernel.org ([2604:1380:4601:e00::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOLVR-003Zq3-Mb for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2022 16:02:59 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 53788B81C83; Wed, 17 Aug 2022 16:02:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C0D2EC433D6; Wed, 17 Aug 2022 16:02:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660752175; bh=PJIdRnxcFCLLc1RziOVQYDinxPh3x7hWnDrzzNmMDjQ=; h=From:To:Cc:Subject:Date:From; b=CgtEQ17TJ0nsBeRjNfLNYJQ1r9JyGq4FQcmMPCFKkanM8+EkgmfS1PGPDbvZ2EkJF TgFPD9Vfaf5NC6L+wzjcrzohjoDvx0Jz8ioVjY2n+d6jMT9d4fnRHcN5rUbjFKc9gO Cg2CyD5M8QJra51v1DmUmPhbDzqQ6/wvuujzkImZmmiqCBwGOhisoEgqDn6ZUqldJH 9CrKgxrECqXQYrx+kSbERKTlU9g4QVr7pstH1c6xVEewvAptjsml4mejw40MNxSU7U ldO0JvOiEydbYxwRKCQAHLLXBAnteuOsSJQtkN894iZ6Y63OhemRf5rHBJGiprVzDX EtzV+WdhjLH0w== From: Mark Brown To: Will Deacon , Catalin Marinas Cc: linux-arm-kernel@lists.infradead.org, Mark Brown , Ard Biesheuvel Subject: [PATCH] arm64/cache: Fix cache_type_cwg() for register generation Date: Wed, 17 Aug 2022 17:02:46 +0100 Message-Id: <20220817160246.420734-1-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1554; i=broonie@kernel.org; h=from:subject; bh=PJIdRnxcFCLLc1RziOVQYDinxPh3x7hWnDrzzNmMDjQ=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBi/RElbmfC/dvJfoQbxG9sp8R4/uUen2K6zRSHF2JP l0RipgqJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYv0RJQAKCRAk1otyXVSH0G5ZB/ 9lmEaNYvCZlkng2s128uBLt4qX80gAI44cHtZfmWQvXkt+1JhkVF5umL4OFCyN6IYLNQBpTyo1jixr GeOBlxkzHNj6ohylPh9g6n2TthotMIDfmb9eLiXjAlWLmnShcFEfFTGqs34NNjzIHdNYlpylHSBobv pHPrF0gukKBhTRXymDFxSDs5vhoS+5jAicX+s0/ZTA/UH4EseTs3J8OrQnmta2yiqbR0HA/VkWc2C2 uw5O8uRzzPpNsicLp89QVKao8MmdE6yE1LtMCjad8st/7NojtHxOE7wCQOLm5nqrOw+jZs/46VyGss PrmfpGf7pYA1s0fTkC1G7xsSfJPK3Z X-Developer-Key: i=broonie@kernel.org; a=openpgp; fpr=3F2568AAC26998F9E813A1C5C3F436CA30F5D8EB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220817_090257_918205_EBB0EB62 X-CRM114-Status: GOOD ( 15.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Ard noticed that since we converted CTR_EL0 to automatic generation we have been seeing errors on some systems handling the value of cache_type_cwg() such as CPU features: No Cache Writeback Granule information, assuming 128 This is because the manual definition of CTR_EL0_CWG_MASK was done without a shift while our convention is to define the mask after shifting. This means that the user in cache_type_cwg() was broken as it was written for the manually written shift then mask. Fix this by reversing, we don't use SYS_FIELD_GET() since that is defined in sysreg.h which we don't want to include in cache.h. The only other field where the _MASK for this register is used is IminLine which is at offset 0 so unaffected. Fixes: 9a3634d02301 ("arm64/sysreg: Convert CTR_EL0 to automatic generation") Reported-by: Ard Biesheuvel Signed-off-by: Mark Brown --- arch/arm64/include/asm/cache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/cache.h b/arch/arm64/include/asm/cache.h index 119e4aa02eb1..8445a3213b2f 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -67,7 +67,7 @@ static __always_inline int icache_is_vpipt(void) static inline u32 cache_type_cwg(void) { - return (read_cpuid_cachetype() >> CTR_EL0_CWG_SHIFT) & CTR_EL0_CWG_MASK; + return (read_cpuid_cachetype() & CTR_EL0_CWG_MASK) >> CTR_EL0_CWG_SHIFT; } #define __read_mostly __section(".data..read_mostly") -- 2.30.2 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel