Commit 5493bf2d authored by Dave Airlie's avatar Dave Airlie
Browse files

Merge tag 'drm-misc-fixes-2024-04-18' of...

Merge tag 'drm-misc-fixes-2024-04-18' of https://gitlab.freedesktop.org/drm/misc/kernel

 into drm-fixes

Short summary of fixes pull:

nouveau:
- dp: Don't probe DP ports twice
- nv04: Fix OOB access
- nv50: Disable AUX bus for disconnected DP ports
- nvkm: Fix race condition

panel:
- Don't unregister DSI devices in several drivers

ttm:
- Stop pooling cached NUMA pages

v3d:
- Fix enabled_ns increment

vmwgfx:
- Fix PRIME import/export
- Fix CRTC's atomic check for primary planes
- Sort plane formats by preference

Signed-off-by: default avatarDave Airlie <airlied@redhat.com>

From: Thomas Zimmermann <tzimmermann@suse.de>
Link: https://patchwork.freedesktop.org/patch/msgid/20240418072229.GA8983@localhost.localdomain
parents 58292f51 941c0bdb
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@
 */

#include "nouveau_drv.h"
#include "nouveau_bios.h"
#include "nouveau_reg.h"
#include "dispnv04/hw.h"
#include "nouveau_encoder.h"
@@ -1677,7 +1678,7 @@ apply_dcb_encoder_quirks(struct drm_device *dev, int idx, u32 *conn, u32 *conf)
	 */
	if (nv_match_device(dev, 0x0201, 0x1462, 0x8851)) {
		if (*conn == 0xf2005014 && *conf == 0xffffffff) {
			fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS, 1, 1, 1);
			fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS, 1, 1, DCB_OUTPUT_B);
			return false;
		}
	}
@@ -1763,26 +1764,26 @@ fabricate_dcb_encoder_table(struct drm_device *dev, struct nvbios *bios)
#ifdef __powerpc__
	/* Apple iMac G4 NV17 */
	if (of_machine_is_compatible("PowerMac4,5")) {
		fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS, 0, all_heads, 1);
		fabricate_dcb_output(dcb, DCB_OUTPUT_ANALOG, 1, all_heads, 2);
		fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS, 0, all_heads, DCB_OUTPUT_B);
		fabricate_dcb_output(dcb, DCB_OUTPUT_ANALOG, 1, all_heads, DCB_OUTPUT_C);
		return;
	}
#endif

	/* Make up some sane defaults */
	fabricate_dcb_output(dcb, DCB_OUTPUT_ANALOG,
			     bios->legacy.i2c_indices.crt, 1, 1);
			     bios->legacy.i2c_indices.crt, 1, DCB_OUTPUT_B);

	if (nv04_tv_identify(dev, bios->legacy.i2c_indices.tv) >= 0)
		fabricate_dcb_output(dcb, DCB_OUTPUT_TV,
				     bios->legacy.i2c_indices.tv,
				     all_heads, 0);
				     all_heads, DCB_OUTPUT_A);

	else if (bios->tmds.output0_script_ptr ||
		 bios->tmds.output1_script_ptr)
		fabricate_dcb_output(dcb, DCB_OUTPUT_TMDS,
				     bios->legacy.i2c_indices.panel,
				     all_heads, 1);
				     all_heads, DCB_OUTPUT_B);
}

static int
+18 −5
Original line number Diff line number Diff line
@@ -225,12 +225,18 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector,
	u8 *dpcd = nv_encoder->dp.dpcd;
	int ret = NOUVEAU_DP_NONE, hpd;

	/* If we've already read the DPCD on an eDP device, we don't need to
	 * reread it as it won't change
	/* eDP ports don't support hotplugging - so there's no point in probing eDP ports unless we
	 * haven't probed them once before.
	 */
	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP &&
	    dpcd[DP_DPCD_REV] != 0)
	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
		if (connector->status == connector_status_connected)
			return NOUVEAU_DP_SST;
		else if (connector->status == connector_status_disconnected)
			return NOUVEAU_DP_NONE;
	}

	// Ensure that the aux bus is enabled for probing
	drm_dp_dpcd_set_powered(&nv_connector->aux, true);

	mutex_lock(&nv_encoder->dp.hpd_irq_lock);
	if (mstm) {
@@ -293,6 +299,13 @@ nouveau_dp_detect(struct nouveau_connector *nv_connector,
	if (mstm && !mstm->suspended && ret != NOUVEAU_DP_MST)
		nv50_mstm_remove(mstm);

	/* GSP doesn't like when we try to do aux transactions on a port it considers disconnected,
	 * and since we don't really have a usecase for that anyway - just disable the aux bus here
	 * if we've decided the connector is disconnected
	 */
	if (ret == NOUVEAU_DP_NONE)
		drm_dp_dpcd_set_powered(&nv_connector->aux, false);

	mutex_unlock(&nv_encoder->dp.hpd_irq_lock);
	return ret;
}
+6 −1
Original line number Diff line number Diff line
@@ -222,8 +222,11 @@ nv50_instobj_acquire(struct nvkm_memory *memory)
	void __iomem *map = NULL;

	/* Already mapped? */
	if (refcount_inc_not_zero(&iobj->maps))
	if (refcount_inc_not_zero(&iobj->maps)) {
		/* read barrier match the wmb on refcount set */
		smp_rmb();
		return iobj->map;
	}

	/* Take the lock, and re-check that another thread hasn't
	 * already mapped the object in the meantime.
@@ -250,6 +253,8 @@ nv50_instobj_acquire(struct nvkm_memory *memory)
			iobj->base.memory.ptrs = &nv50_instobj_fast;
		else
			iobj->base.memory.ptrs = &nv50_instobj_slow;
		/* barrier to ensure the ptrs are written before refcount is set */
		smp_wmb();
		refcount_set(&iobj->maps, 1);
	}

+0 −2
Original line number Diff line number Diff line
@@ -614,8 +614,6 @@ static void nt36672e_panel_remove(struct mipi_dsi_device *dsi)
	struct nt36672e_panel *ctx = mipi_dsi_get_drvdata(dsi);

	mipi_dsi_detach(ctx->dsi);
	mipi_dsi_device_unregister(ctx->dsi);

	drm_panel_remove(&ctx->panel);
}

+0 −2
Original line number Diff line number Diff line
@@ -253,8 +253,6 @@ static void visionox_rm69299_remove(struct mipi_dsi_device *dsi)
	struct visionox_rm69299 *ctx = mipi_dsi_get_drvdata(dsi);

	mipi_dsi_detach(ctx->dsi);
	mipi_dsi_device_unregister(ctx->dsi);

	drm_panel_remove(&ctx->panel);
}

Loading