Re: [PATCH v3 3/8] arm64/sysreg: Convert SPE registers to automatic generation

2022-11-07 Thread Mark Brown
On Fri, Nov 04, 2022 at 10:55:03AM -0500, Rob Herring wrote:

> Convert all the SPE register defines to automatic generation. No
> functional changes.
> 
> New registers and fields for SPEv1.2 are added with the conversion.
> 
> Some of the PMBSR MSS field defines are kept as the automatic generation
> has no way to create multiple names for the same register bits. The
> meaning of the MSS field depends on other bits.

Reviewed-by: Mark Brown 

> +Sysreg   PMSNEVFR_EL13   0   9   9   1
> +Field63:0E
> +EndSysreg

JFTR as noted last time this looks nothing like the spec but is clearly
a sensible interpretation.

I do note that one advantage of doing this register by register rather
than en masse is that it makes it a lot easier to avoid re-reviewing the
same register...


signature.asc
Description: PGP signature
___
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm


[PATCH v3 3/8] arm64/sysreg: Convert SPE registers to automatic generation

2022-11-04 Thread Rob Herring
Convert all the SPE register defines to automatic generation. No
functional changes.

New registers and fields for SPEv1.2 are added with the conversion.

Some of the PMBSR MSS field defines are kept as the automatic generation
has no way to create multiple names for the same register bits. The
meaning of the MSS field depends on other bits.

Tested-by: James Clark 
Signed-off-by: Rob Herring 
---
v3:
 - Make some fields enums and add some missing fields
v2:
 - New patch
---
 arch/arm64/include/asm/sysreg.h |  91 ++
 arch/arm64/tools/sysreg | 139 
 2 files changed, 144 insertions(+), 86 deletions(-)

diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h
index 8df8a0a51273..d002dd00e53e 100644
--- a/arch/arm64/include/asm/sysreg.h
+++ b/arch/arm64/include/asm/sysreg.h
@@ -237,99 +237,18 @@
 #define SYS_PAR_EL1_FSTGENMASK(6, 1)
 
 /*** Statistical Profiling Extension ***/
-/* ID registers */
-#define SYS_PMSIDR_EL1 sys_reg(3, 0, 9, 9, 7)
-#define PMSIDR_EL1_FE_SHIFT0
-#define PMSIDR_EL1_FT_SHIFT1
-#define PMSIDR_EL1_FL_SHIFT2
-#define PMSIDR_EL1_ARCHINST_SHIFT  3
-#define PMSIDR_EL1_LDS_SHIFT   4
-#define PMSIDR_EL1_ERND_SHIFT  5
-#define PMSIDR_EL1_INTERVAL_SHIFT  8
-#define PMSIDR_EL1_INTERVAL_MASK   GENMASK_ULL(11, 8)
-#define PMSIDR_EL1_MAXSIZE_SHIFT   12
-#define PMSIDR_EL1_MAXSIZE_MASKGENMASK_ULL(15, 12)
-#define PMSIDR_EL1_COUNTSIZE_SHIFT 16
-#define PMSIDR_EL1_COUNTSIZE_MASK  GENMASK_ULL(19, 16)
-
-#define SYS_PMBIDR_EL1 sys_reg(3, 0, 9, 10, 7)
-#define PMBIDR_EL1_ALIGN_SHIFT 0
-#define PMBIDR_EL1_ALIGN_MASK  0xfU
-#define PMBIDR_EL1_P_SHIFT 4
-#define PMBIDR_EL1_F_SHIFT 5
-
-/* Sampling controls */
-#define SYS_PMSCR_EL1  sys_reg(3, 0, 9, 9, 0)
-#define PMSCR_EL1_E0SPE_SHIFT  0
-#define PMSCR_EL1_E1SPE_SHIFT  1
-#define PMSCR_EL1_CX_SHIFT 3
-#define PMSCR_EL1_PA_SHIFT 4
-#define PMSCR_EL1_TS_SHIFT 5
-#define PMSCR_EL1_PCT_SHIFT6
-
-#define SYS_PMSCR_EL2  sys_reg(3, 4, 9, 9, 0)
-#define PMSCR_EL2_E0HSPE_SHIFT 0
-#define PMSCR_EL2_E2SPE_SHIFT  1
-#define PMSCR_EL2_CX_SHIFT 3
-#define PMSCR_EL2_PA_SHIFT 4
-#define PMSCR_EL2_TS_SHIFT 5
-#define PMSCR_EL2_PCT_SHIFT6
-
-#define SYS_PMSICR_EL1 sys_reg(3, 0, 9, 9, 2)
-
-#define SYS_PMSIRR_EL1 sys_reg(3, 0, 9, 9, 3)
-#define PMSIRR_EL1_RND_SHIFT   0
-#define PMSIRR_EL1_INTERVAL_SHIFT  8
-#define PMSIRR_EL1_INTERVAL_MASK   GENMASK_ULL(31, 8)
-
-/* Filtering controls */
-#define SYS_PMSNEVFR_EL1   sys_reg(3, 0, 9, 9, 1)
-
-#define SYS_PMSFCR_EL1 sys_reg(3, 0, 9, 9, 4)
-#define PMSFCR_EL1_FE_SHIFT0
-#define PMSFCR_EL1_FT_SHIFT1
-#define PMSFCR_EL1_FL_SHIFT2
-#define PMSFCR_EL1_B_SHIFT 16
-#define PMSFCR_EL1_LD_SHIFT17
-#define PMSFCR_EL1_ST_SHIFT18
-
-#define SYS_PMSEVFR_EL1sys_reg(3, 0, 9, 9, 5)
 #define PMSEVFR_EL1_RES0_IMP   \
(GENMASK_ULL(47, 32) | GENMASK_ULL(23, 16) | GENMASK_ULL(11, 8) |\
 BIT_ULL(6) | BIT_ULL(4) | BIT_ULL(2) | BIT_ULL(0))
 #define PMSEVFR_EL1_RES0_V1P1  \
(PMSEVFR_EL1_RES0_IMP & ~(BIT_ULL(18) | BIT_ULL(17) | BIT_ULL(11)))
 
-#define SYS_PMSLATFR_EL1   sys_reg(3, 0, 9, 9, 6)
-#define PMSLATFR_EL1_MINLAT_SHIFT  0
-
-/* Buffer controls */
-#define SYS_PMBLIMITR_EL1  sys_reg(3, 0, 9, 10, 0)
-#define PMBLIMITR_EL1_E_SHIFT  0
-#define PMBLIMITR_EL1_FM_SHIFT 1
-#define PMBLIMITR_EL1_FM_MASK  GENMASK_ULL(2, 1)
-#define PMBLIMITR_EL1_FM_STOP_IRQ  0
-
-#define SYS_PMBPTR_EL1 sys_reg(3, 0, 9, 10, 1)
-
 /* Buffer error reporting */
-#define SYS_PMBSR_EL1  sys_reg(3, 0, 9, 10, 3)
-#define PMBSR_EL1_COLL_SHIFT   16
-#define PMBSR_EL1_S_SHIFT  17
-#define PMBSR_EL1_EA_SHIFT 18
-#define PMBSR_EL1_DL_SHIFT 19
-#define PMBSR_EL1_EC_SHIFT 26
-#define PMBSR_EL1_EC_MASK  GENMASK_ULL(31, 26)
-
-#define PMBSR_EL1_EC_BUF   0x0UL
-#define PMBSR_EL1_EC_FAULT_S1  0x24UL
-#define PMBSR_EL1_EC_FAULT_S2  0x25UL
-
-#define PMBSR_EL1_FAULT_FSC_SHIFT  0
-#define PMBSR_EL1_FAULT_FSC_MASK   0x3fUL
-
-#define PMBSR_EL1_BUF_BSC_SHIFT0
-#define PMBSR_EL1_BUF_BSC_MASK 0x3fUL
+#define PMBSR_EL1_FAULT_FSC_SHIFT  PMBSR_EL1_MSS_SHIFT
+#define PMBSR_EL1_FAULT_FSC_MASK   PMBSR_EL1_MSS_MASK
+
+#define PMBSR_EL1_BUF_BSC_SHIFTPMBSR_EL1_MSS_SHIFT
+#define PMBSR_EL1_BUF_BSC_MASK PMBSR_EL1_MSS_MASK
 
 #define PMBSR_EL1_BUF_BSC_FULL