[Intel-xe] [RFC PATCH v3 0/3] Split code between common and platform specific

Francois Dugast francois.dugast at intel.com
Thu Mar 16 13:01:22 UTC 2023


This patch series explores a code split between common code and
platform specific code. The minimal hardware abstraction layer is
implemented with a structure of function pointers, similarly to what
is done in accel/habanalabs and in drm/amd/amdgpu.

The objective is to ease the addition of new platforms by limiting
the need to modify the common code and centralizing specific code in
separate functions, potentially in their own file.

v2:
  - Remove platform files and leave platform specific code along common
    code to ease the use of helpers
  - Break down global function pointer structure into smaller
    structures defined and initialized locally per area / compilation unit
    in order to limit exposure of inner details
  - Refactor functions in xe_guc_pc.c to provide more examples
  - Add fake new platform to show impact on code
v3:
  - Leave wrapper functions
  - Use const pointers
  - Assign const pointers to the struct rather than individual function
    pointers members

Francois Dugast (3):
  drm/xe: Introduce function pointers in xe_gt.c with local structure
  drm/xe: Introduce function pointers in xe_guc_pc.c with local
    structure
  drm/xe: Add platform specific functions for a new platform

 drivers/gpu/drm/xe/Makefile            |  1 +
 drivers/gpu/drm/xe/xe_device_types.h   |  2 ++
 drivers/gpu/drm/xe/xe_gt.c             | 49 +++++++++++++++++++++----
 drivers/gpu/drm/xe/xe_gt.h             |  4 +++
 drivers/gpu/drm/xe/xe_guc_pc.c         | 50 +++++++++++++++++++++-----
 drivers/gpu/drm/xe/xe_guc_pc.h         |  5 +++
 drivers/gpu/drm/xe/xe_newplatform.c    | 34 ++++++++++++++++++
 drivers/gpu/drm/xe/xe_newplatform.h    | 15 ++++++++
 drivers/gpu/drm/xe/xe_platform_types.h |  1 +
 9 files changed, 147 insertions(+), 14 deletions(-)
 create mode 100644 drivers/gpu/drm/xe/xe_newplatform.c
 create mode 100644 drivers/gpu/drm/xe/xe_newplatform.h

-- 
2.25.1



More information about the Intel-xe mailing list