diff mbox

[1/2] staging: sm750fb: avoid conflicting vesafb

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

Commit Message

Sudip Mukherjee June 19, 2017, 8:32 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.

Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/staging/sm750fb/sm750.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

Comments

Andy Shevchenko June 19, 2017, 8:47 p.m. UTC | #1
On Mon, Jun 19, 2017 at 11:32 PM, Sudip Mukherjee
<sudipm.mukherjee@gmail.com> wrote:


> +#ifdef CONFIG_X86
> +       primary = pdev->resource[PCI_ROM_RESOURCE].flags &
> +                                       IORESOURCE_ROM_SHADOW;
> +#endif

Why do we need #ifdef?

In any case you may introduce a temporary variable to have pointer to resource

struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];
Sudip Mukherjee June 20, 2017, 8:08 p.m. UTC | #2
On Mon, Jun 19, 2017 at 11:47:20PM +0300, Andy Shevchenko wrote:
> On Mon, Jun 19, 2017 at 11:32 PM, Sudip Mukherjee
> <sudipm.mukherjee@gmail.com> wrote:
> 
> 
> > +#ifdef CONFIG_X86
> > +       primary = pdev->resource[PCI_ROM_RESOURCE].flags &
> > +                                       IORESOURCE_ROM_SHADOW;
> > +#endif
> 
> Why do we need #ifdef?

It has been done in exactly the same way it is done in drm drivers.
All the drm drivers I have checked uses #ifdef.

See for example:
http://elixir.free-electrons.com/linux/v4.12-rc6/source/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c#L470

If you think #ifdef is not required, please send patch for the drm
drivers, and we follow that change here also.

> 
> In any case you may introduce a temporary variable to have pointer to resource
> 
> struct resource *res = &pdev->resource[PCI_ROM_RESOURCE];

No, we will not want to do it in a different way than the way it is done
by drm drivers.

--
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
Dan Carpenter June 20, 2017, 8:20 p.m. UTC | #3
That's totally bogus.  Just say you don't know.  It's never a
reguirement that people fix AMD drivers before they can review code...

regards,
dan carpenter

--
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
Andy Shevchenko June 20, 2017, 8:40 p.m. UTC | #4
On Tue, Jun 20, 2017 at 11:20 PM, Dan Carpenter
<dan.carpenter@oracle.com> wrote:
> That's totally bogus.  Just say you don't know.  It's never a
> reguirement that people fix AMD drivers before they can review code...

Agree. It's not a cargo cult.
If there any real thing behind that #ifdef  I would like to hear.
Sudip Mukherjee June 20, 2017, 8:41 p.m. UTC | #5
Hi Dan,

On Tue, Jun 20, 2017 at 11:20:55PM +0300, Dan Carpenter wrote:
> That's totally bogus.  Just say you don't know.  It's never a
> reguirement that people fix AMD drivers before they can review code...

Yes, I don't know how drm drivers work, so I blindly follow what has
been done there. And since sm750 ultimately has to be converted to a drm
driver to be taken out of staging, so I will prefer to have similar
changes here.

--
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
Sudip Mukherjee June 20, 2017, 8:44 p.m. UTC | #6
On Tue, Jun 20, 2017 at 11:40:59PM +0300, Andy Shevchenko wrote:
> On Tue, Jun 20, 2017 at 11:20 PM, Dan Carpenter
> <dan.carpenter@oracle.com> wrote:
> > That's totally bogus.  Just say you don't know.  It's never a
> > reguirement that people fix AMD drivers before they can review code...
> 
> Agree. It's not a cargo cult.
> If there any real thing behind that #ifdef  I would like to hear.

I dont know the real thing behind that. You can hear the real thing if
you send that patch to drm. And that is the only reason I mentioned that.

--
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
Sudip Mukherjee June 25, 2017, 12:43 p.m. UTC | #7
On Mon, Jun 19, 2017 at 09:32:57PM +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.
> 
> Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
> Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> ---

Hi Greg,
You applied the second patch but not this one. Did I miss any review
comments from you about this one?

--
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 KH June 25, 2017, 12:54 p.m. UTC | #8
On Sun, Jun 25, 2017 at 01:43:34PM +0100, Sudip Mukherjee wrote:
> On Mon, Jun 19, 2017 at 09:32:57PM +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.
> > 
> > Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
> > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> > ---
> 
> Hi Greg,
> You applied the second patch but not this one. Did I miss any review
> comments from you about this one?

All of the other complaints about this patch were not sufficient for me
to justify ignoring it?  Why would I not listen to them?

Please fix and resend if you want it applied.

thanks,

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 June 25, 2017, 1:54 p.m. UTC | #9
On Sun, Jun 25, 2017 at 02:54:51PM +0200, Greg Kroah-Hartman wrote:
> On Sun, Jun 25, 2017 at 01:43:34PM +0100, Sudip Mukherjee wrote:
> > On Mon, Jun 19, 2017 at 09:32:57PM +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.
> > > 
> > > Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
> > > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> > > ---
> > 
> > Hi Greg,
> > You applied the second patch but not this one. Did I miss any review
> > comments from you about this one?
> 
> All of the other complaints about this patch were not sufficient for me
> to justify ignoring it?  Why would I not listen to them?

This patch is doing what all the drm drivers are doing. So you want
us to do something completely new rather than following the established
practice of a drm driver?

--
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 KH June 25, 2017, 2:27 p.m. UTC | #10
On Sun, Jun 25, 2017 at 02:54:29PM +0100, Sudip Mukherjee wrote:
> On Sun, Jun 25, 2017 at 02:54:51PM +0200, Greg Kroah-Hartman wrote:
> > On Sun, Jun 25, 2017 at 01:43:34PM +0100, Sudip Mukherjee wrote:
> > > On Mon, Jun 19, 2017 at 09:32:57PM +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.
> > > > 
> > > > Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
> > > > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> > > > ---
> > > 
> > > Hi Greg,
> > > You applied the second patch but not this one. Did I miss any review
> > > comments from you about this one?
> > 
> > All of the other complaints about this patch were not sufficient for me
> > to justify ignoring it?  Why would I not listen to them?
> 
> This patch is doing what all the drm drivers are doing. So you want
> us to do something completely new rather than following the established
> practice of a drm driver?

I despise cargo-cult programming.  You could not answer the "why", so
why would I accept such a patch?

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 June 25, 2017, 3:07 p.m. UTC | #11
On Sun, Jun 25, 2017 at 04:27:23PM +0200, Greg Kroah-Hartman wrote:
> On Sun, Jun 25, 2017 at 02:54:29PM +0100, Sudip Mukherjee wrote:
> > On Sun, Jun 25, 2017 at 02:54:51PM +0200, Greg Kroah-Hartman wrote:
> > > On Sun, Jun 25, 2017 at 01:43:34PM +0100, Sudip Mukherjee wrote:
> > > > On Mon, Jun 19, 2017 at 09:32:57PM +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.
> > > > > 
> > > > > Signed-off-by: Teddy Wang <teddy.wang@siliconmotion.com>
> > > > > Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
> > > > > ---
> > > > 
> > > > Hi Greg,
> > > > You applied the second patch but not this one. Did I miss any review
> > > > comments from you about this one?
> > > 
> > > All of the other complaints about this patch were not sufficient for me
> > > to justify ignoring it?  Why would I not listen to them?
> > 
> > This patch is doing what all the drm drivers are doing. So you want
> > us to do something completely new rather than following the established
> > practice of a drm driver?
> 
> I despise cargo-cult programming.  You could not answer the "why", so
> why would I accept such a patch?

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.

--
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 KH June 29, 2017, 12:57 p.m. UTC | #12
A: Top-posting.
Q: What is the most annoying thing in e-mail?

A: No.
Q: Should I include quotations after my reply?

http://daringfireball.net/2007/07/on_top

On Wed, Jun 28, 2017 at 06:18:57AM +0000, Teddy Wang 王力强 wrote:
> Hi Greg,
> 
> 	Is the reason Sudip gave you for the question of "why" sufficient ?
> This patch is very important for the driver running in the X86 platform.  Without this patch, many SM750 graphic chip customers complain  the Ubuntu OS can't run well. When they install the OS, the screen will be full of garbage in xorg.
> Ubuntu 16.04.2 LTS and above will enable sm750 staging driver by default.  We need this patch. Thanks.

This patch is long-gone from my queue, it needs to be resent with the
added information for me to be able to accept it.

thanks,

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
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)