Skip to content

Commit 83d78bb

Browse files
kevin-brodsky-armctmarinas
authored andcommitted
arm64/sysreg: Rename POE_RXW to POE_RWX
It is customary to list R, W, X permissions in that order. In fact this is already the case for PIE constants (PIE_RWX). Rename POE_RXW accordingly, as well as POE_XW (currently unused). While at it also swap the W/X lines in compute_s1_overlay_permissions() to follow the R, W, X order. Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com> Link: https://lore.kernel.org/r/20250219164029.2309119-3-kevin.brodsky@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent f91a3a6 commit 83d78bb

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

arch/arm64/include/asm/sysreg.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1077,8 +1077,8 @@
10771077
#define POE_RX UL(0x3)
10781078
#define POE_W UL(0x4)
10791079
#define POE_RW UL(0x5)
1080-
#define POE_XW UL(0x6)
1081-
#define POE_RXW UL(0x7)
1080+
#define POE_WX UL(0x6)
1081+
#define POE_RWX UL(0x7)
10821082
#define POE_MASK UL(0xf)
10831083

10841084
#define POR_ELx_BITS_PER_IDX 4
@@ -1087,7 +1087,7 @@
10871087
#define POR_ELx_PERM_PREP(idx, perm) (((perm) & POE_MASK) << POR_ELx_PERM_SHIFT(idx))
10881088

10891089
/* Initial value for Permission Overlay Extension for EL0 */
1090-
#define POR_EL0_INIT POE_RXW
1090+
#define POR_EL0_INIT POE_RWX
10911091

10921092
/*
10931093
* Definitions for Guarded Control Stack

arch/arm64/kernel/signal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ static void save_reset_user_access_state(struct user_access_state *ua_state)
9191
u64 por_enable_all = 0;
9292

9393
for (int pkey = 0; pkey < arch_max_pkey(); pkey++)
94-
por_enable_all |= POR_ELx_PERM_PREP(pkey, POE_RXW);
94+
por_enable_all |= POR_ELx_PERM_PREP(pkey, POE_RWX);
9595

9696
ua_state->por_el0 = read_sysreg_s(SYS_POR_EL0);
9797
write_sysreg_s(por_enable_all, SYS_POR_EL0);

arch/arm64/kvm/at.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,22 +1090,22 @@ static void compute_s1_overlay_permissions(struct kvm_vcpu *vcpu,
10901090
break;
10911091
}
10921092

1093-
if (pov_perms & ~POE_RXW)
1093+
if (pov_perms & ~POE_RWX)
10941094
pov_perms = POE_NONE;
10951095

10961096
if (wi->poe && wr->pov) {
10971097
wr->pr &= pov_perms & POE_R;
1098-
wr->px &= pov_perms & POE_X;
10991098
wr->pw &= pov_perms & POE_W;
1099+
wr->px &= pov_perms & POE_X;
11001100
}
11011101

1102-
if (uov_perms & ~POE_RXW)
1102+
if (uov_perms & ~POE_RWX)
11031103
uov_perms = POE_NONE;
11041104

11051105
if (wi->e0poe && wr->uov) {
11061106
wr->ur &= uov_perms & POE_R;
1107-
wr->ux &= uov_perms & POE_X;
11081107
wr->uw &= uov_perms & POE_W;
1108+
wr->ux &= uov_perms & POE_X;
11091109
}
11101110
}
11111111

arch/arm64/mm/mmu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1555,7 +1555,7 @@ void __cpu_replace_ttbr1(pgd_t *pgdp, bool cnp)
15551555
#ifdef CONFIG_ARCH_HAS_PKEYS
15561556
int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long init_val)
15571557
{
1558-
u64 new_por = POE_RXW;
1558+
u64 new_por;
15591559
u64 old_por;
15601560

15611561
if (!system_supports_poe())
@@ -1570,7 +1570,7 @@ int arch_set_user_pkey_access(struct task_struct *tsk, int pkey, unsigned long i
15701570
return -EINVAL;
15711571

15721572
/* Set the bits we need in POR: */
1573-
new_por = POE_RXW;
1573+
new_por = POE_RWX;
15741574
if (init_val & PKEY_DISABLE_WRITE)
15751575
new_por &= ~POE_W;
15761576
if (init_val & PKEY_DISABLE_ACCESS)

0 commit comments

Comments
 (0)