On Tue, Dec 02, 2025 at 04:48:02PM -0800, Umesh Nerlige Ramappa wrote:
SoC remapper is used to map different HW functions in the SoC to their
respective drivers. Initialize SoC remapper during driver load.
Signed-off-by: Umesh Nerlige Ramappa <umesh.nerlige.ramappa@intel.com>
---
v2: (Ashutosh/Lucas)
- s/remapper/soc_remapper/
- return status from init during probe
- reorder patches 1 and 2 from earlier series
- fix copyright year
v3: (Michal, Badal)
- Kernel doc fixes
- Alphabetical order for headers/objects
- Add has_soc_remapper
- Drop unnecessary headers
---
drivers/gpu/drm/xe/Makefile | 1 +
drivers/gpu/drm/xe/xe_device.c | 5 +++++
drivers/gpu/drm/xe/xe_device_types.h | 8 ++++++++
drivers/gpu/drm/xe/xe_pci.c | 2 ++
drivers/gpu/drm/xe/xe_pci_types.h | 2 ++
drivers/gpu/drm/xe/xe_soc_remapper.c | 24 ++++++++++++++++++++++++
drivers/gpu/drm/xe/xe_soc_remapper.h | 13 +++++++++++++
7 files changed, 55 insertions(+)
create mode 100644 drivers/gpu/drm/xe/xe_soc_remapper.c
create mode 100644 drivers/gpu/drm/xe/xe_soc_remapper.h
diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile
index 0eadfeda67d9..06c3987afd4c 100644
--- a/drivers/gpu/drm/xe/Makefile
+++ b/drivers/gpu/drm/xe/Makefile
@@ -115,6 +115,7 @@ xe-y += xe_bb.o \
xe_sa.o \
xe_sched_job.o \
xe_shrinker.o \
+ xe_soc_remapper.o \
xe_step.o \
xe_survivability_mode.o \
xe_sync.o \
diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c
index 92f883dd8877..b54fc5852fef 100644
--- a/drivers/gpu/drm/xe/xe_device.c
+++ b/drivers/gpu/drm/xe/xe_device.c
@@ -61,6 +61,7 @@
#include "xe_pxp.h"
#include "xe_query.h"
#include "xe_shrinker.h"
+#include "xe_soc_remapper.h"
#include "xe_survivability_mode.h"
#include "xe_sriov.h"
#include "xe_tile.h"
@@ -906,6 +907,10 @@ int xe_device_probe(struct xe_device *xe)
xe_nvm_init(xe);
+ err = xe_soc_remapper_init(xe);
+ if (err)
+ return err;
+
err = xe_heci_gsc_init(xe);
if (err)
return err;
diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h
index 9a9a8eb84a78..450fe703a3b9 100644
--- a/drivers/gpu/drm/xe/xe_device_types.h
+++ b/drivers/gpu/drm/xe/xe_device_types.h
@@ -315,6 +315,8 @@ struct xe_device {
u8 has_pxp:1;
/** @info.has_range_tlb_inval: Has range based TLB invalidations */
u8 has_range_tlb_inval:1;
+ /** @info.has_soc_remapper: Has SoC remapper support */
+ u8 has_soc_remapper:1;
/** @info.has_sriov: Supports SR-IOV */
u8 has_sriov:1;
/** @info.has_usm: Device has unified shared memory support */
@@ -555,6 +557,12 @@ struct xe_device {
struct mutex lock;
} pmt;
+ /** @soc_remapper: SoC remapper object */
+ struct {
+ /** @soc_remapper.lock: Serialize access to SoC Remapper's index registers */
+ spinlock_t lock;
+ } soc_remapper;
+
/**
* @pm_callback_task: Track the active task that is running in either
* the runtime_suspend or runtime_resume callbacks.
diff --git a/drivers/gpu/drm/xe/xe_pci.c b/drivers/gpu/drm/xe/xe_pci.c
index 75e3588242c7..ec0fed691fa0 100644
--- a/drivers/gpu/drm/xe/xe_pci.c
+++ b/drivers/gpu/drm/xe/xe_pci.c
@@ -413,6 +413,7 @@ static const struct xe_device_desc cri_desc = {
.has_flat_ccs = false,
.has_mbx_power_limits = true,
.has_mert = true,
+ .has_soc_remapper = true,
Needs to be enabled for BMG also, hence the BAT failure.
We should use has_soc_remapper not just for protecting spinlock initialization, but also for guarding soc remapper accesses.
Since there are two soc remappers—SC and Telemetry—we could update has_soc_remapper to use 2 bits (u8 has_soc_remapper:2), and set only the relevant bits in the platform descriptor. For example:
static const struct xe_device_desc bmg_desc = {
.has_soc_remapper = SOC_REMAP_TELEM
static const struct xe_device_desc cri_desc = {
.has_soc_remapper = SOC_REMAP_TELEM | SOC_REMAP_SC
If we prefer a true/false approach, we should use two separate flags: has_soc_telem_remapper and has_soc_sc_remapper.
Thanks,
Badal
Umesh