Skip to contentSkip to conversation

nouveau/dpcd: return EBUSY for aux xfer if the device is asleep

PATCH Applied Dave Airlie 2 participants 4 messages Feb 24 – Mar 4

Subsystems (3)
lore
Share & tools
lore

Dave Airlie

author maintainer
#0 lore raw

PATCH 1/1 nouveau/dpcd: return EBUSY for aux xfer if the device is asleep

From: Dave Airlie <[email protected]>

If we have runtime suspended, and userspace wants to use /dev/drm_dp_* then just tell it the device is busy instead of crashing in the GSP code.

WARNING: CPU: 2 PID: 565741 at drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c:164 r535_gsp_msgq_wait+0x9a/0xb0 [nouveau]
Modules linked in: overlay uinput rfcomm snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables qrtr bnep s>
snd_soc_acpi intel_rapl_msr libarc4 kvm crc8 soundwire_bus irqbypass snd_soc_sdca rapl iwlwifi snd_soc_avs uvcvideo intel_cstate think_lmi uvc firmware_attributes_class intel_uncore intel_wmi_thunderbolt wmi_bmof snd_hda_codec_conexant snd_hda_codec_nvhdmi videobuf2_vmalloc snd_soc_hda_codec cfg80211 videobu>
processor_thermal_mbox sparse_keymap intel_soc_dts_iosf intel_pch_thermal platform_profile rfkill snd soundcore int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad joydev loop nfnetlink zram lz4hc_compress lz4_compress xfs wacom hid_microsoft ff_memless nouveau ucsi_acpi typec_ucsi>
CPU: 2 UID: 0 PID: 565741 Comm: fwupd Not tainted 6.18.10-200.fc43.x86_64 #1 PREEMPT(lazy)
Hardware name: LENOVO 20QTS0PQ00/20QTS0PQ00, BIOS N2OET65W (1.52 ) 08/05/2024
RIP: 0010:r535_gsp_msgq_wait+0x9a/0xb0 [nouveau]

This is a simple fix to get backported. We should probably engineer a proper power domain solution to wake up devices and keep them away while fw updates are happening.

---
 drivers/gpu/drm/nouveau/nouveau_connector.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/gpu/drm/nouveau/nouveau_connector.c +3 -0
index 00d4530aea717..cc239492c7f0b 100644
@@ -1230,6 +1230,9 @@ nouveau_connector_aux_xfer(struct drm_dp_aux *obj, struct drm_dp_aux_msg *msg)
 	u8 size = msg->size;
 	int ret;
 
+	if (pm_runtime_suspended(nv_connector->base.dev->dev))
+		return -EBUSY;
+
 	nv_encoder = find_encoder(&nv_connector->base, DCB_OUTPUT_DP);
 	if (!nv_encoder)
 		return -ENODEV;
Signature · 1 line
2.53.0
maintainer
#1 lore raw
Quoted 10 lines · Dave Airlie

From: Dave Airlie <[email protected]>

If we have runtime suspended, and userspace wants to use /dev/drm_dp_* then just tell it the device is busy instead of crashing in the GSP code.

WARNING: CPU: 2 PID: 565741 at drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c:164 r535_gsp_msgq_wait+0x9a/0xb0 [nouveau]
Modules linked in: overlay uinput rfcomm snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables qrtr bnep s>

snd_soc_acpi intel_rapl_msr libarc4 kvm crc8 soundwire_bus irqbypass snd_soc_sdca rapl iwlwifi snd_soc_avs uvcvideo intel_cstate think_lmi uvc firmware_attributes_class intel_uncore intel_wmi_thunderbolt wmi_bmof snd_hda_codec_conexant snd_hda_codec_nvhdmi videobuf2_vmalloc snd_soc_hda_codec cfg80211 videobu> processor_thermal_mbox sparse_keymap intel_soc_dts_iosf intel_pch_thermal platform_profile rfkill snd soundcore int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad joydev loop nfnetlink zram lz4hc_compress lz4_compress xfs wacom hid_microsoft ff_memless nouveau ucsi_acpi typec_ucsi>

I'd remove the modules linked in, it seems not relevant.

Quoted 5 lines
CPU: 2 UID: 0 PID: 565741 Comm: fwupd Not tainted 6.18.10-200.fc43.x86_64 #1 PREEMPT(lazy)
Hardware name: LENOVO 20QTS0PQ00/20QTS0PQ00, BIOS N2OET65W (1.52 ) 08/05/2024
RIP: 0010:r535_gsp_msgq_wait+0x9a/0xb0 [nouveau]

This is a simple fix to get backported. We should probably engineer a proper power domain solution to wake up devices and keep them away while fw updates are happening.

s/away/awake/ and line length.

Quoted 1 line

Do we want this backported before GSP introduction?

I.e. if it's only about the WARN_ON() and otherwise doesn't cause problems it should probably be

Fixes 176fdcbddfd2 ("drm/nouveau/gsp/r535: add support for booting GSP-RM")

otherwise

Fixes 8894f4919bc4 ("drm/nouveau: register a drm_dp_aux channel for each dp connector")
Quoted 1 line

No need to resend, I can fix up the above (and the minor typo in the SoB) on apply.

author maintainer
#2 lore raw
Quoted 27 lines · Danilo Krummrich
Quoted 10 lines · Dave Airlie

From: Dave Airlie <[email protected]>

If we have runtime suspended, and userspace wants to use /dev/drm_dp_* then just tell it the device is busy instead of crashing in the GSP code.

WARNING: CPU: 2 PID: 565741 at drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c:164 r535_gsp_msgq_wait+0x9a/0xb0 [nouveau]
Modules linked in: overlay uinput rfcomm snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables qrtr bnep s>

snd_soc_acpi intel_rapl_msr libarc4 kvm crc8 soundwire_bus irqbypass snd_soc_sdca rapl iwlwifi snd_soc_avs uvcvideo intel_cstate think_lmi uvc firmware_attributes_class intel_uncore intel_wmi_thunderbolt wmi_bmof snd_hda_codec_conexant snd_hda_codec_nvhdmi videobuf2_vmalloc snd_soc_hda_codec cfg80211 videobu> processor_thermal_mbox sparse_keymap intel_soc_dts_iosf intel_pch_thermal platform_profile rfkill snd soundcore int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad joydev loop nfnetlink zram lz4hc_compress lz4_compress xfs wacom hid_microsoft ff_memless nouveau ucsi_acpi typec_ucsi>

I'd remove the modules linked in, it seems not relevant.

Quoted 5 lines
CPU: 2 UID: 0 PID: 565741 Comm: fwupd Not tainted 6.18.10-200.fc43.x86_64 #1 PREEMPT(lazy)
Hardware name: LENOVO 20QTS0PQ00/20QTS0PQ00, BIOS N2OET65W (1.52 ) 08/05/2024
RIP: 0010:r535_gsp_msgq_wait+0x9a/0xb0 [nouveau]

This is a simple fix to get backported. We should probably engineer a proper power domain solution to wake up devices and keep them away while fw updates are happening.

s/away/awake/ and line length.

Quoted 1 line

Do we want this backported before GSP introduction?

Quoted 8 lines

I.e. if it's only about the WARN_ON() and otherwise doesn't cause problems it should probably be

Fixes 176fdcbddfd2 ("drm/nouveau/gsp/r535: add support for booting GSP-RM")

otherwise

Fixes 8894f4919bc4 ("drm/nouveau: register a drm_dp_aux channel for each dp connector")

Go back to this for safety, probably won't blow up but it could still cause wierd register timeouts.

Quoted 5 lines
Quoted 2 lines

No need to resend, I can fix up the above (and the minor typo in the SoB) on apply.

Thanks,
Dave.

maintainer Applied
#3 lore raw
Quoted 31 lines · Dave Airlie
Quoted 30 lines · Danilo Krummrich
Quoted 10 lines · Dave Airlie

From: Dave Airlie <[email protected]>

If we have runtime suspended, and userspace wants to use /dev/drm_dp_* then just tell it the device is busy instead of crashing in the GSP code.

WARNING: CPU: 2 PID: 565741 at drivers/gpu/drm/nouveau/nvkm/subdev/gsp/rm/r535/rpc.c:164 r535_gsp_msgq_wait+0x9a/0xb0 [nouveau]
Modules linked in: overlay uinput rfcomm snd_seq_dummy snd_hrtimer nf_conntrack_netbios_ns nf_conntrack_broadcast nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 nf_tables qrtr bnep s>

snd_soc_acpi intel_rapl_msr libarc4 kvm crc8 soundwire_bus irqbypass snd_soc_sdca rapl iwlwifi snd_soc_avs uvcvideo intel_cstate think_lmi uvc firmware_attributes_class intel_uncore intel_wmi_thunderbolt wmi_bmof snd_hda_codec_conexant snd_hda_codec_nvhdmi videobuf2_vmalloc snd_soc_hda_codec cfg80211 videobu> processor_thermal_mbox sparse_keymap intel_soc_dts_iosf intel_pch_thermal platform_profile rfkill snd soundcore int3403_thermal int340x_thermal_zone int3400_thermal acpi_thermal_rel acpi_pad joydev loop nfnetlink zram lz4hc_compress lz4_compress xfs wacom hid_microsoft ff_memless nouveau ucsi_acpi typec_ucsi>

I'd remove the modules linked in, it seems not relevant.

Quoted 5 lines
CPU: 2 UID: 0 PID: 565741 Comm: fwupd Not tainted 6.18.10-200.fc43.x86_64 #1 PREEMPT(lazy)
Hardware name: LENOVO 20QTS0PQ00/20QTS0PQ00, BIOS N2OET65W (1.52 ) 08/05/2024
RIP: 0010:r535_gsp_msgq_wait+0x9a/0xb0 [nouveau]

This is a simple fix to get backported. We should probably engineer a proper power domain solution to wake up devices and keep them away while fw updates are happening.

s/away/awake/ and line length.

Quoted 1 line

Do we want this backported before GSP introduction?

I.e. if it's only about the WARN_ON() and otherwise doesn't cause problems it should probably be

Quoted 14 lines
Quoted 5 lines
Fixes 176fdcbddfd2 ("drm/nouveau/gsp/r535: add support for booting GSP-RM")

otherwise

Fixes 8894f4919bc4 ("drm/nouveau: register a drm_dp_aux channel for each dp connector")

Go back to this for safety, probably won't blow up but it could still cause wierd register timeouts.

Quoted 5 lines
Quoted 2 lines

No need to resend, I can fix up the above (and the minor typo in the SoB) on apply.

Applied to drm-misc-fixes, thanks!