Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/panfrost: Add specific register offset macros for JS and MMU AS

Each Panfrost job has its own job slot and MMU address space set of
registers, which are selected with a job-specific index.

Turn the shift and stride used for selection of the right register set base
into a define rather than using magic numbers.

Signed-off-by: Adrián Larumbe <adrian.larumbe@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Steven Price <steven.price@arm.com>
Signed-off-by: Steven Price <steven.price@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20220729144610.2105223-2-adrian.larumbe@collabora.com

authored by

Adrián Larumbe and committed by
Steven Price
6a3aaa2b ef8886f3

+24 -18
+24 -18
drivers/gpu/drm/panfrost/panfrost_regs.h
··· 226 226 #define JOB_INT_MASK_DONE(j) BIT(j) 227 227 228 228 #define JS_BASE 0x1800 229 - #define JS_HEAD_LO(n) (JS_BASE + ((n) * 0x80) + 0x00) 230 - #define JS_HEAD_HI(n) (JS_BASE + ((n) * 0x80) + 0x04) 231 - #define JS_TAIL_LO(n) (JS_BASE + ((n) * 0x80) + 0x08) 232 - #define JS_TAIL_HI(n) (JS_BASE + ((n) * 0x80) + 0x0c) 233 - #define JS_AFFINITY_LO(n) (JS_BASE + ((n) * 0x80) + 0x10) 234 - #define JS_AFFINITY_HI(n) (JS_BASE + ((n) * 0x80) + 0x14) 235 - #define JS_CONFIG(n) (JS_BASE + ((n) * 0x80) + 0x18) 236 - #define JS_XAFFINITY(n) (JS_BASE + ((n) * 0x80) + 0x1c) 237 - #define JS_COMMAND(n) (JS_BASE + ((n) * 0x80) + 0x20) 238 - #define JS_STATUS(n) (JS_BASE + ((n) * 0x80) + 0x24) 239 - #define JS_HEAD_NEXT_LO(n) (JS_BASE + ((n) * 0x80) + 0x40) 240 - #define JS_HEAD_NEXT_HI(n) (JS_BASE + ((n) * 0x80) + 0x44) 241 - #define JS_AFFINITY_NEXT_LO(n) (JS_BASE + ((n) * 0x80) + 0x50) 242 - #define JS_AFFINITY_NEXT_HI(n) (JS_BASE + ((n) * 0x80) + 0x54) 243 - #define JS_CONFIG_NEXT(n) (JS_BASE + ((n) * 0x80) + 0x58) 244 - #define JS_COMMAND_NEXT(n) (JS_BASE + ((n) * 0x80) + 0x60) 245 - #define JS_FLUSH_ID_NEXT(n) (JS_BASE + ((n) * 0x80) + 0x70) 229 + #define JS_SLOT_STRIDE 0x80 230 + 231 + #define JS_HEAD_LO(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x00) 232 + #define JS_HEAD_HI(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x04) 233 + #define JS_TAIL_LO(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x08) 234 + #define JS_TAIL_HI(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x0c) 235 + #define JS_AFFINITY_LO(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x10) 236 + #define JS_AFFINITY_HI(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x14) 237 + #define JS_CONFIG(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x18) 238 + #define JS_XAFFINITY(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x1c) 239 + #define JS_COMMAND(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x20) 240 + #define JS_STATUS(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x24) 241 + #define JS_HEAD_NEXT_LO(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x40) 242 + #define JS_HEAD_NEXT_HI(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x44) 243 + #define JS_AFFINITY_NEXT_LO(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x50) 244 + #define JS_AFFINITY_NEXT_HI(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x54) 245 + #define JS_CONFIG_NEXT(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x58) 246 + #define JS_COMMAND_NEXT(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x60) 247 + #define JS_FLUSH_ID_NEXT(n) (JS_BASE + ((n) * JS_SLOT_STRIDE) + 0x70) 246 248 247 249 /* Possible values of JS_CONFIG and JS_CONFIG_NEXT registers */ 248 250 #define JS_CONFIG_START_FLUSH_CLEAN BIT(8) ··· 283 281 #define AS_COMMAND_FLUSH_MEM 0x05 /* Wait for memory accesses to complete, flush all the L1s cache then 284 282 flush all L2 caches then issue a flush region command to all MMUs */ 285 283 286 - #define MMU_AS(as) (0x2400 + ((as) << 6)) 284 + #define MMU_BASE 0x2400 285 + #define MMU_AS_SHIFT 0x06 286 + #define MMU_AS(as) (MMU_BASE + ((as) << MMU_AS_SHIFT)) 287 287 288 288 #define AS_TRANSTAB_LO(as) (MMU_AS(as) + 0x00) /* (RW) Translation Table Base Address for address space n, low word */ 289 289 #define AS_TRANSTAB_HI(as) (MMU_AS(as) + 0x04) /* (RW) Translation Table Base Address for address space n, high word */ ··· 303 299 #define AS_TRANSCFG_HI(as) (MMU_AS(as) + 0x34) /* (RW) Translation table configuration for address space n, high word */ 304 300 #define AS_FAULTEXTRA_LO(as) (MMU_AS(as) + 0x38) /* (RO) Secondary fault address for address space n, low word */ 305 301 #define AS_FAULTEXTRA_HI(as) (MMU_AS(as) + 0x3C) /* (RO) Secondary fault address for address space n, high word */ 302 + 303 + #define MMU_AS_STRIDE (1 << MMU_AS_SHIFT) 306 304 307 305 /* 308 306 * Begin LPAE MMU TRANSTAB register values