Skip to content

Commit 5939a69

Browse files
committed
Merge tag 'drm-fixes-2024-01-04' of git://anongit.freedesktop.org/drm/drm
Pull drm fixes from Dave Airlie: "These were from over the holiday period, mainly i915, a couple of qaic, bridge and an mgag200. qaic: - fix GEM import - add quirk for soc version bridge: - parade-ps8640, ti-sn65dsi86: fix aux reads bounds mgag200: - fix gamma LUT init i915: - Fix bogus DPCD rev usage for DP phy test pattern setup - Fix handling of MMIO triggered reports in the OA buffer" * tag 'drm-fixes-2024-01-04' of git://anongit.freedesktop.org/drm/drm: drm/i915/perf: Update handling of MMIO triggered reports drm/i915/dp: Fix passing the correct DPCD_REV for drm_dp_set_phy_test_pattern drm/mgag200: Fix gamma lut not initialized for G200ER, G200EV, G200SE drm/bridge: ps8640: Fix size mismatch warning w/ len drm/bridge: ti-sn65dsi86: Never store more than msg->size bytes in AUX xfer drm/bridge: parade-ps8640: Never store more than msg->size bytes in AUX xfer accel/qaic: Implement quirk for SOC_HW_VERSION accel/qaic: Fix GEM import path code
2 parents ac865f0 + faa21f4 commit 5939a69

File tree

11 files changed

+83
-20
lines changed

11 files changed

+83
-20
lines changed

drivers/accel/qaic/mhi_controller.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,8 +404,21 @@ static struct mhi_controller_config aic100_config = {
404404

405405
static int mhi_read_reg(struct mhi_controller *mhi_cntrl, void __iomem *addr, u32 *out)
406406
{
407-
u32 tmp = readl_relaxed(addr);
407+
u32 tmp;
408408

409+
/*
410+
* SOC_HW_VERSION quirk
411+
* The SOC_HW_VERSION register (offset 0x224) is not reliable and
412+
* may contain uninitialized values, including 0xFFFFFFFF. This could
413+
* cause a false positive link down error. Instead, intercept any
414+
* reads and provide the correct value of the register.
415+
*/
416+
if (addr - mhi_cntrl->regs == 0x224) {
417+
*out = 0x60110200;
418+
return 0;
419+
}
420+
421+
tmp = readl_relaxed(addr);
409422
if (tmp == U32_MAX)
410423
return -EIO;
411424

drivers/accel/qaic/qaic_data.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -777,7 +777,6 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_
777777
struct dma_buf_attachment *attach;
778778
struct drm_gem_object *obj;
779779
struct qaic_bo *bo;
780-
size_t size;
781780
int ret;
782781

783782
bo = qaic_alloc_init_bo();
@@ -795,13 +794,12 @@ struct drm_gem_object *qaic_gem_prime_import(struct drm_device *dev, struct dma_
795794
goto attach_fail;
796795
}
797796

798-
size = PAGE_ALIGN(attach->dmabuf->size);
799-
if (size == 0) {
797+
if (!attach->dmabuf->size) {
800798
ret = -EINVAL;
801799
goto size_align_fail;
802800
}
803801

804-
drm_gem_private_object_init(dev, obj, size);
802+
drm_gem_private_object_init(dev, obj, attach->dmabuf->size);
805803
/*
806804
* skipping dma_buf_map_attachment() as we do not know the direction
807805
* just yet. Once the direction is known in the subsequent IOCTL to

drivers/gpu/drm/bridge/parade-ps8640.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux,
210210
struct ps8640 *ps_bridge = aux_to_ps8640(aux);
211211
struct regmap *map = ps_bridge->regmap[PAGE0_DP_CNTL];
212212
struct device *dev = &ps_bridge->page[PAGE0_DP_CNTL]->dev;
213-
unsigned int len = msg->size;
213+
size_t len = msg->size;
214214
unsigned int data;
215215
unsigned int base;
216216
int ret;
@@ -330,11 +330,12 @@ static ssize_t ps8640_aux_transfer_msg(struct drm_dp_aux *aux,
330330
return ret;
331331
}
332332

333-
buf[i] = data;
333+
if (i < msg->size)
334+
buf[i] = data;
334335
}
335336
}
336337

337-
return len;
338+
return min(len, msg->size);
338339
}
339340

340341
static ssize_t ps8640_aux_transfer(struct drm_dp_aux *aux,

drivers/gpu/drm/bridge/ti-sn65dsi86.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,7 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
527527
u32 request_val = AUX_CMD_REQ(msg->request);
528528
u8 *buf = msg->buffer;
529529
unsigned int len = msg->size;
530+
unsigned int short_len;
530531
unsigned int val;
531532
int ret;
532533
u8 addr_len[SN_AUX_LENGTH_REG + 1 - SN_AUX_ADDR_19_16_REG];
@@ -600,7 +601,8 @@ static ssize_t ti_sn_aux_transfer(struct drm_dp_aux *aux,
600601
}
601602

602603
if (val & AUX_IRQ_STATUS_AUX_SHORT) {
603-
ret = regmap_read(pdata->regmap, SN_AUX_LENGTH_REG, &len);
604+
ret = regmap_read(pdata->regmap, SN_AUX_LENGTH_REG, &short_len);
605+
len = min(len, short_len);
604606
if (ret)
605607
goto exit;
606608
} else if (val & AUX_IRQ_STATUS_NAT_I2C_FAIL) {

drivers/gpu/drm/i915/display/intel_dp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4496,7 +4496,7 @@ static void intel_dp_process_phy_request(struct intel_dp *intel_dp,
44964496
intel_dp->train_set, crtc_state->lane_count);
44974497

44984498
drm_dp_set_phy_test_pattern(&intel_dp->aux, data,
4499-
link_status[DP_DPCD_REV]);
4499+
intel_dp->dpcd[DP_DPCD_REV]);
45004500
}
45014501

45024502
static u8 intel_dp_autotest_phy_pattern(struct intel_dp *intel_dp)

drivers/gpu/drm/i915/i915_perf.c

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -772,10 +772,6 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,
772772
* The reason field includes flags identifying what
773773
* triggered this specific report (mostly timer
774774
* triggered or e.g. due to a context switch).
775-
*
776-
* In MMIO triggered reports, some platforms do not set the
777-
* reason bit in this field and it is valid to have a reason
778-
* field of zero.
779775
*/
780776
reason = oa_report_reason(stream, report);
781777
ctx_id = oa_context_id(stream, report32);
@@ -787,8 +783,41 @@ static int gen8_append_oa_reports(struct i915_perf_stream *stream,
787783
*
788784
* Note: that we don't clear the valid_ctx_bit so userspace can
789785
* understand that the ID has been squashed by the kernel.
786+
*
787+
* Update:
788+
*
789+
* On XEHP platforms the behavior of context id valid bit has
790+
* changed compared to prior platforms. To describe this, we
791+
* define a few terms:
792+
*
793+
* context-switch-report: This is a report with the reason type
794+
* being context-switch. It is generated when a context switches
795+
* out.
796+
*
797+
* context-valid-bit: A bit that is set in the report ID field
798+
* to indicate that a valid context has been loaded.
799+
*
800+
* gpu-idle: A condition characterized by a
801+
* context-switch-report with context-valid-bit set to 0.
802+
*
803+
* On prior platforms, context-id-valid bit is set to 0 only
804+
* when GPU goes idle. In all other reports, it is set to 1.
805+
*
806+
* On XEHP platforms, context-valid-bit is set to 1 in a context
807+
* switch report if a new context switched in. For all other
808+
* reports it is set to 0.
809+
*
810+
* This change in behavior causes an issue with MMIO triggered
811+
* reports. MMIO triggered reports have the markers in the
812+
* context ID field and the context-valid-bit is 0. The logic
813+
* below to squash the context ID would render the report
814+
* useless since the user will not be able to find it in the OA
815+
* buffer. Since MMIO triggered reports exist only on XEHP,
816+
* we should avoid squashing these for XEHP platforms.
790817
*/
791-
if (oa_report_ctx_invalid(stream, report)) {
818+
819+
if (oa_report_ctx_invalid(stream, report) &&
820+
GRAPHICS_VER_FULL(stream->engine->i915) < IP_VER(12, 50)) {
792821
ctx_id = INVALID_CTX_ID;
793822
oa_context_id_squash(stream, report32);
794823
}

drivers/gpu/drm/mgag200/mgag200_drv.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -392,6 +392,11 @@ void mgag200_primary_plane_helper_atomic_disable(struct drm_plane *plane,
392392
.destroy = drm_plane_cleanup, \
393393
DRM_GEM_SHADOW_PLANE_FUNCS
394394

395+
void mgag200_crtc_set_gamma_linear(struct mga_device *mdev, const struct drm_format_info *format);
396+
void mgag200_crtc_set_gamma(struct mga_device *mdev,
397+
const struct drm_format_info *format,
398+
struct drm_color_lut *lut);
399+
395400
enum drm_mode_status mgag200_crtc_helper_mode_valid(struct drm_crtc *crtc,
396401
const struct drm_display_mode *mode);
397402
int mgag200_crtc_helper_atomic_check(struct drm_crtc *crtc, struct drm_atomic_state *new_state);

drivers/gpu/drm/mgag200/mgag200_g200er.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,11 @@ static void mgag200_g200er_crtc_helper_atomic_enable(struct drm_crtc *crtc,
202202

203203
mgag200_g200er_reset_tagfifo(mdev);
204204

205+
if (crtc_state->gamma_lut)
206+
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
207+
else
208+
mgag200_crtc_set_gamma_linear(mdev, format);
209+
205210
mgag200_enable_display(mdev);
206211

207212
if (funcs->enable_vidrst)

drivers/gpu/drm/mgag200/mgag200_g200ev.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ static void mgag200_g200ev_crtc_helper_atomic_enable(struct drm_crtc *crtc,
203203

204204
mgag200_g200ev_set_hiprilvl(mdev);
205205

206+
if (crtc_state->gamma_lut)
207+
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
208+
else
209+
mgag200_crtc_set_gamma_linear(mdev, format);
210+
206211
mgag200_enable_display(mdev);
207212

208213
if (funcs->enable_vidrst)

drivers/gpu/drm/mgag200/mgag200_g200se.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,11 @@ static void mgag200_g200se_crtc_helper_atomic_enable(struct drm_crtc *crtc,
334334

335335
mgag200_g200se_set_hiprilvl(mdev, adjusted_mode, format);
336336

337+
if (crtc_state->gamma_lut)
338+
mgag200_crtc_set_gamma(mdev, format, crtc_state->gamma_lut->data);
339+
else
340+
mgag200_crtc_set_gamma_linear(mdev, format);
341+
337342
mgag200_enable_display(mdev);
338343

339344
if (funcs->enable_vidrst)

0 commit comments

Comments
 (0)