Files
linux/drivers/gpu/drm/xe/xe_soc_remapper.c
Michal Wajdeczko 8965e00883 drm/xe: Move xe_root_tile_mmio() to xe_device.h
It seems to be a better place for this helper function, where
we already have other 'root' oriented helpers.

Signed-off-by: Michal Wajdeczko <michal.wajdeczko@intel.com>
Reviewed-by: Stuart Summers <stuart.summers@intel.com>
Reviewed-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patch.msgid.link/20260203211240.745-2-michal.wajdeczko@intel.com
2026-02-05 21:08:28 +01:00

54 lines
1.4 KiB
C

// SPDX-License-Identifier: MIT
/*
* Copyright © 2025 Intel Corporation
*/
#include "regs/xe_soc_remapper_regs.h"
#include "xe_device.h"
#include "xe_mmio.h"
#include "xe_soc_remapper.h"
static void xe_soc_remapper_set_region(struct xe_device *xe, struct xe_reg reg,
u32 mask, u32 val)
{
guard(spinlock_irqsave)(&xe->soc_remapper.lock);
xe_mmio_rmw32(xe_root_tile_mmio(xe), reg, mask, val);
}
static void xe_soc_remapper_set_telem_region(struct xe_device *xe, u32 index)
{
xe_soc_remapper_set_region(xe, SG_REMAP_INDEX1, SG_REMAP_TELEM_MASK,
REG_FIELD_PREP(SG_REMAP_TELEM_MASK, index));
}
static void xe_soc_remapper_set_sysctrl_region(struct xe_device *xe, u32 index)
{
xe_soc_remapper_set_region(xe, SG_REMAP_INDEX1, SG_REMAP_SYSCTRL_MASK,
REG_FIELD_PREP(SG_REMAP_SYSCTRL_MASK, index));
}
/**
* xe_soc_remapper_init() - Initialize SoC remapper
* @xe: Pointer to xe device.
*
* Initialize SoC remapper.
*
* Return: 0 on success, error code on failure
*/
int xe_soc_remapper_init(struct xe_device *xe)
{
bool has_soc_remapper = xe->info.has_soc_remapper_telem ||
xe->info.has_soc_remapper_sysctrl;
if (has_soc_remapper)
spin_lock_init(&xe->soc_remapper.lock);
if (xe->info.has_soc_remapper_telem)
xe->soc_remapper.set_telem_region = xe_soc_remapper_set_telem_region;
if (xe->info.has_soc_remapper_sysctrl)
xe->soc_remapper.set_sysctrl_region = xe_soc_remapper_set_sysctrl_region;
return 0;
}