Skip to contentSkip to conversation

drm/radeon: Bail earlier when radeon.cik_/si_support=0 is passed

PATCH Applied Hans de Goede 5 participants 6 messages Sep 7, 2019 – Sep 13, 2019 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/radeon: Bail earlier when radeon.cik_/si_support=0 is passed

Bail from the pci_driver probe function instead of from the drm_driver load function.

This avoid /dev/dri/card0 temporarily getting registered and then unregistered again, sending unwanted add / remove udev events to userspace.

Specifically this avoids triggering the (userspace) bug fixed by this plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Note that despite that being an userspace bug, not sending unnecessary udev events is a good idea in general.

---
 drivers/gpu/drm/radeon/radeon_drv.c | 31 +++++++++++++++++++++++++++++
 drivers/gpu/drm/radeon/radeon_kms.c | 25 -----------------------
 2 files changed, 31 insertions(+), 25 deletions(-)
drivers/gpu/drm/radeon/radeon_drv.c +31 -0
index a6cbe11f79c6..7033f3a38c87 100644
@@ -325,8 +325,39 @@ bool radeon_device_is_virtual(void);
 static int radeon_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *ent)
 {
+	unsigned long flags = 0;
 	int ret;
 
+	if (!ent)
+		return -ENODEV; /* Avoid NULL-ptr deref in drm_get_pci_dev */
+
+	flags = ent->driver_data;
+
+	if (!radeon_si_support) {
+		switch (flags & RADEON_FAMILY_MASK) {
+		case CHIP_TAHITI:
+		case CHIP_PITCAIRN:
+		case CHIP_VERDE:
+		case CHIP_OLAND:
+		case CHIP_HAINAN:
+			dev_info(&pdev->dev,
+				 "SI support disabled by module param\n");
+			return -ENODEV;
+		}
+	}
+	if (!radeon_cik_support) {
+		switch (flags & RADEON_FAMILY_MASK) {
+		case CHIP_KAVERI:
+		case CHIP_BONAIRE:
+		case CHIP_HAWAII:
+		case CHIP_KABINI:
+		case CHIP_MULLINS:
+			dev_info(&pdev->dev,
+				 "CIK support disabled by module param\n");
+			return -ENODEV;
+		}
+	}
+
 	if (vga_switcheroo_client_probe_defer(pdev))
 		return -EPROBE_DEFER;
 
drivers/gpu/drm/radeon/radeon_kms.c +0 -25
index 07f7ace42c4b..e85c554eeaa9 100644
@@ -100,31 +100,6 @@ int radeon_driver_load_kms(struct drm_device *dev, unsigned long flags)
 	struct radeon_device *rdev;
 	int r, acpi_status;
 
-	if (!radeon_si_support) {
-		switch (flags & RADEON_FAMILY_MASK) {
-		case CHIP_TAHITI:
-		case CHIP_PITCAIRN:
-		case CHIP_VERDE:
-		case CHIP_OLAND:
-		case CHIP_HAINAN:
-			dev_info(dev->dev,
-				 "SI support disabled by module param\n");
-			return -ENODEV;
-		}
-	}
-	if (!radeon_cik_support) {
-		switch (flags & RADEON_FAMILY_MASK) {
-		case CHIP_KAVERI:
-		case CHIP_BONAIRE:
-		case CHIP_HAWAII:
-		case CHIP_KABINI:
-		case CHIP_MULLINS:
-			dev_info(dev->dev,
-				 "CIK support disabled by module param\n");
-			return -ENODEV;
-		}
-	}
-
 	rdev = kzalloc(sizeof(struct radeon_device), GFP_KERNEL);
 	if (rdev == NULL) {
 		return -ENOMEM;
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Hans de Goede

Bail from the pci_driver probe function instead of from the drm_driver load function.

This avoid /dev/dri/card0 temporarily getting registered and then unregistered again, sending unwanted add / remove udev events to userspace.

Specifically this avoids triggering the (userspace) bug fixed by this plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Quoted 5 lines

Note that despite that being an userspace bug, not sending unnecessary udev events is a good idea in general.

amdgpu should be changed correspondingly as well.

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#2 lore raw

Hi,

Quoted 12 lines · Michel Dänzer
Quoted 11 lines · Hans de Goede

Bail from the pci_driver probe function instead of from the drm_driver load function.

This avoid /dev/dri/card0 temporarily getting registered and then unregistered again, sending unwanted add / remove udev events to userspace.

Specifically this avoids triggering the (userspace) bug fixed by this plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Quoted 7 lines
Quoted 5 lines

Note that despite that being an userspace bug, not sending unnecessary udev events is a good idea in general.

Thank you for the review. I've drm push rights, but I guess that radeon/amd GPU patches are collected by someone @AMD, so I do not need to / should not push this myself, right?

Quoted 1 line

amdgpu should be changed correspondingly as well.

Good point. I'm currently travelling (@plumbers) I can do this when I'm back home, but feel free to beat me to it (if you do please Cc me to avoid double work).

Regards,

Hans
_______________________________________________
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): 3c0eb318-6c30-fc98-4005-80b5c00b8f5e-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#4 lore raw
Quoted 16 lines · Hans de Goede
Quoted 15 lines · Michel Dänzer
Quoted 14 lines · Hans de Goede

Bail from the pci_driver probe function instead of from the drm_driver load function.

This avoid /dev/dri/card0 temporarily getting registered and then unregistered again, sending unwanted add / remove udev events to userspace.

Specifically this avoids triggering the (userspace) bug fixed by this plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Note that despite that being an userspace bug, not sending unnecessary udev events is a good idea in general.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Thank you for the review. I've drm push rights, but I guess that radeon/amd GPU patches are collected by someone @AMD, so I do not need to / should not push this myself, right?

I think so, unless one of the driver maintainers says otherwise.

Quoted 6 lines
Quoted 1 line

amdgpu should be changed correspondingly as well.

Good point. I'm currently travelling (@plumbers) I can do this when I'm back home,
but feel free to beat me to it (if you do please Cc me to avoid double work).

I'm happy to leave it to you, if you don't mind.

Signature · 6 lines
Earthling Michel Dänzer               |               https://redhat.com
Libre software enthusiast             |             Mesa and X developer
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#5 lore raw
In reply to Hans de Goede
Quoted 30 lines

-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Tuesday, September 10, 2019 5:36 AM
To: Michel Dänzer <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>
Cc: David Airlie <[email protected]>; [email protected]; amd- [email protected]; Daniel Vetter <[email protected]>
Subject: Re: [PATCH] drm/radeon: Bail earlier when radeon.cik_/si_support=0 is passed

Hi,

Quoted 15 lines · Michel Dänzer
Quoted 14 lines · Hans de Goede

Bail from the pci_driver probe function instead of from the drm_driver load function.

This avoid /dev/dri/card0 temporarily getting registered and then unregistered again, sending unwanted add / remove udev events to userspace.

Specifically this avoids triggering the (userspace) bug fixed by this plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Note that despite that being an userspace bug, not sending unnecessary udev events is a good idea in general.

Quoted 8 lines
Quoted 4 lines
Quoted 2 lines

Thank you for the review. I've drm push rights, but I guess that radeon/amd GPU patches are collected by someone @AMD, so I do not need to / should not push this myself, right?

I'll pick this up later this week when I get home from travel.

Thanks!

Alex

Quoted 10 lines
Quoted 2 lines

amdgpu should be changed correspondingly as well.

Good point. I'm currently travelling (@plumbers) I can do this when I'm back home, but feel free to beat me to it (if you do please Cc me to avoid double work).

Regards,

Hans

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

Applied
#6 lore raw
Quoted 34 lines · Alexander
Quoted 34 lines

-----Original Message-----
From: Hans de Goede <[email protected]>
Sent: Tuesday, September 10, 2019 5:36 AM
To: Michel Dänzer <[email protected]>; Deucher, Alexander <[email protected]>; Koenig, Christian <[email protected]>; Zhou, David(ChunMing) <[email protected]>
Cc: David Airlie <[email protected]>; [email protected]; amd- [email protected]; Daniel Vetter <[email protected]>
Subject: Re: [PATCH] drm/radeon: Bail earlier when radeon.cik_/si_support=0 is passed

Hi,

Quoted 18 lines · Michel Dänzer
Quoted 16 lines · Hans de Goede

Bail from the pci_driver probe function instead of from the drm_driver load function.

This avoid /dev/dri/card0 temporarily getting registered and then unregistered again, sending unwanted add / remove udev events to userspace.

Specifically this avoids triggering the (userspace) bug fixed by this plymouth merge-request:
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/59

Note that despite that being an userspace bug, not sending unnecessary udev events is a good idea in general.

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Thank you for the review. I've drm push rights, but I guess that radeon/amd GPU patches are collected by someone @AMD, so I do not need to / should not push this myself, right?

I'll pick this up later this week when I get home from travel.

Applied. Thanks!

Alex

Quoted 12 lines

Thanks!

Alex

Quoted 7 lines
Quoted 2 lines

amdgpu should be changed correspondingly as well.

Good point. I'm currently travelling (@plumbers) I can do this when I'm back home, but feel free to beat me to it (if you do please Cc me to avoid double work).

Quoted 7 lines
Quoted 3 lines

Regards,

Hans

_______________________________________________
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