stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: sm750fb: avoid conflicting vesafb
@ 2017-07-29 21:17 Sudip Mukherjee
  2017-07-30 15:37 ` Greg Kroah-Hartman
  2017-08-04 21:39 ` Greg Kroah-Hartman
  0 siblings, 2 replies; 3+ messages in thread
From: Sudip Mukherjee @ 2017-07-29 21:17 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: linux-kernel, Teddy Wang, stable, Sudip Mukherjee

From: Teddy Wang <teddy.wang@siliconmotion.com>

commit 740c433ec35187b45abe08bb6c45a321a791be8e upstream

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.

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.'

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/sm750fb/sm750.c | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
index 860e1c2..2a89dc2 100644
--- a/drivers/staging/sm750fb/sm750.c
+++ b/drivers/staging/sm750fb/sm750.c
@@ -1002,6 +1002,26 @@ NO_PARAM:
 	}
 }
 
+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)
 {
@@ -1009,6 +1029,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
 	struct sm750_dev *sm750_dev = NULL;
 	int fbidx;
 
+	err = lynxfb_kick_out_firmware_fb(pdev);
+	if (err)
+		return err;
+
 	/* enable device */
 	if (pci_enable_device(pdev)) {
 		pr_err("can not enable device.\n");
-- 
1.9.1

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

* Re: [PATCH] staging: sm750fb: avoid conflicting vesafb
  2017-07-29 21:17 [PATCH] staging: sm750fb: avoid conflicting vesafb Sudip Mukherjee
@ 2017-07-30 15:37 ` Greg Kroah-Hartman
  2017-08-04 21:39 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-07-30 15:37 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: linux-kernel, Teddy Wang, stable

On Sat, Jul 29, 2017 at 10:17:43PM +0100, Sudip Mukherjee wrote:
> From: Teddy Wang <teddy.wang@siliconmotion.com>
> 
> commit 740c433ec35187b45abe08bb6c45a321a791be8e upstream
> 
> 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.
> 
> 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.'
> 
> 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>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/staging/sm750fb/sm750.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 

Still does not apply to my staging-linus branch without manual fixups.
What is going on here?  Please fix up and resend properly...

thanks,

greg k-h

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

* Re: [PATCH] staging: sm750fb: avoid conflicting vesafb
  2017-07-29 21:17 [PATCH] staging: sm750fb: avoid conflicting vesafb Sudip Mukherjee
  2017-07-30 15:37 ` Greg Kroah-Hartman
@ 2017-08-04 21:39 ` Greg Kroah-Hartman
  1 sibling, 0 replies; 3+ messages in thread
From: Greg Kroah-Hartman @ 2017-08-04 21:39 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: linux-kernel, Teddy Wang, stable

On Sat, Jul 29, 2017 at 10:17:43PM +0100, Sudip Mukherjee wrote:
> From: Teddy Wang <teddy.wang@siliconmotion.com>
> 
> commit 740c433ec35187b45abe08bb6c45a321a791be8e upstream
> 
> 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.
> 
> 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.'
> 
> 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>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> ---
>  drivers/staging/sm750fb/sm750.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
> 
> diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c
> index 860e1c2..2a89dc2 100644
> --- a/drivers/staging/sm750fb/sm750.c
> +++ b/drivers/staging/sm750fb/sm750.c
> @@ -1002,6 +1002,26 @@ NO_PARAM:
>  	}
>  }
>  
> +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)
>  {
> @@ -1009,6 +1029,10 @@ static int lynxfb_pci_probe(struct pci_dev *pdev,
>  	struct sm750_dev *sm750_dev = NULL;
>  	int fbidx;
>  
> +	err = lynxfb_kick_out_firmware_fb(pdev);
> +	if (err)
> +		return err;
> +

This breaks the build, so I have to drop it.  Please be more careful :(

greg k-h

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

end of thread, other threads:[~2017-08-04 21:39 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-29 21:17 [PATCH] staging: sm750fb: avoid conflicting vesafb Sudip Mukherjee
2017-07-30 15:37 ` Greg Kroah-Hartman
2017-08-04 21:39 ` Greg Kroah-Hartman

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