Received: by 2002:ab2:6203:0:b0:1f5:f2ab:c469 with SMTP id o3csp2155605lqt; Mon, 22 Apr 2024 03:09:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVM/ofzyDURwhDmd5OcUfyff4FPmP08Fiip/kdreM5dJXuG4F3TbPvjzGuBfM9kXUzBlXXURAK3wdfe0N5GsKLI5zQ+LIhLbgqRbXHv7g== X-Google-Smtp-Source: AGHT+IHqorGYpNReAIePc53DKqOqDq0scsZLk2YQ5Y9qry9DI73HqJ7ToTZd2PyR9l0S7aHxytBq X-Received: by 2002:a0c:eda6:0:b0:6a0:800a:bbaa with SMTP id h6-20020a0ceda6000000b006a0800abbaamr2863517qvr.28.1713780592883; Mon, 22 Apr 2024 03:09:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1713780592; cv=pass; d=google.com; s=arc-20160816; b=QIlk8G7zBQFxkKnHY2zkCyTyHglxQbySUqBdLNSMFGUOy+MTltY2zwWgatTl45HJoc ZlkmOpPGoqZ8Vcx8vqoPWL8SHMKAEx+F2OC2xvRga2/Oh1fxOUBxjoBO7ol6YAGMPnnn X6JqkCZRvS4ojcZCqxuIlF9U8nzRcsE658c6PGco2nLHfmNcSDI3xOjl+csIKkfuXflX wht9wB+6CJzxgW9Dvea4/N9nMqH5l0MJTY7Jy5jE7DEl8oHgOFh6t84unkD4n+DUWY/W CyM8AMjXxkGy3eY2BAOTktZXeRZjClhZxj6VJ1ZCmI72VCz914f37yueTA0XsTsZRvQ5 Pn7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=xKyjFpoExYPMp1bqLqKWfmNd/jwmLBy7Fda/3BCfwUU=; fh=d4R5xaGrkUXjQUwXWFuVtgJUTPsOTRI/7ZrysnNYDL4=; b=uzI/P9FDrHlZQjdpK+jlh+QHxOXJCkAmwZEBZ2/KbKodAfJ9AXSb1hKiEWCzOaxhLE QFMjj1HXkbpL5d4qFHS+82XNp39Ro4/9puvEm6bdNZePamplJskv6tRDaiTQwUrL//eN e4djbdw+nGtVrVFhG5Ny6FRrLzg6hwThyA8vS0309OkszZOjjKOJyeJ+lSadej4+7oj2 s2q6+5F0DDWgWuUF/D8Xog9YVQzoAO0A/6VzFF1bS0z9QAaBuzXdm6yAQd+eOUSZbIty wgFLhI9Noh/d1f7X8txiMGFT6OFsOlueMN4hwDcJCaN59Zfnq2x0T6GxvQjVlBm4Q59N wuKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-153155-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153155-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id z14-20020a056214040e00b0069b6b416a8csi10061271qvx.224.2024.04.22.03.09.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 03:09:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-153155-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-153155-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-153155-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 9A9FD1C210AE for ; Mon, 22 Apr 2024 10:09:52 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 48CA513D8BB; Mon, 22 Apr 2024 10:09:40 +0000 (UTC) Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C605450280 for ; Mon, 22 Apr 2024 10:09:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713780579; cv=none; b=oRN2K4UvtZEjBn8E7dx/zG0iG6094Rtmodq+0XZyQsbArMhPnSoiWNQQQT7hLXlB59fBcLUZqmUAMCLxo5swKUV+l2GHGQ/GBT4YPYIWIGtWuDbtVDko5rEXmv0GoiOxZWDgcGDwMcWmO8aIQv17bPcy0JItjxBNFCgnL+k5Xc0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713780579; c=relaxed/simple; bh=v8JKjP+EkUO4dWNiSEfGzuAcEHIYI5f01TttKsEYntc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oeTuKXHXeGI/4fi7quCLAbTfOd1FnV3awMvE6JFypBOUx8+NJZ0bTYieKGIwMBphWAVSYmB5Tyxraa4RSCKS0JfNx1d6Ya73ivICcSjlG8vvOl+M+I1VUprZXxnvAlZekih2tOdVeG8/pDBq0QHfreXXiIY4eQCOoL7/OdxlR2Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D453BC113CC; Mon, 22 Apr 2024 10:09:36 +0000 (UTC) Date: Mon, 22 Apr 2024 11:09:34 +0100 From: Catalin Marinas To: Shiqi Liu Cc: will@kernel.org, broonie@kernel.org, anshuman.khandual@arm.com, maz@kernel.org, suzuki.poulose@arm.com, miguel.luis@oracle.com, joey.gouly@arm.com, oliver.upton@linux.dev, jingzhangos@google.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] arm64/sysreg: Update PIE permission encodings Message-ID: References: <20240421063328.29710-1-shiqiliu@hust.edu.cn> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240421063328.29710-1-shiqiliu@hust.edu.cn> On Sun, Apr 21, 2024 at 02:33:28PM +0800, Shiqi Liu wrote: > Fix left shift overflow issue when the parameter idx is greater than or > equal to 8 in the calculation of perm in PIRx_ELx_PERM macro. > > Fix this by modifying the encoding to use a long integer type. > > Signed-off-by: Shiqi Liu > --- > arch/arm64/include/asm/sysreg.h | 24 ++++++++++++------------ > tools/arch/arm64/include/asm/sysreg.h | 24 ++++++++++++------------ > 2 files changed, 24 insertions(+), 24 deletions(-) > > diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h > index 9e8999592f3a..af3b206fa423 100644 > --- a/arch/arm64/include/asm/sysreg.h > +++ b/arch/arm64/include/asm/sysreg.h > @@ -1036,18 +1036,18 @@ > * Permission Indirection Extension (PIE) permission encodings. > * Encodings with the _O suffix, have overlays applied (Permission Overlay Extension). > */ > -#define PIE_NONE_O 0x0 > -#define PIE_R_O 0x1 > -#define PIE_X_O 0x2 > -#define PIE_RX_O 0x3 > -#define PIE_RW_O 0x5 > -#define PIE_RWnX_O 0x6 > -#define PIE_RWX_O 0x7 > -#define PIE_R 0x8 > -#define PIE_GCS 0x9 > -#define PIE_RX 0xa > -#define PIE_RW 0xc > -#define PIE_RWX 0xe > +#define PIE_NONE_O UL(0x0) > +#define PIE_R_O UL(0x1) > +#define PIE_X_O UL(0x2) > +#define PIE_RX_O UL(0x3) > +#define PIE_RW_O UL(0x5) > +#define PIE_RWnX_O UL(0x6) > +#define PIE_RWX_O UL(0x7) > +#define PIE_R UL(0x8) > +#define PIE_GCS UL(0x9) > +#define PIE_RX UL(0xa) > +#define PIE_RW UL(0xc) > +#define PIE_RWX UL(0xe) > > #define PIRx_ELx_PERM(idx, perm) ((perm) << ((idx) * 4)) Thanks. That's indeed the better way to write these constants, they also match the POE_* macros further down in this file. Currently nothing is broken since the PIE_E0 and PIE_E1 macros are only used in assembly where the UL() doesn't have any effect but we may change it in the future. I'll leave it with Will to pick up. Reviewed-by: Catalin Marinas