dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies
       [not found] <20230516110038.2413224-1-schnelle@linux.ibm.com>
@ 2023-05-16 11:00 ` Niklas Schnelle
  2023-05-16 17:13   ` Thomas Zimmermann
  2023-05-16 11:00 ` [PATCH v4 37/41] fbdev: atyfb: Remove unused clock determination Niklas Schnelle
  2023-05-16 11:00 ` [PATCH v4 38/41] video: handle HAS_IOPORT dependencies Niklas Schnelle
  2 siblings, 1 reply; 9+ messages in thread
From: Niklas Schnelle @ 2023-05-16 11:00 UTC (permalink / raw)
  To: Arnd Bergmann, Dave Airlie, Gerd Hoffmann, David Airlie,
	Daniel Vetter
  Cc: linux-arch, Arnd Bergmann, Albert Ou, Rafael J. Wysocki,
	Greg Kroah-Hartman, Paul Walmsley, linux-pci, linux-kernel,
	dri-devel, virtualization, Alan Stern, spice-devel,
	Uwe Kleine-König, Bjorn Helgaas, Geert Uytterhoeven,
	Mauro Carvalho Chehab, Palmer Dabbelt

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to add HAS_IOPORT as dependency for
those drivers using them. In the bochs driver there is optional MMIO
support detected at runtime, warn if this isn't taken when
HAS_IOPORT is not defined.

There is also a direct and hard coded use in cirrus.c which according to
the comment is only necessary during resume.  Let's just skip this as
for example s390 which doesn't have I/O port support also doesen't
support suspend/resume.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
      per-subsystem patches may be applied independently

 drivers/gpu/drm/qxl/Kconfig   |  1 +
 drivers/gpu/drm/tiny/bochs.c  | 17 +++++++++++++++++
 drivers/gpu/drm/tiny/cirrus.c |  2 ++
 3 files changed, 20 insertions(+)

diff --git a/drivers/gpu/drm/qxl/Kconfig b/drivers/gpu/drm/qxl/Kconfig
index ca3f51c2a8fe..d0e0d440c8d9 100644
--- a/drivers/gpu/drm/qxl/Kconfig
+++ b/drivers/gpu/drm/qxl/Kconfig
@@ -2,6 +2,7 @@
 config DRM_QXL
 	tristate "QXL virtual GPU"
 	depends on DRM && PCI && MMU
+	depends on HAS_IOPORT
 	select DRM_KMS_HELPER
 	select DRM_TTM
 	select DRM_TTM_HELPER
diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index d254679a136e..3710339407cc 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -2,6 +2,7 @@
 
 #include <linux/module.h>
 #include <linux/pci.h>
+#include <asm/bug.h>
 
 #include <drm/drm_aperture.h>
 #include <drm/drm_atomic_helper.h>
@@ -105,7 +106,9 @@ static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val)
 
 		writeb(val, bochs->mmio + offset);
 	} else {
+#ifdef CONFIG_HAS_IOPORT
 		outb(val, ioport);
+#endif
 	}
 }
 
@@ -119,7 +122,11 @@ static u8 bochs_vga_readb(struct bochs_device *bochs, u16 ioport)
 
 		return readb(bochs->mmio + offset);
 	} else {
+#ifdef CONFIG_HAS_IOPORT
 		return inb(ioport);
+#else
+		return 0xff;
+#endif
 	}
 }
 
@@ -132,8 +139,12 @@ static u16 bochs_dispi_read(struct bochs_device *bochs, u16 reg)
 
 		ret = readw(bochs->mmio + offset);
 	} else {
+#ifdef CONFIG_HAS_IOPORT
 		outw(reg, VBE_DISPI_IOPORT_INDEX);
 		ret = inw(VBE_DISPI_IOPORT_DATA);
+#else
+		ret = 0xffff;
+#endif
 	}
 	return ret;
 }
@@ -145,8 +156,10 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val)
 
 		writew(val, bochs->mmio + offset);
 	} else {
+#ifdef CONFIG_HAS_IOPORT
 		outw(reg, VBE_DISPI_IOPORT_INDEX);
 		outw(val, VBE_DISPI_IOPORT_DATA);
+#endif
 	}
 }
 
@@ -229,6 +242,10 @@ static int bochs_hw_init(struct drm_device *dev)
 			return -ENOMEM;
 		}
 	} else {
+		if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
+			DRM_ERROR("I/O ports are not supported\n");
+			return -EIO;
+		}
 		ioaddr = VBE_DISPI_IOPORT_INDEX;
 		iosize = 2;
 		if (!request_region(ioaddr, iosize, "bochs-drm")) {
diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
index 594bc472862f..c65fea049bc7 100644
--- a/drivers/gpu/drm/tiny/cirrus.c
+++ b/drivers/gpu/drm/tiny/cirrus.c
@@ -508,8 +508,10 @@ static void cirrus_crtc_helper_atomic_enable(struct drm_crtc *crtc,
 
 	cirrus_mode_set(cirrus, &crtc_state->mode);
 
+#ifdef CONFIG_HAS_IOPORT
 	/* Unblank (needed on S3 resume, vgabios doesn't do it then) */
 	outb(VGA_AR_ENABLE_DISPLAY, VGA_ATT_W);
+#endif
 
 	drm_dev_exit(idx);
 }
-- 
2.39.2


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

* [PATCH v4 37/41] fbdev: atyfb: Remove unused clock determination
       [not found] <20230516110038.2413224-1-schnelle@linux.ibm.com>
  2023-05-16 11:00 ` [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies Niklas Schnelle
@ 2023-05-16 11:00 ` Niklas Schnelle
  2023-05-16 12:24   ` Ville Syrjälä
  2023-05-16 11:00 ` [PATCH v4 38/41] video: handle HAS_IOPORT dependencies Niklas Schnelle
  2 siblings, 1 reply; 9+ messages in thread
From: Niklas Schnelle @ 2023-05-16 11:00 UTC (permalink / raw)
  To: Arnd Bergmann, Helge Deller
  Cc: linux-arch, linux-fbdev, Albert Ou, Rafael J. Wysocki,
	Greg Kroah-Hartman, Paul Walmsley, linux-pci, linux-kernel,
	dri-devel, Alan Stern, Uwe Kleine-König, Bjorn Helgaas,
	Geert Uytterhoeven, Mauro Carvalho Chehab, Palmer Dabbelt

Just below the removed lines par->clk_wr_offset is hard coded to 3 so
there is no use in determining a different clock just to then ignore it
anyway. This also removes the only I/O port use remaining in the driver
allowing it to be built without CONFIG_HAS_IOPORT.

Link: https://lore.kernel.org/all/ZBx5aLo5h546BzBt@intel.com/
Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
      per-subsystem patches may be applied independently

 drivers/video/fbdev/aty/atyfb_base.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
index b02e4e645035..cba2b113b28b 100644
--- a/drivers/video/fbdev/aty/atyfb_base.c
+++ b/drivers/video/fbdev/aty/atyfb_base.c
@@ -3498,11 +3498,6 @@ static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info,
 	if (ret)
 		goto atyfb_setup_generic_fail;
 #endif
-	if (!(aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_EXT_DISP_EN))
-		par->clk_wr_offset = (inb(R_GENMO) & 0x0CU) >> 2;
-	else
-		par->clk_wr_offset = aty_ld_8(CLOCK_CNTL, par) & 0x03U;
-
 	/* according to ATI, we should use clock 3 for acelerated mode */
 	par->clk_wr_offset = 3;
 
-- 
2.39.2


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

* [PATCH v4 38/41] video: handle HAS_IOPORT dependencies
       [not found] <20230516110038.2413224-1-schnelle@linux.ibm.com>
  2023-05-16 11:00 ` [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies Niklas Schnelle
  2023-05-16 11:00 ` [PATCH v4 37/41] fbdev: atyfb: Remove unused clock determination Niklas Schnelle
@ 2023-05-16 11:00 ` Niklas Schnelle
  2023-05-16 17:21   ` Thomas Zimmermann
  2 siblings, 1 reply; 9+ messages in thread
From: Niklas Schnelle @ 2023-05-16 11:00 UTC (permalink / raw)
  To: Arnd Bergmann, Greg Kroah-Hartman, Helge Deller
  Cc: linux-arch, Arnd Bergmann, linux-fbdev, Albert Ou,
	Rafael J. Wysocki, linux-pci, Paul Walmsley, linux-kernel,
	dri-devel, Geert Uytterhoeven, Uwe Kleine-König,
	Bjorn Helgaas, Alan Stern, Mauro Carvalho Chehab, Palmer Dabbelt

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to add HAS_IOPORT as dependency for
those drivers using them and guard inline code in headers.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
      per-subsystem patches may be applied independently

 drivers/video/console/Kconfig |  1 +
 drivers/video/fbdev/Kconfig   | 21 +++++++++++----------
 include/video/vga.h           |  8 ++++++++
 3 files changed, 20 insertions(+), 10 deletions(-)

diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
index 22cea5082ac4..64974eaa3ac5 100644
--- a/drivers/video/console/Kconfig
+++ b/drivers/video/console/Kconfig
@@ -10,6 +10,7 @@ config VGA_CONSOLE
 	depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC &&  !SUPERH && \
 		(!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \
 		!ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML
+	depends on HAS_IOPORT
 	select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE)
 	default y
 	help
diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 96e91570cdd3..a56c57dd839b 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -335,7 +335,7 @@ config FB_IMX
 
 config FB_CYBER2000
 	tristate "CyberPro 2000/2010/5000 support"
-	depends on FB && PCI && (BROKEN || !SPARC64)
+	depends on FB && PCI && HAS_IOPORT && (BROKEN || !SPARC64)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -429,6 +429,7 @@ config FB_FM2
 config FB_ARC
 	tristate "Arc Monochrome LCD board support"
 	depends on FB && (X86 || COMPILE_TEST)
+	depends on HAS_IOPORT
 	select FB_SYS_FILLRECT
 	select FB_SYS_COPYAREA
 	select FB_SYS_IMAGEBLIT
@@ -1332,7 +1333,7 @@ config FB_ATY_BACKLIGHT
 
 config FB_S3
 	tristate "S3 Trio/Virge support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1393,7 +1394,7 @@ config FB_SAVAGE_ACCEL
 
 config FB_SIS
 	tristate "SiS/XGI display support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1424,7 +1425,7 @@ config FB_SIS_315
 
 config FB_VIA
 	tristate "VIA UniChrome (Pro) and Chrome9 display support"
-	depends on FB && PCI && GPIOLIB && I2C && (X86 || COMPILE_TEST)
+	depends on FB && PCI && GPIOLIB && I2C && HAS_IOPORT && (X86 || COMPILE_TEST)
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1463,7 +1464,7 @@ endif
 
 config FB_NEOMAGIC
 	tristate "NeoMagic display support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_MODE_HELPERS
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
@@ -1493,7 +1494,7 @@ config FB_KYRO
 
 config FB_3DFX
 	tristate "3Dfx Banshee/Voodoo3/Voodoo5 display support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_IMAGEBLIT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
@@ -1543,7 +1544,7 @@ config FB_VOODOO1
 
 config FB_VT8623
 	tristate "VIA VT8623 support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1558,7 +1559,7 @@ config FB_VT8623
 
 config FB_TRIDENT
 	tristate "Trident/CyberXXX/CyberBlade support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -1581,7 +1582,7 @@ config FB_TRIDENT
 
 config FB_ARK
 	tristate "ARK 2000PV support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
@@ -2195,7 +2196,7 @@ config FB_SSD1307
 
 config FB_SM712
 	tristate "Silicon Motion SM712 framebuffer support"
-	depends on FB && PCI
+	depends on FB && PCI && HAS_IOPORT
 	select FB_CFB_FILLRECT
 	select FB_CFB_COPYAREA
 	select FB_CFB_IMAGEBLIT
diff --git a/include/video/vga.h b/include/video/vga.h
index 947c0abd04ef..f4b806b85c86 100644
--- a/include/video/vga.h
+++ b/include/video/vga.h
@@ -203,18 +203,26 @@ extern int restore_vga(struct vgastate *state);
 
 static inline unsigned char vga_io_r (unsigned short port)
 {
+#ifdef CONFIG_HAS_IOPORT
 	return inb_p(port);
+#else
+	return 0xff;
+#endif
 }
 
 static inline void vga_io_w (unsigned short port, unsigned char val)
 {
+#ifdef CONFIG_HAS_IOPORT
 	outb_p(val, port);
+#endif
 }
 
 static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
 				  unsigned char val)
 {
+#ifdef CONFIG_HAS_IOPORT
 	outw(VGA_OUT16VAL (val, reg), port);
+#endif
 }
 
 static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
-- 
2.39.2


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

* Re: [PATCH v4 37/41] fbdev: atyfb: Remove unused clock determination
  2023-05-16 11:00 ` [PATCH v4 37/41] fbdev: atyfb: Remove unused clock determination Niklas Schnelle
@ 2023-05-16 12:24   ` Ville Syrjälä
  2023-05-19 14:49     ` Helge Deller
  0 siblings, 1 reply; 9+ messages in thread
From: Ville Syrjälä @ 2023-05-16 12:24 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: linux-arch, linux-fbdev, Albert Ou, Arnd Bergmann,
	Rafael J. Wysocki, Greg Kroah-Hartman, Helge Deller,
	Paul Walmsley, linux-pci, linux-kernel, dri-devel, Alan Stern,
	Uwe Kleine-König, Bjorn Helgaas, Geert Uytterhoeven,
	Mauro Carvalho Chehab, Palmer Dabbelt

On Tue, May 16, 2023 at 01:00:33PM +0200, Niklas Schnelle wrote:
> Just below the removed lines par->clk_wr_offset is hard coded to 3 so
> there is no use in determining a different clock just to then ignore it
> anyway. This also removes the only I/O port use remaining in the driver
> allowing it to be built without CONFIG_HAS_IOPORT.
> 
> Link: https://lore.kernel.org/all/ZBx5aLo5h546BzBt@intel.com/
> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>

Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>

> ---
> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
>       per-subsystem patches may be applied independently
> 
>  drivers/video/fbdev/aty/atyfb_base.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
> index b02e4e645035..cba2b113b28b 100644
> --- a/drivers/video/fbdev/aty/atyfb_base.c
> +++ b/drivers/video/fbdev/aty/atyfb_base.c
> @@ -3498,11 +3498,6 @@ static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info,
>  	if (ret)
>  		goto atyfb_setup_generic_fail;
>  #endif
> -	if (!(aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_EXT_DISP_EN))
> -		par->clk_wr_offset = (inb(R_GENMO) & 0x0CU) >> 2;
> -	else
> -		par->clk_wr_offset = aty_ld_8(CLOCK_CNTL, par) & 0x03U;
> -
>  	/* according to ATI, we should use clock 3 for acelerated mode */
>  	par->clk_wr_offset = 3;
>  
> -- 
> 2.39.2

-- 
Ville Syrjälä
Intel

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

* Re: [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies
  2023-05-16 11:00 ` [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies Niklas Schnelle
@ 2023-05-16 17:13   ` Thomas Zimmermann
  2023-05-16 17:47     ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2023-05-16 17:13 UTC (permalink / raw)
  To: Niklas Schnelle, Arnd Bergmann, Dave Airlie, Gerd Hoffmann,
	David Airlie, Daniel Vetter
  Cc: linux-arch, Arnd Bergmann, Geert Uytterhoeven, Albert Ou,
	Rafael J. Wysocki, Greg Kroah-Hartman, Uwe Kleine-König,
	linux-pci, linux-kernel, dri-devel, virtualization, Alan Stern,
	Paul Walmsley, Bjorn Helgaas, spice-devel, Mauro Carvalho Chehab,
	Palmer Dabbelt


[-- Attachment #1.1: Type: text/plain, Size: 4383 bytes --]

Hi

Am 16.05.23 um 13:00 schrieb Niklas Schnelle:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add HAS_IOPORT as dependency for
> those drivers using them. In the bochs driver there is optional MMIO
> support detected at runtime, warn if this isn't taken when
> HAS_IOPORT is not defined.
> 
> There is also a direct and hard coded use in cirrus.c which according to
> the comment is only necessary during resume.  Let's just skip this as
> for example s390 which doesn't have I/O port support also doesen't
> support suspend/resume.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
>        per-subsystem patches may be applied independently
> 
>   drivers/gpu/drm/qxl/Kconfig   |  1 +
>   drivers/gpu/drm/tiny/bochs.c  | 17 +++++++++++++++++
>   drivers/gpu/drm/tiny/cirrus.c |  2 ++

There are more invocations in gma500. See[1]

[1] 
https://elixir.bootlin.com/linux/v6.3/source/drivers/gpu/drm/gma500/cdv_device.c#L30

>   3 files changed, 20 insertions(+)
> 
> diff --git a/drivers/gpu/drm/qxl/Kconfig b/drivers/gpu/drm/qxl/Kconfig
> index ca3f51c2a8fe..d0e0d440c8d9 100644
> --- a/drivers/gpu/drm/qxl/Kconfig
> +++ b/drivers/gpu/drm/qxl/Kconfig
> @@ -2,6 +2,7 @@
>   config DRM_QXL
>   	tristate "QXL virtual GPU"
>   	depends on DRM && PCI && MMU
> +	depends on HAS_IOPORT
>   	select DRM_KMS_HELPER
>   	select DRM_TTM
>   	select DRM_TTM_HELPER
> diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
> index d254679a136e..3710339407cc 100644
> --- a/drivers/gpu/drm/tiny/bochs.c
> +++ b/drivers/gpu/drm/tiny/bochs.c
> @@ -2,6 +2,7 @@
>   
>   #include <linux/module.h>
>   #include <linux/pci.h>
> +#include <asm/bug.h>

<linux/bug.h> please.

Best regards
Thomas

>   
>   #include <drm/drm_aperture.h>
>   #include <drm/drm_atomic_helper.h>
> @@ -105,7 +106,9 @@ static void bochs_vga_writeb(struct bochs_device *bochs, u16 ioport, u8 val)
>   
>   		writeb(val, bochs->mmio + offset);
>   	} else {
> +#ifdef CONFIG_HAS_IOPORT
>   		outb(val, ioport);
> +#endif
>   	}
>   }
>   
> @@ -119,7 +122,11 @@ static u8 bochs_vga_readb(struct bochs_device *bochs, u16 ioport)
>   
>   		return readb(bochs->mmio + offset);
>   	} else {
> +#ifdef CONFIG_HAS_IOPORT
>   		return inb(ioport);
> +#else
> +		return 0xff;
> +#endif
>   	}
>   }
>   
> @@ -132,8 +139,12 @@ static u16 bochs_dispi_read(struct bochs_device *bochs, u16 reg)
>   
>   		ret = readw(bochs->mmio + offset);
>   	} else {
> +#ifdef CONFIG_HAS_IOPORT
>   		outw(reg, VBE_DISPI_IOPORT_INDEX);
>   		ret = inw(VBE_DISPI_IOPORT_DATA);
> +#else
> +		ret = 0xffff;
> +#endif
>   	}
>   	return ret;
>   }
> @@ -145,8 +156,10 @@ static void bochs_dispi_write(struct bochs_device *bochs, u16 reg, u16 val)
>   
>   		writew(val, bochs->mmio + offset);
>   	} else {
> +#ifdef CONFIG_HAS_IOPORT
>   		outw(reg, VBE_DISPI_IOPORT_INDEX);
>   		outw(val, VBE_DISPI_IOPORT_DATA);
> +#endif
>   	}
>   }
>   
> @@ -229,6 +242,10 @@ static int bochs_hw_init(struct drm_device *dev)
>   			return -ENOMEM;
>   		}
>   	} else {
> +		if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
> +			DRM_ERROR("I/O ports are not supported\n");
> +			return -EIO;
> +		}
>   		ioaddr = VBE_DISPI_IOPORT_INDEX;
>   		iosize = 2;
>   		if (!request_region(ioaddr, iosize, "bochs-drm")) {
> diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
> index 594bc472862f..c65fea049bc7 100644
> --- a/drivers/gpu/drm/tiny/cirrus.c
> +++ b/drivers/gpu/drm/tiny/cirrus.c
> @@ -508,8 +508,10 @@ static void cirrus_crtc_helper_atomic_enable(struct drm_crtc *crtc,
>   
>   	cirrus_mode_set(cirrus, &crtc_state->mode);
>   
> +#ifdef CONFIG_HAS_IOPORT
>   	/* Unblank (needed on S3 resume, vgabios doesn't do it then) */
>   	outb(VGA_AR_ENABLE_DISPLAY, VGA_ATT_W);
> +#endif
>   
>   	drm_dev_exit(idx);
>   }

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH v4 38/41] video: handle HAS_IOPORT dependencies
  2023-05-16 11:00 ` [PATCH v4 38/41] video: handle HAS_IOPORT dependencies Niklas Schnelle
@ 2023-05-16 17:21   ` Thomas Zimmermann
  2023-05-17 12:41     ` Niklas Schnelle
  0 siblings, 1 reply; 9+ messages in thread
From: Thomas Zimmermann @ 2023-05-16 17:21 UTC (permalink / raw)
  To: Niklas Schnelle, Arnd Bergmann, Greg Kroah-Hartman, Helge Deller
  Cc: linux-arch, Arnd Bergmann, linux-fbdev, Albert Ou,
	Rafael J. Wysocki, linux-pci, Uwe Kleine-König, linux-kernel,
	dri-devel, Geert Uytterhoeven, Paul Walmsley, Bjorn Helgaas,
	Alan Stern, Mauro Carvalho Chehab, Palmer Dabbelt


[-- Attachment #1.1: Type: text/plain, Size: 6063 bytes --]

Hi

Am 16.05.23 um 13:00 schrieb Niklas Schnelle:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to add HAS_IOPORT as dependency for
> those drivers using them and guard inline code in headers.
> 
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
>        per-subsystem patches may be applied independently
> 
>   drivers/video/console/Kconfig |  1 +
>   drivers/video/fbdev/Kconfig   | 21 +++++++++++----------
>   include/video/vga.h           |  8 ++++++++

Those are 3 different things. It might be preferable to not handle them 
under the video/ umbrella.

>   3 files changed, 20 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
> index 22cea5082ac4..64974eaa3ac5 100644
> --- a/drivers/video/console/Kconfig
> +++ b/drivers/video/console/Kconfig
> @@ -10,6 +10,7 @@ config VGA_CONSOLE
>   	depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC &&  !SUPERH && \
>   		(!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \
>   		!ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML
> +	depends on HAS_IOPORT
>   	select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE)
>   	default y
>   	help
> diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> index 96e91570cdd3..a56c57dd839b 100644
> --- a/drivers/video/fbdev/Kconfig
> +++ b/drivers/video/fbdev/Kconfig
> @@ -335,7 +335,7 @@ config FB_IMX
>   
>   config FB_CYBER2000
>   	tristate "CyberPro 2000/2010/5000 support"
> -	depends on FB && PCI && (BROKEN || !SPARC64)
> +	depends on FB && PCI && HAS_IOPORT && (BROKEN || !SPARC64)
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -429,6 +429,7 @@ config FB_FM2
>   config FB_ARC
>   	tristate "Arc Monochrome LCD board support"
>   	depends on FB && (X86 || COMPILE_TEST)
> +	depends on HAS_IOPORT
>   	select FB_SYS_FILLRECT
>   	select FB_SYS_COPYAREA
>   	select FB_SYS_IMAGEBLIT
> @@ -1332,7 +1333,7 @@ config FB_ATY_BACKLIGHT
>   
>   config FB_S3
>   	tristate "S3 Trio/Virge support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1393,7 +1394,7 @@ config FB_SAVAGE_ACCEL
>   
>   config FB_SIS
>   	tristate "SiS/XGI display support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1424,7 +1425,7 @@ config FB_SIS_315
>   
>   config FB_VIA
>   	tristate "VIA UniChrome (Pro) and Chrome9 display support"
> -	depends on FB && PCI && GPIOLIB && I2C && (X86 || COMPILE_TEST)
> +	depends on FB && PCI && GPIOLIB && I2C && HAS_IOPORT && (X86 || COMPILE_TEST)
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1463,7 +1464,7 @@ endif
>   
>   config FB_NEOMAGIC
>   	tristate "NeoMagic display support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_MODE_HELPERS
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
> @@ -1493,7 +1494,7 @@ config FB_KYRO
>   
>   config FB_3DFX
>   	tristate "3Dfx Banshee/Voodoo3/Voodoo5 display support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_IMAGEBLIT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
> @@ -1543,7 +1544,7 @@ config FB_VOODOO1
>   
>   config FB_VT8623
>   	tristate "VIA VT8623 support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1558,7 +1559,7 @@ config FB_VT8623
>   
>   config FB_TRIDENT
>   	tristate "Trident/CyberXXX/CyberBlade support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -1581,7 +1582,7 @@ config FB_TRIDENT
>   
>   config FB_ARK
>   	tristate "ARK 2000PV support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> @@ -2195,7 +2196,7 @@ config FB_SSD1307
>   
>   config FB_SM712
>   	tristate "Silicon Motion SM712 framebuffer support"
> -	depends on FB && PCI
> +	depends on FB && PCI && HAS_IOPORT
>   	select FB_CFB_FILLRECT
>   	select FB_CFB_COPYAREA
>   	select FB_CFB_IMAGEBLIT
> diff --git a/include/video/vga.h b/include/video/vga.h
> index 947c0abd04ef..f4b806b85c86 100644
> --- a/include/video/vga.h
> +++ b/include/video/vga.h
> @@ -203,18 +203,26 @@ extern int restore_vga(struct vgastate *state);
>   
>   static inline unsigned char vga_io_r (unsigned short port)
>   {
> +#ifdef CONFIG_HAS_IOPORT
>   	return inb_p(port);
> +#else
> +	return 0xff;
> +#endif
>   }
>   
>   static inline void vga_io_w (unsigned short port, unsigned char val)
>   {
> +#ifdef CONFIG_HAS_IOPORT
>   	outb_p(val, port);
> +#endif
>   }
>   
>   static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
>   				  unsigned char val)
>   {
> +#ifdef CONFIG_HAS_IOPORT
>   	outw(VGA_OUT16VAL (val, reg), port);
> +#endif
>   }

It feels wrong that these helpers silently do nothing. I'd enclose them 
in CONFIG_HAS_IOPORT entirely. The drivers that use them unconditionally 
would then fail to build.

Best regards
Thomas

>   
>   static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)

-- 
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstrasse 146, 90461 Nuernberg, Germany
GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman
HRB 36809 (AG Nuernberg)

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

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

* Re: [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies
  2023-05-16 17:13   ` Thomas Zimmermann
@ 2023-05-16 17:47     ` Arnd Bergmann
  0 siblings, 0 replies; 9+ messages in thread
From: Arnd Bergmann @ 2023-05-16 17:47 UTC (permalink / raw)
  To: Thomas Zimmermann, Niklas Schnelle, Dave Airlie, Gerd Hoffmann,
	Dave Airlie, Daniel Vetter
  Cc: Linux-Arch, Arnd Bergmann, Geert Uytterhoeven, Albert Ou,
	Rafael J . Wysocki, Greg Kroah-Hartman, Uwe Kleine-König,
	linux-pci, linux-kernel, dri-devel, virtualization, Alan Stern,
	Paul Walmsley, Bjorn Helgaas, spice-devel, Mauro Carvalho Chehab,
	Palmer Dabbelt

On Tue, May 16, 2023, at 19:13, Thomas Zimmermann wrote:
>
> Am 16.05.23 um 13:00 schrieb Niklas Schnelle:
>> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
>> not being declared. We thus need to add HAS_IOPORT as dependency for
>> those drivers using them. In the bochs driver there is optional MMIO
>> support detected at runtime, warn if this isn't taken when
>> HAS_IOPORT is not defined.
>> 
>> There is also a direct and hard coded use in cirrus.c which according to
>> the comment is only necessary during resume.  Let's just skip this as
>> for example s390 which doesn't have I/O port support also doesen't
>> support suspend/resume.
>> 
>> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
>> Signed-off-by: Arnd Bergmann <arnd@kernel.org>
>> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
>> ---
>> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
>>        per-subsystem patches may be applied independently
>> 
>>   drivers/gpu/drm/qxl/Kconfig   |  1 +
>>   drivers/gpu/drm/tiny/bochs.c  | 17 +++++++++++++++++
>>   drivers/gpu/drm/tiny/cirrus.c |  2 ++
>
> There are more invocations in gma500. See[1]
>
> [1] 
> https://elixir.bootlin.com/linux/v6.3/source/drivers/gpu/drm/gma500/cdv_device.c#L30

GMA500 already has "depends on X86", so I don't think
any changes are needed there -- x86 is already highly dependent
on I/O ports for a number of reasons.

     Arnd

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

* Re: [PATCH v4 38/41] video: handle HAS_IOPORT dependencies
  2023-05-16 17:21   ` Thomas Zimmermann
@ 2023-05-17 12:41     ` Niklas Schnelle
  0 siblings, 0 replies; 9+ messages in thread
From: Niklas Schnelle @ 2023-05-17 12:41 UTC (permalink / raw)
  To: Thomas Zimmermann, Arnd Bergmann, Greg Kroah-Hartman,
	Helge Deller
  Cc: linux-arch, Arnd Bergmann, linux-fbdev, Albert Ou,
	Rafael J. Wysocki, linux-pci, Uwe Kleine-König, linux-kernel,
	dri-devel, Geert Uytterhoeven, Paul Walmsley, Bjorn Helgaas,
	Alan Stern, Mauro Carvalho Chehab, Palmer Dabbelt

On Tue, 2023-05-16 at 19:21 +0200, Thomas Zimmermann wrote:
> Hi
> 
> Am 16.05.23 um 13:00 schrieb Niklas Schnelle:
> > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> > not being declared. We thus need to add HAS_IOPORT as dependency for
> > those drivers using them and guard inline code in headers.
> > 
> > Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> > Signed-off-by: Arnd Bergmann <arnd@kernel.org>
> > Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> > ---
> > Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
> >        per-subsystem patches may be applied independently
> > 
> >   drivers/video/console/Kconfig |  1 +
> >   drivers/video/fbdev/Kconfig   | 21 +++++++++++----------
> >   include/video/vga.h           |  8 ++++++++
> 
> Those are 3 different things. It might be preferable to not handle them 
> under the video/ umbrella.
> 
> >   3 files changed, 20 insertions(+), 10 deletions(-)
> > 
> > diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig
> > index 22cea5082ac4..64974eaa3ac5 100644
> > --- a/drivers/video/console/Kconfig
> > +++ b/drivers/video/console/Kconfig
> > @@ -10,6 +10,7 @@ config VGA_CONSOLE
> >   	depends on !4xx && !PPC_8xx && !SPARC && !M68K && !PARISC &&  !SUPERH && \
> >   		(!ARM || ARCH_FOOTBRIDGE || ARCH_INTEGRATOR || ARCH_NETWINDER) && \
> >   		!ARM64 && !ARC && !MICROBLAZE && !OPENRISC && !S390 && !UML
> > +	depends on HAS_IOPORT
> >   	select APERTURE_HELPERS if (DRM || FB || VFIO_PCI_CORE)
> >   	default y
> >   	help
> > diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
> > index 96e91570cdd3..a56c57dd839b 100644
> > --- a/drivers/video/fbdev/Kconfig
> > +++ b/drivers/video/fbdev/Kconfig
> > @@ -335,7 +335,7 @@ config FB_IMX
> >   
> >   config FB_CYBER2000
> >   	tristate "CyberPro 2000/2010/5000 support"
> > -	depends on FB && PCI && (BROKEN || !SPARC64)
> > +	depends on FB && PCI && HAS_IOPORT && (BROKEN || !SPARC64)
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> >   	select FB_CFB_IMAGEBLIT
> > @@ -429,6 +429,7 @@ config FB_FM2
> >   config FB_ARC
> >   	tristate "Arc Monochrome LCD board support"
> >   	depends on FB && (X86 || COMPILE_TEST)
> > +	depends on HAS_IOPORT
> >   	select FB_SYS_FILLRECT
> >   	select FB_SYS_COPYAREA
> >   	select FB_SYS_IMAGEBLIT
> > @@ -1332,7 +1333,7 @@ config FB_ATY_BACKLIGHT
> >   
> >   config FB_S3
> >   	tristate "S3 Trio/Virge support"
> > -	depends on FB && PCI
> > +	depends on FB && PCI && HAS_IOPORT
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> >   	select FB_CFB_IMAGEBLIT
> > @@ -1393,7 +1394,7 @@ config FB_SAVAGE_ACCEL
> >   
> >   config FB_SIS
> >   	tristate "SiS/XGI display support"
> > -	depends on FB && PCI
> > +	depends on FB && PCI && HAS_IOPORT
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> >   	select FB_CFB_IMAGEBLIT
> > @@ -1424,7 +1425,7 @@ config FB_SIS_315
> >   
> >   config FB_VIA
> >   	tristate "VIA UniChrome (Pro) and Chrome9 display support"
> > -	depends on FB && PCI && GPIOLIB && I2C && (X86 || COMPILE_TEST)
> > +	depends on FB && PCI && GPIOLIB && I2C && HAS_IOPORT && (X86 || COMPILE_TEST)
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> >   	select FB_CFB_IMAGEBLIT
> > @@ -1463,7 +1464,7 @@ endif
> >   
> >   config FB_NEOMAGIC
> >   	tristate "NeoMagic display support"
> > -	depends on FB && PCI
> > +	depends on FB && PCI && HAS_IOPORT
> >   	select FB_MODE_HELPERS
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> > @@ -1493,7 +1494,7 @@ config FB_KYRO
> >   
> >   config FB_3DFX
> >   	tristate "3Dfx Banshee/Voodoo3/Voodoo5 display support"
> > -	depends on FB && PCI
> > +	depends on FB && PCI && HAS_IOPORT
> >   	select FB_CFB_IMAGEBLIT
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> > @@ -1543,7 +1544,7 @@ config FB_VOODOO1
> >   
> >   config FB_VT8623
> >   	tristate "VIA VT8623 support"
> > -	depends on FB && PCI
> > +	depends on FB && PCI && HAS_IOPORT
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> >   	select FB_CFB_IMAGEBLIT
> > @@ -1558,7 +1559,7 @@ config FB_VT8623
> >   
> >   config FB_TRIDENT
> >   	tristate "Trident/CyberXXX/CyberBlade support"
> > -	depends on FB && PCI
> > +	depends on FB && PCI && HAS_IOPORT
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> >   	select FB_CFB_IMAGEBLIT
> > @@ -1581,7 +1582,7 @@ config FB_TRIDENT
> >   
> >   config FB_ARK
> >   	tristate "ARK 2000PV support"
> > -	depends on FB && PCI
> > +	depends on FB && PCI && HAS_IOPORT
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> >   	select FB_CFB_IMAGEBLIT
> > @@ -2195,7 +2196,7 @@ config FB_SSD1307
> >   
> >   config FB_SM712
> >   	tristate "Silicon Motion SM712 framebuffer support"
> > -	depends on FB && PCI
> > +	depends on FB && PCI && HAS_IOPORT
> >   	select FB_CFB_FILLRECT
> >   	select FB_CFB_COPYAREA
> >   	select FB_CFB_IMAGEBLIT
> > diff --git a/include/video/vga.h b/include/video/vga.h
> > index 947c0abd04ef..f4b806b85c86 100644
> > --- a/include/video/vga.h
> > +++ b/include/video/vga.h
> > @@ -203,18 +203,26 @@ extern int restore_vga(struct vgastate *state);
> >   
> >   static inline unsigned char vga_io_r (unsigned short port)
> >   {
> > +#ifdef CONFIG_HAS_IOPORT
> >   	return inb_p(port);
> > +#else
> > +	return 0xff;
> > +#endif
> >   }
> >   
> >   static inline void vga_io_w (unsigned short port, unsigned char val)
> >   {
> > +#ifdef CONFIG_HAS_IOPORT
> >   	outb_p(val, port);
> > +#endif
> >   }
> >   
> >   static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
> >   				  unsigned char val)
> >   {
> > +#ifdef CONFIG_HAS_IOPORT
> >   	outw(VGA_OUT16VAL (val, reg), port);
> > +#endif
> >   }
> 
> It feels wrong that these helpers silently do nothing. I'd enclose them 
> in CONFIG_HAS_IOPORT entirely. The drivers that use them unconditionally 
> would then fail to build.
> 
> Best regards
> Thomas

Ok yeah, I was looking at the call sites like vga_w_fast() that use
either an HAS_IOPORT dependent function or a writew() based one and so
if I #ifdef the regbase != NULL check we could end up with a NULL
derference but I guess that is kind of what we want since clearly
something is wrong if the driver tries to do I/O port access despite it
not being available.

Thanks,
Niklas

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

* Re: [PATCH v4 37/41] fbdev: atyfb: Remove unused clock determination
  2023-05-16 12:24   ` Ville Syrjälä
@ 2023-05-19 14:49     ` Helge Deller
  0 siblings, 0 replies; 9+ messages in thread
From: Helge Deller @ 2023-05-19 14:49 UTC (permalink / raw)
  To: Ville Syrjälä, Niklas Schnelle
  Cc: linux-arch, linux-fbdev, Albert Ou, Arnd Bergmann,
	Rafael J. Wysocki, Greg Kroah-Hartman, Paul Walmsley, linux-pci,
	linux-kernel, dri-devel, Alan Stern, Uwe Kleine-König,
	Bjorn Helgaas, Geert Uytterhoeven, Mauro Carvalho Chehab,
	Palmer Dabbelt

On 5/16/23 14:24, Ville Syrjälä wrote:
> On Tue, May 16, 2023 at 01:00:33PM +0200, Niklas Schnelle wrote:
>> Just below the removed lines par->clk_wr_offset is hard coded to 3 so
>> there is no use in determining a different clock just to then ignore it
>> anyway. This also removes the only I/O port use remaining in the driver
>> allowing it to be built without CONFIG_HAS_IOPORT.
>>
>> Link: https://lore.kernel.org/all/ZBx5aLo5h546BzBt@intel.com/
>> Suggested-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
>
> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
>
>> ---
>> Note: The HAS_IOPORT Kconfig option was added in v6.4-rc1 so
>>        per-subsystem patches may be applied independently

applied this patch to fbdev git tree.

Thanks!

Helge

>>
>>   drivers/video/fbdev/aty/atyfb_base.c | 5 -----
>>   1 file changed, 5 deletions(-)
>>
>> diff --git a/drivers/video/fbdev/aty/atyfb_base.c b/drivers/video/fbdev/aty/atyfb_base.c
>> index b02e4e645035..cba2b113b28b 100644
>> --- a/drivers/video/fbdev/aty/atyfb_base.c
>> +++ b/drivers/video/fbdev/aty/atyfb_base.c
>> @@ -3498,11 +3498,6 @@ static int atyfb_setup_generic(struct pci_dev *pdev, struct fb_info *info,
>>   	if (ret)
>>   		goto atyfb_setup_generic_fail;
>>   #endif
>> -	if (!(aty_ld_le32(CRTC_GEN_CNTL, par) & CRTC_EXT_DISP_EN))
>> -		par->clk_wr_offset = (inb(R_GENMO) & 0x0CU) >> 2;
>> -	else
>> -		par->clk_wr_offset = aty_ld_8(CLOCK_CNTL, par) & 0x03U;
>> -
>>   	/* according to ATI, we should use clock 3 for acelerated mode */
>>   	par->clk_wr_offset = 3;
>>
>> --
>> 2.39.2
>


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

end of thread, other threads:[~2023-05-19 14:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <20230516110038.2413224-1-schnelle@linux.ibm.com>
2023-05-16 11:00 ` [PATCH v4 07/41] drm: handle HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 17:13   ` Thomas Zimmermann
2023-05-16 17:47     ` Arnd Bergmann
2023-05-16 11:00 ` [PATCH v4 37/41] fbdev: atyfb: Remove unused clock determination Niklas Schnelle
2023-05-16 12:24   ` Ville Syrjälä
2023-05-19 14:49     ` Helge Deller
2023-05-16 11:00 ` [PATCH v4 38/41] video: handle HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 17:21   ` Thomas Zimmermann
2023-05-17 12:41     ` Niklas Schnelle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox