Skip to contentSkip to conversation

Add DP MST AUX devices

PATCH Superseded [email protected] 5 participants 23 messages May 16, 2019 – Jul 1, 2019 8 messages not in the archive

Subsystems (6)

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover Add DP MST AUX devices

From: Leo Li <[email protected]>

This series adds support for MST AUX devices.

A more descriptive 'mstpath' attribute is also added to MST connector devices. In addition, the DP aux device is made to be a child of the corresponding connector's device where possible (*). This allows udev rules to provide descriptive symlinks to the AUX devices.

(*) This can only be done on drivers that register their connector and aux devices via drm_connector_register() and drm_dp_aux_register() respectively. The connector also needs to be registered before the aux device.

Leo Li (6):
drm/dp: Use non-cyclic idr
drm/dp-mst: Use connector kdev as aux device parent drm/sysfs: Add mstpath attribute to connector devices drm/amd/display: Use connector kdev as aux device parent drm/bridge/analogix-anx78xx: Use connector kdev as aux device parent drm/nouveau: Use connector kdev as aux device parent

Ville Syrjälä (1):
drm/dp_mst: Register AUX devices for MST ports

 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |   2 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.c          |  22 ++---
 drivers/gpu/drm/drm_dp_aux_dev.c                   |  17 +++-
 drivers/gpu/drm/drm_dp_mst_topology.c              | 106 ++++++++++++++++++---
 drivers/gpu/drm/drm_sysfs.c                        |  23 +++++
 drivers/gpu/drm/nouveau/nouveau_connector.c        |   2 +-
 include/drm/drm_dp_helper.h                        |   4 +
 include/drm/drm_dp_mst_helper.h                    |   6 ++
 8 files changed, 152 insertions(+), 30 deletions(-)
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

PATCH 1/7 drm/dp: Use non-cyclic idr

From: Leo Li <[email protected]>

In preparation for adding aux devices for DP MST, make the IDR non-cyclic. That way, hotplug cycling MST devices won't needlessly increment the minor version index.

---
 drivers/gpu/drm/drm_dp_aux_dev.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +1 -2
index 0e4f25d..6d84611 100644
@@ -80,8 +80,7 @@ static struct drm_dp_aux_dev *alloc_drm_dp_aux_dev(struct drm_dp_aux *aux)
 	kref_init(&aux_dev->refcount);
 
 	mutex_lock(&aux_idr_mutex);
-	index = idr_alloc_cyclic(&aux_idr, aux_dev, 0, DRM_AUX_MINORS,
-				 GFP_KERNEL);
+	index = idr_alloc(&aux_idr, aux_dev, 0, DRM_AUX_MINORS, GFP_KERNEL);
 	mutex_unlock(&aux_idr_mutex);
 	if (index < 0) {
 		kfree(aux_dev);
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1558019883-12397-1-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

#3 lore raw

PATCH 2/7 drm/dp_mst: Register AUX devices for MST ports

From: Ville Syrjälä <[email protected]>

All available downstream ports - physical and logical - are exposed for each MST device. They are listed in /dev/, following the same naming scheme as SST devices by appending an incremental ID.

Although all downstream ports are exposed, only some will work as expected. Consider the following topology:

               +---------+
               |  ASIC   |
               +---------+
              Conn-0|
                    |
               +----v----+
          +----| MST HUB |----+
          |    +---------+    |
          |                   |
          |Port-1       Port-2|
    +-----v-----+       +-----v-----+
    |  MST      |       |  SST      |
    |  Display  |       |  Display  |
    +-----------+       +-----------+
          |Port-1

x

MST Path | MST Device
----------+----------------------------------

 sst:0     | MST Hub
 mst:0-1   | MST Display
 mst:0-1-1 | MST Display's disconnected DP out
 mst:0-1-8 | MST Display's internal sink
 mst:0-2   | SST Display

On certain MST displays, the upstream physical port will ACK DPCD reads. However, reads on the local logical port to the internal sink will *NAK*. i.e. reading mst:0-1 ACKs, but mst:0-1-8 NAKs.

There may also be duplicates. Some displays will return the same GUID when reading DPCD from both mst:0-1 and mst:0-1-8.

There are some device-dependent behavior as well. The MST hub used during testing will actually *ACK* read requests on a disconnected physical port, whereas the MST displays will NAK.

In light of these discrepancies, it's simpler to expose all downstream ports - both physical and logical - and let the user decide what to use.

---
 drivers/gpu/drm/drm_dp_aux_dev.c      |  14 ++++-
 drivers/gpu/drm/drm_dp_mst_topology.c | 103 +++++++++++++++++++++++++++++-----
 include/drm/drm_dp_helper.h           |   4 ++
 include/drm/drm_dp_mst_helper.h       |   6 ++
 4 files changed, 112 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +12 -2
index 6d84611..01c02b9 100644
@@ -34,6 +34,7 @@
 #include <linux/uaccess.h>
 #include <linux/uio.h>
 #include <drm/drm_dp_helper.h>
+#include <drm/drm_dp_mst_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drmP.h>
 
@@ -114,6 +115,7 @@ static ssize_t name_show(struct device *dev,
 
 	return res;
 }
+
 static DEVICE_ATTR_RO(name);
 
 static struct attribute *drm_dp_aux_attrs[] = {
@@ -160,7 +162,11 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to)
 			break;
 		}
 
-		res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+		if (aux_dev->aux->is_remote)
+			res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf, todo);
+		else
+			res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+
 		if (res <= 0)
 			break;
 
@@ -207,7 +213,11 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
 			break;
 		}
 
-		res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+		if (aux_dev->aux->is_remote)
+			res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf, todo);
+		else
+			res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+
 		if (res <= 0)
 			break;
 
drivers/gpu/drm/drm_dp_mst_topology.c +90 -13

182 lines not on this page · raw message

include/drm/drm_dp_helper.h +4 -0
index 509667e..6dea76a 100644
@@ -1265,6 +1265,10 @@ struct drm_dp_aux {
 	 * @cec: struct containing fields used for CEC-Tunneling-over-AUX.
 	 */
 	struct drm_dp_aux_cec cec;
+	/**
+	 * @is_remote: Is this "AUX CH" actually using sideband messaging.
+	 */
+	bool is_remote;
 };
 
 ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
include/drm/drm_dp_mst_helper.h +6 -0
index 371cc28..30f8c11 100644
@@ -615,6 +615,12 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 
 void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
 int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
+
+ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
+			     unsigned int offset, void *buffer, size_t size);
+ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
+			      unsigned int offset, void *buffer, size_t size);
+
 struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct drm_atomic_state *state,
 								    struct drm_dp_mst_topology_mgr *mgr);
 int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1558019883-12397-3-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

#5 lore raw

Re: [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports

So a couple of things:

Quoted 82 lines · On Thu, 2019-05-16 at 11:17 -0400, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

All available downstream ports - physical and logical - are exposed for each MST device. They are listed in /dev/, following the same naming scheme as SST devices by appending an incremental ID.

Although all downstream ports are exposed, only some will work as expected. Consider the following topology:

               +---------+
               |  ASIC   |
               +---------+
              Conn-0|
                    |
               +----v----+
          +----| MST HUB |----+
          |    +---------+    |
          |                   |
          |Port-1       Port-2|
    +-----v-----+       +-----v-----+
    |  MST      |       |  SST      |
    |  Display  |       |  Display  |
    +-----------+       +-----------+
          |Port-1

x

MST Path | MST Device
----------+----------------------------------

 sst:0     | MST Hub
 mst:0-1   | MST Display
 mst:0-1-1 | MST Display's disconnected DP out
 mst:0-1-8 | MST Display's internal sink
 mst:0-2   | SST Display

On certain MST displays, the upstream physical port will ACK DPCD reads. However, reads on the local logical port to the internal sink will *NAK*. i.e. reading mst:0-1 ACKs, but mst:0-1-8 NAKs.

There may also be duplicates. Some displays will return the same GUID when reading DPCD from both mst:0-1 and mst:0-1-8.

There are some device-dependent behavior as well. The MST hub used during testing will actually *ACK* read requests on a disconnected physical port, whereas the MST displays will NAK.

In light of these discrepancies, it's simpler to expose all downstream ports - both physical and logical - and let the user decide what to use.

---
 drivers/gpu/drm/drm_dp_aux_dev.c      |  14 ++++-
 drivers/gpu/drm/drm_dp_mst_topology.c | 103 +++++++++++++++++++++++++++++
-----
 include/drm/drm_dp_helper.h           |   4 ++
 include/drm/drm_dp_mst_helper.h       |   6 ++
 4 files changed, 112 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +2 -0
index 6d84611..01c02b9 100644
@@ -34,6 +34,7 @@
 #include <linux/uaccess.h>
 #include <linux/uio.h>
 #include <drm/drm_dp_helper.h>
+#include <drm/drm_dp_mst_helper.h>
 #include <drm/drm_crtc.h>
 #include <drm/drmP.h>
 
@@ -114,6 +115,7 @@ static ssize_t name_show(struct device *dev,
 
 	return res;
 }
+
 static DEVICE_ATTR_RO(name);
 
 static struct attribute *drm_dp_aux_attrs[] = {
@@ -160,7 +162,11 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb,
 struct iov_iter *to)

drivers/gpu/drm/drm_dp_aux_dev.c static ssize_t auxdev_read_iter(struct kiocb *iocb, · line 171

Quoted 10 lines
drivers/gpu/drm/drm_dp_aux_dev.c +5 -1
 			break;
 		}
 
-		res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+		if (aux_dev->aux->is_remote)
+			res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf,
 todo);
+		else
+			res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+

It's still not at all clear to me why we're trying to avoid specifying actual callbacks for the aux device. We should remove this part entirely, remove the is_remote entry from struct drm_dp_aux, and then just specify our own hook in struct drm_dp_aux->transfer().

Quoted 24 lines
drivers/gpu/drm/drm_dp_aux_dev.c +0 -0
 		if (res <= 0)
drivers/gpu/drm/drm_dp_aux_dev.c +5 -1
 			break;
@@ -207,7 +213,11 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb,
 struct iov_iter *from)
 			break;
 		}
 
-		res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+		if (aux_dev->aux->is_remote)
+			res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf,
 todo);
+		else
+			res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+
 		if (res <= 0)
drivers/gpu/drm/drm_dp_aux_dev.c +0 -0
 			break;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 2ab16c9..54da68e 100644

drivers/gpu/drm/drm_dp_mst_topology.c line 39

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
@@ -35,6 +35,8 @@
 #include <drm/drm_atomic_helper.h>
 #include <drm/drm_crtc_helper.h>
 
+#include "drm_crtc_helper_internal.h"
+

Unless I'm mistaken, this looks like some sort of ditritus.

Quoted 97 lines
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
 /**
  * DOC: dp mst helper
  *
@@ -52,6 +54,9 @@ static int drm_dp_dpcd_write_payload(struct
 drm_dp_mst_topology_mgr *mgr,
 				     int id,
 				     struct drm_dp_payload *payload);
 
+static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
+				 struct drm_dp_mst_port *port,
+				 int offset, int size, u8 *bytes);
 static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
 				  struct drm_dp_mst_port *port,
drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
 				  int offset, int size, u8 *bytes);
@@ -941,6 +946,8 @@ static void drm_dp_destroy_port(struct kref *kref)
 	struct drm_dp_mst_topology_mgr *mgr = port->mgr;
 
 	if (!port->input) {
+		drm_dp_aux_unregister_devnode(&port->aux);
+
 		port->vcpi.num_slots = 0;
 
 		kfree(port->cached_edid);
@@ -1095,6 +1102,46 @@ static bool drm_dp_port_setup_pdt(struct
 drm_dp_mst_port *port)
 	return send_link;
 }
 
+/**
+ * drm_dp_mst_dpcd_read() - read a series of bytes from the DPCD via

sideband
+ * @aux: Fake sideband AUX CH
+ * @offset: address of the (first) register to read
+ * @buffer: buffer to store the register values
+ * @size: number of bytes in @buffer
+ *
+ * Performs the same functionality for remote devices via
+ * sideband messaging as drm_dp_dpcd_read() does for local
+ * devices via actual AUX CH.
+ */

drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
+ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
+			     unsigned int offset, void *buffer, size_t size)
+{
+	struct drm_dp_mst_port *port = container_of(aux, struct

drm_dp_mst_port, aux);

drivers/gpu/drm/drm_dp_mst_topology.c +7 -0
+
+	return drm_dp_send_dpcd_read(port->mgr, port,
+				     offset, size, buffer);
+}
+
+/**
+ * drm_dp_mst_dpcd_write() - write a series of bytes to the DPCD via

sideband
+ * @aux: Fake sideband AUX CH
+ * @offset: address of the (first) register to write
+ * @buffer: buffer containing the values to write
+ * @size: number of bytes in @buffer
+ *
+ * Performs the same functionality for remote devices via
+ * sideband messaging as drm_dp_dpcd_write() does for local
+ * devices via actual AUX CH.
+ */

drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
+ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
+			      unsigned int offset, void *buffer, size_t size)
+{
+	struct drm_dp_mst_port *port = container_of(aux, struct

drm_dp_mst_port, aux);

drivers/gpu/drm/drm_dp_mst_topology.c +5 -0
+
+	return drm_dp_send_dpcd_write(port->mgr, port,
+				      offset, size, buffer);
+}
+
 static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8

*guid)
{

drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
 	int ret;
@@ -1158,6 +1205,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
 		port->mgr = mstb->mgr;
 		port->aux.name = "DPMST";
 		port->aux.dev = dev->dev;
+		port->aux.is_remote = true;
 		created = true;
 	} else {
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
 		old_pdt = port->pdt;
@@ -1188,7 +1236,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
 				drm_dp_send_enum_path_resources(mstb->mgr,
 mstb, port);
 		} else {
 			port->available_pbn = 0;
-			}
+		}
 	}
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 	if (old_pdt != port->pdt && !port->input) {

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_add_port(struct drm_dp_mst_branch · line 1271

Quoted 4 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1220,6 +1268,8 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
 			drm_connector_set_tile_property(port->connector);
 		}
 		(*mstb->mgr->cbs->register_connector)(port->connector);

This is wrong: we always want to setup everything in the connector first before trying to register it, not after. Otherwise, things explode like so:

[   13.305329] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (3)
[   13.305361] [drm:drm_mode_object_get [drm]] OBJ ID: 123 (1)
[   13.305384] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (4)
[   13.305405] [drm:drm_mode_object_get [drm]] OBJ ID: 124 (1)
[   13.305429] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (5)
[   13.305449] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (6)
[   13.305471] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[   13.305490] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (6)
[   13.305512] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[   13.305532] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[   13.305552] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (5)
[   13.305571] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (6)
[   13.305592] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[   13.305612] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (6)
[   13.305631] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[   13.305651] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[   13.305725] [drm:drm_vblank_enable [drm]] enabling vblank on crtc 0, ret: 0
[   13.305768] [drm:drm_vblank_enable [drm]] enabling vblank on crtc 1, ret: 0
[   13.306088] [drm:drm_handle_vblank [drm]] vblank event on 325, current 325
[   13.322514] [drm:drm_handle_vblank [drm]] vblank event on 313, current 313
[   13.322612] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[   13.322634] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (5)
[   13.322656] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[   13.322676] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (5)
[   13.322697] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (2)
[   13.322718] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (2)
[   13.322740] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (5)
[   13.322764] [drm:vblank_disable_fn [drm]] disabling vblank on crtc 0
[   13.322784] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (4)
[   13.339191] [drm:vblank_disable_fn [drm]] disabling vblank on crtc 1
[  451.149789] Console: switching to colour dummy device 80x25
[  451.194596] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPDDC-A] unregistering
[  451.194666] [drm:drm_sysfs_connector_remove [drm]] removing "eDP-1" from sysfs
[  451.194718] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPDDC-B] unregistering
[  451.194766] [drm:drm_sysfs_connector_remove [drm]] removing "DP-1" from sysfs
[  451.194791] [drm:drm_sysfs_connector_remove [drm]] removing "HDMI-A-1" from sysfs
[  451.194835] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPDDC-C] unregistering
[  451.194880] [drm:drm_sysfs_connector_remove [drm]] removing "DP-2" from sysfs
[  451.194903] [drm:drm_sysfs_connector_remove [drm]] removing "HDMI-A-2" from sysfs
[  451.194924] [drm:drm_sysfs_connector_remove [drm]] removing "DP-3" from sysfs
[  451.194950] [drm:drm_sysfs_connector_remove [drm]] removing "DP-4" from sysfs
[  451.194975] [drm:drm_sysfs_connector_remove [drm]] removing "DP-5" from sysfs
[  451.204535] [drm:drm_mode_object_get [drm]] OBJ ID: 123 (1)
[  451.204551] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (2)
[  451.204566] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (3)
[  451.204582] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[  451.204596] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (6)
[  451.204611] [drm:drm_mode_object_get [drm]] OBJ ID: 124 (1)
[  451.204621] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (2)
[  451.204631] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (4)
[  451.204641] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[  451.204651] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (6)
[  451.204662] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[  451.204671] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[  451.204680] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (5)
[  451.204689] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (4)
[  451.204699] [drm:drm_dp_mst_duplicate_state [drm_kms_helper]] port 00000000dde1b00a (5)
[  451.204703] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (4)
[  451.411817] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 0
[  451.420911] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-A: 0x00600 AUX <- (ret=  1) 02
[  451.425358] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x01000000, dig 0x11101010, pins 0x00000010, long 0x00000000
[  451.425422] [drm:intel_hpd_irq_handler [i915]] digital hpd port A - short
[  451.471777] [drm:drm_dp_mst_topology_get_mstb_validated [drm_kms_helper]] mstb 00000000eec1a629 (2)
[  451.473361] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x01000000, dig 0x12101010, pins 0x00000010, long 0x00000010
[  451.473465] [drm:intel_hpd_irq_handler [i915]] digital hpd port A - long
[  452.207301] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x01000000, dig 0x12101010, pins 0x00000010, long 0x00000010
[  452.207395] [drm:intel_hpd_irq_handler [i915]] digital hpd port A - long
[  452.340311] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-A: 0x00000 AUX -> (ret= 15) 11 0a 02 41 00 00 01 00 02 00 00 00 00 0b 00
[  452.341060] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-A: 0x00201 AUX -> (ret=  1) 00
[  452.341584] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x01000 AUX <- (ret= 10) 10 47 d3 11 11 01 00 00 00 f4
[  452.343183] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x00200000, dig 0x10101011, pins 0x00000020, long 0x00000000
[  452.343286] [drm:intel_hpd_irq_handler [i915]] digital hpd port B - short
[  452.344765] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002 AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 77 77 01 00
[  452.346263] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x01400 AUX -> (ret= 16) 10 46 d6 11 10 01 00 00 78 00 00 00 00 00 00 00
[  452.346287] [drm:drm_dp_get_mst_branch_device [drm_kms_helper]] mstb 00000000eec1a629 (3)
[  452.346305] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 00000000eec1a629 (2)
[  452.346405] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 00000000eec1a629 (1)
[  452.347529] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x02003 AUX <- (ret=  3) 10 00 00
[  452.348672] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x002c0 AUX <- (ret=  1) 01
[  452.350168] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002 AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 77 77 01 00
[  452.351328] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x001c0 AUX <- (ret=  3) 01 01 00
[  452.352665] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0 AUX -> (ret=  1) 01
[  452.358905] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0 AUX -> (ret=  1) 01
[  452.360327] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0 AUX -> (ret=  1) 01
[  452.361660] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0 AUX -> (ret=  1) 03
[  452.361681] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (3)
[  452.361700] [drm:drm_dp_mst_topology_get_port_validated [drm_kms_helper]] port 00000000dde1b00a (2)
[  452.362894] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x01000 AUX <- (ret=  6) 10 43 c7 25 10 c0
[  452.364318] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x00200000, dig 0x10101011, pins 0x00000020, long 0x00000000
[  452.364421] [drm:intel_hpd_irq_handler [i915]] digital hpd port B - short
[  452.365929] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002 AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 77 77 01 00
[  452.367361] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x01400 AUX -> (ret= 16) 10 43 c7 25 10 c0 00 00 00 00 00 00 00 00 00 00
[  452.367388] [drm:drm_dp_get_mst_branch_device [drm_kms_helper]] mstb 00000000eec1a629 (2)
[  452.367407] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 00000000eec1a629 (1)
[  452.367460] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 00000000dde1b00a (1)
[  452.368548] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x02003 AUX <- (ret=  3) 10 00 00
[  452.368803] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x00600 AUX <- (ret=  1) 02
[  452.368970] [drm:intel_dump_cdclk_state [i915]] Changing CDCLK to 337500 kHz, VCO 8100000 kHz, ref 24000 kHz, bypass 24000 kHz, voltage level 0
[  452.369269] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (1)
[  452.369330] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (1)
[  452.369422] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (5)
[  452.369466] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (4)
[  452.369515] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (5)
[  452.369558] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (4)
[  452.369608] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (3)
[  452.369660] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (2)
[  452.369690] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (2)
[  452.369750] [drm:drm_irq_uninstall [drm]] irq=177
[  452.406452] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002 AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 00 00 80 00
[  452.412626] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (3)
[  452.412636] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 91 (2)
[  452.412644] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 98 (2)
[  452.412652] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 104 (2)
[  452.412660] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 109 (2)
[  452.412668] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (3)
[  452.412676] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 117 (2)
[  452.412684] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 120 (2)
[  452.412692] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (2)
[  452.412700] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (2)
[  452.412708] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (1)
[  452.424450] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x00111 AUX <- (ret=  1) 00
[  452.424454] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 00000000eec1a629 (0)
[  452.424457] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 00000000eeef3cfd (0)
[  452.424461] ------------[ cut here ]------------
[  452.424464] sysfs group 'power' not found for kobject 'drm_dp_aux5'
[  452.424471] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424473] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev
[  452.424492] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted: G           O      5.1.0Lyude-Test+ #1
[  452.424494] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W (1.12 ) 04/09/2018
[  452.424496] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424498] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424500] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424501] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[  452.424502] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff981fde2d5a00
[  452.424503] RBP: ffffffffa9ea12e0 R08: 0000000000000792 R09: 0000000000000046
[  452.424504] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12: ffff981fd5f77010
[  452.424505] R13: ffff981fd6ebbedc R14: dead000000000200 R15: dead000000000100
[  452.424507] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000) knlGS:0000000000000000
[  452.424508] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424509] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4: 00000000003606e0
[  452.424510] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.424511] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  452.424512] Call Trace:
[  452.424516]  device_del+0x75/0x360
[  452.424518]  ? class_find_device+0x96/0xf0
[  452.424520]  device_unregister+0x16/0x60
[  452.424521]  device_destroy+0x3a/0x40
[  452.424525]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.424534]  ? drm_dbg+0x87/0x90 [drm]
[  452.424538]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424543]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424547]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0 [drm_kms_helper]
[  452.424551]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.424571]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424592]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424600]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424621]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424633]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424645]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424647]  pci_device_remove+0x3b/0xc0
[  452.424649]  device_release_driver_internal+0xe4/0x1d0
[  452.424651]  pci_stop_bus_device+0x69/0x90
[  452.424653]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424655]  remove_store+0x75/0x90
[  452.424656]  kernfs_fop_write+0x116/0x190
[  452.424658]  vfs_write+0xa5/0x1a0
[  452.424660]  ksys_write+0x57/0xd0
[  452.424663]  do_syscall_64+0x55/0x150
[  452.424665]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424667] RIP: 0033:0x7f8cc1e7d038
[  452.424668] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.424670] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  452.424672] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f8cc1e7d038
[  452.424673] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI: 0000000000000001
[  452.424674] RBP: 000056515aefbf00 R08: 000000000000000a R09: 00007f8cc1f0ee80
[  452.424675] R10: 000000000000000a R11: 0000000000000246 R12: 00007f8cc1f50780
[  452.424676] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15: 0000000000000002
[  452.424678] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424680] ---[ end trace a1c11eaf054910a3 ]---
[  452.424751] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] unregistering
[  452.424755] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 000000000f6aa5a3 (0)
[  452.424765] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 120 (1)
[  452.424770] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000eeef3cfd (1)
[  452.424773] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000eeef3cfd (0)
[  452.424776] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (4)
[  452.424783] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event
[  452.424790] ------------[ cut here ]------------
[  452.424791] sysfs group 'power' not found for kobject 'drm_dp_aux4'
[  452.424795] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424796] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev
[  452.424809] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted: G        W  O      5.1.0Lyude-Test+ #1
[  452.424811] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W (1.12 ) 04/09/2018
[  452.424812] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424813] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424815] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424816] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[  452.424817] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff981fde2d5a00
[  452.424818] RBP: ffffffffa9ea12e0 R08: 00000000000007d1 R09: 0000000000000046
[  452.424820] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12: ffff981fd50d0410
[  452.424821] R13: ffff981fd6ebbebc R14: dead000000000200 R15: dead000000000100
[  452.424822] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000) knlGS:0000000000000000
[  452.424823] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424824] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4: 00000000003606e0
[  452.424825] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.424826] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  452.424827] Call Trace:
[  452.424829]  device_del+0x75/0x360
[  452.424830]  ? class_find_device+0x96/0xf0
[  452.424832]  device_unregister+0x16/0x60
[  452.424833]  device_destroy+0x3a/0x40
[  452.424837]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.424841]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424845]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424849]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0 [drm_kms_helper]
[  452.424854]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.424873]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424892]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424900]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424920]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424932]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424943]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424945]  pci_device_remove+0x3b/0xc0
[  452.424947]  device_release_driver_internal+0xe4/0x1d0
[  452.424948]  pci_stop_bus_device+0x69/0x90
[  452.424950]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424951]  remove_store+0x75/0x90
[  452.424953]  kernfs_fop_write+0x116/0x190
[  452.424954]  vfs_write+0xa5/0x1a0
[  452.424956]  ksys_write+0x57/0xd0
[  452.424957]  do_syscall_64+0x55/0x150
[  452.424959]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424960] RIP: 0033:0x7f8cc1e7d038
[  452.424961] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.424963] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  452.424965] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f8cc1e7d038
[  452.424966] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI: 0000000000000001
[  452.424967] RBP: 000056515aefbf00 R08: 000000000000000a R09: 00007f8cc1f0ee80
[  452.424968] R10: 000000000000000a R11: 0000000000000246 R12: 00007f8cc1f50780
[  452.424969] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15: 0000000000000002
[  452.424971] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424972] ---[ end trace a1c11eaf054910a4 ]---
[  452.424992] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] unregistering
[  452.424997] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 00000000dde1b00a (0)
[  452.425006] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 117 (1)
[  452.425010] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 000000000f6aa5a3 (1)
[  452.425014] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 000000000f6aa5a3 (0)
[  452.425017] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (3)
[  452.425023] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event
[  452.425028] ------------[ cut here ]------------
[  452.425029] sysfs group 'power' not found for kobject 'drm_dp_aux3'
[  452.425033] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.425034] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev
[  452.425047] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted: G        W  O      5.1.0Lyude-Test+ #1
[  452.425048] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W (1.12 ) 04/09/2018
[  452.425050] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.425051] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.425053] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.425054] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[  452.425055] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff981fde2d5a00
[  452.425056] RBP: ffffffffa9ea12e0 R08: 000000000000080f R09: 0000000000000046
[  452.425057] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12: ffff981fd50d1810
[  452.425058] R13: ffff981fd6ebbe1c R14: dead000000000200 R15: dead000000000100
[  452.425059] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000) knlGS:0000000000000000
[  452.425061] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.425062] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4: 00000000003606e0
[  452.425063] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.425064] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  452.425065] Call Trace:
[  452.425066]  device_del+0x75/0x360
[  452.425068]  ? class_find_device+0x96/0xf0
[  452.425069]  device_unregister+0x16/0x60
[  452.425070]  device_destroy+0x3a/0x40
[  452.425074]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.425078]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.425083]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.425087]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0 [drm_kms_helper]
[  452.425091]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.425110]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.425128]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.425137]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.425157]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.425168]  i915_driver_unload+0xa8/0x130 [i915]
[  452.425180]  i915_pci_remove+0x1e/0x40 [i915]
[  452.425182]  pci_device_remove+0x3b/0xc0
[  452.425183]  device_release_driver_internal+0xe4/0x1d0
[  452.425185]  pci_stop_bus_device+0x69/0x90
[  452.425186]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.425188]  remove_store+0x75/0x90
[  452.425189]  kernfs_fop_write+0x116/0x190
[  452.425191]  vfs_write+0xa5/0x1a0
[  452.425192]  ksys_write+0x57/0xd0
[  452.425194]  do_syscall_64+0x55/0x150
[  452.425195]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.425197] RIP: 0033:0x7f8cc1e7d038
[  452.425198] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.425199] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  452.425201] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f8cc1e7d038
[  452.425202] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI: 0000000000000001
[  452.425203] RBP: 000056515aefbf00 R08: 000000000000000a R09: 00007f8cc1f0ee80
[  452.425204] R10: 000000000000000a R11: 0000000000000246 R12: 00007f8cc1f50780
[  452.425205] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15: 0000000000000002
[  452.425207] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.425208] ---[ end trace a1c11eaf054910a5 ]---
[  452.425282] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] unregistering
[  452.425288] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 000000002ba3174e (0)
[  452.425292] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 000000002ba3174e (0)
[  452.425295] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (2)
[  452.425299] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (1)
[  452.425311] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (1)
[  452.425318] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (1)
[  452.425365] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (0)
[  452.425368] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (0)

So, we need to move the drm_dp_aux_register_devnode() call above the connector registration callback. Same goes for the port->aux.dev = port->connector-

Quoted 1 line

kdev; assignment that you do in patch 3/7 (and of course, you can remove the

connector registration status check there now).

Quoted 138 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
+
+		drm_dp_aux_register_devnode(&port->aux);
 	}
 
 out:
@@ -1404,7 +1454,6 @@ static bool drm_dp_validate_guid(struct
 drm_dp_mst_topology_mgr *mgr,
 	return false;
 }
 
-#if 0
 static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num,
 u32 offset, u8 num_bytes)

{

drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 	struct drm_dp_sideband_msg_req_body req;
@@ -1417,7 +1466,6 @@ static int build_dpcd_read(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

drivers/gpu/drm/drm_dp_mst_topology.c +36 -8
 	return 0;
 }
-#endif
 
 static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr *mgr,
 				    bool up, u8 *msg, int len)
@@ -1994,26 +2042,55 @@ int drm_dp_update_payload_part2(struct
 drm_dp_mst_topology_mgr *mgr)
 }
 EXPORT_SYMBOL(drm_dp_update_payload_part2);
 
-#if 0 /* unused as of yet */
 static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
 				 struct drm_dp_mst_port *port,
-				 int offset, int size)
+				 int offset, int size, u8 *bytes)
 {
 	int len;
+	int ret = 0;
 	struct drm_dp_sideband_msg_tx *txmsg;
+	struct drm_dp_mst_branch *mstb;
+
+	mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent);
+	if (!mstb)
+		return -EINVAL;
 
 	txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
-	if (!txmsg)
-		return -ENOMEM;
+	if (!txmsg) {
+		ret = -ENOMEM;
+		goto fail_put;
+	}
 
-	len = build_dpcd_read(txmsg, port->port_num, 0, 8);
+	len = build_dpcd_read(txmsg, port->port_num, offset, size);
 	txmsg->dst = port->parent;
 
 	drm_dp_queue_down_tx(mgr, txmsg);
 
-	return 0;
+	ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
+	if (ret < 0)
+		goto fail_free;
+
+	/* DPCD read should never be NACKed */
+	if (WARN_ON_ONCE(txmsg->reply.reply_type == 1)) {
+		ret = -EIO;
+		goto fail_free;
+	}
+
+	if (txmsg->reply.u.remote_dpcd_read_ack.num_bytes != size) {
+		ret = -EPROTO;
+		goto fail_free;
+	}
+
+	ret = min_t(size_t, txmsg->reply.u.remote_dpcd_read_ack.num_bytes,
 size);
+	memcpy(bytes, txmsg->reply.u.remote_dpcd_read_ack.bytes, ret);
+
+fail_free:
+	kfree(txmsg);
+fail_put:
+	drm_dp_put_mst_branch_device(mstb);
+
+	return ret;
 }
-#endif
 

static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,

drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
 				  struct drm_dp_mst_port *port,
@@ -2041,9 +2118,9 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
 
 	ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
 	if (ret > 0) {
-		if (txmsg->reply.reply_type == 1) {
-			ret = -EINVAL;
-		} else
+		if (txmsg->reply.reply_type == 1)
+			ret = -EIO;
+		else
 			ret = 0;
 	}
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 	kfree(txmsg);
include/drm/drm_dp_helper.h +4 -0
index 509667e..6dea76a 100644
@@ -1265,6 +1265,10 @@ struct drm_dp_aux {
 	 * @cec: struct containing fields used for CEC-Tunneling-over-AUX.
 	 */
 	struct drm_dp_aux_cec cec;
+	/**
+	 * @is_remote: Is this "AUX CH" actually using sideband messaging.
+	 */
+	bool is_remote;
 };
 
 ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
include/drm/drm_dp_mst_helper.h +6 -0
index 371cc28..30f8c11 100644
@@ -615,6 +615,12 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 
 void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
 int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
+
+ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
+			     unsigned int offset, void *buffer, size_t size);
+ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
+			      unsigned int offset, void *buffer, size_t size);
+
 struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct
 drm_atomic_state *state,
 								    struct

drm_dp_mst_topology_mgr *mgr);
int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,

Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 3e237f325a98b044231661886329a808d6701146.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#7 lore raw

Re: [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports

Hey, sorry for my late response!

Quoted 8 lines · Lyude Paul

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_add_port(struct drm_dp_mst_branch · line 1271

Quoted 6 lines
       if (old_pdt != port->pdt && !port->input) {
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1220,6 +1268,8 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
                       drm_connector_set_tile_property(port->connector);
               }
               (*mstb->mgr->cbs->register_connector)(port->connector);

This is wrong: we always want to setup everything in the connector first before trying to register it, not after. Otherwise, things explode like so:

**snip**

Quoted 48 lines
[  452.424461] ------------[ cut here ]------------
[  452.424464] sysfs group 'power' not found for kobject 'drm_dp_aux5'
[  452.424471] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424473] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev
[  452.424492] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted: G           O      5.1.0Lyude-Test+ #1
[  452.424494] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W (1.12 ) 04/09/2018
[  452.424496] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424498] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424500] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424501] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[  452.424502] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff981fde2d5a00
[  452.424503] RBP: ffffffffa9ea12e0 R08: 0000000000000792 R09: 0000000000000046
[  452.424504] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12: ffff981fd5f77010
[  452.424505] R13: ffff981fd6ebbedc R14: dead000000000200 R15: dead000000000100
[  452.424507] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000) knlGS:0000000000000000
[  452.424508] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424509] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4: 00000000003606e0
[  452.424510] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.424511] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  452.424512] Call Trace:
[  452.424516]  device_del+0x75/0x360
[  452.424518]  ? class_find_device+0x96/0xf0
[  452.424520]  device_unregister+0x16/0x60
[  452.424521]  device_destroy+0x3a/0x40
[  452.424525]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.424534]  ? drm_dbg+0x87/0x90 [drm]
[  452.424538]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424543]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424547]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0 [drm_kms_helper]
[  452.424551]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.424571]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424592]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424600]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424621]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424633]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424645]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424647]  pci_device_remove+0x3b/0xc0
[  452.424649]  device_release_driver_internal+0xe4/0x1d0
[  452.424651]  pci_stop_bus_device+0x69/0x90
[  452.424653]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424655]  remove_store+0x75/0x90
[  452.424656]  kernfs_fop_write+0x116/0x190
[  452.424658]  vfs_write+0xa5/0x1a0
[  452.424660]  ksys_write+0x57/0xd0
[  452.424663]  do_syscall_64+0x55/0x150
[  452.424665]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424667] RIP: 0033:0x7f8cc1e7d038
[  452.424668] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
Quoted 8 lines
[  452.424670] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  452.424672] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f8cc1e7d038
[  452.424673] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI: 0000000000000001
[  452.424674] RBP: 000056515aefbf00 R08: 000000000000000a R09: 00007f8cc1f0ee80
[  452.424675] R10: 000000000000000a R11: 0000000000000246 R12: 00007f8cc1f50780
[  452.424676] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15: 0000000000000002
[  452.424678] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424680] ---[ end trace a1c11eaf054910a3 ]---

**snip**

Quoted 5 lines

So, we need to move the drm_dp_aux_register_devnode() call above the connector registration callback. Same goes for the port->aux.dev = port->connector-

Quoted 1 line

kdev; assignment that you do in patch 3/7 (and of course, you can remove the

connector registration status check there now).

Hmm, I don't think that will quite work for the purpose of the series.

If I register the aux device before the connector's, I wouldn't be able to set the connector's kdev as parent. The udev rules depend on this hierarchy to generate the symlinks we want - it reads the parent connector's attrs.

How are you reproducing this? I can try debugging this on an intel system. It looks like there's an expected 'power' attribute group that's missing when unregistering the aux device - I wonder where that gets attached.

Thanks,
Leo

Quoted 4 lines

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_add_port(struct drm_dp_mst_branch *mstb, · line 1273

Quoted 4 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
+
+             drm_dp_aux_register_devnode(&port->aux);
       }

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

maintainer
#8 lore raw

Re: [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports

Quoted 117 lines · Sun peng (Leo)

Hey, sorry for my late response!

Quoted 10 lines · Lyude Paul
Quoted 7 lines
       if (old_pdt != port->pdt && !port->input) {
(quoted diff) +0 -0
@@ -1220,6 +1268,8 @@ static void drm_dp_add_port(struct

drm_dp_mst_branch
*mstb,

                       drm_connector_set_tile_property(port->connector);
               }
               (*mstb->mgr->cbs->register_connector)(port->connector);

This is wrong: we always want to setup everything in the connector first before trying to register it, not after. Otherwise, things explode like so:

**snip**

Quoted 84 lines
[  452.424461] ------------[ cut here ]------------
[  452.424464] sysfs group 'power' not found for kobject 'drm_dp_aux5'
[  452.424471] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.424473] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl

x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev

[  452.424492] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted:
G           O      5.1.0Lyude-Test+ #1
[  452.424494] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W
(1.12 ) 04/09/2018
[  452.424496] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424498] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc
ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff
<0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424500] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424501] RAX: 0000000000000000 RBX: 0000000000000000 RCX:
0000000000000006
[  452.424502] RDX: 0000000000000007 RSI: 0000000000000086 RDI:
ffff981fde2d5a00
[  452.424503] RBP: ffffffffa9ea12e0 R08: 0000000000000792 R09:
0000000000000046
[  452.424504] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12:
ffff981fd5f77010
[  452.424505] R13: ffff981fd6ebbedc R14: dead000000000200 R15:
dead000000000100
[  452.424507] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000)
knlGS:0000000000000000
[  452.424508] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424509] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4:
00000000003606e0
[  452.424510] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[  452.424511] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[  452.424512] Call Trace:
[  452.424516]  device_del+0x75/0x360
[  452.424518]  ? class_find_device+0x96/0xf0
[  452.424520]  device_unregister+0x16/0x60
[  452.424521]  device_destroy+0x3a/0x40
[  452.424525]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.424534]  ? drm_dbg+0x87/0x90 [drm]
[  452.424538]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424543]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424547]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0
[drm_kms_helper]
[  452.424551]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.424571]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424592]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424600]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424621]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424633]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424645]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424647]  pci_device_remove+0x3b/0xc0
[  452.424649]  device_release_driver_internal+0xe4/0x1d0
[  452.424651]  pci_stop_bus_device+0x69/0x90
[  452.424653]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424655]  remove_store+0x75/0x90
[  452.424656]  kernfs_fop_write+0x116/0x190
[  452.424658]  vfs_write+0xa5/0x1a0
[  452.424660]  ksys_write+0x57/0xd0
[  452.424663]  do_syscall_64+0x55/0x150
[  452.424665]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424667] RIP: 0033:0x7f8cc1e7d038
[  452.424668] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00
f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05
<48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.424670] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX:
0000000000000001
[  452.424672] RAX: ffffffffffffffda RBX: 0000000000000002 RCX:
00007f8cc1e7d038
[  452.424673] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI:
0000000000000001
[  452.424674] RBP: 000056515aefbf00 R08: 000000000000000a R09:
Quoted 8 lines

00007f8cc1f0ee80

[  452.424675] R10: 000000000000000a R11: 0000000000000246 R12:
00007f8cc1f50780
[  452.424676] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15:
0000000000000002
[  452.424678] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.424680] ---[ end trace a1c11eaf054910a3 ]---

**snip**

Quoted 5 lines

So, we need to move the drm_dp_aux_register_devnode() call above the connector
registration callback. Same goes for the port->aux.dev = port->connector-

Quoted 2 lines

kdev; assignment that you do in patch 3/7 (and of course, you can remove the

Quoted 8 lines
Quoted 1 line

connector registration status check there now).

Hmm, I don't think that will quite work for the purpose of the series.

If I register the aux device before the connector's, I wouldn't be able to set the connector's kdev as parent. The udev rules depend on this hierarchy to generate the symlinks we want - it reads the parent connector's attrs.

eesh, you're right-somehow I didn't notice that. Guess we'll need some sort of other fix then

Quoted 5 lines

How are you reproducing this? I can try debugging this on an intel system. It looks like there's an expected 'power' attribute group that's missing when unregistering the aux device - I wonder where that gets attached.

I'm reproducing this just by reloading i915 on a machine with some MST displays connected. I uploaded a copy of the script that I use to do this here:

https://people.freedesktop.org/~lyudess/archive/06-03-2019/unloadgpumod.sh

Given a module (in this case drm.ko), it will go through and unload all of the modules depending on it, then drm.ko, then reload.

Quoted 7 lines

Thanks,
Leo

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
+
+             drm_dp_aux_register_devnode(&port->aux);
       }
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
maintainer
#9 lore raw

Re: [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports

Quoted 144 lines · Lyude Paul
Quoted 125 lines · Sun peng (Leo)

Hey, sorry for my late response!

Quoted 11 lines · Lyude Paul
Quoted 8 lines
       if (old_pdt != port->pdt && !port->input) {
(quoted diff) +0 -0
@@ -1220,6 +1268,8 @@ static void drm_dp_add_port(struct

drm_dp_mst_branch
*mstb,
drm_connector_set_tile_property(port-

Quoted 1 line

connector);

               }
               (*mstb->mgr->cbs->register_connector)(port->connector);

This is wrong: we always want to setup everything in the connector first before trying to register it, not after. Otherwise, things explode like so:

**snip**

Quoted 89 lines
[  452.424461] ------------[ cut here ]------------
[  452.424464] sysfs group 'power' not found for kobject 'drm_dp_aux5'
[  452.424471] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.424473] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl

x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev

[  452.424492] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted:
G           O      5.1.0Lyude-Test+ #1
[  452.424494] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS
N22ET35W
(1.12 ) 04/09/2018
[  452.424496] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424498] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0
bc
ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff
<0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424500] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424501] RAX: 0000000000000000 RBX: 0000000000000000 RCX:
0000000000000006
[  452.424502] RDX: 0000000000000007 RSI: 0000000000000086 RDI:
ffff981fde2d5a00
[  452.424503] RBP: ffffffffa9ea12e0 R08: 0000000000000792 R09:
0000000000000046
[  452.424504] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12:
ffff981fd5f77010
[  452.424505] R13: ffff981fd6ebbedc R14: dead000000000200 R15:
dead000000000100
[  452.424507] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000)
knlGS:0000000000000000
[  452.424508] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424509] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4:
00000000003606e0
[  452.424510] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[  452.424511] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[  452.424512] Call Trace:
[  452.424516]  device_del+0x75/0x360
[  452.424518]  ? class_find_device+0x96/0xf0
[  452.424520]  device_unregister+0x16/0x60
[  452.424521]  device_destroy+0x3a/0x40
[  452.424525]  drm_dp_aux_unregister_devnode+0xea/0x180
[drm_kms_helper]
[  452.424534]  ? drm_dbg+0x87/0x90 [drm]
[  452.424538]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424543]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424547]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0
[drm_kms_helper]
[  452.424551]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0
[drm_kms_helper]
[  452.424571]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424592]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424600]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424621]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424633]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424645]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424647]  pci_device_remove+0x3b/0xc0
[  452.424649]  device_release_driver_internal+0xe4/0x1d0
[  452.424651]  pci_stop_bus_device+0x69/0x90
[  452.424653]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424655]  remove_store+0x75/0x90
[  452.424656]  kernfs_fop_write+0x116/0x190
[  452.424658]  vfs_write+0xa5/0x1a0
[  452.424660]  ksys_write+0x57/0xd0
[  452.424663]  do_syscall_64+0x55/0x150
[  452.424665]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424667] RIP: 0033:0x7f8cc1e7d038
[  452.424668] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00
00
f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05
<48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.424670] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX:
0000000000000001
[  452.424672] RAX: ffffffffffffffda RBX: 0000000000000002 RCX:
00007f8cc1e7d038
[  452.424673] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI:
0000000000000001
[  452.424674] RBP: 000056515aefbf00 R08: 000000000000000a R09:
Quoted 8 lines

00007f8cc1f0ee80

[  452.424675] R10: 000000000000000a R11: 0000000000000246 R12:
00007f8cc1f50780
[  452.424676] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15:
0000000000000002
[  452.424678] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.424680] ---[ end trace a1c11eaf054910a3 ]---

**snip**

Quoted 7 lines

So, we need to move the drm_dp_aux_register_devnode() call above the connector
registration callback. Same goes for the port->aux.dev = port-

Quoted 4 lines

connector-
kdev; assignment that you do in patch 3/7 (and of course, you can remove
the

Quoted 8 lines
Quoted 1 line

connector registration status check there now).

Hmm, I don't think that will quite work for the purpose of the series.

If I register the aux device before the connector's, I wouldn't be able to set the connector's kdev as parent. The udev rules depend on this hierarchy to generate the symlinks we want - it reads the parent connector's attrs.

eesh, you're right-somehow I didn't notice that. Guess we'll need some sort of
other fix then

Quoted 4 lines

How are you reproducing this? I can try debugging this on an intel system. It looks like there's an expected 'power' attribute group that's missing when unregistering the aux device - I wonder where that gets attached.

Quoted 5 lines

I'm reproducing this just by reloading i915 on a machine with some MST displays connected. I uploaded a copy of the script that I use to do this here:

https://people.freedesktop.org/~lyudess/archive/06-03-2019/unloadgpumod.sh

oops-almost forgot to mention. The argument you pass to make it reload instead of just unloading is --reload

Quoted 10 lines

Given a module (in this case drm.ko), it will go through and unload all of the
modules depending on it, then drm.ko, then reload.

Quoted 6 lines

Thanks,
Leo

Quoted 3 lines
Quoted 3 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
+
+             drm_dp_aux_register_devnode(&port->aux);
       }
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#10 lore raw

Re: [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports

Quoted 8 lines · Lyude Paul
Quoted 5 lines

I'm reproducing this just by reloading i915 on a machine with some MST displays connected. I uploaded a copy of the script that I use to do this here:

https://people.freedesktop.org/~lyudess/archive/06-03-2019/unloadgpumod.sh

oops-almost forgot to mention. The argument you pass to make it reload instead of just unloading is --reload

Thanks for the script!

So, the warning has to do with:

1. Having the aux device as a child of connector device, and
2. During driver unload, drm_connector_unregister() is called before drm_dp_mst_topology_put_port()

Which means that connector_unregister() will recursively remove the child aux device, before put_port() can properly unregister it. Any further attempts to remove after the first will throw a "not found" warning.

Call-stacks for reference:

*drm_connector_unregister*+0x37/0x60 [drm]

   drm_connector_unregister_all+0x30/0x60 [drm]
   drm_modeset_unregister_all+0xe/0x30 [drm]
   drm_dev_unregister+0x9c/0xb0 [drm]
   i915_driver_unload+0x73/0x120 [i915]

   drm_dp_aux_unregister_devnode+0xf5/0x180 [drm_kms_helper]
   *drm_dp_mst_topology_put_port*+0x4e/0xf0 [drm_kms_helper]
   drm_dp_mst_topology_put_mstb+0x91/0x160 [drm_kms_helper]
   drm_dp_mst_topology_mgr_set_mst+0x12b/0x2b0 [drm_kms_helper]
   ? __finish_swait+0x10/0x40
   drm_dp_mst_topology_mgr_destroy+0x11/0xa0 [drm_kms_helper]
   intel_dp_encoder_flush_work+0x32/0xb0 [i915]
   intel_ddi_encoder_destroy+0x32/0x60 [i915]
   drm_mode_config_cleanup+0x51/0x2e0 [drm]
   intel_modeset_cleanup+0xc8/0x140 [i915]
   i915_driver_unload+0xa0/0x120 [i915]

A solution is to unregister the aux device immediately before the connector device is unregistered - if we are to keep the aux device as a child. Following current scheme with SST, it looks like drm_connector_funcs->early_unregister() is the right place to do so. To keep the balance, aux registration will then happen in drm_connector_funcs->late_register(). This will leave the SDP transaction handling part in DRM still, but pass the responsibility of creating and removing remote (fake) aux devices to the driver.

I have a WIP patch here for you to take a look. It should apply on top of the existing patchset:
https://pastebin.com/1YJZhL4C

I'd like to hear your thoughts, before I go and modify other drivers :)

Thanks,
Leo
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 1acd58fd-a5e8-0f07-709a-902ea67ba760-5C7GfCeVMHo@public.gmane.org

#12 lore raw

Re: [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports

Quoted 54 lines · Sun peng (Leo)
Quoted 10 lines · Lyude Paul
Quoted 6 lines

I'm reproducing this just by reloading i915 on a machine with some MST displays connected. I uploaded a copy of the script that I use to do this
here:

https://people.freedesktop.org/~lyudess/archive/06-03-2019/unloadgpumod.sh

oops-almost forgot to mention. The argument you pass to make it reload instead
of just unloading is --reload

Thanks for the script!

So, the warning has to do with:

1. Having the aux device as a child of connector device, and
2. During driver unload, drm_connector_unregister() is called before drm_dp_mst_topology_put_port()

Which means that connector_unregister() will recursively remove the child aux device, before put_port() can properly unregister it. Any further attempts to remove after the first will throw a "not found" warning.

Call-stacks for reference:

   *drm_connector_unregister*+0x37/0x60 [drm]
   drm_connector_unregister_all+0x30/0x60 [drm]
   drm_modeset_unregister_all+0xe/0x30 [drm]
   drm_dev_unregister+0x9c/0xb0 [drm]
   i915_driver_unload+0x73/0x120 [i915]

   drm_dp_aux_unregister_devnode+0xf5/0x180 [drm_kms_helper]
   *drm_dp_mst_topology_put_port*+0x4e/0xf0 [drm_kms_helper]
   drm_dp_mst_topology_put_mstb+0x91/0x160 [drm_kms_helper]
   drm_dp_mst_topology_mgr_set_mst+0x12b/0x2b0 [drm_kms_helper]
   ? __finish_swait+0x10/0x40
   drm_dp_mst_topology_mgr_destroy+0x11/0xa0 [drm_kms_helper]
   intel_dp_encoder_flush_work+0x32/0xb0 [i915]
   intel_ddi_encoder_destroy+0x32/0x60 [i915]
   drm_mode_config_cleanup+0x51/0x2e0 [drm]
   intel_modeset_cleanup+0xc8/0x140 [i915]
   i915_driver_unload+0xa0/0x120 [i915]

A solution is to unregister the aux device immediately before the connector device is unregistered - if we are to keep the aux device as a child. Following current scheme with SST, it looks like drm_connector_funcs->early_unregister() is the right place to do so. To keep the balance, aux registration will then happen in drm_connector_funcs->late_register(). This will leave the SDP transaction handling part in DRM still, but pass the responsibility of creating and removing remote (fake) aux devices to the driver.

Quoted 4 lines

I have a WIP patch here for you to take a look. It should apply on top of the existing patchset:
https://pastebin.com/1YJZhL4C

This approach seems fine to me! I was thinking we might end up doing something like this. My only thought is that we can probably write up a drm_dp_mst_connector_late_register() and drm_dp_mst_connector_early_unregister() that drivers can call from their →late_register()/→early_unregister() callbacks that handles printing the debug message, setting the parent and registering/unregistering the aux device. I'd imagine someday in the future we'll probably have more things to add to those callbacks for mst as well.

Quoted 4 lines

I'd like to hear your thoughts, before I go and modify other drivers :)

Thanks,
Leo

Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#13 lore raw

Re: [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports

In reply to a message not in the archive

Sorry for the late response! just jumping back on this now.

Quoted 90 lines · Lyude Paul

[CAUTION: External Email]

So a couple of things:

Quoted 85 lines · On Thu, 2019-05-16 at 11:17 -0400, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

All available downstream ports - physical and logical - are exposed for each MST device. They are listed in /dev/, following the same naming scheme as SST devices by appending an incremental ID.

Although all downstream ports are exposed, only some will work as expected. Consider the following topology:

                +---------+
                |  ASIC   |
                +---------+
               Conn-0|
                     |
                +----v----+
           +----| MST HUB |----+
           |    +---------+    |
           |                   |
           |Port-1       Port-2|
     +-----v-----+       +-----v-----+
     |  MST      |       |  SST      |
     |  Display  |       |  Display  |
     +-----------+       +-----------+
           |Port-1

x

MST Path | MST Device
----------+----------------------------------

  sst:0     | MST Hub
  mst:0-1   | MST Display
  mst:0-1-1 | MST Display's disconnected DP out
  mst:0-1-8 | MST Display's internal sink
  mst:0-2   | SST Display

On certain MST displays, the upstream physical port will ACK DPCD reads. However, reads on the local logical port to the internal sink will *NAK*. i.e. reading mst:0-1 ACKs, but mst:0-1-8 NAKs.

There may also be duplicates. Some displays will return the same GUID when reading DPCD from both mst:0-1 and mst:0-1-8.

There are some device-dependent behavior as well. The MST hub used during testing will actually *ACK* read requests on a disconnected physical port, whereas the MST displays will NAK.

In light of these discrepancies, it's simpler to expose all downstream ports - both physical and logical - and let the user decide what to use.

---
  drivers/gpu/drm/drm_dp_aux_dev.c      |  14 ++++-
  drivers/gpu/drm/drm_dp_mst_topology.c | 103 +++++++++++++++++++++++++++++
-----
  include/drm/drm_dp_helper.h           |   4 ++
  include/drm/drm_dp_mst_helper.h       |   6 ++
  4 files changed, 112 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +2 -0
index 6d84611..01c02b9 100644
@@ -34,6 +34,7 @@
  #include <linux/uaccess.h>
  #include <linux/uio.h>
  #include <drm/drm_dp_helper.h>
+#include <drm/drm_dp_mst_helper.h>
  #include <drm/drm_crtc.h>
  #include <drm/drmP.h>
 
@@ -114,6 +115,7 @@ static ssize_t name_show(struct device *dev,
 
       return res;
  }
+
  static DEVICE_ATTR_RO(name);
 
  static struct attribute *drm_dp_aux_attrs[] = {
@@ -160,7 +162,11 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb,
 struct iov_iter *to)
                       break;
               }
 
Quoted 13 lines

drivers/gpu/drm/drm_dp_aux_dev.c static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to) · line 169

Quoted 7 lines
drivers/gpu/drm/drm_dp_aux_dev.c +5 -1
-             res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+             if (aux_dev->aux->is_remote)
+                     res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf,
 todo);
+             else
+                     res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+

It's still not at all clear to me why we're trying to avoid specifying actual callbacks for the aux device. We should remove this part entirely, remove the is_remote entry from struct drm_dp_aux, and then just specify our own hook in struct drm_dp_aux->transfer().

I'm not sure if this would work well. The existing policy does retries around the ->transfer() call. Using the same hook will cause a nested retry - once when calling remote_aux->transfer, and another when calling real_aux->transfer. The difference is the scope of the retry. The former replays the entire aux transaction, while the latter replays just the failed sideband packet. I think having the retry at the packet level makes more sense. Either way, it shouldn't happen in a nested manner.

In general, we need a way to determine whether a message needs to be sent via sideband. I'm not sure if there's a better way than setting a 'is_remote' flag?

Leo

Quoted 580 lines
Quoted 24 lines
drivers/gpu/drm/drm_dp_aux_dev.c +0 -0
               if (res <= 0)
                       break;
drivers/gpu/drm/drm_dp_aux_dev.c +5 -1
@@ -207,7 +213,11 @@ static ssize_t auxdev_write_iter(struct kiocb *iocb,
 struct iov_iter *from)
                       break;
               }
 
-             res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+             if (aux_dev->aux->is_remote)
+                     res = drm_dp_mst_dpcd_write(aux_dev->aux, pos, buf,
 todo);
+             else
+                     res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+
               if (res <= 0)
                       break;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 2ab16c9..54da68e 100644

drivers/gpu/drm/drm_dp_mst_topology.c line 39

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
@@ -35,6 +35,8 @@
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_crtc_helper.h>
 
+#include "drm_crtc_helper_internal.h"
+

Unless I'm mistaken, this looks like some sort of ditritus.

Quoted 97 lines
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
  /**
   * DOC: dp mst helper
   *
@@ -52,6 +54,9 @@ static int drm_dp_dpcd_write_payload(struct
 drm_dp_mst_topology_mgr *mgr,
                                    int id,
                                    struct drm_dp_payload *payload);
 
+static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
+                              struct drm_dp_mst_port *port,
+                              int offset, int size, u8 *bytes);
  static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
                                 struct drm_dp_mst_port *port,
                                 int offset, int size, u8 *bytes);
drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
@@ -941,6 +946,8 @@ static void drm_dp_destroy_port(struct kref *kref)
       struct drm_dp_mst_topology_mgr *mgr = port->mgr;
 
       if (!port->input) {
+             drm_dp_aux_unregister_devnode(&port->aux);
+
               port->vcpi.num_slots = 0;
 
               kfree(port->cached_edid);
@@ -1095,6 +1102,46 @@ static bool drm_dp_port_setup_pdt(struct
 drm_dp_mst_port *port)
       return send_link;
  }
 
+/**
+ * drm_dp_mst_dpcd_read() - read a series of bytes from the DPCD via

sideband
+ * @aux: Fake sideband AUX CH
+ * @offset: address of the (first) register to read
+ * @buffer: buffer to store the register values
+ * @size: number of bytes in @buffer
+ *
+ * Performs the same functionality for remote devices via
+ * sideband messaging as drm_dp_dpcd_read() does for local
+ * devices via actual AUX CH.
+ */

drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
+ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
+                          unsigned int offset, void *buffer, size_t size)
+{
+     struct drm_dp_mst_port *port = container_of(aux, struct

drm_dp_mst_port, aux);

drivers/gpu/drm/drm_dp_mst_topology.c +7 -0
+
+     return drm_dp_send_dpcd_read(port->mgr, port,
+                                  offset, size, buffer);
+}
+
+/**
+ * drm_dp_mst_dpcd_write() - write a series of bytes to the DPCD via

sideband
+ * @aux: Fake sideband AUX CH
+ * @offset: address of the (first) register to write
+ * @buffer: buffer containing the values to write
+ * @size: number of bytes in @buffer
+ *
+ * Performs the same functionality for remote devices via
+ * sideband messaging as drm_dp_dpcd_write() does for local
+ * devices via actual AUX CH.
+ */

drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
+ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
+                           unsigned int offset, void *buffer, size_t size)
+{
+     struct drm_dp_mst_port *port = container_of(aux, struct

drm_dp_mst_port, aux);

drivers/gpu/drm/drm_dp_mst_topology.c +5 -0
+
+     return drm_dp_send_dpcd_write(port->mgr, port,
+                                   offset, size, buffer);
+}
+
  static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8

*guid)

  {
       int ret;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -1158,6 +1205,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
               port->mgr = mstb->mgr;
               port->aux.name = "DPMST";
               port->aux.dev = dev->dev;
+             port->aux.is_remote = true;
               created = true;
       } else {
               old_pdt = port->pdt;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
@@ -1188,7 +1236,7 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
                               drm_dp_send_enum_path_resources(mstb->mgr,
 mstb, port);
               } else {
                       port->available_pbn = 0;
-                     }
+             }
       }
       if (old_pdt != port->pdt && !port->input) {

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_add_port(struct drm_dp_mst_branch · line 1271

Quoted 4 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1220,6 +1268,8 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
                       drm_connector_set_tile_property(port->connector);
               }
               (*mstb->mgr->cbs->register_connector)(port->connector);

This is wrong: we always want to setup everything in the connector first before trying to register it, not after. Otherwise, things explode like so:

[   13.305329] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (3)
[   13.305361] [drm:drm_mode_object_get [drm]] OBJ ID: 123 (1)
[   13.305384] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (4)
[   13.305405] [drm:drm_mode_object_get [drm]] OBJ ID: 124 (1)
[   13.305429] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (5)
[   13.305449] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (6)
[   13.305471] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[   13.305490] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (6)
[   13.305512] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[   13.305532] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[   13.305552] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (5)
[   13.305571] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (6)
[   13.305592] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[   13.305612] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (6)
[   13.305631] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[   13.305651] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[   13.305725] [drm:drm_vblank_enable [drm]] enabling vblank on crtc 0, ret: 0
[   13.305768] [drm:drm_vblank_enable [drm]] enabling vblank on crtc 1, ret: 0
[   13.306088] [drm:drm_handle_vblank [drm]] vblank event on 325, current 325
[   13.322514] [drm:drm_handle_vblank [drm]] vblank event on 313, current 313
[   13.322612] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[   13.322634] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (5)
[   13.322656] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[   13.322676] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (5)
[   13.322697] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (2)
[   13.322718] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (2)
[   13.322740] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (5)
[   13.322764] [drm:vblank_disable_fn [drm]] disabling vblank on crtc 0
[   13.322784] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (4)
[   13.339191] [drm:vblank_disable_fn [drm]] disabling vblank on crtc 1
[  451.149789] Console: switching to colour dummy device 80x25
[  451.194596] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPDDC-A] unregistering
[  451.194666] [drm:drm_sysfs_connector_remove [drm]] removing "eDP-1" from sysfs
[  451.194718] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPDDC-B] unregistering
[  451.194766] [drm:drm_sysfs_connector_remove [drm]] removing "DP-1" from sysfs
[  451.194791] [drm:drm_sysfs_connector_remove [drm]] removing "HDMI-A-1" from sysfs
[  451.194835] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPDDC-C] unregistering
[  451.194880] [drm:drm_sysfs_connector_remove [drm]] removing "DP-2" from sysfs
[  451.194903] [drm:drm_sysfs_connector_remove [drm]] removing "HDMI-A-2" from sysfs
[  451.194924] [drm:drm_sysfs_connector_remove [drm]] removing "DP-3" from sysfs
[  451.194950] [drm:drm_sysfs_connector_remove [drm]] removing "DP-4" from sysfs
[  451.194975] [drm:drm_sysfs_connector_remove [drm]] removing "DP-5" from sysfs
[  451.204535] [drm:drm_mode_object_get [drm]] OBJ ID: 123 (1)
[  451.204551] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (2)
[  451.204566] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (3)
[  451.204582] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[  451.204596] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (6)
[  451.204611] [drm:drm_mode_object_get [drm]] OBJ ID: 124 (1)
[  451.204621] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (2)
[  451.204631] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (4)
[  451.204641] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[  451.204651] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (6)
[  451.204662] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[  451.204671] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[  451.204680] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (5)
[  451.204689] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (4)
[  451.204699] [drm:drm_dp_mst_duplicate_state [drm_kms_helper]] port 00000000dde1b00a (5)
[  451.204703] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (4)
[  451.411817] [drm:intel_panel_actually_set_backlight [i915]] set backlight PWM = 0
[  451.420911] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-A: 0x00600 AUX <- (ret=  1) 02
[  451.425358] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x01000000, dig 0x11101010, pins 0x00000010, long 0x00000000
[  451.425422] [drm:intel_hpd_irq_handler [i915]] digital hpd port A - short
[  451.471777] [drm:drm_dp_mst_topology_get_mstb_validated [drm_kms_helper]] mstb 00000000eec1a629 (2)
[  451.473361] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x01000000, dig 0x12101010, pins 0x00000010, long 0x00000010
[  451.473465] [drm:intel_hpd_irq_handler [i915]] digital hpd port A - long
[  452.207301] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x01000000, dig 0x12101010, pins 0x00000010, long 0x00000010
[  452.207395] [drm:intel_hpd_irq_handler [i915]] digital hpd port A - long
[  452.340311] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-A: 0x00000 AUX -> (ret= 15) 11 0a 02 41 00 00 01 00 02 00 00 00 00 0b 00
[  452.341060] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-A: 0x00201 AUX -> (ret=  1) 00
[  452.341584] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x01000 AUX <- (ret= 10) 10 47 d3 11 11 01 00 00 00 f4
[  452.343183] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x00200000, dig 0x10101011, pins 0x00000020, long 0x00000000
[  452.343286] [drm:intel_hpd_irq_handler [i915]] digital hpd port B - short
[  452.344765] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002 AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 77 77 01 00
[  452.346263] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x01400 AUX -> (ret= 16) 10 46 d6 11 10 01 00 00 78 00 00 00 00 00 00 00
[  452.346287] [drm:drm_dp_get_mst_branch_device [drm_kms_helper]] mstb 00000000eec1a629 (3)
[  452.346305] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 00000000eec1a629 (2)
[  452.346405] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 00000000eec1a629 (1)
[  452.347529] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x02003 AUX <- (ret=  3) 10 00 00
[  452.348672] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x002c0 AUX <- (ret=  1) 01
[  452.350168] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002 AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 77 77 01 00
[  452.351328] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x001c0 AUX <- (ret=  3) 01 01 00
[  452.352665] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0 AUX -> (ret=  1) 01
[  452.358905] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0 AUX -> (ret=  1) 01
[  452.360327] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0 AUX -> (ret=  1) 01
[  452.361660] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0 AUX -> (ret=  1) 03
[  452.361681] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (3)
[  452.361700] [drm:drm_dp_mst_topology_get_port_validated [drm_kms_helper]] port 00000000dde1b00a (2)
[  452.362894] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x01000 AUX <- (ret=  6) 10 43 c7 25 10 c0
[  452.364318] [drm:gen8_de_irq_handler [i915]] hotplug event received, stat 0x00200000, dig 0x10101011, pins 0x00000020, long 0x00000000
[  452.364421] [drm:intel_hpd_irq_handler [i915]] digital hpd port B - short
[  452.365929] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002 AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 77 77 01 00
[  452.367361] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x01400 AUX -> (ret= 16) 10 43 c7 25 10 c0 00 00 00 00 00 00 00 00 00 00
[  452.367388] [drm:drm_dp_get_mst_branch_device [drm_kms_helper]] mstb 00000000eec1a629 (2)
[  452.367407] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 00000000eec1a629 (1)
[  452.367460] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 00000000dde1b00a (1)
[  452.368548] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x02003 AUX <- (ret=  3) 10 00 00
[  452.368803] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x00600 AUX <- (ret=  1) 02
[  452.368970] [drm:intel_dump_cdclk_state [i915]] Changing CDCLK to 337500 kHz, VCO 8100000 kHz, ref 24000 kHz, bypass 24000 kHz, voltage level 0
[  452.369269] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (1)
[  452.369330] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (1)
[  452.369422] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (5)
[  452.369466] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (4)
[  452.369515] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (5)
[  452.369558] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (4)
[  452.369608] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (3)
[  452.369660] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (2)
[  452.369690] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (2)
[  452.369750] [drm:drm_irq_uninstall [drm]] irq=177
[  452.406452] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002 AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 00 00 80 00
[  452.412626] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (3)
[  452.412636] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 91 (2)
[  452.412644] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 98 (2)
[  452.412652] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 104 (2)
[  452.412660] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 109 (2)
[  452.412668] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (3)
[  452.412676] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 117 (2)
[  452.412684] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 120 (2)
[  452.412692] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (2)
[  452.412700] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (2)
[  452.412708] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (1)
[  452.424450] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x00111 AUX <- (ret=  1) 00
[  452.424454] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 00000000eec1a629 (0)
[  452.424457] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 00000000eeef3cfd (0)
[  452.424461] ------------[ cut here ]------------
[  452.424464] sysfs group 'power' not found for kobject 'drm_dp_aux5'
[  452.424471] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424473] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev
[  452.424492] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted: G           O      5.1.0Lyude-Test+ #1
[  452.424494] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W (1.12 ) 04/09/2018
[  452.424496] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424498] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424500] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424501] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[  452.424502] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff981fde2d5a00
[  452.424503] RBP: ffffffffa9ea12e0 R08: 0000000000000792 R09: 0000000000000046
[  452.424504] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12: ffff981fd5f77010
[  452.424505] R13: ffff981fd6ebbedc R14: dead000000000200 R15: dead000000000100
[  452.424507] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000) knlGS:0000000000000000
[  452.424508] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424509] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4: 00000000003606e0
[  452.424510] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.424511] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  452.424512] Call Trace:
[  452.424516]  device_del+0x75/0x360
[  452.424518]  ? class_find_device+0x96/0xf0
[  452.424520]  device_unregister+0x16/0x60
[  452.424521]  device_destroy+0x3a/0x40
[  452.424525]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.424534]  ? drm_dbg+0x87/0x90 [drm]
[  452.424538]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424543]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424547]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0 [drm_kms_helper]
[  452.424551]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.424571]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424592]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424600]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424621]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424633]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424645]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424647]  pci_device_remove+0x3b/0xc0
[  452.424649]  device_release_driver_internal+0xe4/0x1d0
[  452.424651]  pci_stop_bus_device+0x69/0x90
[  452.424653]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424655]  remove_store+0x75/0x90
[  452.424656]  kernfs_fop_write+0x116/0x190
[  452.424658]  vfs_write+0xa5/0x1a0
[  452.424660]  ksys_write+0x57/0xd0
[  452.424663]  do_syscall_64+0x55/0x150
[  452.424665]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424667] RIP: 0033:0x7f8cc1e7d038
[  452.424668] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.424670] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  452.424672] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f8cc1e7d038
[  452.424673] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI: 0000000000000001
[  452.424674] RBP: 000056515aefbf00 R08: 000000000000000a R09: 00007f8cc1f0ee80
[  452.424675] R10: 000000000000000a R11: 0000000000000246 R12: 00007f8cc1f50780
[  452.424676] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15: 0000000000000002
[  452.424678] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424680] ---[ end trace a1c11eaf054910a3 ]---
[  452.424751] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] unregistering
[  452.424755] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 000000000f6aa5a3 (0)
[  452.424765] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 120 (1)
[  452.424770] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000eeef3cfd (1)
[  452.424773] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000eeef3cfd (0)
[  452.424776] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (4)
[  452.424783] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event
[  452.424790] ------------[ cut here ]------------
[  452.424791] sysfs group 'power' not found for kobject 'drm_dp_aux4'
[  452.424795] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424796] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev
[  452.424809] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted: G        W  O      5.1.0Lyude-Test+ #1
[  452.424811] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W (1.12 ) 04/09/2018
[  452.424812] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424813] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424815] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424816] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[  452.424817] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff981fde2d5a00
[  452.424818] RBP: ffffffffa9ea12e0 R08: 00000000000007d1 R09: 0000000000000046
[  452.424820] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12: ffff981fd50d0410
[  452.424821] R13: ffff981fd6ebbebc R14: dead000000000200 R15: dead000000000100
[  452.424822] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000) knlGS:0000000000000000
[  452.424823] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424824] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4: 00000000003606e0
[  452.424825] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.424826] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  452.424827] Call Trace:
[  452.424829]  device_del+0x75/0x360
[  452.424830]  ? class_find_device+0x96/0xf0
[  452.424832]  device_unregister+0x16/0x60
[  452.424833]  device_destroy+0x3a/0x40
[  452.424837]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.424841]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424845]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424849]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0 [drm_kms_helper]
[  452.424854]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.424873]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424892]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424900]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424920]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424932]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424943]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424945]  pci_device_remove+0x3b/0xc0
[  452.424947]  device_release_driver_internal+0xe4/0x1d0
[  452.424948]  pci_stop_bus_device+0x69/0x90
[  452.424950]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424951]  remove_store+0x75/0x90
[  452.424953]  kernfs_fop_write+0x116/0x190
[  452.424954]  vfs_write+0xa5/0x1a0
[  452.424956]  ksys_write+0x57/0xd0
[  452.424957]  do_syscall_64+0x55/0x150
[  452.424959]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424960] RIP: 0033:0x7f8cc1e7d038
[  452.424961] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.424963] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  452.424965] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f8cc1e7d038
[  452.424966] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI: 0000000000000001
[  452.424967] RBP: 000056515aefbf00 R08: 000000000000000a R09: 00007f8cc1f0ee80
[  452.424968] R10: 000000000000000a R11: 0000000000000246 R12: 00007f8cc1f50780
[  452.424969] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15: 0000000000000002
[  452.424971] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.424972] ---[ end trace a1c11eaf054910a4 ]---
[  452.424992] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] unregistering
[  452.424997] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 00000000dde1b00a (0)
[  452.425006] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 117 (1)
[  452.425010] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 000000000f6aa5a3 (1)
[  452.425014] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 000000000f6aa5a3 (0)
[  452.425017] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (3)
[  452.425023] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event
[  452.425028] ------------[ cut here ]------------
[  452.425029] sysfs group 'power' not found for kobject 'drm_dp_aux3'
[  452.425033] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.425034] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev
[  452.425047] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted: G        W  O      5.1.0Lyude-Test+ #1
[  452.425048] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W (1.12 ) 04/09/2018
[  452.425050] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.425051] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff <0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.425053] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.425054] RAX: 0000000000000000 RBX: 0000000000000000 RCX: 0000000000000006
[  452.425055] RDX: 0000000000000007 RSI: 0000000000000086 RDI: ffff981fde2d5a00
[  452.425056] RBP: ffffffffa9ea12e0 R08: 000000000000080f R09: 0000000000000046
[  452.425057] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12: ffff981fd50d1810
[  452.425058] R13: ffff981fd6ebbe1c R14: dead000000000200 R15: dead000000000100
[  452.425059] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000) knlGS:0000000000000000
[  452.425061] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.425062] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4: 00000000003606e0
[  452.425063] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[  452.425064] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[  452.425065] Call Trace:
[  452.425066]  device_del+0x75/0x360
[  452.425068]  ? class_find_device+0x96/0xf0
[  452.425069]  device_unregister+0x16/0x60
[  452.425070]  device_destroy+0x3a/0x40
[  452.425074]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.425078]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.425083]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.425087]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0 [drm_kms_helper]
[  452.425091]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.425110]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.425128]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.425137]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.425157]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.425168]  i915_driver_unload+0xa8/0x130 [i915]
[  452.425180]  i915_pci_remove+0x1e/0x40 [i915]
[  452.425182]  pci_device_remove+0x3b/0xc0
[  452.425183]  device_release_driver_internal+0xe4/0x1d0
[  452.425185]  pci_stop_bus_device+0x69/0x90
[  452.425186]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.425188]  remove_store+0x75/0x90
[  452.425189]  kernfs_fop_write+0x116/0x190
[  452.425191]  vfs_write+0xa5/0x1a0
[  452.425192]  ksys_write+0x57/0xd0
[  452.425194]  do_syscall_64+0x55/0x150
[  452.425195]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.425197] RIP: 0033:0x7f8cc1e7d038
[  452.425198] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00 f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.425199] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
[  452.425201] RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00007f8cc1e7d038
[  452.425202] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI: 0000000000000001
[  452.425203] RBP: 000056515aefbf00 R08: 000000000000000a R09: 00007f8cc1f0ee80
[  452.425204] R10: 000000000000000a R11: 0000000000000246 R12: 00007f8cc1f50780
[  452.425205] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15: 0000000000000002
[  452.425207] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256 sysfs_remove_group+0x76/0x80
[  452.425208] ---[ end trace a1c11eaf054910a5 ]---
[  452.425282] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] unregistering
[  452.425288] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 000000002ba3174e (0)
[  452.425292] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 000000002ba3174e (0)
[  452.425295] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (2)
[  452.425299] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (1)
[  452.425311] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (1)
[  452.425318] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (1)
[  452.425365] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port 00000000dde1b00a (0)
[  452.425368] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb 00000000eec1a629 (0)

So, we need to move the drm_dp_aux_register_devnode() call above the connector registration callback. Same goes for the port->aux.dev = port->connector-

Quoted 1 line

kdev; assignment that you do in patch 3/7 (and of course, you can remove the

connector registration status check there now).

Quoted 125 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
+
+             drm_dp_aux_register_devnode(&port->aux);
       }
 
  out:
@@ -1404,7 +1454,6 @@ static bool drm_dp_validate_guid(struct
 drm_dp_mst_topology_mgr *mgr,
       return false;
  }
 
-#if 0
  static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8 port_num,
 u32 offset, u8 num_bytes)
  {
       struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1417,7 +1466,6 @@ static int build_dpcd_read(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

       return 0;

}

drivers/gpu/drm/drm_dp_mst_topology.c +36 -8
-#endif
 
  static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr *mgr,
                                   bool up, u8 *msg, int len)
@@ -1994,26 +2042,55 @@ int drm_dp_update_payload_part2(struct
 drm_dp_mst_topology_mgr *mgr)
  }
  EXPORT_SYMBOL(drm_dp_update_payload_part2);
 
-#if 0 /* unused as of yet */
  static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
-                              int offset, int size)
+                              int offset, int size, u8 *bytes)
  {
       int len;
+     int ret = 0;
       struct drm_dp_sideband_msg_tx *txmsg;
+     struct drm_dp_mst_branch *mstb;
+
+     mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent);
+     if (!mstb)
+             return -EINVAL;
 
       txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
-     if (!txmsg)
-             return -ENOMEM;
+     if (!txmsg) {
+             ret = -ENOMEM;
+             goto fail_put;
+     }
 
-     len = build_dpcd_read(txmsg, port->port_num, 0, 8);
+     len = build_dpcd_read(txmsg, port->port_num, offset, size);
       txmsg->dst = port->parent;
 
       drm_dp_queue_down_tx(mgr, txmsg);
 
-     return 0;
+     ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
+     if (ret < 0)
+             goto fail_free;
+
+     /* DPCD read should never be NACKed */
+     if (WARN_ON_ONCE(txmsg->reply.reply_type == 1)) {
+             ret = -EIO;
+             goto fail_free;
+     }
+
+     if (txmsg->reply.u.remote_dpcd_read_ack.num_bytes != size) {
+             ret = -EPROTO;
+             goto fail_free;
+     }
+
+     ret = min_t(size_t, txmsg->reply.u.remote_dpcd_read_ack.num_bytes,
 size);
+     memcpy(bytes, txmsg->reply.u.remote_dpcd_read_ack.bytes, ret);
+
+fail_free:
+     kfree(txmsg);
+fail_put:
+     drm_dp_put_mst_branch_device(mstb);
+
+     return ret;
  }
-#endif
 

static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port,

drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
@@ -2041,9 +2118,9 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
 
       ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
       if (ret > 0) {
-             if (txmsg->reply.reply_type == 1) {
-                     ret = -EINVAL;
-             } else
+             if (txmsg->reply.reply_type == 1)
+                     ret = -EIO;
+             else
                       ret = 0;
       }
       kfree(txmsg);
include/drm/drm_dp_helper.h +4 -0
index 509667e..6dea76a 100644
@@ -1265,6 +1265,10 @@ struct drm_dp_aux {
        * @cec: struct containing fields used for CEC-Tunneling-over-AUX.
        */
       struct drm_dp_aux_cec cec;
+     /**
+      * @is_remote: Is this "AUX CH" actually using sideband messaging.
+      */
+     bool is_remote;
  };
 
  ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
include/drm/drm_dp_mst_helper.h +0 -0
index 371cc28..30f8c11 100644
@@ -615,6 +615,12 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 
Quoted 17 lines
Quoted 11 lines
include/drm/drm_dp_mst_helper.h +6 -0
  void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr *mgr);
  int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr);
+
+ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
+                          unsigned int offset, void *buffer, size_t size);
+ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
+                           unsigned int offset, void *buffer, size_t size);
+
  struct drm_dp_mst_topology_state *drm_atomic_get_mst_topology_state(struct
 drm_atomic_state *state,
                                                                   struct
Quoted 2 lines

drm_dp_mst_topology_mgr *mgr);
int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,

--
Cheers,
Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): f800b501-422e-c7fb-ebce-bd0e1717d2b2-5C7GfCeVMHo@public.gmane.org

#15 lore raw

Re: [PATCH 2/7] drm/dp_mst: Register AUX devices for MST ports

Quoted 120 lines · Sun peng (Leo)

Sorry for the late response! just jumping back on this now.

Quoted 91 lines · Lyude Paul

[CAUTION: External Email]

So a couple of things:

Quoted 86 lines · On Thu, 2019-05-16 at 11:17 -0400, [email protected] wrote:

From: Ville Syrjälä <[email protected]>

All available downstream ports - physical and logical - are exposed for each MST device. They are listed in /dev/, following the same naming scheme as SST devices by appending an incremental ID.

Although all downstream ports are exposed, only some will work as expected. Consider the following topology:

                +---------+
                |  ASIC   |
                +---------+
               Conn-0|
                     |
                +----v----+
           +----| MST HUB |----+
           |    +---------+    |
           |                   |
           |Port-1       Port-2|
     +-----v-----+       +-----v-----+
     |  MST      |       |  SST      |
     |  Display  |       |  Display  |
     +-----------+       +-----------+
           |Port-1

x

MST Path | MST Device
----------+----------------------------------

  sst:0     | MST Hub
  mst:0-1   | MST Display
  mst:0-1-1 | MST Display's disconnected DP out
  mst:0-1-8 | MST Display's internal sink
  mst:0-2   | SST Display

On certain MST displays, the upstream physical port will ACK DPCD reads. However, reads on the local logical port to the internal sink will *NAK*. i.e. reading mst:0-1 ACKs, but mst:0-1-8 NAKs.

There may also be duplicates. Some displays will return the same GUID when reading DPCD from both mst:0-1 and mst:0-1-8.

There are some device-dependent behavior as well. The MST hub used during testing will actually *ACK* read requests on a disconnected physical port, whereas the MST displays will NAK.

In light of these discrepancies, it's simpler to expose all downstream ports - both physical and logical - and let the user decide what to use.

---
  drivers/gpu/drm/drm_dp_aux_dev.c      |  14 ++++-
  drivers/gpu/drm/drm_dp_mst_topology.c | 103
+++++++++++++++++++++++++++++
-----
  include/drm/drm_dp_helper.h           |   4 ++
  include/drm/drm_dp_mst_helper.h       |   6 ++
  4 files changed, 112 insertions(+), 15 deletions(-)
drivers/gpu/drm/drm_dp_aux_dev.c +2 -0
index 6d84611..01c02b9 100644
@@ -34,6 +34,7 @@
  #include <linux/uaccess.h>
  #include <linux/uio.h>
  #include <drm/drm_dp_helper.h>
+#include <drm/drm_dp_mst_helper.h>
  #include <drm/drm_crtc.h>
  #include <drm/drmP.h>
 
@@ -114,6 +115,7 @@ static ssize_t name_show(struct device *dev,
 
       return res;
  }
+
  static DEVICE_ATTR_RO(name);
 
  static struct attribute *drm_dp_aux_attrs[] = {
@@ -160,7 +162,11 @@ static ssize_t auxdev_read_iter(struct kiocb *iocb,
 struct iov_iter *to)
                       break;
               }
 
Quoted 17 lines

drivers/gpu/drm/drm_dp_aux_dev.c static ssize_t auxdev_read_iter(struct kiocb *iocb, struct iov_iter *to) · line 169

Quoted 8 lines
drivers/gpu/drm/drm_dp_aux_dev.c +5 -1
-             res = drm_dp_dpcd_read(aux_dev->aux, pos, buf, todo);
+             if (aux_dev->aux->is_remote)
+                     res = drm_dp_mst_dpcd_read(aux_dev->aux, pos, buf,
 todo);
+             else
+                     res = drm_dp_dpcd_read(aux_dev->aux, pos, buf,
 todo);
+

It's still not at all clear to me why we're trying to avoid specifying actual
callbacks for the aux device. We should remove this part entirely, remove the
is_remote entry from struct drm_dp_aux, and then just specify our own hook in
struct drm_dp_aux->transfer().

I'm not sure if this would work well. The existing policy does retries around the ->transfer() call. Using the same hook will cause a nested retry - once when calling remote_aux->transfer, and another when calling real_aux->transfer. The difference is the scope of the retry. The former replays the entire aux transaction, while the latter replays just the failed sideband packet. I think having the retry at the packet level makes more sense. Either way, it shouldn't happen in a nested manner.

Quoted 3 lines

In general, we need a way to determine whether a message needs to be sent via sideband. I'm not sure if there's a better way than setting a 'is_remote' flag?

oh-this is a very good point actually! I suppose we would certainly want to be able to retry on a packet level instead. Since that's the case, I think going with the current is_remote solution should be fine then. Might be worth noting the reasoning behind this with a comment

Quoted 812 lines

Leo

Quoted 809 lines
Quoted 27 lines
               if (res <= 0)
                       break;
drivers/gpu/drm/drm_dp_aux_dev.c +2 -1
@@ -207,7 +213,11 @@ static ssize_t auxdev_write_iter(struct kiocb
 *iocb,
 struct iov_iter *from)
                       break;
               }
 
-             res = drm_dp_dpcd_write(aux_dev->aux, pos, buf, todo);
+             if (aux_dev->aux->is_remote)
+                     res = drm_dp_mst_dpcd_write(aux_dev->aux, pos,
 buf,

todo);

drivers/gpu/drm/drm_dp_aux_dev.c +2 -0
+             else
+                     res = drm_dp_dpcd_write(aux_dev->aux, pos, buf,

todo);

drivers/gpu/drm/drm_dp_aux_dev.c +1 -0
+
               if (res <= 0)
                       break;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 2ab16c9..54da68e 100644

drivers/gpu/drm/drm_dp_mst_topology.c line 39

Quoted 5 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
@@ -35,6 +35,8 @@
  #include <drm/drm_atomic_helper.h>
  #include <drm/drm_crtc_helper.h>
 
+#include "drm_crtc_helper_internal.h"
+

Unless I'm mistaken, this looks like some sort of ditritus.

Quoted 104 lines
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
  /**
   * DOC: dp mst helper
   *
@@ -52,6 +54,9 @@ static int drm_dp_dpcd_write_payload(struct
 drm_dp_mst_topology_mgr *mgr,
                                    int id,
                                    struct drm_dp_payload *payload);
 
+static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
+                              struct drm_dp_mst_port *port,
+                              int offset, int size, u8 *bytes);
  static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
                                 struct drm_dp_mst_port *port,
                                 int offset, int size, u8 *bytes);
drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
@@ -941,6 +946,8 @@ static void drm_dp_destroy_port(struct kref *kref)
       struct drm_dp_mst_topology_mgr *mgr = port->mgr;
 
       if (!port->input) {
+             drm_dp_aux_unregister_devnode(&port->aux);
+
               port->vcpi.num_slots = 0;
 
               kfree(port->cached_edid);
@@ -1095,6 +1102,46 @@ static bool drm_dp_port_setup_pdt(struct
 drm_dp_mst_port *port)
       return send_link;
  }
 
+/**
+ * drm_dp_mst_dpcd_read() - read a series of bytes from the DPCD via

sideband
+ * @aux: Fake sideband AUX CH
+ * @offset: address of the (first) register to read
+ * @buffer: buffer to store the register values
+ * @size: number of bytes in @buffer
+ *
+ * Performs the same functionality for remote devices via
+ * sideband messaging as drm_dp_dpcd_read() does for local
+ * devices via actual AUX CH.
+ */

drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
+ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
+                          unsigned int offset, void *buffer, size_t

size)

drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
+{
+     struct drm_dp_mst_port *port = container_of(aux, struct

drm_dp_mst_port, aux);

drivers/gpu/drm/drm_dp_mst_topology.c +7 -0
+
+     return drm_dp_send_dpcd_read(port->mgr, port,
+                                  offset, size, buffer);
+}
+
+/**
+ * drm_dp_mst_dpcd_write() - write a series of bytes to the DPCD via

sideband
+ * @aux: Fake sideband AUX CH
+ * @offset: address of the (first) register to write
+ * @buffer: buffer containing the values to write
+ * @size: number of bytes in @buffer
+ *
+ * Performs the same functionality for remote devices via
+ * sideband messaging as drm_dp_dpcd_write() does for local
+ * devices via actual AUX CH.
+ */

drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
+ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
+                           unsigned int offset, void *buffer, size_t

size)

drivers/gpu/drm/drm_dp_mst_topology.c +2 -0
+{
+     struct drm_dp_mst_port *port = container_of(aux, struct

drm_dp_mst_port, aux);

drivers/gpu/drm/drm_dp_mst_topology.c +5 -0
+
+     return drm_dp_send_dpcd_write(port->mgr, port,
+                                   offset, size, buffer);
+}
+
  static void drm_dp_check_mstb_guid(struct drm_dp_mst_branch *mstb, u8

*guid)

  {
       int ret;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1158,6 +1205,7 @@ static void drm_dp_add_port(struct

drm_dp_mst_branch
*mstb,

               port->mgr = mstb->mgr;
               port->aux.name = "DPMST";
               port->aux.dev = dev->dev;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
+             port->aux.is_remote = true;
               created = true;
       } else {
               old_pdt = port->pdt;
@@ -1188,7 +1236,7 @@ static void drm_dp_add_port(struct

drm_dp_mst_branch
*mstb,
drm_dp_send_enum_path_resources(mstb-

Quoted 1 line

mgr,

mstb, port);
               } else {
                       port->available_pbn = 0;
drivers/gpu/drm/drm_dp_mst_topology.c +1 -1
-                     }
+             }
       }
 
       if (old_pdt != port->pdt && !port->input) {
@@ -1220,6 +1268,8 @@ static void drm_dp_add_port(struct

drm_dp_mst_branch
*mstb,

Quoted 3 lines
                       drm_connector_set_tile_property(port->connector);
               }
               (*mstb->mgr->cbs->register_connector)(port->connector);

This is wrong: we always want to setup everything in the connector first before trying to register it, not after. Otherwise, things explode like so:

[   13.305329] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (3)
[   13.305361] [drm:drm_mode_object_get [drm]] OBJ ID: 123 (1)
[   13.305384] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (4)
[   13.305405] [drm:drm_mode_object_get [drm]] OBJ ID: 124 (1)
[   13.305429] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (5)
[   13.305449] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (6)
[   13.305471] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[   13.305490] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (6)
[   13.305512] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[   13.305532] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[   13.305552] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (5)
[   13.305571] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (6)
[   13.305592] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[   13.305612] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (6)
[   13.305631] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[   13.305651] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[   13.305725] [drm:drm_vblank_enable [drm]] enabling vblank on crtc 0,
ret: 0
[   13.305768] [drm:drm_vblank_enable [drm]] enabling vblank on crtc 1,
ret: 0
[   13.306088] [drm:drm_handle_vblank [drm]] vblank event on 325, current
325
[   13.322514] [drm:drm_handle_vblank [drm]] vblank event on 313, current
313
[   13.322612] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[   13.322634] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (5)
[   13.322656] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[   13.322676] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (5)
[   13.322697] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (2)
[   13.322718] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (2)
[   13.322740] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (5)
[   13.322764] [drm:vblank_disable_fn [drm]] disabling vblank on crtc 0
[   13.322784] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (4)
[   13.339191] [drm:vblank_disable_fn [drm]] disabling vblank on crtc 1
[  451.149789] Console: switching to colour dummy device 80x25
[  451.194596] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]]
drm_dp_aux_dev: aux [DPDDC-A] unregistering
[  451.194666] [drm:drm_sysfs_connector_remove [drm]] removing "eDP-1"
from sysfs
[  451.194718] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]]
drm_dp_aux_dev: aux [DPDDC-B] unregistering
[  451.194766] [drm:drm_sysfs_connector_remove [drm]] removing "DP-1" from
sysfs
[  451.194791] [drm:drm_sysfs_connector_remove [drm]] removing "HDMI-A-1"
from sysfs
[  451.194835] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]]
drm_dp_aux_dev: aux [DPDDC-C] unregistering
[  451.194880] [drm:drm_sysfs_connector_remove [drm]] removing "DP-2" from
sysfs
[  451.194903] [drm:drm_sysfs_connector_remove [drm]] removing "HDMI-A-2"
from sysfs
[  451.194924] [drm:drm_sysfs_connector_remove [drm]] removing "DP-3" from
sysfs
[  451.194950] [drm:drm_sysfs_connector_remove [drm]] removing "DP-4" from
sysfs
[  451.194975] [drm:drm_sysfs_connector_remove [drm]] removing "DP-5" from
sysfs
[  451.204535] [drm:drm_mode_object_get [drm]] OBJ ID: 123 (1)
[  451.204551] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (2)
[  451.204566] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (3)
[  451.204582] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (5)
[  451.204596] [drm:drm_mode_object_get [drm]] OBJ ID: 85 (6)
[  451.204611] [drm:drm_mode_object_get [drm]] OBJ ID: 124 (1)
[  451.204621] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (2)
[  451.204631] [drm:drm_mode_object_get [drm]] OBJ ID: 113 (4)
[  451.204641] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (5)
[  451.204651] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (6)
[  451.204662] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (6)
[  451.204671] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (6)
[  451.204680] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (5)
[  451.204689] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (4)
[  451.204699] [drm:drm_dp_mst_duplicate_state [drm_kms_helper]] port
00000000dde1b00a (5)
[  451.204703] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
00000000dde1b00a (4)
[  451.411817] [drm:intel_panel_actually_set_backlight [i915]] set
backlight PWM = 0
[  451.420911] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-A: 0x00600
AUX <- (ret=  1) 02
[  451.425358] [drm:gen8_de_irq_handler [i915]] hotplug event received,
stat 0x01000000, dig 0x11101010, pins 0x00000010, long 0x00000000
[  451.425422] [drm:intel_hpd_irq_handler [i915]] digital hpd port A -
short
[  451.471777] [drm:drm_dp_mst_topology_get_mstb_validated
[drm_kms_helper]] mstb 00000000eec1a629 (2)
[  451.473361] [drm:gen8_de_irq_handler [i915]] hotplug event received,
stat 0x01000000, dig 0x12101010, pins 0x00000010, long 0x00000010
[  451.473465] [drm:intel_hpd_irq_handler [i915]] digital hpd port A -
long
[  452.207301] [drm:gen8_de_irq_handler [i915]] hotplug event received,
stat 0x01000000, dig 0x12101010, pins 0x00000010, long 0x00000010
[  452.207395] [drm:intel_hpd_irq_handler [i915]] digital hpd port A -
long
[  452.340311] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-A: 0x00000
AUX -> (ret= 15) 11 0a 02 41 00 00 01 00 02 00 00 00 00 0b 00
[  452.341060] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-A: 0x00201
AUX -> (ret=  1) 00
[  452.341584] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x01000
AUX <- (ret= 10) 10 47 d3 11 11 01 00 00 00 f4
[  452.343183] [drm:gen8_de_irq_handler [i915]] hotplug event received,
stat 0x00200000, dig 0x10101011, pins 0x00000020, long 0x00000000
[  452.343286] [drm:intel_hpd_irq_handler [i915]] digital hpd port B -
short
[  452.344765] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002
AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 77 77 01 00
[  452.346263] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x01400
AUX -> (ret= 16) 10 46 d6 11 10 01 00 00 78 00 00 00 00 00 00 00
[  452.346287] [drm:drm_dp_get_mst_branch_device [drm_kms_helper]] mstb
00000000eec1a629 (3)
[  452.346305] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb
00000000eec1a629 (2)
[  452.346405] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb
00000000eec1a629 (1)
[  452.347529] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x02003
AUX <- (ret=  3) 10 00 00
[  452.348672] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x002c0
AUX <- (ret=  1) 01
[  452.350168] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002
AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 77 77 01 00
[  452.351328] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x001c0
AUX <- (ret=  3) 01 01 00
[  452.352665] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0
AUX -> (ret=  1) 01
[  452.358905] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0
AUX -> (ret=  1) 01
[  452.360327] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0
AUX -> (ret=  1) 01
[  452.361660] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x002c0
AUX -> (ret=  1) 03
[  452.361681] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
00000000dde1b00a (3)
[  452.361700] [drm:drm_dp_mst_topology_get_port_validated
[drm_kms_helper]] port 00000000dde1b00a (2)
[  452.362894] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x01000
AUX <- (ret=  6) 10 43 c7 25 10 c0
[  452.364318] [drm:gen8_de_irq_handler [i915]] hotplug event received,
stat 0x00200000, dig 0x10101011, pins 0x00000020, long 0x00000000
[  452.364421] [drm:intel_hpd_irq_handler [i915]] digital hpd port B -
short
[  452.365929] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002
AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 77 77 01 00
[  452.367361] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x01400
AUX -> (ret= 16) 10 43 c7 25 10 c0 00 00 00 00 00 00 00 00 00 00
[  452.367388] [drm:drm_dp_get_mst_branch_device [drm_kms_helper]] mstb
00000000eec1a629 (2)
[  452.367407] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb
00000000eec1a629 (1)
[  452.367460] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port
00000000dde1b00a (1)
[  452.368548] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x02003
AUX <- (ret=  3) 10 00 00
[  452.368803] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x00600
AUX <- (ret=  1) 02
[  452.368970] [drm:intel_dump_cdclk_state [i915]] Changing CDCLK to
337500 kHz, VCO 8100000 kHz, ref 24000 kHz, bypass 24000 kHz, voltage
level 0
[  452.369269] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 123 (1)
[  452.369330] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 124 (1)
[  452.369422] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (5)
[  452.369466] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (4)
[  452.369515] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (5)
[  452.369558] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (4)
[  452.369608] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (3)
[  452.369660] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (2)
[  452.369690] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
00000000dde1b00a (2)
[  452.369750] [drm:drm_irq_uninstall [drm]] irq=177
[  452.406452] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-B: 0x02002
AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 00 00 80 00
[  452.412626] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (3)
[  452.412636] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 91 (2)
[  452.412644] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 98 (2)
[  452.412652] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 104 (2)
[  452.412660] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 109 (2)
[  452.412668] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (3)
[  452.412676] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 117 (2)
[  452.412684] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 120 (2)
[  452.412692] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 85 (2)
[  452.412700] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (2)
[  452.412708] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 113 (1)
[  452.424450] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-B: 0x00111
AUX <- (ret=  1) 00
[  452.424454] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb
00000000eec1a629 (0)
[  452.424457] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port
00000000eeef3cfd (0)
[  452.424461] ------------[ cut here ]------------
[  452.424464] sysfs group 'power' not found for kobject 'drm_dp_aux5'
[  452.424471] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.424473] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl

x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev

[  452.424492] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted:
G           O      5.1.0Lyude-Test+ #1
[  452.424494] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W
(1.12 ) 04/09/2018
[  452.424496] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424498] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc
ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff
<0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424500] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424501] RAX: 0000000000000000 RBX: 0000000000000000 RCX:
0000000000000006
[  452.424502] RDX: 0000000000000007 RSI: 0000000000000086 RDI:
ffff981fde2d5a00
[  452.424503] RBP: ffffffffa9ea12e0 R08: 0000000000000792 R09:
0000000000000046
[  452.424504] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12:
ffff981fd5f77010
[  452.424505] R13: ffff981fd6ebbedc R14: dead000000000200 R15:
dead000000000100
[  452.424507] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000)
knlGS:0000000000000000
[  452.424508] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424509] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4:
00000000003606e0
[  452.424510] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[  452.424511] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[  452.424512] Call Trace:
[  452.424516]  device_del+0x75/0x360
[  452.424518]  ? class_find_device+0x96/0xf0
[  452.424520]  device_unregister+0x16/0x60
[  452.424521]  device_destroy+0x3a/0x40
[  452.424525]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.424534]  ? drm_dbg+0x87/0x90 [drm]
[  452.424538]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424543]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424547]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0
[drm_kms_helper]
[  452.424551]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.424571]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424592]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424600]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424621]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424633]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424645]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424647]  pci_device_remove+0x3b/0xc0
[  452.424649]  device_release_driver_internal+0xe4/0x1d0
[  452.424651]  pci_stop_bus_device+0x69/0x90
[  452.424653]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424655]  remove_store+0x75/0x90
[  452.424656]  kernfs_fop_write+0x116/0x190
[  452.424658]  vfs_write+0xa5/0x1a0
[  452.424660]  ksys_write+0x57/0xd0
[  452.424663]  do_syscall_64+0x55/0x150
[  452.424665]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424667] RIP: 0033:0x7f8cc1e7d038
[  452.424668] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00
f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05
<48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.424670] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX:
0000000000000001
[  452.424672] RAX: ffffffffffffffda RBX: 0000000000000002 RCX:
00007f8cc1e7d038
[  452.424673] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI:
0000000000000001
[  452.424674] RBP: 000056515aefbf00 R08: 000000000000000a R09:
00007f8cc1f0ee80
[  452.424675] R10: 000000000000000a R11: 0000000000000246 R12:
00007f8cc1f50780
[  452.424676] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15:
0000000000000002
[  452.424678] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.424680] ---[ end trace a1c11eaf054910a3 ]---
[  452.424751] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]]
drm_dp_aux_dev: aux [DPMST] unregistering
[  452.424755] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port
000000000f6aa5a3 (0)
[  452.424765] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 120 (1)
[  452.424770] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
00000000eeef3cfd (1)
[  452.424773] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
00000000eeef3cfd (0)
[  452.424776] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb
00000000eec1a629 (4)
[  452.424783] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug
event
[  452.424790] ------------[ cut here ]------------
[  452.424791] sysfs group 'power' not found for kobject 'drm_dp_aux4'
[  452.424795] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.424796] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl

x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev

[  452.424809] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted:
G        W  O      5.1.0Lyude-Test+ #1
[  452.424811] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W
(1.12 ) 04/09/2018
[  452.424812] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.424813] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc
ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff
<0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.424815] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.424816] RAX: 0000000000000000 RBX: 0000000000000000 RCX:
0000000000000006
[  452.424817] RDX: 0000000000000007 RSI: 0000000000000086 RDI:
ffff981fde2d5a00
[  452.424818] RBP: ffffffffa9ea12e0 R08: 00000000000007d1 R09:
0000000000000046
[  452.424820] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12:
ffff981fd50d0410
[  452.424821] R13: ffff981fd6ebbebc R14: dead000000000200 R15:
dead000000000100
[  452.424822] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000)
knlGS:0000000000000000
[  452.424823] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.424824] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4:
00000000003606e0
[  452.424825] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[  452.424826] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[  452.424827] Call Trace:
[  452.424829]  device_del+0x75/0x360
[  452.424830]  ? class_find_device+0x96/0xf0
[  452.424832]  device_unregister+0x16/0x60
[  452.424833]  device_destroy+0x3a/0x40
[  452.424837]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.424841]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.424845]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.424849]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0
[drm_kms_helper]
[  452.424854]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.424873]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.424892]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.424900]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.424920]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.424932]  i915_driver_unload+0xa8/0x130 [i915]
[  452.424943]  i915_pci_remove+0x1e/0x40 [i915]
[  452.424945]  pci_device_remove+0x3b/0xc0
[  452.424947]  device_release_driver_internal+0xe4/0x1d0
[  452.424948]  pci_stop_bus_device+0x69/0x90
[  452.424950]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.424951]  remove_store+0x75/0x90
[  452.424953]  kernfs_fop_write+0x116/0x190
[  452.424954]  vfs_write+0xa5/0x1a0
[  452.424956]  ksys_write+0x57/0xd0
[  452.424957]  do_syscall_64+0x55/0x150
[  452.424959]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.424960] RIP: 0033:0x7f8cc1e7d038
[  452.424961] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00
f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05
<48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.424963] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX:
0000000000000001
[  452.424965] RAX: ffffffffffffffda RBX: 0000000000000002 RCX:
00007f8cc1e7d038
[  452.424966] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI:
0000000000000001
[  452.424967] RBP: 000056515aefbf00 R08: 000000000000000a R09:
00007f8cc1f0ee80
[  452.424968] R10: 000000000000000a R11: 0000000000000246 R12:
00007f8cc1f50780
[  452.424969] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15:
0000000000000002
[  452.424971] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.424972] ---[ end trace a1c11eaf054910a4 ]---
[  452.424992] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]]
drm_dp_aux_dev: aux [DPMST] unregistering
[  452.424997] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port
00000000dde1b00a (0)
[  452.425006] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 117 (1)
[  452.425010] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
000000000f6aa5a3 (1)
[  452.425014] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
000000000f6aa5a3 (0)
[  452.425017] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb
00000000eec1a629 (3)
[  452.425023] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug
event
[  452.425028] ------------[ cut here ]------------
[  452.425029] sysfs group 'power' not found for kobject 'drm_dp_aux3'
[  452.425033] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.425034] Modules linked in: vfat fat elan_i2c i915(O) intel_rapl

x86_pkg_temp_thermal intel_powerclamp coretemp kvm_intel iTCO_wdt kvm mei_wdt irqbypass iTCO_vendor_support crct10dif_pclmul wmi_bmof intel_wmi_thunderbolt crc32_pclmul i2c_algo_bit ghash_clmulni_intel intel_cstate drm_kms_helper(O) intel_uncore intel_rapl_perf btusb btrtl btbcm syscopyarea btintel sysfillrect sysimgblt fb_sys_fops bluetooth drm(O) joydev mei_me idma64 ucsi_acpi thunderbolt ecdh_generic i2c_i801 intel_xhci_usb_role_switch processor_thermal_device typec_ucsi intel_lpss_pci intel_soc_dts_iosf mei roles intel_lpss typec intel_pch_thermal wmi thinkpad_acpi ledtrig_audio rfkill int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad video pcc_cpufreq crc32c_intel nvme serio_raw uas e1000e nvme_core usb_storage i2c_dev

[  452.425047] CPU: 3 PID: 1887 Comm: unloadgpumod Tainted:
G        W  O      5.1.0Lyude-Test+ #1
[  452.425048] Hardware name: LENOVO 20L8S2N800/20L8S2N800, BIOS N22ET35W
(1.12 ) 04/09/2018
[  452.425050] RIP: 0010:sysfs_remove_group+0x76/0x80
[  452.425051] Code: 48 89 df 5b 5d 41 5c e9 f8 bc ff ff 48 89 df e8 d0 bc
ff ff eb cb 49 8b 14 24 48 8b 75 00 48 c7 c7 08 a5 0c aa e8 44 00 d6 ff
<0f> 0b 5b 5d 41 5c c3 0f 1f 00 0f 1f 44 00 00 48 85 f6 74 31 41 54
[  452.425053] RSP: 0018:ffffa8bb81b5fb28 EFLAGS: 00010282
[  452.425054] RAX: 0000000000000000 RBX: 0000000000000000 RCX:
0000000000000006
[  452.425055] RDX: 0000000000000007 RSI: 0000000000000086 RDI:
ffff981fde2d5a00
[  452.425056] RBP: ffffffffa9ea12e0 R08: 000000000000080f R09:
0000000000000046
[  452.425057] R10: 0000000000000727 R11: ffffa8bb81b5f9d0 R12:
ffff981fd50d1810
[  452.425058] R13: ffff981fd6ebbe1c R14: dead000000000200 R15:
dead000000000100
[  452.425059] FS:  00007f8cc1d8c740(0000) GS:ffff981fde2c0000(0000)
knlGS:0000000000000000
[  452.425061] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[  452.425062] CR2: 000055b19d079a08 CR3: 000000043b2a0002 CR4:
00000000003606e0
[  452.425063] DR0: 0000000000000000 DR1: 0000000000000000 DR2:
0000000000000000
[  452.425064] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7:
0000000000000400
[  452.425065] Call Trace:
[  452.425066]  device_del+0x75/0x360
[  452.425068]  ? class_find_device+0x96/0xf0
[  452.425069]  device_unregister+0x16/0x60
[  452.425070]  device_destroy+0x3a/0x40
[  452.425074]  drm_dp_aux_unregister_devnode+0xea/0x180 [drm_kms_helper]
[  452.425078]  drm_dp_mst_topology_put_port+0x5b/0x110 [drm_kms_helper]
[  452.425083]  drm_dp_mst_topology_put_mstb+0xb6/0x180 [drm_kms_helper]
[  452.425087]  drm_dp_mst_topology_mgr_set_mst+0x233/0x2b0
[drm_kms_helper]
[  452.425091]  drm_dp_mst_topology_mgr_destroy+0x18/0xa0 [drm_kms_helper]
[  452.425110]  intel_dp_encoder_flush_work+0x32/0xb0 [i915]
[  452.425128]  intel_ddi_encoder_destroy+0x32/0x70 [i915]
[  452.425137]  drm_mode_config_cleanup+0x51/0x2e0 [drm]
[  452.425157]  intel_modeset_cleanup+0xc8/0x140 [i915]
[  452.425168]  i915_driver_unload+0xa8/0x130 [i915]
[  452.425180]  i915_pci_remove+0x1e/0x40 [i915]
[  452.425182]  pci_device_remove+0x3b/0xc0
[  452.425183]  device_release_driver_internal+0xe4/0x1d0
[  452.425185]  pci_stop_bus_device+0x69/0x90
[  452.425186]  pci_stop_and_remove_bus_device_locked+0x16/0x30
[  452.425188]  remove_store+0x75/0x90
[  452.425189]  kernfs_fop_write+0x116/0x190
[  452.425191]  vfs_write+0xa5/0x1a0
[  452.425192]  ksys_write+0x57/0xd0
[  452.425194]  do_syscall_64+0x55/0x150
[  452.425195]  entry_SYSCALL_64_after_hwframe+0x44/0xa9
[  452.425197] RIP: 0033:0x7f8cc1e7d038
[  452.425198] Code: 89 02 48 c7 c0 ff ff ff ff eb b3 0f 1f 80 00 00 00 00
f3 0f 1e fa 48 8d 05 e5 76 0d 00 8b 00 85 c0 75 17 b8 01 00 00 00 0f 05
<48> 3d 00 f0 ff ff 77 58 c3 0f 1f 80 00 00 00 00 41 54 49 89 d4 55
[  452.425199] RSP: 002b:00007ffce4321218 EFLAGS: 00000246 ORIG_RAX:
0000000000000001
[  452.425201] RAX: ffffffffffffffda RBX: 0000000000000002 RCX:
00007f8cc1e7d038
[  452.425202] RDX: 0000000000000002 RSI: 000056515aefbf00 RDI:
0000000000000001
[  452.425203] RBP: 000056515aefbf00 R08: 000000000000000a R09:
00007f8cc1f0ee80
[  452.425204] R10: 000000000000000a R11: 0000000000000246 R12:
00007f8cc1f50780
[  452.425205] R13: 0000000000000002 R14: 00007f8cc1f4b740 R15:
0000000000000002
[  452.425207] WARNING: CPU: 3 PID: 1887 at fs/sysfs/group.c:256
sysfs_remove_group+0x76/0x80
[  452.425208] ---[ end trace a1c11eaf054910a5 ]---
[  452.425282] [drm:drm_dp_aux_unregister_devnode [drm_kms_helper]]
drm_dp_aux_dev: aux [DPMST] unregistering
[  452.425288] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port
000000002ba3174e (0)
[  452.425292] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
000000002ba3174e (0)
[  452.425295] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb
00000000eec1a629 (2)
[  452.425299] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb
00000000eec1a629 (1)
[  452.425311] [drm:drm_mode_object_put.part.3 [drm]] OBJ ID: 86 (1)
[  452.425318] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
00000000dde1b00a (1)
[  452.425365] [drm:drm_dp_mst_put_port_malloc [drm_kms_helper]] port
00000000dde1b00a (0)
[  452.425368] [drm:drm_dp_mst_put_mstb_malloc [drm_kms_helper]] mstb

00000000eec1a629 (0)

So, we need to move the drm_dp_aux_register_devnode() call above the connector
registration callback. Same goes for the port->aux.dev = port->connector-

Quoted 2 lines

kdev; assignment that you do in patch 3/7 (and of course, you can remove the

connector registration status check there now).

Quoted 139 lines
drivers/gpu/drm/drm_dp_mst_topology.c +2 -1
+
+             drm_dp_aux_register_devnode(&port->aux);
       }
 
  out:
@@ -1404,7 +1454,6 @@ static bool drm_dp_validate_guid(struct
 drm_dp_mst_topology_mgr *mgr,
       return false;
  }
 
-#if 0
  static int build_dpcd_read(struct drm_dp_sideband_msg_tx *msg, u8
 port_num,

u32 offset, u8 num_bytes)

  {
       struct drm_dp_sideband_msg_req_body req;
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
@@ -1417,7 +1466,6 @@ static int build_dpcd_read(struct

drm_dp_sideband_msg_tx *msg, u8 port_num, u32

       return 0;

}
-#endif

static int drm_dp_send_sideband_msg(struct drm_dp_mst_topology_mgr
*mgr,
bool up, u8 *msg, int len)

drivers/gpu/drm/drm_dp_mst_topology.c +36 -7
@@ -1994,26 +2042,55 @@ int drm_dp_update_payload_part2(struct
 drm_dp_mst_topology_mgr *mgr)
  }
  EXPORT_SYMBOL(drm_dp_update_payload_part2);
 
-#if 0 /* unused as of yet */
  static int drm_dp_send_dpcd_read(struct drm_dp_mst_topology_mgr *mgr,
                                struct drm_dp_mst_port *port,
-                              int offset, int size)
+                              int offset, int size, u8 *bytes)
  {
       int len;
+     int ret = 0;
       struct drm_dp_sideband_msg_tx *txmsg;
+     struct drm_dp_mst_branch *mstb;
+
+     mstb = drm_dp_get_validated_mstb_ref(mgr, port->parent);
+     if (!mstb)
+             return -EINVAL;
 
       txmsg = kzalloc(sizeof(*txmsg), GFP_KERNEL);
-     if (!txmsg)
-             return -ENOMEM;
+     if (!txmsg) {
+             ret = -ENOMEM;
+             goto fail_put;
+     }
 
-     len = build_dpcd_read(txmsg, port->port_num, 0, 8);
+     len = build_dpcd_read(txmsg, port->port_num, offset, size);
       txmsg->dst = port->parent;
 
       drm_dp_queue_down_tx(mgr, txmsg);
 
-     return 0;
+     ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
+     if (ret < 0)
+             goto fail_free;
+
+     /* DPCD read should never be NACKed */
+     if (WARN_ON_ONCE(txmsg->reply.reply_type == 1)) {
+             ret = -EIO;
+             goto fail_free;
+     }
+
+     if (txmsg->reply.u.remote_dpcd_read_ack.num_bytes != size) {
+             ret = -EPROTO;
+             goto fail_free;
+     }
+
+     ret = min_t(size_t, txmsg->reply.u.remote_dpcd_read_ack.num_bytes,
 size);
+     memcpy(bytes, txmsg->reply.u.remote_dpcd_read_ack.bytes, ret);
+
+fail_free:
+     kfree(txmsg);
+fail_put:
+     drm_dp_put_mst_branch_device(mstb);
+
+     return ret;
  }
-#endif
 

static int drm_dp_send_dpcd_write(struct drm_dp_mst_topology_mgr *mgr,
struct drm_dp_mst_port *port,

drivers/gpu/drm/drm_dp_mst_topology.c +3 -3
@@ -2041,9 +2118,9 @@ static int drm_dp_send_dpcd_write(struct
 drm_dp_mst_topology_mgr *mgr,
 
       ret = drm_dp_mst_wait_tx_reply(mstb, txmsg);
       if (ret > 0) {
-             if (txmsg->reply.reply_type == 1) {
-                     ret = -EINVAL;
-             } else
+             if (txmsg->reply.reply_type == 1)
+                     ret = -EIO;
+             else
                       ret = 0;
       }
       kfree(txmsg);
include/drm/drm_dp_helper.h +0 -0
index 509667e..6dea76a 100644
@@ -1265,6 +1265,10 @@ struct drm_dp_aux {
        * @cec: struct containing fields used for CEC-Tunneling-over-

AUX.

        */
       struct drm_dp_aux_cec cec;
include/drm/drm_dp_helper.h +4 -0
+     /**
+      * @is_remote: Is this "AUX CH" actually using sideband messaging.
+      */
+     bool is_remote;
  };
 
  ssize_t drm_dp_dpcd_read(struct drm_dp_aux *aux, unsigned int offset,
include/drm/drm_dp_mst_helper.h +5 -0
index 371cc28..30f8c11 100644
@@ -615,6 +615,12 @@ void drm_dp_mst_dump_topology(struct seq_file *m,
 
  void drm_dp_mst_topology_mgr_suspend(struct drm_dp_mst_topology_mgr
 *mgr);
  int drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr
 *mgr);
+
+ssize_t drm_dp_mst_dpcd_read(struct drm_dp_aux *aux,
+                          unsigned int offset, void *buffer, size_t
 size);
+ssize_t drm_dp_mst_dpcd_write(struct drm_dp_aux *aux,
+                           unsigned int offset, void *buffer, size_t

size);

Quoted 8 lines

+
struct drm_dp_mst_topology_state
*drm_atomic_get_mst_topology_state(struct
drm_atomic_state *state,
struc
t
drm_dp_mst_topology_mgr *mgr);
int drm_dp_atomic_find_vcpi_slots(struct drm_atomic_state *state,

--
Cheers,
Lyude Paul

Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#16 lore raw

PATCH 3/7 drm/dp-mst: Use connector kdev as aux device parent

In reply to a message not in the archive

From: Leo Li <[email protected]>

Placing the MST aux device as a child of the connector gives udev the ability to access the connector device's attributes. This will come in handy when writing udev rules to create more descriptive symlinks to the MST aux devices.

Cc Ville Syrjälä <[email protected]>
Cc Lyude Paul <[email protected]>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
index 54da68e..cd2f3c4 100644
@@ -1269,6 +1269,9 @@ static void drm_dp_add_port(struct drm_dp_mst_branch *mstb,
 		}
 		(*mstb->mgr->cbs->register_connector)(port->connector);
 
+		if (port->connector->registration_state == DRM_CONNECTOR_REGISTERED)
+			port->aux.dev = port->connector->kdev;
+
 		drm_dp_aux_register_devnode(&port->aux);
 	}
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1558019883-12397-4-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#18 lore raw

Re: [PATCH 3/7] drm/dp-mst: Use connector kdev as aux device parent

Quoted 20 lines · On Thu, 2019-05-16 at 11:17 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

Placing the MST aux device as a child of the connector gives udev the ability to access the connector device's attributes. This will come in handy when writing udev rules to create more descriptive symlinks to the MST aux devices.

Cc Ville Syrjälä <[email protected]>
Cc Lyude Paul <[email protected]>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
index 54da68e..cd2f3c4 100644

drivers/gpu/drm/drm_dp_mst_topology.c static void drm_dp_add_port(struct drm_dp_mst_branch · line 1276

Quoted 8 lines
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
@@ -1269,6 +1269,9 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
 		}
 		(*mstb->mgr->cbs->register_connector)(port->connector);
 
+		if (port->connector->registration_state ==
 DRM_CONNECTOR_REGISTERED)
+			port->aux.dev = port->connector->kdev;
+

Line wrapping please! Probably worth running checkpatch on all of these patches as well.

With that nitpick addressed:

Quoted 3 lines
drivers/gpu/drm/drm_dp_mst_topology.c +0 -0
 		drm_dp_aux_register_devnode(&port->aux);

}

Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer
#19 lore raw

Re: [PATCH 3/7] drm/dp-mst: Use connector kdev as aux device parent

In reply to [email protected]

agh----sorry, but I need to take back my Reviewed-by. Noticed an issue when reloading drm and i915. I'll explain it when I respond to patch 2/7 in a moment

Quoted 31 lines · On Thu, 2019-05-16 at 11:17 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

Placing the MST aux device as a child of the connector gives udev the ability to access the connector device's attributes. This will come in handy when writing udev rules to create more descriptive symlinks to the MST aux devices.

Cc Ville Syrjälä <[email protected]>
Cc Lyude Paul <[email protected]>
---
 drivers/gpu/drm/drm_dp_mst_topology.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +3 -0
index 54da68e..cd2f3c4 100644
@@ -1269,6 +1269,9 @@ static void drm_dp_add_port(struct drm_dp_mst_branch
 *mstb,
 		}
 		(*mstb->mgr->cbs->register_connector)(port->connector);
 
+		if (port->connector->registration_state ==
 DRM_CONNECTOR_REGISTERED)
+			port->aux.dev = port->connector->kdev;
+
 		drm_dp_aux_register_devnode(&port->aux);

}

Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#20 lore raw

PATCH 4/7 drm/sysfs: Add mstpath attribute to connector devices

In reply to a message not in the archive

From: Leo Li <[email protected]>

This can be used to create more descriptive symlinks for MST aux devices. Consider the following udev rule:

SUBSYSTEM=="drm_dp_aux_dev", SUBSYSTEMS=="drm", ATTRS{mstpath}=="?*",

	SYMLINK+="drm_dp_aux/by-path/$attr{mstpath}"

The following symlinks will be created (depending on your MST topology):

$ ls /dev/drm_dp_aux/by-path/
card0-mst:0-1  card0-mst:0-1-1  card0-mst:0-1-8  card0-mst:0-8
Cc Ville Syrjälä <[email protected]>
Cc Lyude Paul <[email protected]>
---
 drivers/gpu/drm/drm_sysfs.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
drivers/gpu/drm/drm_sysfs.c +23 -0
index ecb7b33..e000e0c 100644
@@ -229,16 +229,39 @@ static ssize_t modes_show(struct device *device,
 	return written;
 }
 
+static ssize_t mstpath_show(struct device *device,
+			    struct device_attribute *attr,
+			    char *buf)
+{
+	struct drm_connector *connector = to_drm_connector(device);
+	ssize_t ret = 0;
+	char *path;
+
+	mutex_lock(&connector->dev->mode_config.mutex);
+	if (!connector->path_blob_ptr)
+		goto unlock;
+
+	path = connector->path_blob_ptr->data;
+	ret = snprintf(buf, PAGE_SIZE, "card%d-%s\n",
+	               connector->dev->primary->index, path);
+
+unlock:
+	mutex_unlock(&connector->dev->mode_config.mutex);
+	return ret;
+}
+
 static DEVICE_ATTR_RW(status);
 static DEVICE_ATTR_RO(enabled);
 static DEVICE_ATTR_RO(dpms);
 static DEVICE_ATTR_RO(modes);
+static DEVICE_ATTR_RO(mstpath);
 
 static struct attribute *connector_dev_attrs[] = {
 	&dev_attr_status.attr,
 	&dev_attr_enabled.attr,
 	&dev_attr_dpms.attr,
 	&dev_attr_modes.attr,
+	&dev_attr_mstpath.attr,
 	NULL
 };
 
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#21 lore raw

PATCH 7/7 drm/nouveau: Use connector kdev as aux device parent

In reply to a message not in the archive

From: Leo Li <[email protected]>

Set the connector's kernel device as the parent for the aux kernel device. This allows udev rules to access connector attributes when creating symlinks to aux devices.

Cc Ben Skeggs <[email protected]>
Cc Lyude Paul <[email protected]>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +1 -1
index 3f463c9..738782a 100644
@@ -1345,7 +1345,7 @@ nouveau_connector_create(struct drm_device *dev,
 		break;
 	case DRM_MODE_CONNECTOR_DisplayPort:
 	case DRM_MODE_CONNECTOR_eDP:
-		nv_connector->aux.dev = dev->dev;
+		nv_connector->aux.dev = connector->kdev;
 		nv_connector->aux.transfer = nouveau_connector_aux_xfer;
 		snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x",
 			 dcbe->hasht, dcbe->hashm);
Signature · 6 lines
2.7.4

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

A message that is not in the archive (sent off-list or not yet received): 1558019883-12397-8-git-send-email-sunpeng.li-5C7GfCeVMHo@public.gmane.org

Reviewed-by
#23 lore raw

Re: [PATCH 7/7] drm/nouveau: Use connector kdev as aux device parent

Quoted 27 lines · On Thu, 2019-05-16 at 11:18 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

Set the connector's kernel device as the parent for the aux kernel device. This allows udev rules to access connector attributes when creating symlinks to aux devices.

Cc Ben Skeggs <[email protected]>
Cc Lyude Paul <[email protected]>
---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/nouveau/nouveau_connector.c +1 -1
index 3f463c9..738782a 100644
@@ -1345,7 +1345,7 @@ nouveau_connector_create(struct drm_device *dev,
 		break;
 	case DRM_MODE_CONNECTOR_DisplayPort:
 	case DRM_MODE_CONNECTOR_eDP:
-		nv_connector->aux.dev = dev->dev;
+		nv_connector->aux.dev = connector->kdev;
 		nv_connector->aux.transfer = nouveau_connector_aux_xfer;
 		snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x",
 			 dcbe->hasht, dcbe->hashm);
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#24 lore raw
In reply to a message not in the archive

Hi, could we (and for future versions of this series and others) get a respin of this that's actually rebased against drm-tip? That is the defacto standard branch to do development on, and otherwise anyone trying to test these patches has to resolve merge conflicts (along with maintainers). The branch this appears to be based off of doesn't even have the new kref scheme for branch devices and ports.

Quoted 36 lines · On Thu, 2019-05-16 at 11:17 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

This series adds support for MST AUX devices.

A more descriptive 'mstpath' attribute is also added to MST connector devices. In addition, the DP aux device is made to be a child of the corresponding connector's device where possible (*). This allows udev rules to provide descriptive symlinks to the AUX devices.

(*) This can only be done on drivers that register their connector and aux devices via drm_connector_register() and drm_dp_aux_register() respectively. The connector also needs to be registered before the aux device.

Leo Li (6):
drm/dp: Use non-cyclic idr
drm/dp-mst: Use connector kdev as aux device parent drm/sysfs: Add mstpath attribute to connector devices drm/amd/display: Use connector kdev as aux device parent drm/bridge/analogix-anx78xx: Use connector kdev as aux device parent drm/nouveau: Use connector kdev as aux device parent

Ville Syrjälä (1):
drm/dp_mst: Register AUX devices for MST ports

 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |   2 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.c          |  22 ++---
 drivers/gpu/drm/drm_dp_aux_dev.c                   |  17 +++-
 drivers/gpu/drm/drm_dp_mst_topology.c              | 106
++++++++++++++++++---
 drivers/gpu/drm/drm_sysfs.c                        |  23 +++++
 drivers/gpu/drm/nouveau/nouveau_connector.c        |   2 +-
 include/drm/drm_dp_helper.h                        |   4 +
 include/drm/drm_dp_mst_helper.h                    |   6 ++
 8 files changed, 152 insertions(+), 30 deletions(-)
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
maintainer
#25 lore raw

Whoops-one more thing I forgot to mention. This is just personal preference for me, but if you're ccing me on any of the patches in the series feel free to just do it for all of them. Makes my inbox a little less confusing to look at

Quoted 47 lines · Lyude Paul

Hi, could we (and for future versions of this series and others) get a respin
of this that's actually rebased against drm-tip? That is the defacto standard
branch to do development on, and otherwise anyone trying to test these patches
has to resolve merge conflicts (along with maintainers). The branch this appears to be based off of doesn't even have the new kref scheme for branch devices and ports.

Quoted 36 lines · On Thu, 2019-05-16 at 11:17 -0400, [email protected] wrote:

From: Leo Li <[email protected]>

This series adds support for MST AUX devices.

A more descriptive 'mstpath' attribute is also added to MST connector devices. In addition, the DP aux device is made to be a child of the corresponding connector's device where possible (*). This allows udev rules to provide descriptive symlinks to the AUX devices.

(*) This can only be done on drivers that register their connector and aux devices via drm_connector_register() and drm_dp_aux_register() respectively. The connector also needs to be registered before the aux device.

Leo Li (6):
drm/dp: Use non-cyclic idr
drm/dp-mst: Use connector kdev as aux device parent drm/sysfs: Add mstpath attribute to connector devices drm/amd/display: Use connector kdev as aux device parent drm/bridge/analogix-anx78xx: Use connector kdev as aux device parent drm/nouveau: Use connector kdev as aux device parent

Ville Syrjälä (1):
drm/dp_mst: Register AUX devices for MST ports

 .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |   2 +-
 drivers/gpu/drm/bridge/analogix-anx78xx.c          |  22 ++---
 drivers/gpu/drm/drm_dp_aux_dev.c                   |  17 +++-
 drivers/gpu/drm/drm_dp_mst_topology.c              | 106
++++++++++++++++++---
 drivers/gpu/drm/drm_sysfs.c                        |  23 +++++
 drivers/gpu/drm/nouveau/nouveau_connector.c        |   2 +-
 include/drm/drm_dp_helper.h                        |   4 +
 include/drm/drm_dp_mst_helper.h                    |   6 ++
 8 files changed, 152 insertions(+), 30 deletions(-)
Signature · 7 lines
Cheers,
	Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

A message that is not in the archive (sent off-list or not yet received): 2248d762446e824def09699f0ef719b9c90d0dbc.camel-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#27 lore raw
Quoted 9 lines · Lyude Paul

[CAUTION: External Email]

Hi, could we (and for future versions of this series and others) get a respin of this that's actually rebased against drm-tip? That is the defacto standard branch to do development on, and otherwise anyone trying to test these patches has to resolve merge conflicts (along with maintainers). The branch this appears to be based off of doesn't even have the new kref scheme for branch devices and ports.

Sorry, this was laziness on my part :)
Rebasing this now.

Leo

Quoted 37 lines · On Thu, 2019-05-16 at 11:17 -0400, [email protected] wrote:
Quoted 25 lines

From: Leo Li <[email protected]>

This series adds support for MST AUX devices.

A more descriptive 'mstpath' attribute is also added to MST connector devices. In addition, the DP aux device is made to be a child of the corresponding connector's device where possible (*). This allows udev rules to provide descriptive symlinks to the AUX devices.

(*) This can only be done on drivers that register their connector and aux devices via drm_connector_register() and drm_dp_aux_register() respectively. The connector also needs to be registered before the aux device.

Leo Li (6):
drm/dp: Use non-cyclic idr
drm/dp-mst: Use connector kdev as aux device parent drm/sysfs: Add mstpath attribute to connector devices drm/amd/display: Use connector kdev as aux device parent drm/bridge/analogix-anx78xx: Use connector kdev as aux device parent drm/nouveau: Use connector kdev as aux device parent

Ville Syrjälä (1):
drm/dp_mst: Register AUX devices for MST ports

Quoted 11 lines
  .../amd/display/amdgpu_dm/amdgpu_dm_mst_types.c    |   2 +-
  drivers/gpu/drm/bridge/analogix-anx78xx.c          |  22 ++---
  drivers/gpu/drm/drm_dp_aux_dev.c                   |  17 +++-
  drivers/gpu/drm/drm_dp_mst_topology.c              | 106
++++++++++++++++++---
  drivers/gpu/drm/drm_sysfs.c                        |  23 +++++
  drivers/gpu/drm/nouveau/nouveau_connector.c        |   2 +-
  include/drm/drm_dp_helper.h                        |   4 +
  include/drm/drm_dp_mst_helper.h                    |   6 ++
  8 files changed, 152 insertions(+), 30 deletions(-)
Quoted 4 lines

--
Cheers,
Lyude Paul

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#28 lore raw

PATCH 5/7 drm/amd/display: Use connector kdev as aux device parent

In reply to [email protected]

From: Leo Li <[email protected]>

Set the connector's kernel device as the parent for the aux kernel device. This allows udev rules to access connector attributes when creating symlinks to aux devices.

For example, the following udev rule:

SUBSYSTEM=="drm_dp_aux_dev", SUBSYSTEMS=="drm", ATTRS{edid}=="*",

	SYMLINK+="drm_dp_aux/by-name/$id"

Will create the following symlinks using the connector's name:

$ ls /dev/drm_dp_aux/by-name/
card0-DP-1  card0-DP-2  card0-DP-3
Cc Ville Syrjälä <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Nicholas Kazlauskas <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Jerry (Fangzhi) Zuo <[email protected]>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1 -1
index a6f44a4..083fb97 100644
@@ -385,7 +385,7 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
 				       struct amdgpu_dm_connector *aconnector)
 {
 	aconnector->dm_dp_aux.aux.name = "dmdc";
-	aconnector->dm_dp_aux.aux.dev = dm->adev->dev;
+	aconnector->dm_dp_aux.aux.dev = aconnector->base.kdev;
 	aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer;
 	aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc;
 
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 5/7
#29 lore raw

Re: [PATCH 5/7] drm/amd/display: Use connector kdev as aux device parent

Quoted 17 lines · On 5/16/19 11:18 AM, [email protected] wrote:

From: Leo Li <[email protected]>

Set the connector's kernel device as the parent for the aux kernel device. This allows udev rules to access connector attributes when creating symlinks to aux devices.

For example, the following udev rule:

SUBSYSTEM=="drm_dp_aux_dev", SUBSYSTEMS=="drm", ATTRS{edid}=="*",

         SYMLINK+="drm_dp_aux/by-name/$id"

Will create the following symlinks using the connector's name:

$ ls /dev/drm_dp_aux/by-name/
card0-DP-1  card0-DP-2  card0-DP-3
Quoted 6 lines
Cc Ville Syrjälä <[email protected]>
Cc Lyude Paul <[email protected]>
Cc Nicholas Kazlauskas <[email protected]>
Cc Harry Wentland <[email protected]>
Cc Jerry (Fangzhi) Zuo <[email protected]>

No idea why it wasn't like this in the first place.

Nicholas Kazlauskas

Quoted 20 lines
---
  drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c +1 -2
index a6f44a4..083fb97 100644
@@ -385,7 +385,7 @@ void amdgpu_dm_initialize_dp_connector(struct amdgpu_display_manager *dm,
                                        struct amdgpu_dm_connector *aconnector)
  {
         aconnector->dm_dp_aux.aux.name = "dmdc";
-       aconnector->dm_dp_aux.aux.dev = dm->adev->dev;
+       aconnector->dm_dp_aux.aux.dev = aconnector->base.kdev;
         aconnector->dm_dp_aux.aux.transfer = dm_dp_aux_transfer;
         aconnector->dm_dp_aux.ddc_service = aconnector->dc_link->ddc;
 
--

2.7.4

Quoted 5 lines

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#30 lore raw

PATCH 6/7 drm/bridge/analogix-anx78xx: Use connector kdev as aux device parent

In reply to [email protected]

From: Leo Li <[email protected]>

Set the connector's kernel device as the parent for the aux kernel device. This allows udev rules to access connector attributes when creating symlinks to aux devices.

To do so, the connector needs to be registered beforehand. Therefore, shift aux registration to be after connector registration.

Cc Enric Balletbo i Serra <[email protected]>
Cc Nicolas Boichat <[email protected]>
---
 drivers/gpu/drm/bridge/analogix-anx78xx.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/gpu/drm/bridge/analogix-anx78xx.c +11 -11
index f8433c9..9fc8b4c 100644
@@ -1018,17 +1018,6 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge)
 		return -ENODEV;
 	}
 
-	/* Register aux channel */
-	anx78xx->aux.name = "DP-AUX";
-	anx78xx->aux.dev = &anx78xx->client->dev;
-	anx78xx->aux.transfer = anx78xx_aux_transfer;
-
-	err = drm_dp_aux_register(&anx78xx->aux);
-	if (err < 0) {
-		DRM_ERROR("Failed to register aux channel: %d\n", err);
-		return err;
-	}
-
 	err = drm_connector_init(bridge->dev, &anx78xx->connector,
 				 &anx78xx_connector_funcs,
 				 DRM_MODE_CONNECTOR_DisplayPort);
@@ -1048,6 +1037,17 @@ static int anx78xx_bridge_attach(struct drm_bridge *bridge)
 
 	anx78xx->connector.polled = DRM_CONNECTOR_POLL_HPD;
 
+	/* Register aux channel */
+	anx78xx->aux.name = "DP-AUX";
+	anx78xx->aux.dev = &anx78xx->connector.kdev;
+	anx78xx->aux.transfer = anx78xx_aux_transfer;
+
+	err = drm_dp_aux_register(&anx78xx->aux);
+	if (err < 0) {
+		DRM_ERROR("Failed to register aux channel: %d\n", err);
+		return err;
+	}
+
 	err = drm_connector_attach_encoder(&anx78xx->connector,
 					   bridge->encoder);
 	if (err) {
Signature · 6 lines
2.7.4

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel