]> www.infradead.org Git - users/jedix/linux-maple.git/commit
arm64/sysreg: Improve PIR/POR helpers
authorKevin Brodsky <kevin.brodsky@arm.com>
Wed, 19 Feb 2025 16:40:27 +0000 (16:40 +0000)
committerCatalin Marinas <catalin.marinas@arm.com>
Mon, 10 Mar 2025 18:10:40 +0000 (18:10 +0000)
commitf91a3a6088ea4396299f1a72f6b0302bbe21a314
tree56329edc113b046d5b83c32714b5509206f587d8
parent0ad2507d5d93f39619fc42372c347d6006b64319
arm64/sysreg: Improve PIR/POR helpers

We currently have one helper to set a PIRx_ELx's permission field to
a given value, PIRx_ELx_PERM(), and another helper to extract a
permission field from POR_ELx, POR_ELx_IDX(). The naming is pretty
confusing - it isn't clear at all that "_PERM" corresponds to a
setter and "_IDX" to a getter.

This patch aims at improving the situation by using the same
suffixes as FIELD_PREP()/FIELD_GET(), which we have already adopted
for SYS_FIELD_{PREP,GET}():

* PIRx_ELx_PERM_PREP(), POR_ELx_PERM_PREP() create a register value
  where the permission field for a given index is set to a given value.

* POR_ELx_PERM_GET() extracts the permission field from a given
  register value for a given index.

These helpers are not implemented using FIELD_PREP()/FIELD_GET()
because the mask may not be constant, and they need to be usable in
assembly. They are all defined in asm/sysreg.h, as one would expect
for basic sysreg-related helpers.

Finally the new POR_ELx_PERM_* macros are used for existing
calculations in signal.c and mmu.c.

Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
Link: https://lore.kernel.org/r/20250219164029.2309119-2-kevin.brodsky@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/include/asm/pgtable-prot.h
arch/arm64/include/asm/por.h
arch/arm64/include/asm/sysreg.h
arch/arm64/kernel/signal.c
arch/arm64/mm/mmu.c