mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-22 07:27:12 +08:00
Merge tag 'drm-xe-fixes-2025-06-26' of https://gitlab.freedesktop.org/drm/xe/kernel into drm-fixes
UAPI Changes: Driver Changes: - Missing error check (Haoxiang Li) - Fix xe_hwmon_power_max_write (Karthik) - Move flushes (Maarten and Matthew Auld) - Explicitly exit CT safe mode on unwind (Michal) - Process deferred GGTT node removals on device unwind (Michal) Signed-off-by: Dave Airlie <airlied@redhat.com> From: Thomas Hellstrom <thomas.hellstrom@linux.intel.com> Link: https://lore.kernel.org/r/aF1T6EzzC3xj4K4H@fedora
This commit is contained in:
@@ -104,6 +104,8 @@ int xe_display_create(struct xe_device *xe)
|
||||
spin_lock_init(&xe->display.fb_tracking.lock);
|
||||
|
||||
xe->display.hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
|
||||
if (!xe->display.hotplug.dp_wq)
|
||||
return -ENOMEM;
|
||||
|
||||
return drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@ u32 intel_dsb_buffer_ggtt_offset(struct intel_dsb_buffer *dsb_buf)
|
||||
|
||||
void intel_dsb_buffer_write(struct intel_dsb_buffer *dsb_buf, u32 idx, u32 val)
|
||||
{
|
||||
struct xe_device *xe = dsb_buf->vma->bo->tile->xe;
|
||||
|
||||
iosys_map_wr(&dsb_buf->vma->bo->vmap, idx * 4, u32, val);
|
||||
xe_device_l2_flush(xe);
|
||||
}
|
||||
|
||||
u32 intel_dsb_buffer_read(struct intel_dsb_buffer *dsb_buf, u32 idx)
|
||||
@@ -30,12 +27,9 @@ u32 intel_dsb_buffer_read(struct intel_dsb_buffer *dsb_buf, u32 idx)
|
||||
|
||||
void intel_dsb_buffer_memset(struct intel_dsb_buffer *dsb_buf, u32 idx, u32 val, size_t size)
|
||||
{
|
||||
struct xe_device *xe = dsb_buf->vma->bo->tile->xe;
|
||||
|
||||
WARN_ON(idx > (dsb_buf->buf_size - size) / sizeof(*dsb_buf->cmd_buf));
|
||||
|
||||
iosys_map_memset(&dsb_buf->vma->bo->vmap, idx * 4, val, size);
|
||||
xe_device_l2_flush(xe);
|
||||
}
|
||||
|
||||
bool intel_dsb_buffer_create(struct intel_crtc *crtc, struct intel_dsb_buffer *dsb_buf, size_t size)
|
||||
@@ -74,9 +68,12 @@ void intel_dsb_buffer_cleanup(struct intel_dsb_buffer *dsb_buf)
|
||||
|
||||
void intel_dsb_buffer_flush_map(struct intel_dsb_buffer *dsb_buf)
|
||||
{
|
||||
struct xe_device *xe = dsb_buf->vma->bo->tile->xe;
|
||||
|
||||
/*
|
||||
* The memory barrier here is to ensure coherency of DSB vs MMIO,
|
||||
* both for weak ordering archs and discrete cards.
|
||||
*/
|
||||
xe_device_wmb(dsb_buf->vma->bo->tile->xe);
|
||||
xe_device_wmb(xe);
|
||||
xe_device_l2_flush(xe);
|
||||
}
|
||||
|
||||
@@ -164,6 +164,9 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
|
||||
|
||||
vma->dpt = dpt;
|
||||
vma->node = dpt->ggtt_node[tile0->id];
|
||||
|
||||
/* Ensure DPT writes are flushed */
|
||||
xe_device_l2_flush(xe);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -333,8 +336,6 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
|
||||
if (ret)
|
||||
goto err_unpin;
|
||||
|
||||
/* Ensure DPT writes are flushed */
|
||||
xe_device_l2_flush(xe);
|
||||
return vma;
|
||||
|
||||
err_unpin:
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
#define PCU_CR_PACKAGE_RAPL_LIMIT XE_REG(MCHBAR_MIRROR_BASE_SNB + 0x59a0)
|
||||
#define PWR_LIM_VAL REG_GENMASK(14, 0)
|
||||
#define PWR_LIM_EN REG_BIT(15)
|
||||
#define PWR_LIM REG_GENMASK(15, 0)
|
||||
#define PWR_LIM_TIME REG_GENMASK(23, 17)
|
||||
#define PWR_LIM_TIME_X REG_GENMASK(23, 22)
|
||||
#define PWR_LIM_TIME_Y REG_GENMASK(21, 17)
|
||||
|
||||
@@ -201,6 +201,13 @@ static const struct xe_ggtt_pt_ops xelpg_pt_wa_ops = {
|
||||
.ggtt_set_pte = xe_ggtt_set_pte_and_flush,
|
||||
};
|
||||
|
||||
static void dev_fini_ggtt(void *arg)
|
||||
{
|
||||
struct xe_ggtt *ggtt = arg;
|
||||
|
||||
drain_workqueue(ggtt->wq);
|
||||
}
|
||||
|
||||
/**
|
||||
* xe_ggtt_init_early - Early GGTT initialization
|
||||
* @ggtt: the &xe_ggtt to be initialized
|
||||
@@ -257,6 +264,10 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = devm_add_action_or_reset(xe->drm.dev, dev_fini_ggtt, ggtt);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
if (IS_SRIOV_VF(xe)) {
|
||||
err = xe_gt_sriov_vf_prepare_ggtt(xe_tile_get_gt(ggtt->tile, 0));
|
||||
if (err)
|
||||
|
||||
@@ -34,6 +34,11 @@
|
||||
#include "xe_pm.h"
|
||||
#include "xe_trace_guc.h"
|
||||
|
||||
static void receive_g2h(struct xe_guc_ct *ct);
|
||||
static void g2h_worker_func(struct work_struct *w);
|
||||
static void safe_mode_worker_func(struct work_struct *w);
|
||||
static void ct_exit_safe_mode(struct xe_guc_ct *ct);
|
||||
|
||||
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
|
||||
enum {
|
||||
/* Internal states, not error conditions */
|
||||
@@ -186,14 +191,11 @@ static void guc_ct_fini(struct drm_device *drm, void *arg)
|
||||
{
|
||||
struct xe_guc_ct *ct = arg;
|
||||
|
||||
ct_exit_safe_mode(ct);
|
||||
destroy_workqueue(ct->g2h_wq);
|
||||
xa_destroy(&ct->fence_lookup);
|
||||
}
|
||||
|
||||
static void receive_g2h(struct xe_guc_ct *ct);
|
||||
static void g2h_worker_func(struct work_struct *w);
|
||||
static void safe_mode_worker_func(struct work_struct *w);
|
||||
|
||||
static void primelockdep(struct xe_guc_ct *ct)
|
||||
{
|
||||
if (!IS_ENABLED(CONFIG_LOCKDEP))
|
||||
|
||||
@@ -159,8 +159,8 @@ static int xe_hwmon_pcode_read_power_limit(const struct xe_hwmon *hwmon, u32 att
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int xe_hwmon_pcode_write_power_limit(const struct xe_hwmon *hwmon, u32 attr, u8 channel,
|
||||
u32 uval)
|
||||
static int xe_hwmon_pcode_rmw_power_limit(const struct xe_hwmon *hwmon, u32 attr, u8 channel,
|
||||
u32 clr, u32 set)
|
||||
{
|
||||
struct xe_tile *root_tile = xe_device_get_root_tile(hwmon->xe);
|
||||
u32 val0, val1;
|
||||
@@ -179,7 +179,7 @@ static int xe_hwmon_pcode_write_power_limit(const struct xe_hwmon *hwmon, u32 at
|
||||
channel, val0, val1, ret);
|
||||
|
||||
if (attr == PL1_HWMON_ATTR)
|
||||
val0 = uval;
|
||||
val0 = (val0 & ~clr) | set;
|
||||
else
|
||||
return -EIO;
|
||||
|
||||
@@ -339,7 +339,7 @@ static int xe_hwmon_power_max_write(struct xe_hwmon *hwmon, u32 attr, int channe
|
||||
if (hwmon->xe->info.has_mbx_power_limits) {
|
||||
drm_dbg(&hwmon->xe->drm, "disabling %s on channel %d\n",
|
||||
PWR_ATTR_TO_STR(attr), channel);
|
||||
xe_hwmon_pcode_write_power_limit(hwmon, attr, channel, 0);
|
||||
xe_hwmon_pcode_rmw_power_limit(hwmon, attr, channel, PWR_LIM_EN, 0);
|
||||
xe_hwmon_pcode_read_power_limit(hwmon, attr, channel, ®_val);
|
||||
} else {
|
||||
reg_val = xe_mmio_rmw32(mmio, rapl_limit, PWR_LIM_EN, 0);
|
||||
@@ -370,10 +370,9 @@ static int xe_hwmon_power_max_write(struct xe_hwmon *hwmon, u32 attr, int channe
|
||||
}
|
||||
|
||||
if (hwmon->xe->info.has_mbx_power_limits)
|
||||
ret = xe_hwmon_pcode_write_power_limit(hwmon, attr, channel, reg_val);
|
||||
ret = xe_hwmon_pcode_rmw_power_limit(hwmon, attr, channel, PWR_LIM, reg_val);
|
||||
else
|
||||
reg_val = xe_mmio_rmw32(mmio, rapl_limit, PWR_LIM_EN | PWR_LIM_VAL,
|
||||
reg_val);
|
||||
reg_val = xe_mmio_rmw32(mmio, rapl_limit, PWR_LIM, reg_val);
|
||||
unlock:
|
||||
mutex_unlock(&hwmon->hwmon_lock);
|
||||
return ret;
|
||||
@@ -563,14 +562,11 @@ xe_hwmon_power_max_interval_store(struct device *dev, struct device_attribute *a
|
||||
|
||||
mutex_lock(&hwmon->hwmon_lock);
|
||||
|
||||
if (hwmon->xe->info.has_mbx_power_limits) {
|
||||
ret = xe_hwmon_pcode_read_power_limit(hwmon, power_attr, channel, (u32 *)&r);
|
||||
r = (r & ~PWR_LIM_TIME) | rxy;
|
||||
xe_hwmon_pcode_write_power_limit(hwmon, power_attr, channel, r);
|
||||
} else {
|
||||
if (hwmon->xe->info.has_mbx_power_limits)
|
||||
xe_hwmon_pcode_rmw_power_limit(hwmon, power_attr, channel, PWR_LIM_TIME, rxy);
|
||||
else
|
||||
r = xe_mmio_rmw32(mmio, xe_hwmon_get_reg(hwmon, REG_PKG_RAPL_LIMIT, channel),
|
||||
PWR_LIM_TIME, rxy);
|
||||
}
|
||||
|
||||
mutex_unlock(&hwmon->hwmon_lock);
|
||||
|
||||
@@ -1138,12 +1134,12 @@ xe_hwmon_get_preregistration_info(struct xe_hwmon *hwmon)
|
||||
} else {
|
||||
drm_info(&hwmon->xe->drm, "Using mailbox commands for power limits\n");
|
||||
/* Write default limits to read from pcode from now on. */
|
||||
xe_hwmon_pcode_write_power_limit(hwmon, PL1_HWMON_ATTR,
|
||||
CHANNEL_CARD,
|
||||
hwmon->pl1_on_boot[CHANNEL_CARD]);
|
||||
xe_hwmon_pcode_write_power_limit(hwmon, PL1_HWMON_ATTR,
|
||||
CHANNEL_PKG,
|
||||
hwmon->pl1_on_boot[CHANNEL_PKG]);
|
||||
xe_hwmon_pcode_rmw_power_limit(hwmon, PL1_HWMON_ATTR,
|
||||
CHANNEL_CARD, PWR_LIM | PWR_LIM_TIME,
|
||||
hwmon->pl1_on_boot[CHANNEL_CARD]);
|
||||
xe_hwmon_pcode_rmw_power_limit(hwmon, PL1_HWMON_ATTR,
|
||||
CHANNEL_PKG, PWR_LIM | PWR_LIM_TIME,
|
||||
hwmon->pl1_on_boot[CHANNEL_PKG]);
|
||||
hwmon->scl_shift_power = PWR_UNIT;
|
||||
hwmon->scl_shift_energy = ENERGY_UNIT;
|
||||
hwmon->scl_shift_time = TIME_UNIT;
|
||||
|
||||
Reference in New Issue
Block a user