Skip to contentSkip to conversation

drm: hibmc: Use set_busid function from drm core

PATCH In review Daniel Axtens 3 participants 4 messages Jun 9, 2017 – Jun 20, 2017

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

PATCH 1/1 drm: hibmc: Use set_busid function from drm core

Currently, calling drmGetBusid from libdrm on a hibmc VGA card returns a string like "0007:a1:00.0".

The busid reported by most cards begins with "pci:". For example, on an amd64 system, a VGA card reported "pci:0000:00:02.0".

The missing "pci:" prefix confuses Xorg and leads to crashes and other misbehaviour.[0]

Use the standard helper from the drm core to set the busid to include the "pci:" prefix. This is done by many other drivers.

With this patch, Xorg can be run successfully.

[0]: https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1691991

Cc Xinliang Liu <[email protected]>
Cc Rongrong Zou <[email protected]>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +1 -0
index 2ffdbf9801bd..9663a633897a 100644
@@ -69,6 +69,7 @@ static struct drm_driver hibmc_driver = {
 	.dumb_map_offset        = hibmc_dumb_mmap_offset,
 	.dumb_destroy           = drm_gem_dumb_destroy,
 	.irq_handler		= hibmc_drm_interrupt,
+	.set_busid		= drm_pci_set_busid,
 };
 
 static int __maybe_unused hibmc_pm_suspend(struct device *dev)
Signature · 6 lines
2.11.0

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

Hi Daniel,

Quoted 29 lines · Daniel Axtens

Currently, calling drmGetBusid from libdrm on a hibmc VGA card returns a string like "0007:a1:00.0".

The busid reported by most cards begins with "pci:". For example, on an amd64 system, a VGA card reported "pci:0000:00:02.0".

The missing "pci:" prefix confuses Xorg and leads to crashes and other misbehaviour.[0]

Use the standard helper from the drm core to set the busid to include the "pci:" prefix. This is done by many other drivers.

With this patch, Xorg can be run successfully.

[0]: https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1691991

Cc Xinliang Liu <[email protected]>
Cc Rongrong Zou <[email protected]>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 +
 1 file changed, 1 insertion(+)
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +0 -0
index 2ffdbf9801bd..9663a633897a 100644

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c static struct drm_driver hibmc_driver = { · line 72

Quoted 4 lines
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +1 -0
@@ -69,6 +69,7 @@ static struct drm_driver hibmc_driver = {
        .dumb_map_offset        = hibmc_dumb_mmap_offset,
        .dumb_destroy           = drm_gem_dumb_destroy,
        .irq_handler            = hibmc_drm_interrupt,
+       .set_busid              = drm_pci_set_busid,

Daniel V has been working very hard on cleaning all the set_busid "chaos" and even has some patches which remove it completely [1]. While your patch is correct, it would be nicer if we can remove the code so that nobody else gets bitten ;-)

Can you be so kind and re-spin your patch with the cleanups (2-4) on top? IIRC your fix should be CC kernel-stable.

Thanks
Emil

[1] https://lists.freedesktop.org/archives/dri-devel/2017-May/142670.html
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#2 lore raw

Hi Emil,

Quoted 7 lines

Daniel V has been working very hard on cleaning all the set_busid "chaos" and even has some patches which remove it completely [1]. While your patch is correct, it would be nicer if we can remove the code so that nobody else gets bitten ;-)

Can you be so kind and re-spin your patch with the cleanups (2-4) on top? IIRC your fix should be CC kernel-stable.

Thanks for pointing me towards that series.

That series (in particular patch 4) actually fixes the bug I was trying to fix, so it renders my patch unnecessary. However, I notice that series has attracted a lot of discussion: any ideas when is it likely to land?

I just want to avoid the situation where we don't merge my fix because of Daniel's series and Daniel's series also doesn't land for another few releases!

Regards,
Daniel

Quoted 5 lines

Thanks
Emil

[1] https://lists.freedesktop.org/archives/dri-devel/2017-May/142670.html

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

#3 lore raw
In reply to Emil Velikov
Quoted 27 lines · Emil Velikov

Hi Daniel,

Quoted 24 lines · Daniel Axtens

Currently, calling drmGetBusid from libdrm on a hibmc VGA card returns a string like "0007:a1:00.0".

The busid reported by most cards begins with "pci:". For example, on an amd64 system, a VGA card reported "pci:0000:00:02.0".

The missing "pci:" prefix confuses Xorg and leads to crashes and other misbehaviour.[0]

Use the standard helper from the drm core to set the busid to include the "pci:" prefix. This is done by many other drivers.

With this patch, Xorg can be run successfully.

[0]: https://bugs.launchpad.net/ubuntu/+source/xorg/+bug/1691991

Cc Xinliang Liu <[email protected]>
Cc Rongrong Zou <[email protected]>
---
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c | 1 +
 1 file changed, 1 insertion(+)
Quoted 14 lines

drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c static struct drm_driver hibmc_driver = { · line 72

Quoted 9 lines
drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c +1 -0
index 2ffdbf9801bd..9663a633897a 100644
@@ -69,6 +69,7 @@ static struct drm_driver hibmc_driver = {
        .dumb_map_offset        = hibmc_dumb_mmap_offset,
        .dumb_destroy           = drm_gem_dumb_destroy,
        .irq_handler            = hibmc_drm_interrupt,
+       .set_busid              = drm_pci_set_busid,

Daniel V has been working very hard on cleaning all the set_busid "chaos" and even has some patches which remove it completely [1]. While your patch is correct, it would be nicer if we can remove the code so that nobody else gets bitten ;-)

Yeah I just applied my patches to nuke the set_busid callback. Pls drop this one. If you want this backported, I guess we could cherry-pick it over with a cc: stable (it's likely only going to reach 4.14 as-is). -Daniel

Quoted 8 lines

Can you be so kind and re-spin your patch with the cleanups (2-4) on top? IIRC your fix should be CC kernel-stable.

Thanks
Emil

[1] https://lists.freedesktop.org/archives/dri-devel/2017-May/142670.html

Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel