From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Thomas Zimmermann <tzimmermann@suse.de>,
Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Helge Deller <deller@gmx.de>
Cc: linux-arch@vger.kernel.org, "Arnd Bergmann" <arnd@kernel.org>,
linux-fbdev@vger.kernel.org, "Albert Ou" <aou@eecs.berkeley.edu>,
"Rafael J. Wysocki" <rafael@kernel.org>,
linux-pci@vger.kernel.org,
"Paul Walmsley" <paul.walmsley@sifive.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
"Geert Uytterhoeven" <geert@linux-m68k.org>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Alan Stern" <stern@rowland.harvard.edu>,
"Mauro Carvalho Chehab" <mchehab@kernel.org>,
"Palmer Dabbelt" <palmer@dabbelt.com>
Subject: Re: [PATCH v4 38/41] video: handle HAS_IOPORT dependencies
Date: Wed, 17 May 2023 14:41:20 +0200 [thread overview]
Message-ID: <db6db5d49e236548c26fbaa2e16462463814d7ff.camel@linux.ibm.com> (raw)
In-Reply-To: <87ba918b-214b-a58a-ecc4-17b0bd00e8f8@suse.de>
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
next prev parent reply other threads:[~2023-05-17 12:41 UTC|newest]
Thread overview: 88+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-16 10:59 [PATCH v4 00/41] treewide: Remove I/O port accessors for HAS_IOPORT=n Niklas Schnelle
2023-05-16 10:59 ` [PATCH v4 01/41] kgdb: add HAS_IOPORT dependency Niklas Schnelle
2023-05-16 10:59 ` [PATCH v4 02/41] ata: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 13:18 ` Damien Le Moal
2023-05-16 13:23 ` Damien Le Moal
2023-05-19 12:46 ` Niklas Schnelle
2023-05-30 20:51 ` Sergey Shtylyov
2023-05-16 10:59 ` [PATCH v4 03/41] char: impi, tpm: depend on HAS_IOPORT Niklas Schnelle
2023-05-16 11:06 ` Paul Menzel
2023-05-16 11:39 ` Niklas Schnelle
2023-05-16 11:46 ` Greg Kroah-Hartman
2023-05-16 12:35 ` Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 04/41] comedi: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 05/41] counter: " Niklas Schnelle
2023-05-19 1:26 ` William Breathitt Gray
2023-05-19 13:17 ` Niklas Schnelle
2023-05-19 13:38 ` Niklas Schnelle
2023-05-19 13:39 ` Niklas Schnelle
2023-05-19 14:21 ` William Breathitt Gray
2023-05-22 10:42 ` Niklas Schnelle
2023-05-22 11:15 ` William Breathitt Gray
2023-05-16 11:00 ` [PATCH v4 06/41] /dev/port: don't compile file operations without CONFIG_DEVPORT Niklas Schnelle
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 08/41] firmware: dmi-sysfs: handle HAS_IOPORT=n Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 09/41] gpio: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 12:57 ` Linus Walleij
2023-05-17 14:15 ` Bartosz Golaszewski
2023-05-16 11:00 ` [PATCH v4 10/41] hwmon: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 11/41] i2c: " Niklas Schnelle
2023-06-05 10:12 ` Wolfram Sang
2023-06-05 12:01 ` Niklas Schnelle
2023-06-05 20:05 ` Wolfram Sang
2023-06-05 12:01 ` Uwe Kleine-König
2023-06-05 12:55 ` Wolfram Sang
2023-05-16 11:00 ` [PATCH v4 12/41] iio: ad7606: Kconfig: " Niklas Schnelle
2023-05-20 15:40 ` Jonathan Cameron
2023-05-16 11:00 ` [PATCH v4 13/41] Input: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 14/41] Input: gameport: add ISA and " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 15/41] leds: add " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 16/41] media: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 17/41] misc: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 18/41] mISDN: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 19/41] mpt fusion: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 20/41] net: handle " Niklas Schnelle
2023-05-16 15:48 ` Maciej W. Rozycki
2023-05-16 11:00 ` [PATCH v4 21/41] parport: PC style parport depends on HAS_IOPORT Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 22/41] PCI: Make quirk using inw() depend " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 23/41] PCI/sysfs: Make I/O resource " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 24/41] pcmcia: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 25/41] platform: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 26/41] pnp: " Niklas Schnelle
2023-05-16 11:55 ` Rafael J. Wysocki
2023-05-16 11:00 ` [PATCH v4 27/41] power: " Niklas Schnelle
2023-05-16 20:03 ` Sebastian Reichel
2023-05-16 11:00 ` [PATCH v4 28/41] rtc: " Niklas Schnelle
2023-05-16 15:49 ` Maciej W. Rozycki
2023-05-17 8:15 ` Niklas Schnelle
2023-05-17 9:53 ` Maciej W. Rozycki
2023-05-16 11:00 ` [PATCH v4 29/41] scsi: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 30/41] sound: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 31/41] speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 32/41] staging: add HAS_IOPORT dependencies Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 33/41] tty: serial: handle " Niklas Schnelle
2023-05-30 10:48 ` Greg Kroah-Hartman
2023-05-30 11:53 ` Arnd Bergmann
2023-05-30 14:31 ` Greg Kroah-Hartman
2023-05-16 11:00 ` [PATCH v4 34/41] usb: add " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 35/41] usb: uhci: handle " Niklas Schnelle
2023-05-16 16:29 ` Greg Kroah-Hartman
2023-05-16 16:44 ` Arnd Bergmann
2023-05-16 19:51 ` Alan Stern
2023-05-17 8:29 ` Niklas Schnelle
2023-05-16 20:17 ` Alan Stern
2023-05-17 12:17 ` Arnd Bergmann
2023-05-19 11:31 ` Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 36/41] usb: pci-quirks: " Niklas Schnelle
2023-05-30 11:00 ` Niklas Schnelle
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 message]
2023-05-16 11:00 ` [PATCH v4 39/41] watchdog: add " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 40/41] wireless: " Niklas Schnelle
2023-05-16 11:00 ` [PATCH v4 41/41] asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=n Niklas Schnelle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=db6db5d49e236548c26fbaa2e16462463814d7ff.camel@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=aou@eecs.berkeley.edu \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=bhelgaas@google.com \
--cc=deller@gmx.de \
--cc=dri-devel@lists.freedesktop.org \
--cc=geert@linux-m68k.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-fbdev@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=palmer@dabbelt.com \
--cc=paul.walmsley@sifive.com \
--cc=rafael@kernel.org \
--cc=stern@rowland.harvard.edu \
--cc=tzimmermann@suse.de \
--cc=u.kleine-koenig@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).