Skip to content

Commit 8ba371c

Browse files
committed
Merge tag 'drm-misc-fixes-2023-08-10' of git://anongit.freedesktop.org/drm/drm-misc into drm-fixes
Multiple fixes for nouveau around memory safety and DisplayPort, one fix to reduce the log level of rockchip, a power state fix for the it6505 bridge, a timing fix for the lt9611 bridge, a cache maintenance fix for ivpu and one to reset vma->vm_ops on mmap for shmem-helper. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <mripard@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/fwed6gzdtkse5ocrgd37elhyw7qirfptsvfp5mqqverdzifhxj@4da3vesxcqp2
2 parents 52a93d3 + 07dd476 commit 8ba371c

File tree

14 files changed

+92
-28
lines changed

14 files changed

+92
-28
lines changed

drivers/accel/ivpu/ivpu_gem.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ static void internal_free_pages_locked(struct ivpu_bo *bo)
173173
{
174174
unsigned int i, npages = bo->base.size >> PAGE_SHIFT;
175175

176+
if (ivpu_bo_cache_mode(bo) != DRM_IVPU_BO_CACHED)
177+
set_pages_array_wb(bo->pages, bo->base.size >> PAGE_SHIFT);
178+
176179
for (i = 0; i < npages; i++)
177180
put_page(bo->pages[i]);
178181

@@ -587,6 +590,11 @@ ivpu_bo_alloc_internal(struct ivpu_device *vdev, u64 vpu_addr, u64 size, u32 fla
587590
if (ivpu_bo_cache_mode(bo) != DRM_IVPU_BO_CACHED)
588591
drm_clflush_pages(bo->pages, bo->base.size >> PAGE_SHIFT);
589592

593+
if (bo->flags & DRM_IVPU_BO_WC)
594+
set_pages_array_wc(bo->pages, bo->base.size >> PAGE_SHIFT);
595+
else if (bo->flags & DRM_IVPU_BO_UNCACHED)
596+
set_pages_array_uc(bo->pages, bo->base.size >> PAGE_SHIFT);
597+
590598
prot = ivpu_bo_pgprot(bo, PAGE_KERNEL);
591599
bo->kvaddr = vmap(bo->pages, bo->base.size >> PAGE_SHIFT, VM_MAP, prot);
592600
if (!bo->kvaddr) {

drivers/gpu/drm/bridge/ite-it6505.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,9 +2517,11 @@ static irqreturn_t it6505_int_threaded_handler(int unused, void *data)
25172517
};
25182518
int int_status[3], i;
25192519

2520-
if (it6505->enable_drv_hold || pm_runtime_get_if_in_use(dev) <= 0)
2520+
if (it6505->enable_drv_hold || !it6505->powered)
25212521
return IRQ_HANDLED;
25222522

2523+
pm_runtime_get_sync(dev);
2524+
25232525
int_status[0] = it6505_read(it6505, INT_STATUS_01);
25242526
int_status[1] = it6505_read(it6505, INT_STATUS_02);
25252527
int_status[2] = it6505_read(it6505, INT_STATUS_03);

drivers/gpu/drm/bridge/lontium-lt9611.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -774,9 +774,7 @@ static struct mipi_dsi_device *lt9611_attach_dsi(struct lt9611 *lt9611,
774774
dsi->lanes = 4;
775775
dsi->format = MIPI_DSI_FMT_RGB888;
776776
dsi->mode_flags = MIPI_DSI_MODE_VIDEO | MIPI_DSI_MODE_VIDEO_SYNC_PULSE |
777-
MIPI_DSI_MODE_VIDEO_HSE | MIPI_DSI_MODE_VIDEO_NO_HSA |
778-
MIPI_DSI_MODE_VIDEO_NO_HFP | MIPI_DSI_MODE_VIDEO_NO_HBP |
779-
MIPI_DSI_MODE_NO_EOT_PACKET;
777+
MIPI_DSI_MODE_VIDEO_HSE;
780778

781779
ret = devm_mipi_dsi_attach(dev, dsi);
782780
if (ret < 0) {

drivers/gpu/drm/drm_gem_shmem_helper.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,13 @@ int drm_gem_shmem_mmap(struct drm_gem_shmem_object *shmem, struct vm_area_struct
623623
int ret;
624624

625625
if (obj->import_attach) {
626+
/* Reset both vm_ops and vm_private_data, so we don't end up with
627+
* vm_ops pointing to our implementation if the dma-buf backend
628+
* doesn't set those fields.
629+
*/
626630
vma->vm_private_data = NULL;
631+
vma->vm_ops = NULL;
632+
627633
ret = dma_buf_mmap(obj->dma_buf, vma, 0);
628634

629635
/* Drop the reference drm_gem_mmap_obj() acquired.*/

drivers/gpu/drm/nouveau/nouveau_connector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -967,7 +967,7 @@ nouveau_connector_get_modes(struct drm_connector *connector)
967967
/* Determine display colour depth for everything except LVDS now,
968968
* DP requires this before mode_valid() is called.
969969
*/
970-
if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode)
970+
if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS)
971971
nouveau_connector_detect_depth(connector);
972972

973973
/* Find the native mode if this is a digital panel, if we didn't

drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
#include "head.h"
2727
#include "ior.h"
2828

29+
#include <drm/display/drm_dp.h>
30+
2931
#include <subdev/bios.h>
3032
#include <subdev/bios/init.h>
3133
#include <subdev/gpio.h>
@@ -634,6 +636,50 @@ nvkm_dp_enable_supported_link_rates(struct nvkm_outp *outp)
634636
return outp->dp.rates != 0;
635637
}
636638

639+
/* XXX: This is a big fat hack, and this is just drm_dp_read_dpcd_caps()
640+
* converted to work inside nvkm. This is a temporary holdover until we start
641+
* passing the drm_dp_aux device through NVKM
642+
*/
643+
static int
644+
nvkm_dp_read_dpcd_caps(struct nvkm_outp *outp)
645+
{
646+
struct nvkm_i2c_aux *aux = outp->dp.aux;
647+
u8 dpcd_ext[DP_RECEIVER_CAP_SIZE];
648+
int ret;
649+
650+
ret = nvkm_rdaux(aux, DPCD_RC00_DPCD_REV, outp->dp.dpcd, DP_RECEIVER_CAP_SIZE);
651+
if (ret < 0)
652+
return ret;
653+
654+
/*
655+
* Prior to DP1.3 the bit represented by
656+
* DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT was reserved.
657+
* If it is set DP_DPCD_REV at 0000h could be at a value less than
658+
* the true capability of the panel. The only way to check is to
659+
* then compare 0000h and 2200h.
660+
*/
661+
if (!(outp->dp.dpcd[DP_TRAINING_AUX_RD_INTERVAL] &
662+
DP_EXTENDED_RECEIVER_CAP_FIELD_PRESENT))
663+
return 0;
664+
665+
ret = nvkm_rdaux(aux, DP_DP13_DPCD_REV, dpcd_ext, sizeof(dpcd_ext));
666+
if (ret < 0)
667+
return ret;
668+
669+
if (outp->dp.dpcd[DP_DPCD_REV] > dpcd_ext[DP_DPCD_REV]) {
670+
OUTP_DBG(outp, "Extended DPCD rev less than base DPCD rev (%d > %d)\n",
671+
outp->dp.dpcd[DP_DPCD_REV], dpcd_ext[DP_DPCD_REV]);
672+
return 0;
673+
}
674+
675+
if (!memcmp(outp->dp.dpcd, dpcd_ext, sizeof(dpcd_ext)))
676+
return 0;
677+
678+
memcpy(outp->dp.dpcd, dpcd_ext, sizeof(dpcd_ext));
679+
680+
return 0;
681+
}
682+
637683
void
638684
nvkm_dp_enable(struct nvkm_outp *outp, bool auxpwr)
639685
{
@@ -689,7 +735,7 @@ nvkm_dp_enable(struct nvkm_outp *outp, bool auxpwr)
689735
memset(outp->dp.lttpr, 0x00, sizeof(outp->dp.lttpr));
690736
}
691737

692-
if (!nvkm_rdaux(aux, DPCD_RC00_DPCD_REV, outp->dp.dpcd, sizeof(outp->dp.dpcd))) {
738+
if (!nvkm_dp_read_dpcd_caps(outp)) {
693739
const u8 rates[] = { 0x1e, 0x14, 0x0a, 0x06, 0 };
694740
const u8 *rate;
695741
int rate_max;

drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgf100.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ void gk104_grctx_generate_r418800(struct gf100_gr *);
117117

118118
extern const struct gf100_grctx_func gk110_grctx;
119119
void gk110_grctx_generate_r419eb0(struct gf100_gr *);
120+
void gk110_grctx_generate_r419f78(struct gf100_gr *);
120121

121122
extern const struct gf100_grctx_func gk110b_grctx;
122123
extern const struct gf100_grctx_func gk208_grctx;

drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk104.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,9 @@ static void
906906
gk104_grctx_generate_r419f78(struct gf100_gr *gr)
907907
{
908908
struct nvkm_device *device = gr->base.engine.subdev.device;
909-
nvkm_mask(device, 0x419f78, 0x00000001, 0x00000000);
909+
910+
/* bit 3 set disables loads in fp helper invocations, we need it enabled */
911+
nvkm_mask(device, 0x419f78, 0x00000009, 0x00000000);
910912
}
911913

912914
void

drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk110.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -820,6 +820,15 @@ gk110_grctx_generate_r419eb0(struct gf100_gr *gr)
820820
nvkm_mask(device, 0x419eb0, 0x00001000, 0x00001000);
821821
}
822822

823+
void
824+
gk110_grctx_generate_r419f78(struct gf100_gr *gr)
825+
{
826+
struct nvkm_device *device = gr->base.engine.subdev.device;
827+
828+
/* bit 3 set disables loads in fp helper invocations, we need it enabled */
829+
nvkm_mask(device, 0x419f78, 0x00000008, 0x00000000);
830+
}
831+
823832
const struct gf100_grctx_func
824833
gk110_grctx = {
825834
.main = gf100_grctx_generate_main,
@@ -854,4 +863,5 @@ gk110_grctx = {
854863
.gpc_tpc_nr = gk104_grctx_generate_gpc_tpc_nr,
855864
.r418800 = gk104_grctx_generate_r418800,
856865
.r419eb0 = gk110_grctx_generate_r419eb0,
866+
.r419f78 = gk110_grctx_generate_r419f78,
857867
};

drivers/gpu/drm/nouveau/nvkm/engine/gr/ctxgk110b.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,5 @@ gk110b_grctx = {
103103
.gpc_tpc_nr = gk104_grctx_generate_gpc_tpc_nr,
104104
.r418800 = gk104_grctx_generate_r418800,
105105
.r419eb0 = gk110_grctx_generate_r419eb0,
106+
.r419f78 = gk110_grctx_generate_r419f78,
106107
};

0 commit comments

Comments
 (0)