Skip to content

Commit faa21f4

Browse files
committed
Merge tag 'drm-misc-fixes-2024-01-03' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
drm-misc-fixes for v6.7 final: - 2 small qaic fixes. - Fixes for overflow in aux xfer. - Fix uninitialised gamma lut in gmag200. - Small compiler warning fix for backports of a ps8640 fix. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/9ba866b4-3144-47a9-a2c0-7313c67249d7@linux.intel.com
2 parents bc2fdea + 11f9eb8 commit faa21f4

File tree

9 files changed

+48
-14
lines changed

9 files changed

+48
-14
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/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)

drivers/gpu/drm/mgag200/mgag200_mode.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
* This file contains setup code for the CRTC.
2929
*/
3030

31-
static void mgag200_crtc_set_gamma_linear(struct mga_device *mdev,
32-
const struct drm_format_info *format)
31+
void mgag200_crtc_set_gamma_linear(struct mga_device *mdev,
32+
const struct drm_format_info *format)
3333
{
3434
int i;
3535

@@ -65,9 +65,9 @@ static void mgag200_crtc_set_gamma_linear(struct mga_device *mdev,
6565
}
6666
}
6767

68-
static void mgag200_crtc_set_gamma(struct mga_device *mdev,
69-
const struct drm_format_info *format,
70-
struct drm_color_lut *lut)
68+
void mgag200_crtc_set_gamma(struct mga_device *mdev,
69+
const struct drm_format_info *format,
70+
struct drm_color_lut *lut)
7171
{
7272
int i;
7373

0 commit comments

Comments
 (0)