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 E57B5C00140 for ; Thu, 18 Aug 2022 21:38:08 +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:References:In-Reply-To: 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: List-Owner; bh=HQteIbS0QIC2wNT7lS5SJzsQVy73avui0L4EGSdmh5g=; b=a4iv3sWLm2hXvg dhpBWyOjfFY1XJSjQ51vaTqjb/6P7puF+P7Ss0wZeyOWkzknoKxiSeoAZK/Ao3uDjZxtTC+SdB94P LX+TRwGvTxy1zE/RaD/6cqH6lDyZetYsrJa86eLiM3IhgYjqVCq3CSg6LB1KIsmza1uADLZ9Ox+B/ fKqQM/W8YlHfotEgbWZS9KHZnp+dYcRO2BKNHtcuS87pV9cAcTF3JLMWOJWyb30riHO8NJLA4U48k Ozieci5fvcShiOC9gkaGjuAHJCdxB7BxuukrsjiKpV40aO52ZZzQS58/nOgKif5jiSiLCowQajZqs wU8hjBdMnyYW/n0b76JQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOnCN-009vL7-Ob; Thu, 18 Aug 2022 21:37:08 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oOnBi-009uzI-TC for linux-arm-kernel@lists.infradead.org; Thu, 18 Aug 2022 21:36:28 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 78E3761589; Thu, 18 Aug 2022 21:36:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6D8EBC43141; Thu, 18 Aug 2022 21:36:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1660858585; bh=1e5R8CANt+wQn0YJFHEm1vcR1mOJfSqm0OIq3PUIBSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lmcn7WxJZMAQ9Lj3fN0WMXLwb59OdIJEAGR4gaHP0kmh/eNUbLRMQA/qtInM8xYXg zIXv22xucV5T2mViaPd4lt6GB/7mQDqg8wih6YhtF0S7ew1Kav6G9wQ8W93Xah3CgB d198BWDpXo33E14WV5j+nhc2KWgzRG6pIB7JzBRClnEvAWgX8imeL+w1N/9reH4/jT rIRYVrin5PXRcjfkxl5sU+CXh9Z801WwhihTXJi8xSuEUBsTGmJAbjObnD7Qxwy8op x8wYZ9XBYDy3gfw4T/XuYPwT0qOaehvlzNNMtofC1HI2rFydzZqEjpj7VXTtxmBa+t b+gXWSLyOgGeQ== From: Mark Brown To: Catalin Marinas , Will Deacon Cc: Mark.Rutland@arm.com, linux-arm-kernel@lists.infradead.org, Mark Brown , Ard Biesheuvel Subject: [PATCH v2 3/3] arm64/cache: Fix cache_type_cwg() for register generation Date: Thu, 18 Aug 2022 22:36:13 +0100 Message-Id: <20220818213613.733091-4-broonie@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220818213613.733091-1-broonie@kernel.org> References: <20220818213613.733091-1-broonie@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1458; i=broonie@kernel.org; h=from:subject; bh=1e5R8CANt+wQn0YJFHEm1vcR1mOJfSqm0OIq3PUIBSg=; b=owEBbQGS/pANAwAKASTWi3JdVIfQAcsmYgBi/rDM/CMhrQi/DpcfCukR6SankprMQxsqMCZPasNu CQoql+yJATMEAAEKAB0WIQSt5miqZ1cYtZ/in+ok1otyXVSH0AUCYv6wzAAKCRAk1otyXVSH0ATWB/ 40Z5NtZ740EyG+wylKTN68bcGwyySRV9tHoNhAX9y27LA0RnDSBNIFyLCWwkPuPyMsG1SDJ7I0PcfG ImCV2Mxqd7BUHuzYwnEaKu7Q/5vIDzLuSvK7dMmxO8vMvLB3KNr7kPIvT9iU1eIyUJHIuYYQwCXag9 IcRGo+segnC0JzkHirG5QVwHn0E8qzvC5BH062ZnN9XbtYTvjdQjMbuvYKCGgqKlI3lJ19+bCbhjfc agNMa7tm9WXC2OwpSQHqM/m6+KHO64OVxkqFldDFQJbVssepPxlpmn/zOEWO9U4AL1PX4dhMiMu4l2 zDkgKQm6mxcjwqWFfB4PbvjjrPrAkW 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-20220818_143627_041690_C8DE0846 X-CRM114-Status: GOOD ( 15.59 ) 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 converting to use SYS_FIELD_GET(). 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 ca9b487112cc..34256bda0da9 100644 --- a/arch/arm64/include/asm/cache.h +++ b/arch/arm64/include/asm/cache.h @@ -71,7 +71,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 SYS_FIELD_GET(CTR_EL0, CWG, read_cpuid_cachetype()); } #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