[v5,1/4] video: fbdev: atyfb: only use ioremap_uc() on i386 and ia64

Message ID 20230921110424.215592-2-bhe@redhat.com
State New
Headers
Series arch/*/io.h: remove ioremap_uc in some architectures |

Commit Message

Baoquan He Sept. 21, 2023, 11:04 a.m. UTC
  From: Arnd Bergmann <arnd@arndb.de>

ioremap_uc() is only meaningful on old x86-32 systems with the PAT
extension, and on ia64 with its slightly unconventional ioremap()
behavior, everywhere else this is the same as ioremap() anyway.

Change the only driver that still references ioremap_uc() to only do so
on x86-32/ia64 in order to allow removing that interface at some
point in the future for the other architectures.

On some architectures, ioremap_uc() just returns NULL, changing
the driver to call ioremap() means that they now have a chance
of working correctly.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Baoquan He <bhe@redhat.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
Cc: Helge Deller <deller@gmx.de>
Cc: Thomas Zimmermann <tzimmermann@suse.de>
Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: linux-fbdev@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
---
 drivers/video/fbdev/aty/atyfb_base.c | 4 ++++
 1 file changed, 4 insertions(+)
  

Comments

Helge Deller Sept. 23, 2023, 6:53 p.m. UTC | #1
On 9/21/23 13:04, Baoquan He wrote:
> From: Arnd Bergmann <arnd@arndb.de>
>
> ioremap_uc() is only meaningful on old x86-32 systems with the PAT
> extension, and on ia64 with its slightly unconventional ioremap()
> behavior, everywhere else this is the same as ioremap() anyway.
>
> Change the only driver that still references ioremap_uc() to only do so
> on x86-32/ia64 in order to allow removing that interface at some
> point in the future for the other architectures.
>
> On some architectures, ioremap_uc() just returns NULL, changing
> the driver to call ioremap() means that they now have a chance
> of working correctly.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
> Cc: Helge Deller <deller@gmx.de>
> Cc: Thomas Zimmermann <tzimmermann@suse.de>
> Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
> Cc: linux-fbdev@vger.kernel.org
> Cc: dri-devel@lists.freedesktop.org

applied to fbdev git tree.

Thanks!
Helge


> ---
>   drivers/video/fbdev/aty/atyfb_base.c | 4 ++++
>   1 file changed, 4 insertions(+)
>
> diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
> index 5c87817a4f4c..3dcf83f5e7b4 100644
> --- a/drivers/video/fbdev/aty/atyfb_base.c
> +++ b/drivers/video/fbdev/aty/atyfb_base.c
> @@ -3440,11 +3440,15 @@ static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info,
>   	}
>
>   	info->fix.mmio_start = raddr;
> +#if defined(__i386__) || defined(__ia64__)
>   	/*
>   	 * By using strong UC we force the MTRR to never have an
>   	 * effect on the MMIO region on both non-PAT and PAT systems.
>   	 */
>   	par->ati_regbase = ioremap_uc(info->fix.mmio_start, 0x1000);
> +#else
> +	par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000);
> +#endif
>   	if (par->ati_regbase == NULL)
>   		return -ENOMEM;
>
  

Patch

diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index 5c87817a4f4c..3dcf83f5e7b4 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -3440,11 +3440,15 @@  static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info,
 	}
 
 	info->fix.mmio_start = raddr;
+#if defined(__i386__) || defined(__ia64__)
 	/*
 	 * By using strong UC we force the MTRR to never have an
 	 * effect on the MMIO region on both non-PAT and PAT systems.
 	 */
 	par->ati_regbase = ioremap_uc(info->fix.mmio_start, 0x1000);
+#else
+	par->ati_regbase = ioremap(info->fix.mmio_start, 0x1000);
+#endif
 	if (par->ati_regbase == NULL)
 		return -ENOMEM;