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

drm/xe/pcode: add struct drm_device based interface

In preparation for dropping the dependency on struct intel_uncore or
struct xe_tile from display code, add a struct drm_device based
interface to pcode.

Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
Link: https://lore.kernel.org/r/eeaa9cc8438caab2e22f9cb2142fbc18cc0fd861.1750678991.git.jani.nikula@intel.com
Signed-off-by: Jani Nikula <jani.nikula@intel.com>

+37 -1
+26
drivers/gpu/drm/xe/xe_pcode.c
··· 336 336 return xe_pcode_ready(xe, false); 337 337 } 338 338 ALLOW_ERROR_INJECTION(xe_pcode_probe_early, ERRNO); /* See xe_pci_probe */ 339 + 340 + /* Helpers with drm device */ 341 + int intel_pcode_read(struct drm_device *drm, u32 mbox, u32 *val, u32 *val1) 342 + { 343 + struct xe_device *xe = to_xe_device(drm); 344 + struct xe_tile *tile = xe_device_get_root_tile(xe); 345 + 346 + return xe_pcode_read(tile, mbox, val, val1); 347 + } 348 + 349 + int intel_pcode_write_timeout(struct drm_device *drm, u32 mbox, u32 val, int timeout_ms) 350 + { 351 + struct xe_device *xe = to_xe_device(drm); 352 + struct xe_tile *tile = xe_device_get_root_tile(xe); 353 + 354 + return xe_pcode_write_timeout(tile, mbox, val, timeout_ms); 355 + } 356 + 357 + int intel_pcode_request(struct drm_device *drm, u32 mbox, u32 request, 358 + u32 reply_mask, u32 reply, int timeout_base_ms) 359 + { 360 + struct xe_device *xe = to_xe_device(drm); 361 + struct xe_tile *tile = xe_device_get_root_tile(xe); 362 + 363 + return xe_pcode_request(tile, mbox, request, reply_mask, reply, timeout_base_ms); 364 + }
+11 -1
drivers/gpu/drm/xe/xe_pcode.h
··· 7 7 #define _XE_PCODE_H_ 8 8 9 9 #include <linux/types.h> 10 - struct xe_tile; 10 + 11 + struct drm_device; 11 12 struct xe_device; 13 + struct xe_tile; 12 14 13 15 void xe_pcode_init(struct xe_tile *tile); 14 16 int xe_pcode_probe_early(struct xe_device *xe); ··· 33 31 (FIELD_PREP(PCODE_MB_COMMAND, mbcmd)\ 34 32 | FIELD_PREP(PCODE_MB_PARAM1, param1)\ 35 33 | FIELD_PREP(PCODE_MB_PARAM2, param2)) 34 + 35 + /* Helpers with drm device */ 36 + int intel_pcode_read(struct drm_device *drm, u32 mbox, u32 *val, u32 *val1); 37 + int intel_pcode_write_timeout(struct drm_device *drm, u32 mbox, u32 val, int timeout_ms); 38 + #define intel_pcode_write(drm, mbox, val) \ 39 + intel_pcode_write_timeout((drm), (mbox), (val), 1) 40 + int intel_pcode_request(struct drm_device *drm, u32 mbox, u32 request, 41 + u32 reply_mask, u32 reply, int timeout_base_ms); 36 42 37 43 #endif