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

Configure Feed

Select the types of activity you want to include in your feed.

drm/panfrost: Expose the selected coherency protocol to the UMD

Will be needed if we want to skip CPU cache maintenance operations when
the GPU can snoop CPU caches.

v2:
- New commit

v3:
- Fix the coherency values (enum instead of bitmask)

v4:
- Fix init/test on coherency_features

v5:
- No changes

v6:
- Collect R-b

v7:
- No changes

v8:
- No changes

Reviewed-by: Steven Price <steven.price@arm.com>
Link: https://patch.msgid.link/20251208100841.730527-10-boris.brezillon@collabora.com
Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>

+40 -5
+1
drivers/gpu/drm/panfrost/panfrost_device.h
··· 79 79 u32 thread_max_workgroup_sz; 80 80 u32 thread_max_barrier_sz; 81 81 u32 coherency_features; 82 + u32 selected_coherency; 82 83 u32 afbc_features; 83 84 u32 texture_features[4]; 84 85 u32 js_features[16];
+1
drivers/gpu/drm/panfrost/panfrost_drv.c
··· 95 95 PANFROST_FEATURE_ARRAY(JS_FEATURES, js_features, 15); 96 96 PANFROST_FEATURE(NR_CORE_GROUPS, nr_core_groups); 97 97 PANFROST_FEATURE(THREAD_TLS_ALLOC, thread_tls_alloc); 98 + PANFROST_FEATURE(SELECTED_COHERENCY, selected_coherency); 98 99 99 100 case DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP: 100 101 ret = panfrost_ioctl_query_timestamp(pfdev, &param->value);
+23 -3
drivers/gpu/drm/panfrost/panfrost_gpu.c
··· 159 159 pfdev->features.revision >= 0x2000) 160 160 quirks |= JM_MAX_JOB_THROTTLE_LIMIT << JM_JOB_THROTTLE_LIMIT_SHIFT; 161 161 else if (panfrost_model_eq(pfdev, 0x6000) && 162 - pfdev->features.coherency_features == COHERENCY_ACE) 163 - quirks |= (COHERENCY_ACE_LITE | COHERENCY_ACE) << 162 + pfdev->features.coherency_features == BIT(COHERENCY_ACE)) 163 + quirks |= (BIT(COHERENCY_ACE_LITE) | BIT(COHERENCY_ACE)) << 164 164 JM_FORCE_COHERENCY_FEATURES_SHIFT; 165 165 166 166 if (panfrost_has_hw_feature(pfdev, HW_FEATURE_IDVS_GROUP_SIZE)) ··· 263 263 pfdev->features.max_threads = gpu_read(pfdev, GPU_THREAD_MAX_THREADS); 264 264 pfdev->features.thread_max_workgroup_sz = gpu_read(pfdev, GPU_THREAD_MAX_WORKGROUP_SIZE); 265 265 pfdev->features.thread_max_barrier_sz = gpu_read(pfdev, GPU_THREAD_MAX_BARRIER_SIZE); 266 - pfdev->features.coherency_features = gpu_read(pfdev, GPU_COHERENCY_FEATURES); 266 + 267 + if (panfrost_has_hw_feature(pfdev, HW_FEATURE_COHERENCY_REG)) 268 + pfdev->features.coherency_features = gpu_read(pfdev, GPU_COHERENCY_FEATURES); 269 + else 270 + pfdev->features.coherency_features = BIT(COHERENCY_ACE_LITE); 271 + 272 + BUILD_BUG_ON(COHERENCY_ACE_LITE != DRM_PANFROST_GPU_COHERENCY_ACE_LITE); 273 + BUILD_BUG_ON(COHERENCY_ACE != DRM_PANFROST_GPU_COHERENCY_ACE); 274 + BUILD_BUG_ON(COHERENCY_NONE != DRM_PANFROST_GPU_COHERENCY_NONE); 275 + 276 + if (!pfdev->coherent) { 277 + pfdev->features.selected_coherency = COHERENCY_NONE; 278 + } else if (pfdev->features.coherency_features & BIT(COHERENCY_ACE)) { 279 + pfdev->features.selected_coherency = COHERENCY_ACE; 280 + } else if (pfdev->features.coherency_features & BIT(COHERENCY_ACE_LITE)) { 281 + pfdev->features.selected_coherency = COHERENCY_ACE_LITE; 282 + } else { 283 + drm_WARN(&pfdev->base, true, "No known coherency protocol supported"); 284 + pfdev->features.selected_coherency = COHERENCY_NONE; 285 + } 286 + 267 287 pfdev->features.afbc_features = gpu_read(pfdev, GPU_AFBC_FEATURES); 268 288 for (i = 0; i < 4; i++) 269 289 pfdev->features.texture_features[i] = gpu_read(pfdev, GPU_TEXTURE_FEATURES(i));
+8 -2
drivers/gpu/drm/panfrost/panfrost_regs.h
··· 102 102 #define GPU_L2_PRESENT_LO 0x120 /* (RO) Level 2 cache present bitmap, low word */ 103 103 #define GPU_L2_PRESENT_HI 0x124 /* (RO) Level 2 cache present bitmap, high word */ 104 104 105 + /* GPU_COHERENCY_FEATURES is a bitmask of BIT(COHERENCY_xxx) values encoding the 106 + * set of supported coherency protocols. GPU_COHERENCY_ENABLE is passed a 107 + * COHERENCY_xxx value. 108 + */ 105 109 #define GPU_COHERENCY_FEATURES 0x300 /* (RO) Coherency features present */ 106 - #define COHERENCY_ACE_LITE BIT(0) 107 - #define COHERENCY_ACE BIT(1) 110 + #define GPU_COHERENCY_ENABLE 0x304 /* (RW) Coherency protocol selection */ 111 + #define COHERENCY_ACE_LITE 0 112 + #define COHERENCY_ACE 1 113 + #define COHERENCY_NONE 31 108 114 109 115 #define GPU_STACK_PRESENT_LO 0xE00 /* (RO) Core stack present bitmap, low word */ 110 116 #define GPU_STACK_PRESENT_HI 0xE04 /* (RO) Core stack present bitmap, high word */
+7
include/uapi/drm/panfrost_drm.h
··· 228 228 DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP, 229 229 DRM_PANFROST_PARAM_SYSTEM_TIMESTAMP_FREQUENCY, 230 230 DRM_PANFROST_PARAM_ALLOWED_JM_CTX_PRIORITIES, 231 + DRM_PANFROST_PARAM_SELECTED_COHERENCY, 232 + }; 233 + 234 + enum drm_panfrost_gpu_coherency { 235 + DRM_PANFROST_GPU_COHERENCY_ACE_LITE = 0, 236 + DRM_PANFROST_GPU_COHERENCY_ACE = 1, 237 + DRM_PANFROST_GPU_COHERENCY_NONE = 31, 231 238 }; 232 239 233 240 struct drm_panfrost_get_param {