drm/vmwgfx: Stop requesting the pci regions
Subsystems (8)
PATCH 1/1 drm/vmwgfx: Stop requesting the pci regions
From: Zack Rusin <[email protected]>
When sysfb_simple is enabled loading vmwgfx fails because the regions are held by the platform. In that case remove_conflicting*_framebuffers only removes the simplefb but not the regions held by sysfb.
Like the other drm drivers we need to stop requesting all the pci regions to let the driver load with platform code enabled.
This allows vmwgfx to load correctly on systems with sysfb_simple enabled.
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +0 -4
@@ -724,10 +724,6 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,pci_set_master (pdev); - ret =pci_request_regions (pdev,"vmwgfx probe" ); -if (ret) -return ret; - dev->pci_id = pci_id;if (pci_id ==VMWGFX_PCI_ID_SVGA3 ) { rmmio_start =pci_resource_start (pdev,0 );
Signature · 1 line
2.32.0
Hello Zack,
Quoted 6 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions are held by the platform. In that case remove_conflicting*_framebuffers only removes the simplefb but not the regions held by sysfb.
Indeed, that's an issue. I wonder if we should drop the IORESOURCE_BUSY flag from the memory resource added to the "simple-framebuffer" device ?
In fact, maybe in sysfb_create_simplefb() shouldn't even attempt to claim a memory resource and just register the platform device with no resources ?
Quoted 4 lines
Like the other drm drivers we need to stop requesting all the pci regions to let the driver load with platform code enabled.
This allows vmwgfx to load correctly on systems withsysfb_simpleenabled.
I read this very interesting thread from two years ago:
https://lkml.org/lkml/2020/11/5/248
Maybe is worth mentioning in the commit message what Daniel said there, that is that only a few DRM drivers request explicitly the PCI regions and the only reliable approach is for bus drivers to claim these.
In other words, removing the pci_request_regions() seems to have merit on its own.
Quoted 6 lines
Signed-off-by Zack Rusin <[email protected]>Fixes 523375c943e5 ("drm/vmwgfx: Port vmwgfx to arm64")Cc <[email protected]>Reviewed-by Martin Krastev <[email protected]>---
The patch looks good to me, thanks a lot for fixing this:
Best regards,
Signature · 3 lines
Javier Martinez Canillas Linux Engineering Red Hat
Javier Martinez Canillas
maintainerQuoted 10 lines · Javier Martinez Canillas
Hello Zack,
Quoted 6 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions are held by the platform. In that case remove_conflicting*_framebuffers only removes the simplefb but not the regions held by sysfb.
Quoted 6 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSYflag from the memory resource added to the "simple-framebuffer" device ?In fact, maybe in
sysfb_create_simplefb()shouldn't even attempt to claim a memory resource and just register the platform device with no resources ?
Answering my own question, this would mean adding that platform specific logic to the drivers matching the "simple-framebuffer" device so it should remain in sysfb_create_simplefb().
But I still wonder if dropping the IORESOURCE_BUSY flag is something that will be reasonable to prevent other drivers having the the issue reported in this patch.
Best regards,
Signature · 3 lines
Javier Martinez Canillas Linux Engineering Red Hat
Quoted 11 lines · Javier Martinez Canillas
Hello Zack,
Quoted 7 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions are held by the platform. In that case remove_conflicting*_framebuffers
only removes the simplefb but not the regions held by sysfb.
Quoted 3 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSYflag from the memory resource added to the "simple-framebuffer" device ?
I think this is one of those cases where it depends on what we plan to do after that. Sementically it makes sense to have it in there - the framebuffer memory is claimed by the "simple-framebuffer" and it's busy, it's just that it creates issues for drivers after unloading. I think removing it, while making things easier for drivers, would be confusing for people reading the code later, unless there's some kind of cleanup that would happen with it (e.g. removing IORESOURCE_BUSY altogether and making the drm drivers properly request their resources). At least by itself it doesn't seem to be much better solution than having the drm drivers not call pci_request_region[s], which apart from hyperv and cirrus (iirc bochs does it for resources other than fb which wouldn't have been claimed by "simple-framebuffer") is already the case.
I do think we should do one of them to make the codebase coherent:
either remove IORESOURCE_BUSY from "simple-framebuffer" or remove pci_request_region[s] from hyperv and cirrus.
Quoted 7 lines
Quoted 6 lines
Like the other drm drivers we need to stop requesting all the pci regions
to let the driver load with platform code enabled.
This allows vmwgfx to load correctly on systems withsysfb_simpleenabled.
Quoted 7 lines
I read this very interesting thread from two years ago:
https://lkml.org/lkml/2020/11/5/248
Maybe is worth mentioning in the commit message what Daniel said there, that is that only a few DRM drivers request explicitly the PCI regions and the only reliable approach is for bus drivers to claim these.
Ah, great point. I'll update the commit log with that.
Quoted 10 lines
Quoted 6 lines
Signed-off-by Zack Rusin <[email protected]>Fixes 523375c943e5 ("drm/vmwgfx: Port vmwgfx to arm64")Cc <[email protected]>Reviewed-by Martin Krastev <[email protected]>---
The patch looks good to me, thanks a lot for fixing this:
Reviewed-by Javier Martinez Canillas <[email protected]>
Thanks for taking a look at this, I appreciate it!
z
Thomas Zimmermann
maintainerHi
Am 19.01.22 um 03:15 schrieb Zack Rusin:
Quoted 30 lines · Javier Martinez Canillas
Quoted 11 lines
Hello Zack,
Quoted 7 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions are held by the platform. In that case remove_conflicting*_framebuffers
only removes the simplefb but not the regions held by sysfb.Quoted 3 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSYflag from the memory resource added to the "simple-framebuffer" device ?I think this is one of those cases where it depends on what we plan to do after that. Sementically it makes sense to have it in there - the framebuffer memory is claimed by the "simple-framebuffer" and it's busy, it's just that it creates issues for drivers after unloading. I think removing it, while making things easier for drivers, would be confusing for people reading the code later, unless there's some kind of cleanup that would happen with it (e.g. removing
IORESOURCE_BUSYaltogether and making the drm drivers properly request their resources). At least by itself it doesn't seem to be much better solution than having the drm drivers not call pci_request_region[s], which apart from hyperv and cirrus (iirc bochs does it for resources other than fb which wouldn't have been claimed by "simple-framebuffer") is already the case.
Quoted 3 lines
I do think we should do one of them to make the codebase coherent:
either removeIORESOURCE_BUSYfrom "simple-framebuffer" or remove pci_request_region[s] from hyperv and cirrus.
I just discussed this a bit with Javier. It's a problem with the simple-framebuffer code, rather then vmwgfx.
IMHO the best solution is to drop IORESOURCE_BUSY from sysfb and have drivers register/release the range with _BUSY. That would signal the memory belongs to the sysfb device but is not busy unless a driver has been bound. After simplefb released the range, it should be 'non-busy' again and available for vmwgfx. Simpledrm does a hot-unplug of the sysfb device, so the memory range gets released entirely. If you want, I'll prepare some patches for this scenario.
If this doesn't work, pushing all request/release pairs into drivers would be my next option.
If none of this is feasible, we can still remove pci_request_region() from vmwgfx.
Best regards
Thomas
Quoted 34 lines
Quoted 10 lines
Quoted 9 lines
Like the other drm drivers we need to stop requesting all the pci regions
to let the driver load with platform code enabled.
This allows vmwgfx to load correctly on systems withsysfb_simpleenabled.Quoted 7 lines
I read this very interesting thread from two years ago:
https://lkml.org/lkml/2020/11/5/248
Maybe is worth mentioning in the commit message what Daniel said there, that is that only a few DRM drivers request explicitly the PCI regions and the only reliable approach is for bus drivers to claim these.
Ah, great point. I'll update the commit log with that.
Quoted 10 lines
Quoted 6 lines
Signed-off-by Zack Rusin <[email protected]>Fixes 523375c943e5 ("drm/vmwgfx: Port vmwgfx to arm64")Cc <[email protected]>Reviewed-by Martin Krastev <[email protected]>---
The patch looks good to me, thanks a lot for fixing this:
Reviewed-by Javier Martinez Canillas <[email protected]>Thanks for taking a look at this, I appreciate it!
z
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Thomas Zimmermann
maintainerHi Zack
Am 19.01.22 um 10:13 schrieb Thomas Zimmermann:
Quoted 33 lines
Hi
Am 19.01.22 um 03:15 schrieb Zack Rusin:
Quoted 30 lines · Javier Martinez Canillas
Quoted 11 lines
Hello Zack,
Quoted 7 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions are held by the platform. In that case remove_conflicting*_framebuffers
only removes the simplefb but not the regions held by sysfb.Quoted 3 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSYflag from the memory resource added to the "simple-framebuffer" device ?I think this is one of those cases where it depends on what we plan to do after that. Sementically it makes sense to have it in there - the framebuffer memory is claimed by the "simple-framebuffer" and it's busy, it's just that it creates issues for drivers after unloading. I think removing it, while making things easier for drivers, would be confusing for people reading the code later, unless there's some kind of cleanup that would happen with it (e.g. removing
IORESOURCE_BUSYaltogether and making the drm drivers properly request their resources). At least by itself it doesn't seem to be much better solution than having the drm drivers not call pci_request_region[s], which apart from hyperv and cirrus (iirc bochs does it for resources other than fb which wouldn't have been claimed by "simple-framebuffer") is already the case.
Quoted 7 lines
Quoted 3 lines
I do think we should do one of them to make the codebase coherent:
either removeIORESOURCE_BUSYfrom "simple-framebuffer" or remove pci_request_region[s] from hyperv and cirrus.I just discussed this a bit with Javier. It's a problem with the simple-framebuffer code, rather then vmwgfx.
IMHO the best solution is to drop
IORESOURCE_BUSYfrom sysfb and have drivers register/release the range with_BUSY. That would signal the memory belongs to the sysfb device but is not busy unless a driver has been bound. After simplefb released the range, it should be 'non-busy' again and available for vmwgfx. Simpledrm does a hot-unplug of the sysfb device, so the memory range gets released entirely. If you want, I'll prepare some patches for this scenario.
Attached is a patch that implements this. Doing
cat /proc/iomem
...
e0000000-efffffff : 0000:00:02.0
e0000000-e07e8fff : BOOTFB
e0000000-e07e8fff : simplefb...
shows the memory. 'BOOTFB' is the simple-framebuffer device and 'simplefb' is the driver. Only the latter uses _BUSY. Same for simpledrm. Once the drivers have been unloaded, the BUSY flag is gone and the memory canbe acquired by vmwgfx.
Zack, please test this patch. If it works, I'll send out the real patchset.
Best regards
Thomas
Quoted 43 lines
If this doesn't work, pushing all request/release pairs into drivers would be my next option.
If none of this is feasible, we can still remove
pci_request_region()from vmwgfx.Best regards
ThomasQuoted 34 lines
Quoted 10 lines
Quoted 9 lines
Like the other drm drivers we need to stop requesting all the pci regions
to let the driver load with platform code enabled.
This allows vmwgfx to load correctly on systems withsysfb_simpleenabled.Quoted 7 lines
I read this very interesting thread from two years ago:
https://lkml.org/lkml/2020/11/5/248
Maybe is worth mentioning in the commit message what Daniel said there, that is that only a few DRM drivers request explicitly the PCI regions and the only reliable approach is for bus drivers to claim these.
Ah, great point. I'll update the commit log with that.
Quoted 10 lines
Quoted 6 lines
Signed-off-by Zack Rusin <[email protected]>Fixes 523375c943e5 ("drm/vmwgfx: Port vmwgfx to arm64")Cc <[email protected]>Reviewed-by Martin Krastev <[email protected]>---
The patch looks good to me, thanks a lot for fixing this:
Reviewed-by Javier Martinez Canillas <[email protected]>Thanks for taking a look at this, I appreciate it!
z
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
From f5da496296f7dcaf8754e1b0446660b100539a73 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <[email protected]>
Date: Wed, 19 Jan 2022 10:23:07 +0100
Subject: [PATCH] [RFC] drop IORESOURCE_BUSY from sysfb code and request memory
in drivers
Drop the IORESOURCE_BUSY flag when creating a simple-framebuffer device. Instead acquire the memory in drivers.
--- drivers/firmware/sysfb_simplefb.c | 2 +- drivers/gpu/drm/tiny/simpledrm.c | 17 ++++++--- drivers/video/fbdev/simplefb.c | 57 ++++++++++++++++++++++--------- 3 files changed, 53 insertions(+), 23 deletions(-)
drivers/firmware/sysfb_simplefb.c +1 -1
@@ -99,7 +99,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si,/* setup IORESOURCE_MEM as framebuffer memory */ memset (&res,0 ,sizeof (res)); - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_MEM ; res.name = simplefb_resname; res.start = base; res.end = res.start + length -1 ;
drivers/gpu/drm/tiny/simpledrm.c +12 -5
@@ -526,21 +526,28 @@ static int simpledrm_device_init_mm(struct simpledrm_device *sdev) {struct drm_device *dev = &sdev->dev;struct platform_device *pdev = sdev->pdev; -struct resource *mem; +struct resource *res, *mem;void __iomem *screen_base;int ret; - mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!mem) + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res)return -EINVAL ; - ret =devm_aperture_acquire_from_firmware (dev, mem->start,resource_size (mem)); + ret =devm_aperture_acquire_from_firmware (dev, res->start,resource_size (res));if (ret) {drm_err (dev,"could not acquire memory range %pr: error %d\n" , - mem, ret); + res, ret);return ret; } + mem =devm_request_mem_region (&pdev->dev, res->start,resource_size (res), + sdev->dev.driver->name); +if (!mem) { +drm_err (dev,"could not acquire memory region %pr\n" , res); +return -EBUSY ; + } + screen_base =devm_ioremap_wc (&pdev->dev, mem->start,resource_size (mem));if (!screen_base)
drivers/video/fbdev/simplefb.c +40 -17
103 lines not on this page · raw message
Signature · 1 line
2.34.1
Quoted 74 lines · Thomas Zimmermann
Hi Zack
Am 19.01.22 um 10:13 schrieb Thomas Zimmermann:
Quoted 50 lines
Hi
Am 19.01.22 um 03:15 schrieb Zack Rusin:
Quoted 40 lines · Javier Martinez Canillas
Quoted 12 lines
Hello Zack,
Quoted 8 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions
are held by the platform. In that case remove_conflicting*_framebuffers
only removes the simplefb but not the regions held by sysfb.Quoted 5 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSY
flag from the memory resource added to the "simple-framebuffer" device
?I think this is one of those cases where it depends on what we plan to
do after that. Sementically it makes sense to have it in there - the
framebuffer memory is claimed by the "simple-framebuffer" and it's busy, it's just that it creates issues for drivers after unloading. I
think removing it, while making things easier for drivers, would be confusing for people reading the code later, unless there's some kind
of cleanup that would happen with it (e.g. removingIORESOURCE_BUSYaltogether and making the drm drivers properly request their resources). At least by itself it doesn't seem to be much better solution than having the drm drivers not call pci_request_region[s],
which apart from hyperv and cirrus (iirc bochs does it for resources
other than fb which wouldn't have been claimed by "simple- framebuffer")
is already the case.Quoted 3 lines
I do think we should do one of them to make the codebase coherent:
either removeIORESOURCE_BUSYfrom "simple-framebuffer" or remove pci_request_region[s] from hyperv and cirrus.I just discussed this a bit with Javier. It's a problem with the simple-framebuffer code, rather then vmwgfx.
Quoted 10 lines
IMHO the best solution is to drop
IORESOURCE_BUSYfrom sysfb and have drivers register/release the range with_BUSY. That would signal the memory belongs to the sysfb device but is not busy unless a driver has
been bound. After simplefb released the range, it should be 'non- busy'
again and available for vmwgfx. Simpledrm does a hot-unplug of the sysfb
device, so the memory range gets released entirely. If you want, I'll prepare some patches for this scenario.Attached is a patch that implements this. Doing
cat
/proc/iomem
...
e0000000-efffffff : 0000:00:02.0e0000000-e07e8fff : BOOTFB
e0000000-e07e8fff : simplefb
Quoted 8 lines
...
shows the memory. 'BOOTFB' is the simple-framebuffer device and 'simplefb' is the driver. Only the latter uses
_BUSY. Same for and the memory canbe acquired by vmwgfx.Zack, please test this patch. If it works, I'll send out the real patchset.
Hmm, the patch looks good but it doesn't work. After boot: /proc/iomem 50000000-7fffffff : pcie@0x40000000
78000000-7fffffff : 0000:00:0f.0
78000000-782fffff : BOOTFB
and vmwgfx fails on pci_request_regions:
kernel: fb0: switching to vmwgfx from simple
kernel: Console: switching to colour dummy device 80x25
kernel: vmwgfx 0000:00:0f.0: BAR 2: can't reserve [mem 0x78000000- 0x7fffffff 64bit pref]
kernel: vmwgfx: probe of 0000:00:0f.0 failed with error -16
leaving the system without a fb driver.
z
Thomas Zimmermann
maintainerHi
Am 19.01.22 um 16:12 schrieb Zack Rusin:
Quoted 91 lines · Thomas Zimmermann
Quoted 74 lines
Hi Zack
Am 19.01.22 um 10:13 schrieb Thomas Zimmermann:
Quoted 50 lines
Hi
Am 19.01.22 um 03:15 schrieb Zack Rusin:
Quoted 40 lines · Javier Martinez Canillas
Quoted 12 lines
Hello Zack,
Quoted 8 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions
are held by the platform. In that case remove_conflicting*_framebuffers
only removes the simplefb but not the regions held by sysfb.Quoted 5 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSY
flag from the memory resource added to the "simple-framebuffer" device
?I think this is one of those cases where it depends on what we plan to
do after that. Sementically it makes sense to have it in there - the
framebuffer memory is claimed by the "simple-framebuffer" and it's busy, it's just that it creates issues for drivers after unloading. I
think removing it, while making things easier for drivers, would be confusing for people reading the code later, unless there's some kind
of cleanup that would happen with it (e.g. removingIORESOURCE_BUSYaltogether and making the drm drivers properly request their resources). At least by itself it doesn't seem to be much better solution than having the drm drivers not call pci_request_region[s],
which apart from hyperv and cirrus (iirc bochs does it for resources
other than fb which wouldn't have been claimed by "simple- framebuffer")
is already the case.Quoted 3 lines
I do think we should do one of them to make the codebase coherent:
either removeIORESOURCE_BUSYfrom "simple-framebuffer" or remove pci_request_region[s] from hyperv and cirrus.I just discussed this a bit with Javier. It's a problem with the simple-framebuffer code, rather then vmwgfx.
Quoted 10 lines
IMHO the best solution is to drop
IORESOURCE_BUSYfrom sysfb and have drivers register/release the range with_BUSY. That would signal the memory belongs to the sysfb device but is not busy unless a driver has
been bound. After simplefb released the range, it should be 'non- busy'
again and available for vmwgfx. Simpledrm does a hot-unplug of the sysfb
device, so the memory range gets released entirely. If you want, I'll prepare some patches for this scenario.Attached is a patch that implements this. Doing
cat
/proc/iomem
...
e0000000-efffffff : 0000:00:02.0e0000000-e07e8fff : BOOTFB
e0000000-e07e8fff : simplefb
Quoted 8 lines
...
shows the memory. 'BOOTFB' is the simple-framebuffer device and 'simplefb' is the driver. Only the latter uses
_BUSY. Same for and the memory canbe acquired by vmwgfx.Zack, please test this patch. If it works, I'll send out the real patchset.
Hmm, the patch looks good but it doesn't work. After boot:
/proc/iomem50000000-7fffffff : pcie@0x40000000
78000000-7fffffff : 0000:00:0f.078000000-782fffff : BOOTFBand vmwgfx fails on
pci_request_regions:
Quoted 7 lines
kernel: fb0: switching to vmwgfx from simple
kernel: Console: switching to colour dummy device 80x25
kernel: vmwgfx 0000:00:0f.0: BAR 2: can't reserve [mem 0x78000000-0x7fffffff64bit pref]
kernel: vmwgfx: probe of 0000:00:0f.0 failed with error -16leaving the system without a fb driver.
OK, I suspect that it would work if you use simpledrm instead of simplefb. Could you try please? You'd have to build DRM and simpledrm into the kernel binary.
If that works, would you consider protecting pci_request_region() with
#if not defined(CONFIG_FB_SIMPLE)
#endif
with a FIXME comment?
simpledrm hot-unplugs the sysfb device entirely. Maybe simplefb can do the same. I'm not sure, but possibly.
Best regards
Thomas
Quoted 2 lines
z
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Javier Martinez Canillas
maintainerOn 1/19/22 16:50, Thomas Zimmermann wrote:
[snip]
Quoted 43 lines
Quoted 43 lines
Quoted 21 lines
Quoted 10 lines
IMHO the best solution is to drop
IORESOURCE_BUSYfrom sysfb and have drivers register/release the range with_BUSY. That would signal the memory belongs to the sysfb device but is not busy unless a driver has
been bound. After simplefb released the range, it should be 'non- busy'
again and available for vmwgfx. Simpledrm does a hot-unplug of the sysfb
device, so the memory range gets released entirely. If you want, I'll prepare some patches for this scenario.Attached is a patch that implements this. Doing
cat
/proc/iomem
...
e0000000-efffffff : 0000:00:02.0e0000000-e07e8fff : BOOTFB
e0000000-e07e8fff : simplefb
Quoted 8 lines
...
shows the memory. 'BOOTFB' is the simple-framebuffer device and 'simplefb' is the driver. Only the latter uses
_BUSY. Same for and the memory canbe acquired by vmwgfx.Zack, please test this patch. If it works, I'll send out the real patchset.
Hmm, the patch looks good but it doesn't work. After boot:
/proc/iomem50000000-7fffffff : pcie@0x40000000
78000000-7fffffff : 0000:00:0f.078000000-782fffff : BOOTFBand vmwgfx fails on
pci_request_regions:kernel: fb0: switching to vmwgfx from simple
kernel: Console: switching to colour dummy device 80x25
kernel: vmwgfx 0000:00:0f.0: BAR 2: can't reserve [mem 0x78000000-0x7fffffff64bit pref]
kernel: vmwgfx: probe of 0000:00:0f.0 failed with error -16
Quoted 6 lines
Quoted 1 line
leaving the system without a fb driver.
OK, I suspect that it would work if you use simpledrm instead of simplefb. Could you try please? You'd have to build DRM and simpledrm into the kernel binary.
Yes, I believe that should work.
Zack, could you please try if just the following [0] make it works ?
That is, dropping the IORESOURCE_BUSY but not doing the memory region request / release in simplefb and keeping it in the vmwgfx driver.
[0]:
From da6de1430b9dc252eccf2d6fee0446d33375fa6d Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <[email protected]>
Date: Wed, 19 Jan 2022 14:41:25 +0100
Subject: [PATCH] drivers/firmware: Don't mark as busy the simple-framebuffer
IO resource
The sysfb_create_simplefb() function requests a IO memory resource for the simple-framebuffer platform device, but it also marks it as busy which led to drivers requesting the same memory resource to fail.
Let's drop the IORESOURCE_BUSY flag and let drivers to request it as busy instead.
--- drivers/firmware/sysfb_simplefb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firmware/sysfb_simplefb.c +1 -1
@@ -99,7 +99,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si,/* setup IORESOURCE_MEM as framebuffer memory */ memset (&res,0 ,sizeof (res)); - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_MEM ; res.name = simplefb_resname; res.start = base; res.end = res.start + length -1 ;
Signature · 1 line
2.33.1
Quoted 56 lines · Javier Martinez Canillas
On 1/19/22 16:50, Thomas Zimmermann wrote:
[snip]
Quoted 52 lines
Quoted 51 lines
Quoted 27 lines
Quoted 8 lines
IMHO the best solution is to drop
IORESOURCE_BUSYfrom sysfb and have
drivers register/release the range with_BUSY. That would signal the
memory belongs to the sysfb device but is not busy unless a driver
has
been bound. After simplefb released the range, it should beQuoted 8 lines
'non-
busy'
again and available for vmwgfx. Simpledrm does a hot-unplug of the
sysfb
device, so the memory range gets released entirely. If you want, I'll
prepare some patches for this scenario.Attached is a patch that implements this. Doing
cat
/proc/iomem
...
e0000000-efffffff : 0000:00:02.0e0000000-e07e8fff : BOOTFB
e0000000-e07e8fff : simplefb
Quoted 8 lines
...
shows the memory. 'BOOTFB' is the simple-framebuffer device and 'simplefb' is the driver. Only the latter uses
_BUSY. Same for and the memory canbe acquired by vmwgfx.Zack, please test this patch. If it works, I'll send out the real patchset.
Hmm, the patch looks good but it doesn't work. After boot:
/proc/iomem
50000000-7fffffff : pcie@0x40000000 78000000-7fffffff : 0000:00:0f.0 78000000-782fffff : BOOTFBand vmwgfx fails on
pci_request_regions:kernel: fb0: switching to vmwgfx from simple
kernel: Console: switching to colour dummy device 80x25
kernel: vmwgfx 0000:00:0f.0: BAR 2: can't reserve [mem 0x78000000-0x7fffffff64bit pref]
kernel: vmwgfx: probe of 0000:00:0f.0 failed with error -16leaving the system without a fb driver.
Quoted 7 lines
Quoted 4 lines
OK, I suspect that it would work if you use simpledrm instead of simplefb. Could you try please? You'd have to build DRM and simpledrm into the kernel binary.
Yes, I believe that should work.
Zack, could you please try if just the following [0] make it works ?
Unfortunately that still fails with the same:
kernel: fb0: switching to vmwgfx from simple
kernel: Console: switching to colour dummy device 80x25
kernel: vmwgfx 0000:00:0f.0: BAR 2: can't reserve [mem 0x78000000- 0x7fffffff 64bit pref]
kernel: vmwgfx: probe of 0000:00:0f.0 failed with error -16
z
Quoted 122 lines · Thomas Zimmermann
Hi
Am 19.01.22 um 16:12 schrieb Zack Rusin:
Quoted 119 lines · Thomas Zimmermann
Quoted 95 lines
Hi Zack
Am 19.01.22 um 10:13 schrieb Thomas Zimmermann:
Quoted 65 lines
Hi
Am 19.01.22 um 03:15 schrieb Zack Rusin:
Quoted 52 lines
Quoted 14 lines · Javier Martinez Canillas
Hello Zack,
Quoted 10 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the
regions
are held by the platform. In that case remove_conflicting*_framebuffers
only removes the simplefb but not the regions held by sysfb.Quoted 6 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSY
flag from the memory resource added to the "simple- framebuffer"
device
?I think this is one of those cases where it depends on what we plan
to
do after that. Sementically it makes sense to have it in there -
the
framebuffer memory is claimed by the "simple-framebuffer" and it's
busy, it's just that it creates issues for drivers after unloading.
I
think removing it, while making things easier for drivers, would be
confusing for people reading the code later, unless there's some
kind
of cleanup that would happen with it (e.g. removingIORESOURCE_BUSY
altogether and making the drm drivers properly request their resources). At least by itself it doesn't seem to be much better
solution than having the drm drivers not call pci_request_region[s],
which apart from hyperv and cirrus (iirc bochs does it for resources
other than fb which wouldn't have been claimed by "simple- framebuffer")
is already the case.Quoted 5 lines
I do think we should do one of them to make the codebase coherent:
either removeIORESOURCE_BUSYfrom "simple-framebuffer" or remove
pci_request_region[s] from hyperv and cirrus.I just discussed this a bit with Javier. It's a problem with the
simple-framebuffer code, rather then vmwgfx.Quoted 16 lines
IMHO the best solution is to drop
IORESOURCE_BUSYfrom sysfb and have
drivers register/release the range with_BUSY. That would signal the
memory belongs to the sysfb device but is not busy unless a driver
has
been bound. After simplefb released the range, it should be 'non-
busy'
again and available for vmwgfx. Simpledrm does a hot-unplug of the
sysfb
device, so the memory range gets released entirely. If you want, I'll
prepare some patches for this scenario.Attached is a patch that implements this. Doing
cat
/proc/iomem
...
e0000000-efffffff : 0000:00:02.0e0000000-e07e8fff : BOOTFB
e0000000-e07e8fff : simplefb
Quoted 8 lines
...
shows the memory. 'BOOTFB' is the simple-framebuffer device and 'simplefb' is the driver. Only the latter uses
_BUSY. Same for and the memory canbe acquired by vmwgfx.Zack, please test this patch. If it works, I'll send out the real patchset.
Hmm, the patch looks good but it doesn't work. After boot:
/proc/iomem
50000000-7fffffff : pcie@0x40000000 78000000-7fffffff : 0000:00:0f.0 78000000-782fffff : BOOTFBand vmwgfx fails on
pci_request_regions:kernel: fb0: switching to vmwgfx from simple
kernel: Console: switching to colour dummy device 80x25
kernel: vmwgfx 0000:00:0f.0: BAR 2: can't reserve [mem 0x78000000-0x7fffffff64bit pref]
kernel: vmwgfx: probe of 0000:00:0f.0 failed with error -16
Quoted 4 lines
Quoted 1 line
leaving the system without a fb driver.
OK, I suspect that it would work if you use simpledrm instead of into the kernel binary.
Yes, simpledrm works fine. BTW, is there any remaining work before distros can enable it by default?
Quoted 7 lines
If that works, would you consider protecting
pci_request_region()with
#if notdefined(CONFIG_FB_SIMPLE)
#endifwith a FIXME comment?
Yes, I think that's a good compromise. I'll respin the patch with that.
z
Javier Martinez Canillas
maintainerHello Zack,
On 1/20/22 05:06, Zack Rusin wrote:
[snip]
Quoted 15 lines
Quoted 15 lines
Quoted 15 lines
Hmm, the patch looks good but it doesn't work. After boot:
/proc/iomem
50000000-7fffffff : pcie@0x40000000 78000000-7fffffff : 0000:00:0f.0 78000000-782fffff : BOOTFBand vmwgfx fails on
pci_request_regions:kernel: fb0: switching to vmwgfx from simple
kernel: Console: switching to colour dummy device 80x25
kernel: vmwgfx 0000:00:0f.0: BAR 2: can't reserve [mem 0x78000000-0x7fffffff64bit pref]
kernel: vmwgfx: probe of 0000:00:0f.0 failed with error -16
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
leaving the system without a fb driver.
OK, I suspect that it would work if you use simpledrm instead of into the kernel binary.
Yes, simpledrm works fine. BTW, is there any remaining work before distros can enable it by default?
Alpine already did AFAIK, OpenSUSE and Fedora are doing it soon
I don't know about the others distros but I guess they will follow.
Quoted 10 lines
Quoted 7 lines
If that works, would you consider protecting
pci_request_region()with
#if notdefined(CONFIG_FB_SIMPLE)
#endifwith a FIXME comment?
Yes, I think that's a good compromise. I'll respin the patch with that.
Agreed. Thanks a lot for testing the other patches anyways.
Best regards,
Signature · 3 lines
Javier Martinez Canillas Linux Engineering Red Hat
Thomas Zimmermann
maintainerHi
Am 20.01.22 um 05:06 schrieb Zack Rusin:
[...]
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines
kernel: fb0: switching to vmwgfx from simple
kernel: Console: switching to colour dummy device 80x25
kernel: vmwgfx 0000:00:0f.0: BAR 2: can't reserve [mem 0x78000000-0x7fffffff64bit pref]
kernel: vmwgfx: probe of 0000:00:0f.0 failed with error -16
Quoted 7 lines
Quoted 4 lines
Quoted 1 line
leaving the system without a fb driver.
OK, I suspect that it would work if you use simpledrm instead of into the kernel binary.
Yes, simpledrm works fine. BTW, is there any remaining work before distros can enable it by default?
It's here and ready for use.
Simpledrm requires DRM to be linked in the kernel. We're modularizing DRM helpers to reduce the binary size.
On the distro side, Javier and me are sorting out issue. But it's fairly quite and not many problems show up.
Quoted 10 lines
Quoted 8 lines
If that works, would you consider protecting
pci_request_region()with
#if notdefined(CONFIG_FB_SIMPLE)
#endifwith a FIXME comment?
Yes, I think that's a good compromise. I'll respin the patch with that.
Before you do that, I have one more patch for you to try. It's all the changes as before, but now fbdev hot-unplugs the underlying platform device from the device hierarchy. The BOOTFB will not consume parts of vmwgfx's display memory range any longer. It's now the same behavior as with simpledrm.
This works for me with simplefb and efifb on i915 hardware.
Best regards
Thomas
Quoted 2 lines
z
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
From dfd482bfc143b9ec0d8b103a56f6576acef8a860 Mon Sep 17 00:00:00 2001
From: Thomas Zimmermann <[email protected]>
Date: Wed, 19 Jan 2022 10:23:07 +0100
Subject: [PATCH v2] [RFC] drop IORESOURCE_BUSY from sysfb code and request
memory in drivers
Drop the IORESOURCE_BUSY flag when creating a simple-framebuffer device. Instead acquire the memory in drivers. Also hot-unplug the platform device.
--- drivers/firmware/sysfb_simplefb.c | 2 +- drivers/gpu/drm/tiny/simpledrm.c | 17 ++++++--- drivers/video/fbdev/core/fbmem.c | 29 ++++++++++++++-- drivers/video/fbdev/simplefb.c | 57 ++++++++++++++++++++++--------- include/linux/fb.h | 1 + 5 files changed, 80 insertions(+), 26 deletions(-)
drivers/firmware/sysfb_simplefb.c +1 -1
@@ -99,7 +99,7 @@ __init int sysfb_create_simplefb(const struct screen_info *si,/* setup IORESOURCE_MEM as framebuffer memory */ memset (&res,0 ,sizeof (res)); - res.flags =IORESOURCE_MEM |IORESOURCE_BUSY ; + res.flags =IORESOURCE_MEM ; res.name = simplefb_resname; res.start = base; res.end = res.start + length -1 ;
drivers/gpu/drm/tiny/simpledrm.c +12 -5
@@ -526,21 +526,28 @@ static int simpledrm_device_init_mm(struct simpledrm_device *sdev) {struct drm_device *dev = &sdev->dev;struct platform_device *pdev = sdev->pdev; -struct resource *mem; +struct resource *res, *mem;void __iomem *screen_base;int ret; - mem =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); -if (!mem) + res =platform_get_resource (pdev,IORESOURCE_MEM ,0 ); +if (!res)return -EINVAL ; - ret =devm_aperture_acquire_from_firmware (dev, mem->start,resource_size (mem)); + ret =devm_aperture_acquire_from_firmware (dev, res->start,resource_size (res));if (ret) {drm_err (dev,"could not acquire memory range %pr: error %d\n" , - mem, ret); + res, ret);return ret; } + mem =devm_request_mem_region (&pdev->dev, res->start,resource_size (res), + sdev->dev.driver->name); +if (!mem) { +drm_err (dev,"could not acquire memory region %pr\n" , res); +return -EBUSY ; + } + screen_base =devm_ioremap_wc (&pdev->dev, mem->start,resource_size (mem));if (!screen_base)
drivers/video/fbdev/core/fbmem.c +26 -3
@@ -25,6 +25,7 @@#include <linux/init.h> #include <linux/linux_logo.h> #include <linux/proc_fs.h> +#include <linux/platform_device.h> #include <linux/seq_file.h> #include <linux/console.h> #include <linux/kmod.h>
@@ -1557,18 +1558,36 @@ static void do_remove_conflicting_framebuffers(struct apertures_struct *a,/* check all firmware fbs and kick off if the base addr overlaps */ for_each_registered_fb (i) {struct apertures_struct *gen_aper; +struct device *dev;if (!(registered_fb[i]->flags &FBINFO_MISC_FIRMWARE ))continue ; gen_aper = registered_fb[i]->apertures; + dev = registered_fb[i]->device;if (fb_do_apertures_overlap (gen_aper, a) || (primary && gen_aper && gen_aper->count && gen_aper->ranges[0 ].base ==VGA_FB_PHYS )) {printk (KERN_INFO "fb%d: switching to %s from %s\n" , i, name, registered_fb[i]->fix.id); -do_unregister_framebuffer (registered_fb[i]); + +/* +* If we kick-out a firmware driver, we also want to remove +* the underlying platform device, such as simple-framebuffer, +* VESA, EFI, etc. A native driver will then be able to +* allocate the memory range. +* +* If it's not a platform device, at least print a warning. A +* fix would add code to remove the device from the system. +*/ +if (dev_is_platform (dev)) { + registered_fb[i]->forced_out = true; +platform_device_unregister (to_platform_device (dev)); + }else { +printk (KERN_WARNING "fb%d: cannot remove device\n" , i); +do_unregister_framebuffer (registered_fb[i]); + } } } }
@@ -1898,9 +1917,13 @@ EXPORT_SYMBOL(register_framebuffer);void unregister_framebuffer (struct fb_info *fb_info) { -mutex_lock (®istration_lock); +bool forced_out = fb_info->forced_out; + +if (!forced_out) +mutex_lock (®istration_lock);do_unregister_framebuffer (fb_info); -mutex_unlock (®istration_lock); +if (!forced_out) +mutex_unlock (®istration_lock); }EXPORT_SYMBOL (unregister_framebuffer);
drivers/video/fbdev/simplefb.c +40 -17
103 lines not on this page · raw message
include/linux/fb.h +1 -0
@@ -502,6 +502,7 @@ struct fb_info { } *apertures;bool skip_vt_switch;/* no VT switch on suspend/resume required */ +bool forced_out;/* set when being removed by another driver */ };static inline struct apertures_struct *alloc_apertures (unsigned int max_num) {
Signature · 1 line
2.34.1
Quoted 20 lines · Thomas Zimmermann
Quoted 10 lines
Quoted 7 lines
If that works, would you consider protecting
pci_request_region()with
#if notdefined(CONFIG_FB_SIMPLE)
#endifwith a FIXME comment?
Yes, I think that's a good compromise. I'll respin the patch with that.
Before you do that, I have one more patch for you to try. It's all the
changes as before, but now fbdev hot-unplugs the underlying platform device from the device hierarchy. The BOOTFB will not consume parts of
vmwgfx's display memory range any longer. It's now the same behavior as
with simpledrm.
Quoted 1 line
This works for me with simplefb and efifb on i915 hardware.
Yea, that works for me too. Both with simpledrm and simplefb. The patch looks good too.
Do you think you'll be able to get this in stable kernels? If not I'll still need something for vmwgfx to make kernels between 5.15 and whenever this patch gets in boot with fb.
z
Thomas Zimmermann
maintainerHi
Am 20.01.22 um 22:28 schrieb Zack Rusin:
Quoted 21 lines · Thomas Zimmermann
Quoted 20 lines
Quoted 10 lines
Quoted 7 lines
If that works, would you consider protecting
pci_request_region()with
#if notdefined(CONFIG_FB_SIMPLE)
#endifwith a FIXME comment?
Yes, I think that's a good compromise. I'll respin the patch with that.
Before you do that, I have one more patch for you to try. It's all the
changes as before, but now fbdev hot-unplugs the underlying platform device from the device hierarchy. The BOOTFB will not consume parts of
vmwgfx's display memory range any longer. It's now the same behavior as
with simpledrm.
Quoted 8 lines
Quoted 1 line
This works for me with simplefb and efifb on i915 hardware.
Yea, that works for me too. Both with simpledrm and simplefb. The patch looks good too.
Do you think you'll be able to get this in stable kernels? If not I'll still need something for vmwgfx to make kernels between 5.15 and whenever this patch gets in boot with fb.
I'll prepare a patchset with these changes. The actual fix is the change to fbmem.c. This one should go to stable and should be easy to backport. All the other patches are mostly for correctness and can go to drm-misc-next only.
Can I add your Tested-by tag to the patches?
Best regards
Thomas
Quoted 2 lines
z
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Quoted 61 lines · Thomas Zimmermann
Hi
Am 19.01.22 um 03:15 schrieb Zack Rusin:
Quoted 40 lines · Javier Martinez Canillas
Quoted 12 lines
Hello Zack,
Quoted 8 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions
are held by the platform. In that case remove_conflicting*_framebuffers
only removes the simplefb but not the regions held by sysfb.Quoted 5 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSY
flag from the memory resource added to the "simple-framebuffer" device
?I think this is one of those cases where it depends on what we plan to
do after that. Sementically it makes sense to have it in there - the
framebuffer memory is claimed by the "simple-framebuffer" and it's busy, it's just that it creates issues for drivers after unloading. I
think removing it, while making things easier for drivers, would be confusing for people reading the code later, unless there's some kind
of cleanup that would happen with it (e.g. removingIORESOURCE_BUSYaltogether and making the drm drivers properly request their resources). At least by itself it doesn't seem to be much better solution than having the drm drivers not call pci_request_region[s],
which apart from hyperv and cirrus (iirc bochs does it for resources
other than fb which wouldn't have been claimed by "simple- framebuffer")
is already the case.Quoted 3 lines
I do think we should do one of them to make the codebase coherent:
either removeIORESOURCE_BUSYfrom "simple-framebuffer" or remove pci_request_region[s] from hyperv and cirrus.I just discussed this a bit with Javier. It's a problem with the simple-framebuffer code, rather then vmwgfx.
IMHO the best solution is to drop
IORESOURCE_BUSYfrom sysfb and have drivers register/release the range with_BUSY. That would signal the memory belongs to the sysfb device but is not busy unless a driver has
been bound. After simplefb released the range, it should be 'non- busy'
again and available for vmwgfx. Simpledrm does a hot-unplug of the sysfb
device, so the memory range gets released entirely. If you want, I'll prepare some patches for this scenario.
Quoted 5 lines
If this doesn't work, pushing all request/release pairs into drivers would be my next option.
If none of this is feasible, we can still remove
pci_request_region()from vmwgfx.
I think that's orthogonal to the fix because having pci_request_region makes vmwgfx behave differently from majority of DRM drivers, e.g. on systems with sysfb enabled with 5.15 vmwgfx fails to boot and leaves the system broken without any fb driver (because while we have *remove_conflicting*_framebuffers we don't have drm_restore_system_fb or such to load back the boot fb after drm driver load fails) but since it's one of the few drivers which does request regions it took a bit for us to notice.
So in this case I'd much rather be like the other drivers rather than correct because it lowers the odds of vmwgfx breaking in the future.
z
Thomas Zimmermann
maintainerHi
Am 19.01.22 um 15:24 schrieb Zack Rusin:
Quoted 78 lines · Thomas Zimmermann
Quoted 61 lines
Hi
Am 19.01.22 um 03:15 schrieb Zack Rusin:
Quoted 40 lines · Javier Martinez Canillas
Quoted 12 lines
Hello Zack,
Quoted 8 lines · Zack Rusin
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions
are held by the platform. In that case remove_conflicting*_framebuffers
only removes the simplefb but not the regions held by sysfb.Quoted 5 lines
Indeed, that's an issue. I wonder if we should drop the
IORESOURCE_BUSY
flag from the memory resource added to the "simple-framebuffer" device
?I think this is one of those cases where it depends on what we plan to
do after that. Sementically it makes sense to have it in there - the
framebuffer memory is claimed by the "simple-framebuffer" and it's busy, it's just that it creates issues for drivers after unloading. I
think removing it, while making things easier for drivers, would be confusing for people reading the code later, unless there's some kind
of cleanup that would happen with it (e.g. removingIORESOURCE_BUSYaltogether and making the drm drivers properly request their resources). At least by itself it doesn't seem to be much better solution than having the drm drivers not call pci_request_region[s],
which apart from hyperv and cirrus (iirc bochs does it for resources
other than fb which wouldn't have been claimed by "simple- framebuffer")
is already the case.Quoted 3 lines
I do think we should do one of them to make the codebase coherent:
either removeIORESOURCE_BUSYfrom "simple-framebuffer" or remove pci_request_region[s] from hyperv and cirrus.I just discussed this a bit with Javier. It's a problem with the simple-framebuffer code, rather then vmwgfx.
IMHO the best solution is to drop
IORESOURCE_BUSYfrom sysfb and have drivers register/release the range with_BUSY. That would signal the memory belongs to the sysfb device but is not busy unless a driver has
been bound. After simplefb released the range, it should be 'non- busy'
again and available for vmwgfx. Simpledrm does a hot-unplug of the sysfb
device, so the memory range gets released entirely. If you want, I'll prepare some patches for this scenario.Quoted 5 lines
If this doesn't work, pushing all request/release pairs into drivers would be my next option.
If none of this is feasible, we can still remove
pci_request_region()from vmwgfx.I think that's orthogonal to the fix because having
pci_request_regionmakes vmwgfx behave differently from majority of DRM drivers, e.g. on systems with sysfb enabled with 5.15 vmwgfx fails to boot and leaves the system broken without any fb driver (because while we have *remove_conflicting*_framebuffers we don't havedrm_restore_system_fbor such to load back the boot fb after drm driver load fails) but since it's one of the few drivers which does request regions it took a bit for us to notice.
Quoted 2 lines
So in this case I'd much rather be like the other drivers rather than correct because it lowers the odds of vmwgfx breaking in the future.
Well, if you want to remove the calls then do so, of course.
I'd rather add the request_memory() calls to all the other drivers that are missing them. Javier suggested to make this an official TODO item. Having the BUSY flag set when a driver is active, still is the correct thing to do.
I'm not sure i understand your comment about drm_restore_system_fb. There is no way of atomically switching drivers and that's always been a problem. Failing at pci_request_memroy() is just one of many possible reasons for the switch to fail. The best you could do is to rearrange the code to do 'remove_conflicting*()' at the latest point possible.
Best regards
Thomas
Quoted 3 lines
z
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev
Thomas Zimmermann
maintainerHi Zack
Am 17.01.22 um 19:03 schrieb Zack Rusin:
Quoted 5 lines
From: Zack Rusin <[email protected]>
When
sysfb_simpleis enabled loading vmwgfx fails because the regions are held by the platform. In that case remove_conflicting*_framebuffers only removes the simplefb but not the regions held by sysfb.
I don't understand this sentence. There's only one memory resource claimed by the sysfb code. What else would block vmwgfx?
I appears to me as if simplefb should release the region (or the simple-framebuffer device).
simpledrm does a hot-unplug of the simple-framebuffer, so the region should be released afterwards.
Best regard
Thomas
Quoted 29 lines
Like the other drm drivers we need to stop requesting all the pci regions to let the driver load with platform code enabled.
This allows vmwgfx to load correctly on systems withsysfb_simpleenabled.Signed-off-by Zack Rusin <[email protected]>Fixes 523375c943e5 ("drm/vmwgfx: Port vmwgfx to arm64")Cc <[email protected]>Reviewed-by Martin Krastev <[email protected]>--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 4 ---- 1 file changed, 4 deletions(-)drivers/gpu/drm/vmwgfx/vmwgfx_drv.c +0
-4@@ -724,10 +724,6 @@ static int vmw_setup_pci_resources(struct vmw_private *dev,pci_set_master (pdev); - ret =pci_request_regions (pdev,"vmwgfx probe" ); -if (ret) -return ret; - dev->pci_id = pci_id;if (pci_id ==VMWGFX_PCI_ID_SVGA3 ) { rmmio_start =pci_resource_start (pdev,0 );
Signature · 6 lines
Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Maxfeldstr. 5, 90409 Nürnberg, Germany (HRB 36809, AG Nürnberg) Geschäftsführer: Ivo Totev