dri-devel.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fbdev: list all pci memory bars as conflicting apertures
@ 2019-03-14 11:45 ` Gerd Hoffmann
  2019-04-01 14:00   ` Bartlomiej Zolnierkiewicz
  0 siblings, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2019-03-14 11:45 UTC (permalink / raw)
  To: dri-devel
  Cc: Daniel Vetter, Gerd Hoffmann, Bartlomiej Zolnierkiewicz,
	open list:FRAMEBUFFER LAYER, open list

Simply add all pci memory bars to struct apertures_struct in
remove_conflicting_pci_framebuffers(), without depending on the
res_id parameter.

The plan is to drop the res_id parameter later on.  For now keep the
parameter, use it for sanity-checking and warn on inconsistencies.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/video/fbdev/core/fbmem.c | 29 +++++++++++++++++++++++++----
 1 file changed, 25 insertions(+), 4 deletions(-)

diff --git a/drivers/video/fbdev/core/fbmem.c b/drivers/video/fbdev/core/fbmem.c
index cb43a2258c51..e4e5c129a0f5 100644
--- a/drivers/video/fbdev/core/fbmem.c
+++ b/drivers/video/fbdev/core/fbmem.c
@@ -1879,14 +1879,35 @@ int remove_conflicting_pci_framebuffers(struct pci_dev *pdev, int res_id, const
 {
 	struct apertures_struct *ap;
 	bool primary = false;
-	int err;
+	int err, idx, bar;
+	bool res_id_found = false;
 
-	ap = alloc_apertures(1);
+	for (idx = 0, bar = 0; bar < PCI_ROM_RESOURCE; bar++) {
+		if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM))
+			continue;
+		idx++;
+	}
+
+	ap = alloc_apertures(idx);
 	if (!ap)
 		return -ENOMEM;
 
-	ap->ranges[0].base = pci_resource_start(pdev, res_id);
-	ap->ranges[0].size = pci_resource_len(pdev, res_id);
+	for (idx = 0, bar = 0; bar < PCI_ROM_RESOURCE; bar++) {
+		if (!(pci_resource_flags(pdev, bar) & IORESOURCE_MEM))
+			continue;
+		ap->ranges[idx].base = pci_resource_start(pdev, bar);
+		ap->ranges[idx].size = pci_resource_len(pdev, bar);
+		pci_info(pdev, "%s: bar %d: 0x%lx -> 0x%lx\n", __func__, bar,
+			 (unsigned long)pci_resource_start(pdev, bar),
+			 (unsigned long)pci_resource_end(pdev, bar));
+		idx++;
+		if (res_id == bar)
+			res_id_found = true;
+	}
+	if (!res_id_found)
+		pci_warn(pdev, "%s: passed res_id (%d) is not a memory bar\n",
+			 __func__, res_id);
+
 #ifdef CONFIG_X86
 	primary = pdev->resource[PCI_ROM_RESOURCE].flags &
 					IORESOURCE_ROM_SHADOW;
-- 
2.18.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbdev: list all pci memory bars as conflicting apertures
  2019-03-14 11:45 ` [PATCH] fbdev: list all pci memory bars as conflicting apertures Gerd Hoffmann
@ 2019-04-01 14:00   ` Bartlomiej Zolnierkiewicz
  2019-04-02 12:09     ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Bartlomiej Zolnierkiewicz @ 2019-04-01 14:00 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: dri-devel, Daniel Vetter, open list:FRAMEBUFFER LAYER, open list


On 03/14/2019 12:45 PM, Gerd Hoffmann wrote:
> Simply add all pci memory bars to struct apertures_struct in
> remove_conflicting_pci_framebuffers(), without depending on the
> res_id parameter.
> 
> The plan is to drop the res_id parameter later on.  For now keep the
> parameter, use it for sanity-checking and warn on inconsistencies.
> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Patch queued for v5.2, thanks.

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbdev: list all pci memory bars as conflicting apertures
  2019-04-01 14:00   ` Bartlomiej Zolnierkiewicz
@ 2019-04-02 12:09     ` Daniel Vetter
  2019-04-02 20:43       ` Gerd Hoffmann
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2019-04-02 12:09 UTC (permalink / raw)
  To: Bartlomiej Zolnierkiewicz
  Cc: Gerd Hoffmann, dri-devel, open list:FRAMEBUFFER LAYER, open list

On Mon, Apr 1, 2019 at 4:00 PM Bartlomiej Zolnierkiewicz
<b.zolnierkie@samsung.com> wrote:
>
>
> On 03/14/2019 12:45 PM, Gerd Hoffmann wrote:
> > Simply add all pci memory bars to struct apertures_struct in
> > remove_conflicting_pci_framebuffers(), without depending on the
> > res_id parameter.
> >
> > The plan is to drop the res_id parameter later on.  For now keep the
> > parameter, use it for sanity-checking and warn on inconsistencies.
> >
> > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
>
> Patch queued for v5.2, thanks.

Might be good to also stuff this into drm (double merge or topic
branch, whatever you prefer), since that's where all the users are.
Gerd also has some follow-up patches to apply on top of this one iirc.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbdev: list all pci memory bars as conflicting apertures
  2019-04-02 12:09     ` Daniel Vetter
@ 2019-04-02 20:43       ` Gerd Hoffmann
  2019-04-03  6:48         ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2019-04-02 20:43 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Bartlomiej Zolnierkiewicz, dri-devel,
	open list:FRAMEBUFFER LAYER, open list

On Tue, Apr 02, 2019 at 02:09:45PM +0200, Daniel Vetter wrote:
> On Mon, Apr 1, 2019 at 4:00 PM Bartlomiej Zolnierkiewicz
> <b.zolnierkie@samsung.com> wrote:
> >
> >
> > On 03/14/2019 12:45 PM, Gerd Hoffmann wrote:
> > > Simply add all pci memory bars to struct apertures_struct in
> > > remove_conflicting_pci_framebuffers(), without depending on the
> > > res_id parameter.
> > >
> > > The plan is to drop the res_id parameter later on.  For now keep the
> > > parameter, use it for sanity-checking and warn on inconsistencies.
> > >
> > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> >
> > Patch queued for v5.2, thanks.
> 
> Might be good to also stuff this into drm (double merge or topic
> branch, whatever you prefer), since that's where all the users are.
> Gerd also has some follow-up patches to apply on top of this one iirc.

No follow-up patches yet.  Plan is to wait a bit, see if the
sanity-checks trigger, and if all goes well go drop the res_id
parameter in 5.3 ...

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbdev: list all pci memory bars as conflicting apertures
  2019-04-02 20:43       ` Gerd Hoffmann
@ 2019-04-03  6:48         ` Daniel Vetter
  2019-04-03  7:22           ` Gerd Hoffmann
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Vetter @ 2019-04-03  6:48 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Bartlomiej Zolnierkiewicz, dri-devel,
	open list:FRAMEBUFFER LAYER, open list

On Tue, Apr 2, 2019 at 10:43 PM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Tue, Apr 02, 2019 at 02:09:45PM +0200, Daniel Vetter wrote:
> > On Mon, Apr 1, 2019 at 4:00 PM Bartlomiej Zolnierkiewicz
> > <b.zolnierkie@samsung.com> wrote:
> > >
> > >
> > > On 03/14/2019 12:45 PM, Gerd Hoffmann wrote:
> > > > Simply add all pci memory bars to struct apertures_struct in
> > > > remove_conflicting_pci_framebuffers(), without depending on the
> > > > res_id parameter.
> > > >
> > > > The plan is to drop the res_id parameter later on.  For now keep the
> > > > parameter, use it for sanity-checking and warn on inconsistencies.
> > > >
> > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > >
> > > Patch queued for v5.2, thanks.
> >
> > Might be good to also stuff this into drm (double merge or topic
> > branch, whatever you prefer), since that's where all the users are.
> > Gerd also has some follow-up patches to apply on top of this one iirc.
>
> No follow-up patches yet.  Plan is to wait a bit, see if the
> sanity-checks trigger, and if all goes well go drop the res_id
> parameter in 5.3 ...

Hm I thought you had a patch to convert i915 over. Or did that land already?
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbdev: list all pci memory bars as conflicting apertures
  2019-04-03  6:48         ` Daniel Vetter
@ 2019-04-03  7:22           ` Gerd Hoffmann
  2019-04-03  7:25             ` Daniel Vetter
  0 siblings, 1 reply; 7+ messages in thread
From: Gerd Hoffmann @ 2019-04-03  7:22 UTC (permalink / raw)
  To: Daniel Vetter
  Cc: Bartlomiej Zolnierkiewicz, dri-devel,
	open list:FRAMEBUFFER LAYER, open list

On Wed, Apr 03, 2019 at 08:48:16AM +0200, Daniel Vetter wrote:
> On Tue, Apr 2, 2019 at 10:43 PM Gerd Hoffmann <kraxel@redhat.com> wrote:
> >
> > On Tue, Apr 02, 2019 at 02:09:45PM +0200, Daniel Vetter wrote:
> > > On Mon, Apr 1, 2019 at 4:00 PM Bartlomiej Zolnierkiewicz
> > > <b.zolnierkie@samsung.com> wrote:
> > > >
> > > >
> > > > On 03/14/2019 12:45 PM, Gerd Hoffmann wrote:
> > > > > Simply add all pci memory bars to struct apertures_struct in
> > > > > remove_conflicting_pci_framebuffers(), without depending on the
> > > > > res_id parameter.
> > > > >
> > > > > The plan is to drop the res_id parameter later on.  For now keep the
> > > > > parameter, use it for sanity-checking and warn on inconsistencies.
> > > > >
> > > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > >
> > > > Patch queued for v5.2, thanks.
> > >
> > > Might be good to also stuff this into drm (double merge or topic
> > > branch, whatever you prefer), since that's where all the users are.
> > > Gerd also has some follow-up patches to apply on top of this one iirc.
> >
> > No follow-up patches yet.  Plan is to wait a bit, see if the
> > sanity-checks trigger, and if all goes well go drop the res_id
> > parameter in 5.3 ...
> 
> Hm I thought you had a patch to convert i915 over. Or did that land already?

Ah, *that* one.  Yep, that is still sitting in a branch here.  Didn't
rebase it yet.  But I suspect it will be easier to first drop res_id
and then rebase the i915 patch on top of *that*, so I don't have to
figure which i915 revision needs which res_id ...

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] fbdev: list all pci memory bars as conflicting apertures
  2019-04-03  7:22           ` Gerd Hoffmann
@ 2019-04-03  7:25             ` Daniel Vetter
  0 siblings, 0 replies; 7+ messages in thread
From: Daniel Vetter @ 2019-04-03  7:25 UTC (permalink / raw)
  To: Gerd Hoffmann
  Cc: Bartlomiej Zolnierkiewicz, dri-devel,
	open list:FRAMEBUFFER LAYER, open list

On Wed, Apr 3, 2019 at 9:22 AM Gerd Hoffmann <kraxel@redhat.com> wrote:
>
> On Wed, Apr 03, 2019 at 08:48:16AM +0200, Daniel Vetter wrote:
> > On Tue, Apr 2, 2019 at 10:43 PM Gerd Hoffmann <kraxel@redhat.com> wrote:
> > >
> > > On Tue, Apr 02, 2019 at 02:09:45PM +0200, Daniel Vetter wrote:
> > > > On Mon, Apr 1, 2019 at 4:00 PM Bartlomiej Zolnierkiewicz
> > > > <b.zolnierkie@samsung.com> wrote:
> > > > >
> > > > >
> > > > > On 03/14/2019 12:45 PM, Gerd Hoffmann wrote:
> > > > > > Simply add all pci memory bars to struct apertures_struct in
> > > > > > remove_conflicting_pci_framebuffers(), without depending on the
> > > > > > res_id parameter.
> > > > > >
> > > > > > The plan is to drop the res_id parameter later on.  For now keep the
> > > > > > parameter, use it for sanity-checking and warn on inconsistencies.
> > > > > >
> > > > > > Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> > > > > > Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > > > >
> > > > > Patch queued for v5.2, thanks.
> > > >
> > > > Might be good to also stuff this into drm (double merge or topic
> > > > branch, whatever you prefer), since that's where all the users are.
> > > > Gerd also has some follow-up patches to apply on top of this one iirc.
> > >
> > > No follow-up patches yet.  Plan is to wait a bit, see if the
> > > sanity-checks trigger, and if all goes well go drop the res_id
> > > parameter in 5.3 ...
> >
> > Hm I thought you had a patch to convert i915 over. Or did that land already?
>
> Ah, *that* one.  Yep, that is still sitting in a branch here.  Didn't
> rebase it yet.  But I suspect it will be easier to first drop res_id
> and then rebase the i915 patch on top of *that*, so I don't have to
> figure which i915 revision needs which res_id ...

Ok, sounds like a plan for 5.3 somewhen.
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2019-04-03  7:25 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20190314114511epcas2p2a9669714177b00989bd3195300f7d3a6@epcas2p2.samsung.com>
2019-03-14 11:45 ` [PATCH] fbdev: list all pci memory bars as conflicting apertures Gerd Hoffmann
2019-04-01 14:00   ` Bartlomiej Zolnierkiewicz
2019-04-02 12:09     ` Daniel Vetter
2019-04-02 20:43       ` Gerd Hoffmann
2019-04-03  6:48         ` Daniel Vetter
2019-04-03  7:22           ` Gerd Hoffmann
2019-04-03  7:25             ` Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).