[PATCH] arm64/mm: Change protval as 'pteval_t' in map_range()

Anshuman Khandual posted 1 patch 1 week, 5 days ago
arch/arm64/kernel/pi/map_range.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH] arm64/mm: Change protval as 'pteval_t' in map_range()
Posted by Anshuman Khandual 1 week, 5 days ago
pgprot_t has been defined as an encapsulated structure with pteval_t as its
element. Hence it is prudent to use pteval_t as the type instead of via the
size based u64. Besides pteval_t type might be different size later on with
FEAT_D128.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ard Biesheuvel <ardb@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
---
This applies on v6.12-rc7

 arch/arm64/kernel/pi/map_range.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kernel/pi/map_range.c b/arch/arm64/kernel/pi/map_range.c
index 5410b2cac590..2b69e3beeef8 100644
--- a/arch/arm64/kernel/pi/map_range.c
+++ b/arch/arm64/kernel/pi/map_range.c
@@ -30,7 +30,7 @@ void __init map_range(u64 *pte, u64 start, u64 end, u64 pa, pgprot_t prot,
 		      int level, pte_t *tbl, bool may_use_cont, u64 va_offset)
 {
 	u64 cmask = (level == 3) ? CONT_PTE_SIZE - 1 : U64_MAX;
-	u64 protval = pgprot_val(prot) & ~PTE_TYPE_MASK;
+	pteval_t protval = pgprot_val(prot) & ~PTE_TYPE_MASK;
 	int lshift = (3 - level) * (PAGE_SHIFT - 3);
 	u64 lmask = (PAGE_SIZE << lshift) - 1;
 
-- 
2.30.2
Re: [PATCH] arm64/mm: Change protval as 'pteval_t' in map_range()
Posted by Catalin Marinas 1 week, 4 days ago
On Mon, 11 Nov 2024 13:22:49 +0530, Anshuman Khandual wrote:
> pgprot_t has been defined as an encapsulated structure with pteval_t as its
> element. Hence it is prudent to use pteval_t as the type instead of via the
> size based u64. Besides pteval_t type might be different size later on with
> FEAT_D128.
> 
> 

Applied to arm64 (for-next/misc), thanks!

[1/1] arm64/mm: Change protval as 'pteval_t' in map_range()
      https://git.kernel.org/arm64/c/de7fb8d3a2c9

-- 
Catalin
Re: [PATCH] arm64/mm: Change protval as 'pteval_t' in map_range()
Posted by Gavin Shan 1 week, 5 days ago
On 11/11/24 5:52 PM, Anshuman Khandual wrote:
> pgprot_t has been defined as an encapsulated structure with pteval_t as its
> element. Hence it is prudent to use pteval_t as the type instead of via the
> size based u64. Besides pteval_t type might be different size later on with
> FEAT_D128.
> 
> Cc: Catalin Marinas <catalin.marinas@arm.com>
> Cc: Will Deacon <will@kernel.org>
> Cc: Ard Biesheuvel <ardb@kernel.org>
> Cc: Ryan Roberts <ryan.roberts@arm.com>
> Cc: Mark Rutland <mark.rutland@arm.com>
> Cc: linux-arm-kernel@lists.infradead.org
> Cc: linux-kernel@vger.kernel.org
> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
> ---
> This applies on v6.12-rc7
> 
>   arch/arm64/kernel/pi/map_range.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: Gavin Shan <gshan@redhat.com>