Message ID | 20190704190519.29525-8-sunpeng.li@amd.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Enable MST Aux devices (v2) | expand |
On Thu, Jul 04, 2019 at 03:05:16PM -0400, sunpeng.li@amd.com wrote: > From: Leo Li <sunpeng.li@amd.com> > > Implement late_register and early_unregister hooks for MST connectors. > Call drm helpers for MST connector registration, which registers the > AUX devices. > > Signed-off-by: Leo Li <sunpeng.li@amd.com> > --- > drivers/gpu/drm/i915/display/intel_dp_mst.c | 29 +++++++++++++++++++-- > 1 file changed, 27 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c > index 60652ebbdf61..be309016f746 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c > @@ -400,13 +400,38 @@ intel_dp_mst_detect(struct drm_connector *connector, bool force) > intel_connector->port); > } > > +static int > +intel_dp_mst_connector_late_register(struct drm_connector *connector) > +{ > + struct intel_connector *intel_connector = to_intel_connector(connector); > + struct drm_dp_mst_port *port = intel_connector->port; > + > + int ret; > + > + ret = intel_connector_register(connector); > + if (ret) > + return ret; > + > + return drm_dp_mst_connector_late_register(connector, port); We should probably unwind properly in case of an error from this guy. Currently it won't matter since intel_connector_register() only sets up the backlight and that doesn't exist for MST connectors, but if and when someone adds more stuff to intel_connector_register() they may not notice that the caller is leaking. > +} > + > +static void > +intel_dp_mst_connector_early_unregister(struct drm_connector *connector) > +{ > + struct intel_connector *intel_connector = to_intel_connector(connector); > + struct drm_dp_mst_port *port = intel_connector->port; > + > + drm_dp_mst_connector_early_unregister(connector, port); > + intel_connector_unregister(connector); > +} > + > static const struct drm_connector_funcs intel_dp_mst_connector_funcs = { > .detect = intel_dp_mst_detect, > .fill_modes = drm_helper_probe_single_connector_modes, > .atomic_get_property = intel_digital_connector_atomic_get_property, > .atomic_set_property = intel_digital_connector_atomic_set_property, > - .late_register = intel_connector_register, > - .early_unregister = intel_connector_unregister, > + .late_register = intel_dp_mst_connector_late_register, > + .early_unregister = intel_dp_mst_connector_early_unregister, > .destroy = intel_connector_destroy, > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > .atomic_duplicate_state = intel_digital_connector_duplicate_state, > -- > 2.22.0
BTW, I just tried these patches on my T450s (using i915) and I'm seeing some kernel warnings with them when adding DP aux devices after connecting a new MST topology to the system: [ 296.511130] kauditd_printk_skb: 2 callbacks suppressed [ 296.511135] audit: type=1305 audit(1562960713.086:245): op=set audit_pid=0 old=743 auid=4294967295 ses=4294967295 res=1 [ 296.513594] audit: type=1131 audit(1562960713.088:246): pid=1 uid=0 auid=4294967295 ses=4294967295 msg='unit=auditd comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=success' [ 298.506015] audit: type=1305 audit(1562960715.080:247): op=set audit_enabled=1 old=1 auid=4294967295 ses=4294967295 res=1 [ 298.506057] audit: type=1305 audit(1562960715.080:248): op=set audit_pid=7270 old=0 auid=4294967295 ses=4294967295 res=1 [ 367.725603] [drm:intel_get_hpd_pins.isra.0 [i915]] hotplug event received, stat 0x00400000, dig 0x10101210, pins 0x00000040, long 0x00000040 [ 367.725684] [drm:intel_hpd_irq_handler [i915]] digital hpd port C - long [ 367.725760] [drm:intel_hpd_irq_handler [i915]] Received HPD interrupt on PIN 6 - cnt: 10 [ 367.725888] [drm:intel_dp_hpd_pulse [i915]] got hpd irq on port C - long [ 367.725977] [drm:i915_hotplug_work_func [i915]] running encoder hotplug functions [ 367.726068] [drm:i915_hotplug_work_func [i915]] Connector DP-2 (pin 6) received hotplug event. [ 367.726165] [drm:intel_dp_detect [i915]] [CONNECTOR:86:DP-2] [ 367.726679] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x00000 AUX -> (ret= 15) 12 14 c4 01 00 05 01 83 02 00 00 00 00 00 04 [ 367.726748] [drm:intel_dp_read_dpcd [i915]] DPCD: 12 14 c4 01 00 05 01 83 02 00 00 00 00 00 04 [ 367.727117] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x00200 AUX -> (ret= 1) 01 [ 367.727787] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x00080 AUX -> (ret= 16) 08 0d 0d 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 367.727886] [drm:intel_dp_print_rates [i915]] source rates: 162000, 270000, 540000 [ 367.727974] [drm:intel_dp_print_rates [i915]] sink rates: 162000, 270000, 540000 [ 367.728047] [drm:intel_dp_print_rates [i915]] common rates: 162000, 270000, 540000 [ 367.728548] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x00500 AUX -> (ret= 12) 90 cc 24 53 59 4e 41 23 22 10 02 1d [ 367.728597] [drm:drm_dp_read_desc [drm_kms_helper]] DP branch: OUI 90-cc-24 dev-ID SYNA#" HW-rev 1.0 SW-rev 2.29 quirks 0x0000 [ 367.729069] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x00021 AUX -> (ret= 1) 01 [ 367.729159] [drm:intel_dp_detect [i915]] MST support? port C: yes, sink: yes, modparam: yes [ 367.729805] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x00000 AUX -> (ret= 15) 12 14 c4 01 00 05 01 83 02 00 00 00 00 00 04 [ 367.729830] [drm:drm_dp_mst_topology_mgr_set_mst [drm_kms_helper]] mstb 000000001b4abbfa (2) [ 367.730301] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x00111 AUX <- (ret= 1) 07 [ 367.730868] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x002c0 AUX <- (ret= 1) 01 [ 367.731086] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x001c0 AUX <- (ret= 3) 00 00 3f [ 367.731432] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x002c0 AUX -> (ret= 1) 01 [ 367.731448] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 000000001b4abbfa (1) [ 367.731521] [drm:i915_hotplug_work_func [i915]] Connector HDMI-A-2 (pin 6) received hotplug event. [ 367.731587] [drm:intel_hdmi_detect [i915]] [CONNECTOR:91:HDMI-A-2] [ 367.731784] [drm:drm_dp_mst_topology_try_get_mstb.part.0 [drm_kms_helper]] mstb 000000001b4abbfa (2) [ 367.732133] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x01000 AUX <- (ret= 5) 10 02 cb 01 d5 [ 367.732249] [drm:do_gmbus_xfer [i915]] GMBUS [i915 gmbus dpc] NAK for addr: 0050 w(1) [ 367.732328] [drm:do_gmbus_xfer [i915]] GMBUS [i915 gmbus dpc] NAK on first message, retry [ 367.732568] [drm:do_gmbus_xfer [i915]] GMBUS [i915 gmbus dpc] NAK for addr: 0050 w(1) [ 367.732630] [drm:drm_do_probe_ddc_edid [drm]] drm: skipping non-existent adapter i915 gmbus dpc [ 367.732726] [drm:intel_hdmi_set_edid [i915]] HDMI GMBUS EDID read failed, retry using GPIO bit-banging [ 367.732820] [drm:intel_gmbus_force_bit [i915]] enabling bit-banging on i915 gmbus dpc. force bit now 1 [ 367.733406] [drm:intel_get_hpd_pins.isra.0 [i915]] hotplug event received, stat 0x00400000, dig 0x10101110, pins 0x00000040, long 0x00000000 [ 367.733491] [drm:intel_hpd_irq_handler [i915]] digital hpd port C - short [ 367.733616] [drm:intel_dp_hpd_pulse [i915]] got hpd irq on port C - short [ 367.733711] [drm:drm_do_probe_ddc_edid [drm]] drm: skipping non-existent adapter i915 gmbus dpc [ 367.733826] [drm:intel_gmbus_force_bit [i915]] disabling bit-banging on i915 gmbus dpc. force bit now 0 [ 367.734104] [drm:do_gmbus_xfer [i915]] GMBUS [i915 gmbus dpc] NAK for addr: 0040 w(1) [ 367.734197] [drm:do_gmbus_xfer [i915]] GMBUS [i915 gmbus dpc] NAK on first message, retry [ 367.734234] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x02002 AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 00 00 80 00 [ 367.734335] [drm:intel_dp_hpd_pulse [i915]] got esi 01 10 00 [ 367.734510] [drm:do_gmbus_xfer [i915]] GMBUS [i915 gmbus dpc] NAK for addr: 0040 w(1) [ 367.734539] [drm:drm_dp_dual_mode_detect [drm_kms_helper]] DP dual mode HDMI ID: (err -6) [ 367.734893] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x01400 AUX -> (ret= 16) 10 2d 8c 01 00 00 00 00 00 00 00 00 00 00 00 00 [ 367.735446] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x01410 AUX -> (ret= 16) 00 00 00 00 04 90 c0 31 40 11 00 00 00 00 00 00 [ 367.735994] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x01420 AUX -> (ret= 16) 00 00 00 00 00 00 00 00 00 00 11 02 00 00 00 16 [ 367.736229] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x02003 AUX <- (ret= 3) 10 00 00 [ 367.736713] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x02002 AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 00 00 80 00 [ 367.736737] [drm:intel_dp_hpd_pulse [i915]] got esi2 01 00 00 [ 367.736756] [drm:intel_dp_hpd_pulse [i915]] got esi 01 00 00 [ 367.737420] [drm:intel_get_hpd_pins.isra.0 [i915]] hotplug event received, stat 0x00400000, dig 0x10101110, pins 0x00000040, long 0x00000000 [ 367.737441] [drm:intel_hpd_irq_handler [i915]] digital hpd port C - short [ 367.737468] [drm:intel_dp_hpd_pulse [i915]] got hpd irq on port C - short [ 367.737939] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x02002 AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 00 00 80 00 [ 367.737961] [drm:intel_dp_hpd_pulse [i915]] got esi 01 10 00 [ 367.738452] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x01400 AUX -> (ret= 16) 10 25 45 00 00 00 00 00 00 00 00 00 00 00 00 00 [ 367.738940] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x01410 AUX -> (ret= 16) 00 00 00 03 00 00 00 00 00 00 00 00 00 00 00 00 [ 367.739331] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x01420 AUX -> (ret= 8) 00 00 00 00 00 00 00 a9 [ 367.739336] [drm:drm_dp_mst_topology_try_get_mstb.part.0 [drm_kms_helper]] mstb 000000001b4abbfa (3) [ 367.739340] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 000000001b4abbfa (2) [ 367.739372] [drm:drm_dp_send_link_address [drm_kms_helper]] link address reply: 4 [ 367.739378] [drm:drm_dp_send_link_address [drm_kms_helper]] port 0: input 1, pdt: 1, pn: 0, dpcd_rev: 00, mcs: 1, ddps: 1, ldps 0, sdp 0/0 [ 367.739384] [drm:drm_dp_send_link_address [drm_kms_helper]] port 1: input 0, pdt: 3, pn: 1, dpcd_rev: 11, mcs: 0, ddps: 1, ldps 0, sdp 1/1 [ 367.739390] [drm:drm_dp_send_link_address [drm_kms_helper]] port 2: input 0, pdt: 0, pn: 2, dpcd_rev: 00, mcs: 0, ddps: 0, ldps 0, sdp 0/0 [ 367.739396] [drm:drm_dp_send_link_address [drm_kms_helper]] port 3: input 0, pdt: 0, pn: 3, dpcd_rev: 00, mcs: 0, ddps: 0, ldps 0, sdp 0/0 [ 367.739531] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x02003 AUX <- (ret= 3) 10 00 00 [ 367.739986] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x00030 AUX <- (ret= 16) 31 08 01 00 01 00 00 00 31 08 01 00 01 00 00 00 [ 367.739991] [drm:drm_dp_add_port [drm_kms_helper]] mstb 000000001b4abbfa (2) [ 367.739997] [drm:drm_dp_add_port [drm_kms_helper]] port 000000007ac74091 (2) [ 367.740002] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 000000007ac74091 (1) [ 367.740009] [drm:drm_dp_add_port [drm_kms_helper]] mstb 000000001b4abbfa (3) [ 367.740014] [drm:drm_dp_add_port [drm_kms_helper]] port 000000006e23aef3 (2) [ 367.740289] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x02002 AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 00 00 80 00 [ 367.740314] [drm:intel_dp_hpd_pulse [i915]] got esi2 01 00 00 [ 367.740337] [drm:intel_dp_hpd_pulse [i915]] got esi 01 00 00 [ 367.740497] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x01000 AUX <- (ret= 6) 10 43 d4 10 10 e2 [ 367.741445] [drm:intel_get_hpd_pins.isra.0 [i915]] hotplug event received, stat 0x00400000, dig 0x10101110, pins 0x00000040, long 0x00000000 [ 367.741462] [drm:intel_hpd_irq_handler [i915]] digital hpd port C - short [ 367.741482] [drm:intel_dp_hpd_pulse [i915]] got hpd irq on port C - short [ 367.741939] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x02002 AUX -> (ret= 14) 01 10 00 00 00 00 00 00 00 00 00 00 80 00 [ 367.741958] [drm:intel_dp_hpd_pulse [i915]] got esi 01 10 00 [ 367.742447] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x01400 AUX -> (ret= 16) 10 47 d3 10 10 05 00 05 00 3c 00 00 00 00 00 00 [ 367.742452] [drm:drm_dp_mst_topology_try_get_mstb.part.0 [drm_kms_helper]] mstb 000000001b4abbfa (3) [ 367.742456] [drm:drm_dp_mst_topology_put_mstb [drm_kms_helper]] mstb 000000001b4abbfa (2) [ 367.742471] [drm:drm_dp_send_enum_path_resources.isra.0 [drm_kms_helper]] enum path resources 1: 1280 1280 [ 367.742526] [drm:drm_dp_mst_get_port_malloc [drm_kms_helper]] port 000000006e23aef3 (2) [ 367.742571] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] [ 367.742651] Modules linked in: vfat fat joydev rmi_smbus rmi_core i915 wmi_bmof iTCO_wdt intel_rapl x86_pkg_temp_thermal i2c_algo_bit coretemp drm_kms_helper crc32_pclmul syscopyarea sysfillrect sysimgblt psmouse fb_sys_fops i2c_i801 drm i2c_core lpc_ich mei_me mfd_core thinkpad_acpi mei ledtrig_audio wmi tpm_tis tpm_tis_core tpm video pcc_cpufreq crc32c_intel serio_raw ehci_pci ehci_hcd xhci_pci xhci_hcd [ 367.742859] CPU: 2 PID: 442 Comm: kworker/2:3 Kdump: loaded Not tainted 5.2.0Lyude-Test+ #1 [ 367.742905] Hardware name: LENOVO 20BWS1KY00/20BWS1KY00, BIOS JBET71WW (1.35 ) 09/14/2018 [ 367.742957] Workqueue: events_long drm_dp_mst_link_probe_work [drm_kms_helper] [ 367.743011] RIP: 0010:__drm_mode_object_add+0xaa/0xb0 [drm] [ 367.743044] Code: 41 c7 44 24 10 01 00 00 00 4c 89 ff e8 4f 58 6b e1 85 db b8 00 00 00 00 0f 4e c3 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b eb 82 66 90 0f 1f 44 00 00 55 45 31 c0 b9 01 00 00 00 48 89 [ 367.743143] RSP: 0018:ffffc90000447b68 EFLAGS: 00010246 [ 367.743174] RAX: ffff888319350df0 RBX: ffff88830a840000 RCX: 0000000000000001 [ 367.743214] RDX: 00000000b0b0b0b0 RSI: ffff888313ad2e90 RDI: ffff88830a840000 [ 367.743254] RBP: ffffc90000447b98 R08: 0000000000000000 R09: ffff888319350df0 [ 367.743294] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888313ad2e90 [ 367.743334] R13: 0000000000000001 R14: 0000000000000000 R15: ffffffffa01b0d7a [ 367.743375] FS: 0000000000000000(0000) GS:ffff88831da80000(0000) knlGS:0000000000000000 [ 367.743421] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 367.743453] CR2: 00007f733dd19d88 CR3: 000000000220a006 CR4: 00000000003606e0 [ 367.743494] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 367.743534] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 367.743575] Call Trace: [ 367.743604] drm_mode_object_add+0x16/0x20 [drm] [ 367.743643] drm_property_create+0xd4/0x1b0 [drm] [ 367.743682] drm_property_create_range+0x1f/0x40 [drm] [ 367.743722] drm_connector_attach_max_bpc_property+0x69/0x90 [drm] [ 367.743784] intel_dp_add_mst_connector+0x130/0x140 [i915] [ 367.743822] drm_dp_add_port+0x222/0x490 [drm_kms_helper] [ 367.743856] ? memory_bm_create+0x1d1/0x4a0 [ 367.743886] ? drm_dp_dpcd_write+0x61/0xb0 [drm_kms_helper] [ 367.743930] ? drm_dbg+0x87/0x90 [drm] [ 367.743958] ? drm_dp_dpcd_write+0x61/0xb0 [drm_kms_helper] [ 367.743996] drm_dp_send_link_address+0x162/0x1c0 [drm_kms_helper] [ 367.744037] drm_dp_check_and_send_link_address+0xa2/0xb0 [drm_kms_helper] [ 367.744081] drm_dp_mst_link_probe_work+0x69/0x90 [drm_kms_helper] [ 367.744118] process_one_work+0x198/0x380 [ 367.744143] worker_thread+0x4d/0x3a0 [ 367.744166] kthread+0x106/0x140 [ 367.744188] ? process_one_work+0x380/0x380 [ 367.744213] ? kthread_park+0x90/0x90 [ 367.744237] ret_from_fork+0x35/0x40 [ 367.744272] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] [ 367.744330] ---[ end trace 314c8adc7c8ca583 ]--- [ 367.744396] [drm:drm_sysfs_connector_add [drm]] adding "DP-3" to sysfs [ 367.744406] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event [ 367.744426] [drm:drm_dp_mst_connector_late_register [drm_kms_helper]] registering DPMST remote bus for card0-DP-3 [ 367.744454] [drm:drm_dp_dpcd_write [drm_kms_helper]] DPDDC-C: 0x02003 AUX <- (ret= 3) 10 00 00 [ 367.744908] [drm:drm_dp_dpcd_read [drm_kms_helper]] DPDDC-C: 0x02002 AUX -> (ret= 14) 01 00 00 00 00 00 00 00 00 00 00 00 80 00 [ 367.744927] [drm:intel_dp_hpd_pulse [i915]] got esi2 01 00 00 [ 367.744944] [drm:intel_dp_hpd_pulse [i915]] got esi 01 00 00 [ 367.745595] [drm:drm_dp_aux_register_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] registered as minor 3 [ 367.745601] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 000000006e23aef3 (1) [ 367.745605] [drm:drm_dp_add_port [drm_kms_helper]] mstb 000000001b4abbfa (4) [ 367.745609] [drm:drm_dp_add_port [drm_kms_helper]] port 0000000024a17a86 (2) [ 367.745613] [drm:drm_dp_mst_get_port_malloc [drm_kms_helper]] port 0000000024a17a86 (2) [ 367.745635] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] [ 367.745668] Modules linked in: vfat fat joydev rmi_smbus rmi_core i915 wmi_bmof iTCO_wdt intel_rapl x86_pkg_temp_thermal i2c_algo_bit coretemp drm_kms_helper crc32_pclmul syscopyarea sysfillrect sysimgblt psmouse fb_sys_fops i2c_i801 drm i2c_core lpc_ich mei_me mfd_core thinkpad_acpi mei ledtrig_audio wmi tpm_tis tpm_tis_core tpm video pcc_cpufreq crc32c_intel serio_raw ehci_pci ehci_hcd xhci_pci xhci_hcd [ 367.745774] CPU: 2 PID: 442 Comm: kworker/2:3 Kdump: loaded Tainted: G W 5.2.0Lyude-Test+ #1 [ 367.745802] Hardware name: LENOVO 20BWS1KY00/20BWS1KY00, BIOS JBET71WW (1.35 ) 09/14/2018 [ 367.745847] Workqueue: events_long drm_dp_mst_link_probe_work [drm_kms_helper] [ 367.745899] RIP: 0010:__drm_mode_object_add+0xaa/0xb0 [drm] [ 367.745931] Code: 41 c7 44 24 10 01 00 00 00 4c 89 ff e8 4f 58 6b e1 85 db b8 00 00 00 00 0f 4e c3 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b eb 82 66 90 0f 1f 44 00 00 55 45 31 c0 b9 01 00 00 00 48 89 [ 367.746022] RSP: 0018:ffffc90000447b68 EFLAGS: 00010246 [ 367.746052] RAX: ffff888319350d90 RBX: ffff88830a840000 RCX: 0000000000000001 [ 367.746090] RDX: 00000000b0b0b0b0 RSI: ffff888313ad2c90 RDI: ffff88830a840000 [ 367.746128] RBP: ffffc90000447b98 R08: 0000000000000000 R09: ffff888319350d90 [ 367.746165] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888313ad2c90 [ 367.746204] R13: 0000000000000001 R14: 0000000000000000 R15: ffffffffa01b0d7a [ 367.746242] FS: 0000000000000000(0000) GS:ffff88831da80000(0000) knlGS:0000000000000000 [ 367.746285] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 367.748602] CR2: 00007f733dd19d88 CR3: 00000003190ba003 CR4: 00000000003606e0 [ 367.750927] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 367.753249] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 367.755581] Call Trace: [ 367.757571] drm_mode_object_add+0x16/0x20 [drm] [ 367.759275] drm_property_create+0xd4/0x1b0 [drm] [ 367.761414] drm_property_create_range+0x1f/0x40 [drm] [ 367.763605] drm_connector_attach_max_bpc_property+0x69/0x90 [drm] [ 367.765862] intel_dp_add_mst_connector+0x130/0x140 [i915] [ 367.768061] drm_dp_add_port+0x222/0x490 [drm_kms_helper] [ 367.770256] ? memory_bm_create+0x1d2/0x4a0 [ 367.772428] ? drm_dp_dpcd_write+0x61/0xb0 [drm_kms_helper] [ 367.774552] ? drm_dbg+0x87/0x90 [drm] [ 367.776554] ? drm_dp_dpcd_write+0x61/0xb0 [drm_kms_helper] [ 367.777972] drm_dp_send_link_address+0x162/0x1c0 [drm_kms_helper] [ 367.779153] drm_dp_check_and_send_link_address+0xa2/0xb0 [drm_kms_helper] [ 367.780406] drm_dp_mst_link_probe_work+0x69/0x90 [drm_kms_helper] [ 367.781512] process_one_work+0x198/0x380 [ 367.782566] worker_thread+0x4d/0x3a0 [ 367.783619] kthread+0x106/0x140 [ 367.784656] ? process_one_work+0x380/0x380 [ 367.785693] ? kthread_park+0x90/0x90 [ 367.786728] ret_from_fork+0x35/0x40 [ 367.787775] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] [ 367.788839] ---[ end trace 314c8adc7c8ca584 ]--- [ 367.790031] [drm:drm_sysfs_connector_add [drm]] adding "DP-4" to sysfs [ 367.790043] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event [ 367.790066] [drm:drm_dp_mst_connector_late_register [drm_kms_helper]] registering DPMST remote bus for card0-DP-4 [ 367.790107] [drm:drm_dp_aux_register_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] registered as minor 4 [ 367.790115] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 0000000024a17a86 (1) [ 367.790124] [drm:drm_dp_add_port [drm_kms_helper]] mstb 000000001b4abbfa (5) [ 367.790130] [drm:drm_dp_add_port [drm_kms_helper]] port 00000000b8b9df74 (2) [ 367.790137] [drm:drm_dp_mst_get_port_malloc [drm_kms_helper]] port 00000000b8b9df74 (2) [ 367.790169] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] [ 367.791436] Modules linked in: vfat fat joydev rmi_smbus rmi_core i915 wmi_bmof iTCO_wdt intel_rapl x86_pkg_temp_thermal i2c_algo_bit coretemp drm_kms_helper crc32_pclmul syscopyarea sysfillrect sysimgblt psmouse fb_sys_fops i2c_i801 drm i2c_core lpc_ich mei_me mfd_core thinkpad_acpi mei ledtrig_audio wmi tpm_tis tpm_tis_core tpm video pcc_cpufreq crc32c_intel serio_raw ehci_pci ehci_hcd xhci_pci xhci_hcd [ 367.793914] CPU: 2 PID: 442 Comm: kworker/2:3 Kdump: loaded Tainted: G W 5.2.0Lyude-Test+ #1 [ 367.795127] Hardware name: LENOVO 20BWS1KY00/20BWS1KY00, BIOS JBET71WW (1.35 ) 09/14/2018 [ 367.796330] Workqueue: events_long drm_dp_mst_link_probe_work [drm_kms_helper] [ 367.797554] RIP: 0010:__drm_mode_object_add+0xaa/0xb0 [drm] [ 367.798774] Code: 41 c7 44 24 10 01 00 00 00 4c 89 ff e8 4f 58 6b e1 85 db b8 00 00 00 00 0f 4e c3 48 83 c4 08 5b 41 5c 41 5d 41 5e 41 5f 5d c3 <0f> 0b eb 82 66 90 0f 1f 44 00 00 55 45 31 c0 b9 01 00 00 00 48 89 [ 367.800047] RSP: 0018:ffffc90000447b68 EFLAGS: 00010246 [ 367.801322] RAX: ffff8883193421a0 RBX: ffff88830a840000 RCX: 0000000000000001 [ 367.802629] RDX: 00000000b0b0b0b0 RSI: ffff888313ad2890 RDI: ffff88830a840000 [ 367.803915] RBP: ffffc90000447b98 R08: 0000000000000000 R09: ffff8883193421a0 [ 367.805202] R10: 0000000000000000 R11: 0000000000000000 R12: ffff888313ad2890 [ 367.806489] R13: 0000000000000001 R14: 0000000000000000 R15: ffffffffa01b0d7a [ 367.807793] FS: 0000000000000000(0000) GS:ffff88831da80000(0000) knlGS:0000000000000000 [ 367.809080] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 367.810363] CR2: 00007f733dd19d88 CR3: 00000003190ba003 CR4: 00000000003606e0 [ 367.811675] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 367.812962] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 367.814248] Call Trace: [ 367.815554] drm_mode_object_add+0x16/0x20 [drm] [ 367.816862] drm_property_create+0xd4/0x1b0 [drm] [ 367.818167] drm_property_create_range+0x1f/0x40 [drm] [ 367.819466] drm_connector_attach_max_bpc_property+0x69/0x90 [drm] [ 367.820790] intel_dp_add_mst_connector+0x130/0x140 [i915] [ 367.822190] drm_dp_add_port+0x222/0x490 [drm_kms_helper] [ 367.823451] ? memory_bm_create+0x1d3/0x4a0 [ 367.824692] ? drm_dp_dpcd_write+0x61/0xb0 [drm_kms_helper] [ 367.825877] ? drm_dbg+0x87/0x90 [drm] [ 367.827026] ? drm_dp_dpcd_write+0x61/0xb0 [drm_kms_helper] [ 367.828168] drm_dp_send_link_address+0x162/0x1c0 [drm_kms_helper] [ 367.829305] drm_dp_check_and_send_link_address+0xa2/0xb0 [drm_kms_helper] [ 367.830440] drm_dp_mst_link_probe_work+0x69/0x90 [drm_kms_helper] [ 367.831552] process_one_work+0x198/0x380 [ 367.832620] worker_thread+0x4d/0x3a0 [ 367.833671] kthread+0x106/0x140 [ 367.834714] ? process_one_work+0x380/0x380 [ 367.835756] ? kthread_park+0x90/0x90 [ 367.836799] ret_from_fork+0x35/0x40 [ 367.837851] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] [ 367.838919] ---[ end trace 314c8adc7c8ca585 ]--- [ 367.840066] [drm:drm_sysfs_connector_add [drm]] adding "DP-5" to sysfs [ 367.840078] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event [ 367.840101] [drm:drm_dp_mst_connector_late_register [drm_kms_helper]] registering DPMST remote bus for card0-DP-5 [ 367.840152] [drm:drm_dp_aux_register_devnode [drm_kms_helper]] drm_dp_aux_dev: aux [DPMST] registered as minor 5 [ 367.840164] [drm:drm_dp_mst_topology_put_port [drm_kms_helper]] port 00000000b8b9df74 (1) [ 367.840176] [drm:drm_sysfs_hotplug_event [drm]] generating hotplug event [ 367.840189] [drm:drm_fb_helper_hotplug_event.part.0 [drm_kms_helper]] [ 367.840202] [drm:drm_client_modeset_probe [drm]] [ 367.840223] [drm:drm_mode_object_get [drm]] OBJ ID: 68 (4) [ 367.840237] [drm:drm_mode_object_get [drm]] OBJ ID: 74 (2) [ 367.840250] [drm:drm_mode_object_get [drm]] OBJ ID: 80 (2) [ 367.840266] [drm:drm_mode_object_get [drm]] OBJ ID: 86 (2) [ 367.840279] [drm:drm_mode_object_get [drm]] OBJ ID: 91 (2) [ 367.840291] [drm:drm_mode_object_get [drm]] OBJ ID: 94 (2) [ 367.840304] [drm:drm_mode_object_get [drm]] OBJ ID: 99 (2) [ 367.840329] [drm:drm_mode_object_get [drm]] OBJ ID: 102 (2) On Thu, 2019-07-04 at 15:05 -0400, sunpeng.li@amd.com wrote: > From: Leo Li <sunpeng.li@amd.com> > > Implement late_register and early_unregister hooks for MST connectors. > Call drm helpers for MST connector registration, which registers the > AUX devices. > > Signed-off-by: Leo Li <sunpeng.li@amd.com> > --- > drivers/gpu/drm/i915/display/intel_dp_mst.c | 29 +++++++++++++++++++-- > 1 file changed, 27 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c > b/drivers/gpu/drm/i915/display/intel_dp_mst.c > index 60652ebbdf61..be309016f746 100644 > --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c > +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c > @@ -400,13 +400,38 @@ intel_dp_mst_detect(struct drm_connector *connector, > bool force) > intel_connector->port); > } > > +static int > +intel_dp_mst_connector_late_register(struct drm_connector *connector) > +{ > + struct intel_connector *intel_connector = > to_intel_connector(connector); > + struct drm_dp_mst_port *port = intel_connector->port; > + > + int ret; > + > + ret = intel_connector_register(connector); > + if (ret) > + return ret; > + > + return drm_dp_mst_connector_late_register(connector, port); > +} > + > +static void > +intel_dp_mst_connector_early_unregister(struct drm_connector *connector) > +{ > + struct intel_connector *intel_connector = > to_intel_connector(connector); > + struct drm_dp_mst_port *port = intel_connector->port; > + > + drm_dp_mst_connector_early_unregister(connector, port); > + intel_connector_unregister(connector); > +} > + > static const struct drm_connector_funcs intel_dp_mst_connector_funcs = { > .detect = intel_dp_mst_detect, > .fill_modes = drm_helper_probe_single_connector_modes, > .atomic_get_property = intel_digital_connector_atomic_get_property, > .atomic_set_property = intel_digital_connector_atomic_set_property, > - .late_register = intel_connector_register, > - .early_unregister = intel_connector_unregister, > + .late_register = intel_dp_mst_connector_late_register, > + .early_unregister = intel_dp_mst_connector_early_unregister, > .destroy = intel_connector_destroy, > .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, > .atomic_duplicate_state = intel_digital_connector_duplicate_state,
On Fri, Jul 12, 2019 at 03:48:53PM -0400, Lyude Paul wrote: > BTW, I just tried these patches on my T450s (using i915) and I'm seeing some > kernel warnings with them when adding DP aux devices after connecting a new > MST topology to the system: > > [ 367.742571] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] Looks like Daniel added that particular WARN in commit 4f5368b5541a ("drm/kms: Catch mode_object lifetime errors").
On Fri, Jul 12, 2019 at 11:05:59PM +0300, Ville Syrjälä wrote: > On Fri, Jul 12, 2019 at 03:48:53PM -0400, Lyude Paul wrote: > > BTW, I just tried these patches on my T450s (using i915) and I'm seeing some > > kernel warnings with them when adding DP aux devices after connecting a new > > MST topology to the system: > > > > [ 367.742571] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] > > Looks like Daniel added that particular WARN in > commit 4f5368b5541a ("drm/kms: Catch mode_object lifetime errors"). And I'm the one who added the max_bpc prop to the mst connectors, which is a per-connector property (ie. a new one gets created for every connecotor). So that could be a problem I suppose. I guess we may need to create just one of these for MST and reuse it for every connector. Could just point at the prop of the corresponding SST connector I suppose... + /* Reuse the prop because blah */ + connector->max_bpc_property = + intel_dp->attached_connector->base.max_bpc_property; drm_connector_attach_max_bpc_property(connector, 6, 12);
On 2019-07-12 4:15 p.m., Ville Syrjälä wrote: > On Fri, Jul 12, 2019 at 11:05:59PM +0300, Ville Syrjälä wrote: >> On Fri, Jul 12, 2019 at 03:48:53PM -0400, Lyude Paul wrote: >>> BTW, I just tried these patches on my T450s (using i915) and I'm seeing some >>> kernel warnings with them when adding DP aux devices after connecting a new >>> MST topology to the system: >>> >>> [ 367.742571] WARNING: CPU: 2 PID: 442 at drivers/gpu/drm/drm_mode_object.c:45 __drm_mode_object_add+0xaa/0xb0 [drm] >> >> Looks like Daniel added that particular WARN in >> commit 4f5368b5541a ("drm/kms: Catch mode_object lifetime errors"). > > And I'm the one who added the max_bpc prop to the mst connectors, which > is a per-connector property (ie. a new one gets created for every > connecotor). So that could be a problem I suppose. I guess we may need > to create just one of these for MST and reuse it for every connector. > Could just point at the prop of the corresponding SST connector I > suppose... > > + /* Reuse the prop because blah */ > + connector->max_bpc_property = > + intel_dp->attached_connector->base.max_bpc_property; > drm_connector_attach_max_bpc_property(connector, 6, 12); I'd prefer to address this separately, if that's alright. It isn't related to this series, and no new warnings are introduced by this either. Leo > >
diff --git a/drivers/gpu/drm/i915/display/intel_dp_mst.c b/drivers/gpu/drm/i915/display/intel_dp_mst.c index 60652ebbdf61..be309016f746 100644 --- a/drivers/gpu/drm/i915/display/intel_dp_mst.c +++ b/drivers/gpu/drm/i915/display/intel_dp_mst.c @@ -400,13 +400,38 @@ intel_dp_mst_detect(struct drm_connector *connector, bool force) intel_connector->port); } +static int +intel_dp_mst_connector_late_register(struct drm_connector *connector) +{ + struct intel_connector *intel_connector = to_intel_connector(connector); + struct drm_dp_mst_port *port = intel_connector->port; + + int ret; + + ret = intel_connector_register(connector); + if (ret) + return ret; + + return drm_dp_mst_connector_late_register(connector, port); +} + +static void +intel_dp_mst_connector_early_unregister(struct drm_connector *connector) +{ + struct intel_connector *intel_connector = to_intel_connector(connector); + struct drm_dp_mst_port *port = intel_connector->port; + + drm_dp_mst_connector_early_unregister(connector, port); + intel_connector_unregister(connector); +} + static const struct drm_connector_funcs intel_dp_mst_connector_funcs = { .detect = intel_dp_mst_detect, .fill_modes = drm_helper_probe_single_connector_modes, .atomic_get_property = intel_digital_connector_atomic_get_property, .atomic_set_property = intel_digital_connector_atomic_set_property, - .late_register = intel_connector_register, - .early_unregister = intel_connector_unregister, + .late_register = intel_dp_mst_connector_late_register, + .early_unregister = intel_dp_mst_connector_early_unregister, .destroy = intel_connector_destroy, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, .atomic_duplicate_state = intel_digital_connector_duplicate_state,