[PATCH V5 0/4] arm64/sysreg: Clean up TCR_EL1 field macros

Anshuman Khandual posted 4 patches 1 week, 4 days ago
arch/arm64/include/asm/assembler.h     |  6 +-
arch/arm64/include/asm/cputype.h       |  2 +-
arch/arm64/include/asm/kvm_arm.h       | 43 +++++++++++
arch/arm64/include/asm/mmu_context.h   |  4 +-
arch/arm64/include/asm/pgtable-hwdef.h | 98 +-------------------------
arch/arm64/include/asm/pgtable-prot.h  |  2 +-
arch/arm64/include/asm/sysreg.h        |  2 -
arch/arm64/kernel/cpufeature.c         |  4 +-
arch/arm64/kernel/pi/map_kernel.c      |  8 +--
arch/arm64/kernel/vmcore_info.c        |  2 +-
arch/arm64/mm/proc.S                   | 36 ++++++----
arch/arm64/tools/sysreg                | 52 +++++++++++---
tools/arch/arm64/include/asm/cputype.h |  2 +-
13 files changed, 127 insertions(+), 134 deletions(-)
[PATCH V5 0/4] arm64/sysreg: Clean up TCR_EL1 field macros
Posted by Anshuman Khandual 1 week, 4 days ago
Currently TCR_EL1 field macros are sprinkled across the arm64 platform code
including KVM implementation. Clean these up via updating required register
filed definitions in tools sysreg format and then subsequently doing all
necessary replacements. All required TCR_XXX macros have been moved from
(asm/pgtable-hwdef.h) into KVM header (asm/kvm_arm.h) for their continued
usage in KVM.

The cleanup does not cause any functional change.

This applies on v6.17-rc6

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Mark Brown <broonie@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: kvmarm@lists.linux.dev
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org

Changes in V5:

- Split tools header and KVM changes into separate patches per Will

Changes in V4:

https://lore.kernel.org/all/20250907123000.414181-1-anshuman.khandual@arm.com/

- Dropped all unused TCR_XXX macros while moving into KVM header

Changes in V3:

https://lore.kernel.org/all/20250901072037.743380-1-anshuman.khandual@arm.com/

- KVM TCR_XXX flags are expressed via TCR_EL1_XXX flags per Marc

Changes in V2:

https://lore.kernel.org/all/20250829060215.1086792-1-anshuman.khandual@arm.com/

- Fixed ARM ARM version from 7.B to L.B
- Changed UnsignedEnum into Enum per Mark
- Dropped all TCR_EL1 replacements from KVM code
- Moved existing TCR_XXX macros from (asm/pgtable-hwdef.h) into KVM header
  (asm/kvm_arm.h) for their continued usage
- Dropped patches 3 and 4 which could be done subsequently

Changes in V1:

https://lore.kernel.org/linux-arm-kernel/20250818045759.672408-1-anshuman.khandual@arm.com/

Anshuman Khandual (4):
  tools: header : arm64: Replace TCR_NFD[0|1] with TCR_EL1_NFD[0|1]
  arm64/sysreg: Update TCR_EL1 register
  arm64/sysreg: Replace TCR_EL1 field macros
  KVM: arm64: Move inside all required TCR_XXX macros

 arch/arm64/include/asm/assembler.h     |  6 +-
 arch/arm64/include/asm/cputype.h       |  2 +-
 arch/arm64/include/asm/kvm_arm.h       | 43 +++++++++++
 arch/arm64/include/asm/mmu_context.h   |  4 +-
 arch/arm64/include/asm/pgtable-hwdef.h | 98 +-------------------------
 arch/arm64/include/asm/pgtable-prot.h  |  2 +-
 arch/arm64/include/asm/sysreg.h        |  2 -
 arch/arm64/kernel/cpufeature.c         |  4 +-
 arch/arm64/kernel/pi/map_kernel.c      |  8 +--
 arch/arm64/kernel/vmcore_info.c        |  2 +-
 arch/arm64/mm/proc.S                   | 36 ++++++----
 arch/arm64/tools/sysreg                | 52 +++++++++++---
 tools/arch/arm64/include/asm/cputype.h |  2 +-
 13 files changed, 127 insertions(+), 134 deletions(-)

-- 
2.25.1
Re: [PATCH V5 0/4] arm64/sysreg: Clean up TCR_EL1 field macros
Posted by Will Deacon 1 week, 2 days ago
On Sun, 21 Sep 2025 06:22:56 +0530, Anshuman Khandual wrote:
> Currently TCR_EL1 field macros are sprinkled across the arm64 platform code
> including KVM implementation. Clean these up via updating required register
> filed definitions in tools sysreg format and then subsequently doing all
> necessary replacements. All required TCR_XXX macros have been moved from
> (asm/pgtable-hwdef.h) into KVM header (asm/kvm_arm.h) for their continued
> usage in KVM.
> 
> [...]

Applied arch parts to arm64 (for-next/sysregs), thanks!

[2/4] arm64/sysreg: Update TCR_EL1 register
      https://git.kernel.org/arm64/c/14f158552eec
[3/4] arm64/sysreg: Replace TCR_EL1 field macros
      https://git.kernel.org/arm64/c/4f91624778b2

Cheers,
-- 
Will

https://fixes.arm64.dev
https://next.arm64.dev
https://will.arm64.dev