]> www.infradead.org Git - users/hch/configfs.git/commitdiff
drm/xe: Assert pat.ops function pointers
authorMichal Wajdeczko <michal.wajdeczko@intel.com>
Tue, 9 Apr 2024 10:51:05 +0000 (12:51 +0200)
committerMichal Wajdeczko <michal.wajdeczko@intel.com>
Wed, 10 Apr 2024 09:21:47 +0000 (11:21 +0200)
Make sure that pat.ops (if selected) has all required function
pointers setup. Only .program_media may be omitted if we have
older media version.

This should help avoid late runtime checks against individual
function pointers.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Piotr Piórkowski <piotr.piorkowski@intel.com>
Cc: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Piotr Piórkowski <piotr.piorkowski@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240409105106.1067-1-michal.wajdeczko@intel.com
drivers/gpu/drm/xe/xe_pat.c

index 13812042177d673b338d7d561e6c24571f105837..d76831a4e5d1d1b377c9a60ba283d9860655257d 100644 (file)
@@ -435,6 +435,10 @@ void xe_pat_init_early(struct xe_device *xe)
        /* VFs can't program nor dump PAT settings */
        if (IS_SRIOV_VF(xe))
                xe->pat.ops = NULL;
+
+       xe_assert(xe, !xe->pat.ops || xe->pat.ops->dump);
+       xe_assert(xe, !xe->pat.ops || xe->pat.ops->program_graphics);
+       xe_assert(xe, !xe->pat.ops || MEDIA_VER(xe) < 13 || xe->pat.ops->program_media);
 }
 
 void xe_pat_init(struct xe_gt *gt)