[Intel-xe] [RFC PATCH 0/1] drm/xe: Introduce function pointers for MMIO functions

Francois Dugast francois.dugast at intel.com
Fri Jun 2 14:25:00 UTC 2023


This explores a possible code split between generic and device specific
functions. 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.

It is a new look at the series below but focused on the particular case of some
MMIO functions required by Hanaba for simulation:
https://patchwork.freedesktop.org/series/114630

The inline xe_mmio_*() functions in xe_mmio.h are left for convenience and also
to avoid a massive search and replace with xe->mmio_funcs->*() while this RFC is
being discussed. This is the reason why struct xe_mmio_funcs is exposed in
xe_mmio.h for now.

A posssible improvement suggested by Ohad Sharabi is to replace the switch with
a table lookup after device probe, using an index carried by xe_device_desc.

Francois Dugast (1):
  drm/xe: Introduce function pointers for MMIO functions

 drivers/gpu/drm/xe/xe_device_types.h |  3 ++
 drivers/gpu/drm/xe/xe_mmio.c         | 81 ++++++++++++++++++++++++++++
 drivers/gpu/drm/xe/xe_mmio.h         | 35 ++++++------
 3 files changed, 99 insertions(+), 20 deletions(-)

-- 
2.34.1



More information about the Intel-xe mailing list