diff mbox

[RESEND] staging: sm750fb: avoid conflicting vesafb

Message ID 1498856263-4544-1-git-send-email-sudipm.mukherjee@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Sudip Mukherjee June 30, 2017, 8:57 p.m. UTC
From: Teddy Wang <teddy.wang@siliconmotion.com>

If vesafb is enabled in the config then /dev/fb0 is created by vesa
and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
effectively work with xorg.
So if it has been alloted fb1, then try to remove the other fb0.

Cc: <stable@vger.kernel.org> # v4.4+
Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---

In the previous send, why #ifdef is used was asked.
https://lkml.org/lkml/2017/6/25/57

Answered at: https://lkml.org/lkml/2017/6/25/69
Also pasting here for reference.

'Did a quick research into "why".
The patch d8801e4df91e ("x86/PCI: Set IORESOURCE_ROM_SHADOW only for the
default VGA device") has started setting IORESOURCE_ROM_SHADOW in flags
for a default VGA device and that is being done only for x86.
And so, we will need that #ifdef to check IORESOURCE_ROM_SHADOW as that
needs to be checked only for a x86 and not for other arch.'

 drivers/staging/sm750fb/sm750.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Sudip Mukherjee July 11, 2017, 9:03 p.m. UTC | #1
Hi Greg,

On Fri, Jun 30, 2017 at 09:57:43PM +0100, Sudip Mukherjee wrote:
> From: Teddy Wang <teddy.wang@siliconmotion.com>
> 
> If vesafb is enabled in the config then /dev/fb0 is created by vesa
> and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
> effectively work with xorg.
> So if it has been alloted fb1, then try to remove the other fb0.
> 
> Cc: <stable@vger.kernel.org> # v4.4+
> Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---
> 
> In the previous send, why #ifdef is used was asked.
> https://lkml.org/lkml/2017/6/25/57
> 
> Answered at: https://lkml.org/lkml/2017/6/25/69
> Also pasting here for reference.
> 
> 'Did a quick research into "why".
> The patch d8801e4df91e ("x86/PCI: Set IORESOURCE_ROM_SHADOW only for the
> default VGA device") has started setting IORESOURCE_ROM_SHADOW in flags
> for a default VGA device and that is being done only for x86.
> And so, we will need that #ifdef to check IORESOURCE_ROM_SHADOW as that
> needs to be checked only for a x86 and not for other arch.'

A gentle ping.

--
Regards
Sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Greg Kroah-Hartman July 12, 2017, 6:06 a.m. UTC | #2
On Tue, Jul 11, 2017 at 10:03:01PM +0100, Sudip Mukherjee wrote:
> Hi Greg,
> 
> On Fri, Jun 30, 2017 at 09:57:43PM +0100, Sudip Mukherjee wrote:
> > From: Teddy Wang <teddy.wang@siliconmotion.com>
> > 
> > If vesafb is enabled in the config then /dev/fb0 is created by vesa
> > and this sm750 driver gets fb1, fb2. But we need to be fb0 and fb1 to
> > effectively work with xorg.
> > So if it has been alloted fb1, then try to remove the other fb0.
> > 
> > Cc: <stable@vger.kernel.org> # v4.4+
> > Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
> > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> > ---
> > 
> > In the previous send, why #ifdef is used was asked.
> > https://lkml.org/lkml/2017/6/25/57
> > 
> > Answered at: https://lkml.org/lkml/2017/6/25/69
> > Also pasting here for reference.
> > 
> > 'Did a quick research into "why".
> > The patch d8801e4df91e ("x86/PCI: Set IORESOURCE_ROM_SHADOW only for the
> > default VGA device") has started setting IORESOURCE_ROM_SHADOW in flags
> > for a default VGA device and that is being done only for x86.
> > And so, we will need that #ifdef to check IORESOURCE_ROM_SHADOW as that
> > needs to be checked only for a x86 and not for other arch.'
> 
> A gentle ping.

It's in the middle of the merge window, I can't do anything with patches
right now, you know better than this...

I'll get to it after 4.13-rc1 is out, relax please.

greg k-h
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Sudip Mukherjee July 12, 2017, 4:41 p.m. UTC | #3
On Wed, Jul 12, 2017 at 08:06:24AM +0200, Greg Kroah-Hartman wrote:
> On Tue, Jul 11, 2017 at 10:03:01PM +0100, Sudip Mukherjee wrote:
> > Hi Greg,
> > 
> > On Fri, Jun 30, 2017 at 09:57:43PM +0100, Sudip Mukherjee wrote:
> > > From: Teddy Wang <teddy.wang@siliconmotion.com>
> > > 
<snip>
> > 
> > A gentle ping.
> 
> It's in the middle of the merge window, I can't do anything with patches
> right now, you know better than this...

yes, sorry, my bad.
lost count of days.

--
Regards
Sudip
--
To unsubscribe from this list: send the line "unsubscribe linux-fbdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index d5934f3..8199dbe 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1053,6 +1053,26 @@  static int sm750fb_frambuffer_alloc(struct sm750_dev *sm750_dev, int fbidx)
 	return err;
 }
 
+static int lynxfb_kick_out_firmware_fb(struct pci_dev *pdev)
+{
+	struct apertures_struct *ap;
+	bool primary = false;
+
+	ap = alloc_apertures(1);
+	if (!ap)
+		return -ENOMEM;
+
+	ap->ranges[0].base = pci_resource_start(pdev, 0);
+	ap->ranges[0].size = pci_resource_len(pdev, 0);
+#ifdef CONFIG_X86
+	primary = pdev->resource[PCI_ROM_RESOURCE].flags &
+					IORESOURCE_ROM_SHADOW;
+#endif
+	remove_conflicting_framebuffers(ap, "sm750_fb1", primary);
+	kfree(ap);
+	return 0;
+}
+
 static int lynxfb_pci_probe(struct pci_dev *pdev,
 			    const struct pci_device_id *ent)
 {
@@ -1061,6 +1081,10 @@  static int lynxfb_pci_probe(struct pci_dev *pdev,
 	int fbidx;
 	int err;
 
+	err = lynxfb_kick_out_firmware_fb(pdev);
+	if (err)
+		return err;
+
 	/* enable device */
 	err = pcim_enable_device(pdev);
 	if (err)