Skip to content

Commit 6daaa47

Browse files
committed
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 <[email protected]> From: Thomas Hellstrom <[email protected]> Link: https://lore.kernel.org/r/aF1T6EzzC3xj4K4H@fedora
2 parents b6211ab + af2b588 commit 6daaa47

File tree

7 files changed

+42
-32
lines changed

7 files changed

+42
-32
lines changed

drivers/gpu/drm/xe/display/xe_display.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ int xe_display_create(struct xe_device *xe)
104104
spin_lock_init(&xe->display.fb_tracking.lock);
105105

106106
xe->display.hotplug.dp_wq = alloc_ordered_workqueue("xe-dp", 0);
107+
if (!xe->display.hotplug.dp_wq)
108+
return -ENOMEM;
107109

108110
return drmm_add_action_or_reset(&xe->drm, display_destroy, NULL);
109111
}

drivers/gpu/drm/xe/display/xe_dsb_buffer.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,7 @@ u32 intel_dsb_buffer_ggtt_offset(struct intel_dsb_buffer *dsb_buf)
1717

1818
void intel_dsb_buffer_write(struct intel_dsb_buffer *dsb_buf, u32 idx, u32 val)
1919
{
20-
struct xe_device *xe = dsb_buf->vma->bo->tile->xe;
21-
2220
iosys_map_wr(&dsb_buf->vma->bo->vmap, idx * 4, u32, val);
23-
xe_device_l2_flush(xe);
2421
}
2522

2623
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)
3027

3128
void intel_dsb_buffer_memset(struct intel_dsb_buffer *dsb_buf, u32 idx, u32 val, size_t size)
3229
{
33-
struct xe_device *xe = dsb_buf->vma->bo->tile->xe;
34-
3530
WARN_ON(idx > (dsb_buf->buf_size - size) / sizeof(*dsb_buf->cmd_buf));
3631

3732
iosys_map_memset(&dsb_buf->vma->bo->vmap, idx * 4, val, size);
38-
xe_device_l2_flush(xe);
3933
}
4034

4135
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)
7468

7569
void intel_dsb_buffer_flush_map(struct intel_dsb_buffer *dsb_buf)
7670
{
71+
struct xe_device *xe = dsb_buf->vma->bo->tile->xe;
72+
7773
/*
7874
* The memory barrier here is to ensure coherency of DSB vs MMIO,
7975
* both for weak ordering archs and discrete cards.
8076
*/
81-
xe_device_wmb(dsb_buf->vma->bo->tile->xe);
77+
xe_device_wmb(xe);
78+
xe_device_l2_flush(xe);
8279
}

drivers/gpu/drm/xe/display/xe_fb_pin.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,9 @@ static int __xe_pin_fb_vma_dpt(const struct intel_framebuffer *fb,
164164

165165
vma->dpt = dpt;
166166
vma->node = dpt->ggtt_node[tile0->id];
167+
168+
/* Ensure DPT writes are flushed */
169+
xe_device_l2_flush(xe);
167170
return 0;
168171
}
169172

@@ -333,8 +336,6 @@ static struct i915_vma *__xe_pin_fb_vma(const struct intel_framebuffer *fb,
333336
if (ret)
334337
goto err_unpin;
335338

336-
/* Ensure DPT writes are flushed */
337-
xe_device_l2_flush(xe);
338339
return vma;
339340

340341
err_unpin:

drivers/gpu/drm/xe/regs/xe_mchbar_regs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
#define PCU_CR_PACKAGE_RAPL_LIMIT XE_REG(MCHBAR_MIRROR_BASE_SNB + 0x59a0)
4141
#define PWR_LIM_VAL REG_GENMASK(14, 0)
4242
#define PWR_LIM_EN REG_BIT(15)
43+
#define PWR_LIM REG_GENMASK(15, 0)
4344
#define PWR_LIM_TIME REG_GENMASK(23, 17)
4445
#define PWR_LIM_TIME_X REG_GENMASK(23, 22)
4546
#define PWR_LIM_TIME_Y REG_GENMASK(21, 17)

drivers/gpu/drm/xe/xe_ggtt.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,13 @@ static const struct xe_ggtt_pt_ops xelpg_pt_wa_ops = {
201201
.ggtt_set_pte = xe_ggtt_set_pte_and_flush,
202202
};
203203

204+
static void dev_fini_ggtt(void *arg)
205+
{
206+
struct xe_ggtt *ggtt = arg;
207+
208+
drain_workqueue(ggtt->wq);
209+
}
210+
204211
/**
205212
* xe_ggtt_init_early - Early GGTT initialization
206213
* @ggtt: the &xe_ggtt to be initialized
@@ -257,6 +264,10 @@ int xe_ggtt_init_early(struct xe_ggtt *ggtt)
257264
if (err)
258265
return err;
259266

267+
err = devm_add_action_or_reset(xe->drm.dev, dev_fini_ggtt, ggtt);
268+
if (err)
269+
return err;
270+
260271
if (IS_SRIOV_VF(xe)) {
261272
err = xe_gt_sriov_vf_prepare_ggtt(xe_tile_get_gt(ggtt->tile, 0));
262273
if (err)

drivers/gpu/drm/xe/xe_guc_ct.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
#include "xe_pm.h"
3535
#include "xe_trace_guc.h"
3636

37+
static void receive_g2h(struct xe_guc_ct *ct);
38+
static void g2h_worker_func(struct work_struct *w);
39+
static void safe_mode_worker_func(struct work_struct *w);
40+
static void ct_exit_safe_mode(struct xe_guc_ct *ct);
41+
3742
#if IS_ENABLED(CONFIG_DRM_XE_DEBUG)
3843
enum {
3944
/* Internal states, not error conditions */
@@ -186,14 +191,11 @@ static void guc_ct_fini(struct drm_device *drm, void *arg)
186191
{
187192
struct xe_guc_ct *ct = arg;
188193

194+
ct_exit_safe_mode(ct);
189195
destroy_workqueue(ct->g2h_wq);
190196
xa_destroy(&ct->fence_lookup);
191197
}
192198

193-
static void receive_g2h(struct xe_guc_ct *ct);
194-
static void g2h_worker_func(struct work_struct *w);
195-
static void safe_mode_worker_func(struct work_struct *w);
196-
197199
static void primelockdep(struct xe_guc_ct *ct)
198200
{
199201
if (!IS_ENABLED(CONFIG_LOCKDEP))

drivers/gpu/drm/xe/xe_hwmon.c

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,8 @@ static int xe_hwmon_pcode_read_power_limit(const struct xe_hwmon *hwmon, u32 att
159159
return ret;
160160
}
161161

162-
static int xe_hwmon_pcode_write_power_limit(const struct xe_hwmon *hwmon, u32 attr, u8 channel,
163-
u32 uval)
162+
static int xe_hwmon_pcode_rmw_power_limit(const struct xe_hwmon *hwmon, u32 attr, u8 channel,
163+
u32 clr, u32 set)
164164
{
165165
struct xe_tile *root_tile = xe_device_get_root_tile(hwmon->xe);
166166
u32 val0, val1;
@@ -179,7 +179,7 @@ static int xe_hwmon_pcode_write_power_limit(const struct xe_hwmon *hwmon, u32 at
179179
channel, val0, val1, ret);
180180

181181
if (attr == PL1_HWMON_ATTR)
182-
val0 = uval;
182+
val0 = (val0 & ~clr) | set;
183183
else
184184
return -EIO;
185185

@@ -339,7 +339,7 @@ static int xe_hwmon_power_max_write(struct xe_hwmon *hwmon, u32 attr, int channe
339339
if (hwmon->xe->info.has_mbx_power_limits) {
340340
drm_dbg(&hwmon->xe->drm, "disabling %s on channel %d\n",
341341
PWR_ATTR_TO_STR(attr), channel);
342-
xe_hwmon_pcode_write_power_limit(hwmon, attr, channel, 0);
342+
xe_hwmon_pcode_rmw_power_limit(hwmon, attr, channel, PWR_LIM_EN, 0);
343343
xe_hwmon_pcode_read_power_limit(hwmon, attr, channel, &reg_val);
344344
} else {
345345
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
370370
}
371371

372372
if (hwmon->xe->info.has_mbx_power_limits)
373-
ret = xe_hwmon_pcode_write_power_limit(hwmon, attr, channel, reg_val);
373+
ret = xe_hwmon_pcode_rmw_power_limit(hwmon, attr, channel, PWR_LIM, reg_val);
374374
else
375-
reg_val = xe_mmio_rmw32(mmio, rapl_limit, PWR_LIM_EN | PWR_LIM_VAL,
376-
reg_val);
375+
reg_val = xe_mmio_rmw32(mmio, rapl_limit, PWR_LIM, reg_val);
377376
unlock:
378377
mutex_unlock(&hwmon->hwmon_lock);
379378
return ret;
@@ -563,14 +562,11 @@ xe_hwmon_power_max_interval_store(struct device *dev, struct device_attribute *a
563562

564563
mutex_lock(&hwmon->hwmon_lock);
565564

566-
if (hwmon->xe->info.has_mbx_power_limits) {
567-
ret = xe_hwmon_pcode_read_power_limit(hwmon, power_attr, channel, (u32 *)&r);
568-
r = (r & ~PWR_LIM_TIME) | rxy;
569-
xe_hwmon_pcode_write_power_limit(hwmon, power_attr, channel, r);
570-
} else {
565+
if (hwmon->xe->info.has_mbx_power_limits)
566+
xe_hwmon_pcode_rmw_power_limit(hwmon, power_attr, channel, PWR_LIM_TIME, rxy);
567+
else
571568
r = xe_mmio_rmw32(mmio, xe_hwmon_get_reg(hwmon, REG_PKG_RAPL_LIMIT, channel),
572569
PWR_LIM_TIME, rxy);
573-
}
574570

575571
mutex_unlock(&hwmon->hwmon_lock);
576572

@@ -1138,12 +1134,12 @@ xe_hwmon_get_preregistration_info(struct xe_hwmon *hwmon)
11381134
} else {
11391135
drm_info(&hwmon->xe->drm, "Using mailbox commands for power limits\n");
11401136
/* Write default limits to read from pcode from now on. */
1141-
xe_hwmon_pcode_write_power_limit(hwmon, PL1_HWMON_ATTR,
1142-
CHANNEL_CARD,
1143-
hwmon->pl1_on_boot[CHANNEL_CARD]);
1144-
xe_hwmon_pcode_write_power_limit(hwmon, PL1_HWMON_ATTR,
1145-
CHANNEL_PKG,
1146-
hwmon->pl1_on_boot[CHANNEL_PKG]);
1137+
xe_hwmon_pcode_rmw_power_limit(hwmon, PL1_HWMON_ATTR,
1138+
CHANNEL_CARD, PWR_LIM | PWR_LIM_TIME,
1139+
hwmon->pl1_on_boot[CHANNEL_CARD]);
1140+
xe_hwmon_pcode_rmw_power_limit(hwmon, PL1_HWMON_ATTR,
1141+
CHANNEL_PKG, PWR_LIM | PWR_LIM_TIME,
1142+
hwmon->pl1_on_boot[CHANNEL_PKG]);
11471143
hwmon->scl_shift_power = PWR_UNIT;
11481144
hwmon->scl_shift_energy = ENERGY_UNIT;
11491145
hwmon->scl_shift_time = TIME_UNIT;

0 commit comments

Comments
 (0)