2023-05-22 10:53:15

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 00/44] treewide: Remove I/O port accessors for HAS_IOPORT=n

Hello Kernel Hackers,

Some platforms such as s390 do not support PCI I/O spaces. On such platforms
I/O space accessors like inb()/outb() are stubs that can never actually work.
The way these stubs are implemented in asm-generic/io.h leads to compiler
warnings because any use will be a NULL pointer access on these platforms. In
a previous patch we tried handling this with a run-time warning on access. This
approach however was rejected by Linus[0] with the argument that this really
should be a compile-time check and, though a much more invasive change, we
believe that is indeed the right approach.

This patch series does exactly that by utilizing the HAS_IOPORT Kconfig option
introduced in v6.4-rc1 via the spun out first patch[1] of a previous version. With
the final patch of this series HAS_IOPORT=n means that inb()/outb() and friends
are not defined. This is also the same approach originally planned by Uwe
Kleine-König as mentioned in commit ce816fa88cca ("Kconfig: rename HAS_IOPORT
to HAS_IOPORT_MAP"). With the HAS_IOPORT Kconfig option merged already
per-subsystem patches can now also be merged independently and only the last
patch needs to wait.

This series builds heavily on an original patch for demonstating the concept by
Arnd Bergmann[2] and incoporates feedback of previous versions [3][4][5][6].

A few patches have already been applied but I've kept those which are not yet
in v6.4-rc3.

This version is based on v6.4-rc3 and is also available on my kernel.org tree
in the has_ioport_v5:

https://git.kernel.org/pub/scm/linux/kernel/git/niks/linux.git

Thanks,
Niklas Schnelle

Changes froom v4:
- Rebased on v6.4-rc3
- ata: Moved #ifdef CONFIG_PATA_ALI into ata_pci_bmdma_clear_simplex()
(Damien Le Moal)
- char: Fixed ipmi typo and split the char subsystem patch into 3 parts for
char, tpm, and ipmi (Greg K-H)
- rtc: Added missing "|| MACH_DECSTATION" (Maciej W. Rozycki)
- usb: Made UHCI_OUT() empty variant "do {} while (0)" and removed unneeded
unconditional UHCI_IN() / UHCI_OUT() uses (Arnd, Alan Stern, Greg K-H)
- usb: pci-quirks: Added missing USB_PCI dependency
- video: Split into vgacon and fbdev patches
- Removed atyfb patch as it was merged in v6.4-rc3

Changes from v3:
- Rebased on v6.4-rc2 which includes the Kconfig HAS_IOPORT option
- Fixed some wrong #ifdef HAS_IOPORT to #ifdef CONFIG_HAS_IOPORT
- Split the usb subsystem patch into 3 parts (Arnd)
- Removed unneeded HAS_IOPORT dependency for SERIO_PARKBD (Geert Uytterhoeven)
- Removed no-op I/O access from FB_ATY (Ville Syrjälä)
- Simplified HAS_IOPORT dependencies for the sound subsystem (Takashi Iwai)
- Slightly reworded the subject line of the last patch which removes
the I/O port accessor functions.

Changes from RFC v2:
- Rebased on v6.3-rc1
- Fixed a NULL pointer dereference in set_io_from_upio() due to accidentially
expanded #ifdef CONFIG_SERIAL_8250_RT288X (kernel test robot)
- Dropped "ACPI: add dependency on HAS_IOPORT" (Bjorn Helgaas)
- Reworded commit message and moved ifdefs for "PCI/sysfs: Make I/O resource
depend on HAS_IOPORT" (Bjorn Helgaas)
- Instead of complete removal inb() etc. are marked with __compiletime_error()
when HAS_IOPORT is unset allowing for better error reporting (Ahmad Fatoum)
- Removed HAS_IOPORT dependency from PCMCIA as I/O port use is optional in at
least PC Card. Instead added HAS_IOPORT on a per driver basis. (Bjorn
Helgaas)
- Made uhci_has_pci_registers() constant 0 if HAS_IOPORT is not defined (Alan
Stern)

Changes from RFC v1:
- Completely dropped the LEGACY_PCI option and replaced its dependencies with
HAS_IOPORT as appropriate
- In the usb subsystem patch I incorporated the feedback from v1 by Alan Stern:
- Used a local macro to nop in*()/out*() in the helpers
- Removed an unnecessary further restriction on CONFIG_USB_UHCI_HCD
- Added a few more subsystems including wireless, ptp, and, mISDN that I had
previously missed due to a blanket !S390.
- Removed blanket !S390 dependencies where they are added due to the I/O port
problem
- In the sound system SND_OPL3_LIB needed to use "depends on" instead of
"select" because of its added HAS_IOPORT dependency
- In the drm subsystem the bochs driver gets #ifdefs instead of a blanket
dependency because its MMIO capable device variant should work without
HAS_IOPORT.

[0] https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/
[1] https://lore.kernel.org/lkml/[email protected]/
[2] https://lore.kernel.org/lkml/CAK8P3a0MNbx-iuzW_-=0ab6-TTZzwV-PT_6gAC1Gp5PgYyHcrA@mail.gmail.com/
[3] https://yhbt.net/lore/all/[email protected]/
[4] https://lore.kernel.org/all/[email protected]/
[5] https://lore.kernel.org/lkml/[email protected]/
[6] https://lore.kernel.org/all/[email protected]/

Niklas Schnelle (44):
kgdb: add HAS_IOPORT dependency
ata: add HAS_IOPORT dependencies
char: add HAS_IOPORT dependencies
char: ipmi: handle HAS_IOPORT dependencies
char: tpm: handle HAS_IOPORT dependencies
comedi: add HAS_IOPORT dependencies
counter: add HAS_IOPORT_MAP dependency
/dev/port: don't compile file operations without CONFIG_DEVPORT
drm: handle HAS_IOPORT dependencies
firmware: dmi-sysfs: handle HAS_IOPORT=n
gpio: add HAS_IOPORT dependencies
hwmon: add HAS_IOPORT dependencies
i2c: add HAS_IOPORT dependencies
iio: ad7606: Kconfig: add HAS_IOPORT dependencies
Input: add HAS_IOPORT dependencies
Input: gameport: add ISA and HAS_IOPORT dependencies
leds: add HAS_IOPORT dependencies
media: add HAS_IOPORT dependencies
misc: add HAS_IOPORT dependencies
mISDN: add HAS_IOPORT dependencies
mpt fusion: add HAS_IOPORT dependencies
net: handle HAS_IOPORT dependencies
parport: PC style parport depends on HAS_IOPORT
PCI: Make quirk using inw() depend on HAS_IOPORT
PCI/sysfs: Make I/O resource depend on HAS_IOPORT
pcmcia: add HAS_IOPORT dependencies
platform: add HAS_IOPORT dependencies
pnp: add HAS_IOPORT dependencies
power: add HAS_IOPORT dependencies
rtc: add HAS_IOPORT dependencies
scsi: add HAS_IOPORT dependencies
sound: add HAS_IOPORT dependencies
speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO
staging: add HAS_IOPORT dependencies
tty: serial: handle HAS_IOPORT dependencies
usb: add HAS_IOPORT dependencies
usb: uhci: handle HAS_IOPORT dependencies
usb: pci-quirks: handle HAS_IOPORT dependencies
vgacon: add HAS_IOPORT dependencies
fbdev: add HAS_IOPORT dependencies
video: Handle HAS_IOPORT dependencies
watchdog: add HAS_IOPORT dependencies
wireless: add HAS_IOPORT dependencies
asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=n

drivers/accessibility/speakup/Kconfig | 1 +
drivers/ata/Kconfig | 28 ++---
drivers/ata/libata-sff.c | 4 +
drivers/char/Kconfig | 3 +-
drivers/char/ipmi/Makefile | 11 +-
drivers/char/ipmi/ipmi_si_intf.c | 3 +-
drivers/char/ipmi/ipmi_si_pci.c | 3 +
drivers/char/mem.c | 6 +-
drivers/char/tpm/Kconfig | 1 +
drivers/char/tpm/tpm_infineon.c | 16 ++-
drivers/char/tpm/tpm_tis_core.c | 19 ++-
drivers/comedi/Kconfig | 103 +++++++++------
drivers/counter/Kconfig | 1 +
drivers/firmware/dmi-sysfs.c | 4 +
drivers/gpio/Kconfig | 26 ++--
drivers/gpu/drm/qxl/Kconfig | 1 +
drivers/gpu/drm/tiny/bochs.c | 17 +++
drivers/gpu/drm/tiny/cirrus.c | 2 +
drivers/hwmon/Kconfig | 21 +++-
drivers/i2c/busses/Kconfig | 31 ++---
drivers/iio/adc/Kconfig | 2 +-
drivers/input/gameport/Kconfig | 4 +-
drivers/input/serio/Kconfig | 1 +
drivers/input/touchscreen/Kconfig | 1 +
drivers/isdn/Kconfig | 1 -
drivers/isdn/hardware/mISDN/Kconfig | 12 +-
drivers/leds/Kconfig | 2 +-
drivers/media/pci/dm1105/Kconfig | 2 +-
drivers/media/radio/Kconfig | 14 ++-
drivers/media/rc/Kconfig | 6 +
drivers/message/fusion/Kconfig | 2 +-
drivers/misc/altera-stapl/Makefile | 3 +-
drivers/misc/altera-stapl/altera.c | 6 +-
drivers/net/Kconfig | 2 +-
drivers/net/arcnet/Kconfig | 2 +-
drivers/net/can/cc770/Kconfig | 1 +
drivers/net/can/sja1000/Kconfig | 1 +
drivers/net/ethernet/3com/Kconfig | 4 +-
drivers/net/ethernet/8390/Kconfig | 6 +-
drivers/net/ethernet/amd/Kconfig | 4 +-
drivers/net/ethernet/fujitsu/Kconfig | 2 +-
drivers/net/ethernet/intel/Kconfig | 2 +-
drivers/net/ethernet/sis/Kconfig | 4 +-
drivers/net/ethernet/smsc/Kconfig | 2 +-
drivers/net/ethernet/ti/Kconfig | 2 +-
drivers/net/ethernet/via/Kconfig | 1 +
drivers/net/ethernet/xircom/Kconfig | 2 +-
drivers/net/fddi/defxx.c | 2 +-
drivers/net/hamradio/Kconfig | 6 +-
drivers/net/wan/Kconfig | 2 +-
drivers/net/wireless/atmel/Kconfig | 2 +-
drivers/net/wireless/intersil/hostap/Kconfig | 2 +-
drivers/parport/Kconfig | 3 +-
drivers/pci/pci-sysfs.c | 4 +
drivers/pci/quirks.c | 2 +
drivers/pcmcia/Kconfig | 5 +-
drivers/platform/chrome/Kconfig | 1 +
drivers/platform/chrome/wilco_ec/Kconfig | 1 +
drivers/pnp/isapnp/Kconfig | 2 +-
drivers/power/reset/Kconfig | 1 +
drivers/rtc/Kconfig | 4 +-
drivers/scsi/Kconfig | 25 ++--
drivers/scsi/aic7xxx/Kconfig.aic79xx | 2 +-
drivers/scsi/aic7xxx/Kconfig.aic7xxx | 2 +-
drivers/scsi/aic94xx/Kconfig | 2 +-
drivers/scsi/megaraid/Kconfig.megaraid | 6 +-
drivers/scsi/mvsas/Kconfig | 2 +-
drivers/scsi/pcmcia/Kconfig | 6 +-
drivers/scsi/qla2xxx/Kconfig | 2 +-
drivers/staging/sm750fb/Kconfig | 2 +-
drivers/staging/vt6655/Kconfig | 2 +-
drivers/tty/Kconfig | 4 +-
drivers/tty/serial/8250/8250_early.c | 4 +
drivers/tty/serial/8250/8250_pci.c | 14 +++
drivers/tty/serial/8250/8250_port.c | 44 +++++--
drivers/tty/serial/8250/Kconfig | 5 +-
drivers/tty/serial/Kconfig | 2 +-
drivers/usb/Kconfig | 10 ++
drivers/usb/core/hcd-pci.c | 2 +
drivers/usb/host/Kconfig | 4 +-
drivers/usb/host/pci-quirks.c | 125 ++++++++++---------
drivers/usb/host/pci-quirks.h | 30 +++--
drivers/usb/host/uhci-hcd.c | 2 +-
drivers/usb/host/uhci-hcd.h | 24 ++--
drivers/video/console/Kconfig | 1 +
drivers/video/fbdev/Kconfig | 22 ++--
drivers/watchdog/Kconfig | 6 +-
include/asm-generic/io.h | 60 +++++++++
include/linux/gameport.h | 9 +-
include/linux/parport.h | 2 +-
include/video/vga.h | 35 ++++--
lib/Kconfig.kgdb | 1 +
net/ax25/Kconfig | 2 +-
sound/drivers/Kconfig | 3 +
sound/isa/Kconfig | 1 +
sound/pci/Kconfig | 45 +++++--
sound/pcmcia/Kconfig | 1 +
97 files changed, 641 insertions(+), 297 deletions(-)


base-commit: 44c026a73be8038f03dbdeef028b642880cf1511
--
2.39.2



2023-05-22 10:53:29

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 04/44] char: ipmi: handle HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to add this dependency and ifdef
sections of code using inb()/outb() as alternative access methods.

Acked-by: Corey Minyard <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/char/ipmi/Makefile | 11 ++++-------
drivers/char/ipmi/ipmi_si_intf.c | 3 ++-
drivers/char/ipmi/ipmi_si_pci.c | 3 +++
3 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/char/ipmi/Makefile b/drivers/char/ipmi/Makefile
index cb6138b8ded9..e0944547c9d0 100644
--- a/drivers/char/ipmi/Makefile
+++ b/drivers/char/ipmi/Makefile
@@ -5,13 +5,10 @@

ipmi_si-y := ipmi_si_intf.o ipmi_kcs_sm.o ipmi_smic_sm.o ipmi_bt_sm.o \
ipmi_si_hotmod.o ipmi_si_hardcode.o ipmi_si_platform.o \
- ipmi_si_port_io.o ipmi_si_mem_io.o
-ifdef CONFIG_PCI
-ipmi_si-y += ipmi_si_pci.o
-endif
-ifdef CONFIG_PARISC
-ipmi_si-y += ipmi_si_parisc.o
-endif
+ ipmi_si_mem_io.o
+ipmi_si-$(CONFIG_HAS_IOPORT) += ipmi_si_port_io.o
+ipmi_si-$(CONFIG_PCI) += ipmi_si_pci.o
+ipmi_si-$(CONFIG_PARISC) += ipmi_si_parisc.o

obj-$(CONFIG_IPMI_HANDLER) += ipmi_msghandler.o
obj-$(CONFIG_IPMI_DEVICE_INTERFACE) += ipmi_devintf.o
diff --git a/drivers/char/ipmi/ipmi_si_intf.c b/drivers/char/ipmi/ipmi_si_intf.c
index abddd7e43a9a..edbbdb804913 100644
--- a/drivers/char/ipmi/ipmi_si_intf.c
+++ b/drivers/char/ipmi/ipmi_si_intf.c
@@ -1882,7 +1882,8 @@ int ipmi_si_add_smi(struct si_sm_io *io)
}

if (!io->io_setup) {
- if (io->addr_space == IPMI_IO_ADDR_SPACE) {
+ if (IS_ENABLED(CONFIG_HAS_IOPORT) &&
+ io->addr_space == IPMI_IO_ADDR_SPACE) {
io->io_setup = ipmi_si_port_setup;
} else if (io->addr_space == IPMI_MEM_ADDR_SPACE) {
io->io_setup = ipmi_si_mem_setup;
diff --git a/drivers/char/ipmi/ipmi_si_pci.c b/drivers/char/ipmi/ipmi_si_pci.c
index 74fa2055868b..b83d55685b22 100644
--- a/drivers/char/ipmi/ipmi_si_pci.c
+++ b/drivers/char/ipmi/ipmi_si_pci.c
@@ -97,6 +97,9 @@ static int ipmi_pci_probe(struct pci_dev *pdev,
}

if (pci_resource_flags(pdev, 0) & IORESOURCE_IO) {
+ if (!IS_ENABLED(CONFIG_HAS_IOPORT))
+ return -ENXIO;
+
io.addr_space = IPMI_IO_ADDR_SPACE;
io.io_setup = ipmi_si_port_setup;
} else {
--
2.39.2


2023-05-22 10:53:29

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 09/44] drm: handle HAS_IOPORT dependencies

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 <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
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


2023-05-22 10:53:33

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 15/44] Input: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/input/serio/Kconfig | 1 +
drivers/input/touchscreen/Kconfig | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig
index f39b7b3f7942..17edc1597446 100644
--- a/drivers/input/serio/Kconfig
+++ b/drivers/input/serio/Kconfig
@@ -148,6 +148,7 @@ config HIL_MLC
config SERIO_PCIPS2
tristate "PCI PS/2 keyboard and PS/2 mouse controller"
depends on PCI
+ depends on HAS_IOPORT
help
Say Y here if you have a Mobility Docking station with PS/2
keyboard and mice ports.
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig
index 143ff43c67ae..c2cbd332af1d 100644
--- a/drivers/input/touchscreen/Kconfig
+++ b/drivers/input/touchscreen/Kconfig
@@ -700,6 +700,7 @@ config TOUCHSCREEN_INEXIO

config TOUCHSCREEN_MK712
tristate "ICS MicroClock MK712 touchscreen"
+ depends on ISA
help
Say Y here if you have the ICS MicroClock MK712 touchscreen
controller chip in your system.
--
2.39.2


2023-05-22 10:53:40

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 02/44] ata: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Damien Le Moal <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/ata/Kconfig | 28 ++++++++++++++--------------
drivers/ata/libata-sff.c | 4 ++++
2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index 42b51c9812a0..c521cdc51f8c 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -557,7 +557,7 @@ comment "PATA SFF controllers with BMDMA"

config PATA_ALI
tristate "ALi PATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select PATA_TIMINGS
help
This option enables support for the ALi ATA interfaces
@@ -567,7 +567,7 @@ config PATA_ALI

config PATA_AMD
tristate "AMD/NVidia PATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select PATA_TIMINGS
help
This option enables support for the AMD and NVidia PATA
@@ -585,7 +585,7 @@ config PATA_ARASAN_CF

config PATA_ARTOP
tristate "ARTOP 6210/6260 PATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This option enables support for ARTOP PATA controllers.

@@ -612,7 +612,7 @@ config PATA_ATP867X

config PATA_CMD64X
tristate "CMD64x PATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select PATA_TIMINGS
help
This option enables support for the CMD64x series chips
@@ -659,7 +659,7 @@ config PATA_CS5536

config PATA_CYPRESS
tristate "Cypress CY82C693 PATA support (Very Experimental)"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select PATA_TIMINGS
help
This option enables support for the Cypress/Contaq CY82C693
@@ -707,7 +707,7 @@ config PATA_HPT366

config PATA_HPT37X
tristate "HPT 370/370A/371/372/374/302 PATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This option enables support for the majority of the later HPT
PATA controllers via the new ATA layer.
@@ -716,7 +716,7 @@ config PATA_HPT37X

config PATA_HPT3X2N
tristate "HPT 371N/372N/302N PATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This option enables support for the N variant HPT PATA
controllers via the new ATA layer.
@@ -819,7 +819,7 @@ config PATA_MPC52xx

config PATA_NETCELL
tristate "NETCELL Revolution RAID support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This option enables support for the Netcell Revolution RAID
PATA controller.
@@ -855,7 +855,7 @@ config PATA_OLDPIIX

config PATA_OPTIDMA
tristate "OPTI FireStar PATA support (Very Experimental)"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This option enables DMA/PIO support for the later OPTi
controllers found on some old motherboards and in some
@@ -865,7 +865,7 @@ config PATA_OPTIDMA

config PATA_PDC2027X
tristate "Promise PATA 2027x support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This option enables support for Promise PATA pdc20268 to pdc20277 host adapters.

@@ -873,7 +873,7 @@ config PATA_PDC2027X

config PATA_PDC_OLD
tristate "Older Promise PATA controller support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This option enables support for the Promise 20246, 20262, 20263,
20265 and 20267 adapters.
@@ -901,7 +901,7 @@ config PATA_RDC

config PATA_SC1200
tristate "SC1200 PATA support"
- depends on PCI && (X86_32 || COMPILE_TEST)
+ depends on PCI && (X86_32 || COMPILE_TEST) && HAS_IOPORT
help
This option enables support for the NatSemi/AMD SC1200 SoC
companion chip used with the Geode processor family.
@@ -919,7 +919,7 @@ config PATA_SCH

config PATA_SERVERWORKS
tristate "SERVERWORKS OSB4/CSB5/CSB6/HT1000 PATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This option enables support for the Serverworks OSB4/CSB5/CSB6 and
HT1000 PATA controllers, via the new ATA layer.
@@ -1183,7 +1183,7 @@ config ATA_GENERIC

config PATA_LEGACY
tristate "Legacy ISA PATA support (Experimental)"
- depends on (ISA || PCI)
+ depends on (ISA || PCI) && HAS_IOPORT
select PATA_TIMINGS
help
This option enables support for ISA/VLB/PCI bus legacy PATA
diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
index 9d28badfe41d..c8cb7ed28f83 100644
--- a/drivers/ata/libata-sff.c
+++ b/drivers/ata/libata-sff.c
@@ -3042,6 +3042,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma_port_start32);
*/
int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
{
+#ifdef CONFIG_HAS_IOPORT
unsigned long bmdma = pci_resource_start(pdev, 4);
u8 simplex;

@@ -3054,6 +3055,9 @@ int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
if (simplex & 0x80)
return -EOPNOTSUPP;
return 0;
+#else
+ return -ENOENT;
+#endif /* CONFIG_HAS_IOPORT */
}
EXPORT_SYMBOL_GPL(ata_pci_bmdma_clear_simplex);

--
2.39.2


2023-05-22 10:53:43

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 16/44] Input: gameport: add ISA and HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. As ISA already implies HAS_IOPORT we can simply add
this dependency and guard sections of code using inb()/outb() as
alternative access methods.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/input/gameport/Kconfig | 4 +++-
include/linux/gameport.h | 9 +++++++--
2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/input/gameport/Kconfig b/drivers/input/gameport/Kconfig
index 5a2c2fb3217d..fe73b26e647a 100644
--- a/drivers/input/gameport/Kconfig
+++ b/drivers/input/gameport/Kconfig
@@ -25,6 +25,7 @@ if GAMEPORT

config GAMEPORT_NS558
tristate "Classic ISA and PnP gameport support"
+ depends on ISA
help
Say Y here if you have an ISA or PnP gameport.

@@ -35,6 +36,7 @@ config GAMEPORT_NS558

config GAMEPORT_L4
tristate "PDPI Lightning 4 gamecard support"
+ depends on ISA
help
Say Y here if you have a PDPI Lightning 4 gamecard.

@@ -53,7 +55,7 @@ config GAMEPORT_EMU10K1

config GAMEPORT_FM801
tristate "ForteMedia FM801 gameport support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
Say Y here if you have ForteMedia FM801 PCI audio controller
(Abit AU10, Genius Sound Maker, HP Workstation zx2000,
diff --git a/include/linux/gameport.h b/include/linux/gameport.h
index 8c2f00018e89..4d5720022b63 100644
--- a/include/linux/gameport.h
+++ b/include/linux/gameport.h
@@ -167,16 +167,21 @@ static inline void gameport_trigger(struct gameport *gameport)
{
if (gameport->trigger)
gameport->trigger(gameport);
+#ifdef CONFIG_HAS_IOPORT
else
outb(0xff, gameport->io);
+#endif
}

static inline unsigned char gameport_read(struct gameport *gameport)
{
if (gameport->read)
return gameport->read(gameport);
- else
- return inb(gameport->io);
+#ifdef CONFIG_HAS_IOPORT
+ return inb(gameport->io);
+#else
+ return 0xff;
+#endif
}

static inline int gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
--
2.39.2


2023-05-22 10:53:52

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 23/44] parport: PC style parport depends on HAS_IOPORT

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. As PC style parport uses these functions we need to
handle this dependency.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/parport/Kconfig | 3 ++-
include/linux/parport.h | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/parport/Kconfig b/drivers/parport/Kconfig
index 5561362224e2..631c193fe42c 100644
--- a/drivers/parport/Kconfig
+++ b/drivers/parport/Kconfig
@@ -42,7 +42,8 @@ if PARPORT

config PARPORT_PC
tristate "PC-style hardware"
- depends on ARCH_MIGHT_HAVE_PC_PARPORT || (PCI && !S390)
+ depends on ARCH_MIGHT_HAVE_PC_PARPORT || PCI
+ depends on HAS_IOPORT
help
You should say Y here if you have a PC-style parallel port. All
IBM PC compatible computers and some Alphas have PC-style
diff --git a/include/linux/parport.h b/include/linux/parport.h
index a0bc9e0267b7..fff39bc30629 100644
--- a/include/linux/parport.h
+++ b/include/linux/parport.h
@@ -514,7 +514,7 @@ extern int parport_device_proc_register(struct pardevice *device);
extern int parport_device_proc_unregister(struct pardevice *device);

/* If PC hardware is the only type supported, we can optimise a bit. */
-#if !defined(CONFIG_PARPORT_NOT_PC)
+#if !defined(CONFIG_PARPORT_NOT_PC) && defined(CONFIG_PARPORT_PC)

#include <linux/parport_pc.h>
#define parport_write_data(p,x) parport_pc_write_data(p,x)
--
2.39.2


2023-05-22 10:53:54

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 24/44] PCI: Make quirk using inw() depend on HAS_IOPORT

In the future inw() and friends will not be compiled on architectures
without I/O port support.

Acked-by: Bjorn Helgaas <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/pci/quirks.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index f4e2a88729fd..81fb75f128f7 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -268,6 +268,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_2, quirk_isa_d
DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_CBUS_3, quirk_isa_dma_hangs);
#endif

+#ifdef CONFIG_HAS_IOPORT
/*
* Intel NM10 "TigerPoint" LPC PM1a_STS.BM_STS must be clear
* for some HT machines to use C4 w/o hanging.
@@ -287,6 +288,7 @@ static void quirk_tigerpoint_bm_sts(struct pci_dev *dev)
}
}
DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_TGP_LPC, quirk_tigerpoint_bm_sts);
+#endif

/* Chipsets where PCI->PCI transfers vanish or hang */
static void quirk_nopcipci(struct pci_dev *dev)
--
2.39.2


2023-05-22 10:54:09

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 21/44] mpt fusion: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/message/fusion/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/message/fusion/Kconfig b/drivers/message/fusion/Kconfig
index a3d0288fd0e2..88a6e506a942 100644
--- a/drivers/message/fusion/Kconfig
+++ b/drivers/message/fusion/Kconfig
@@ -2,7 +2,7 @@

menuconfig FUSION
bool "Fusion MPT device support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
Say Y here to get to see options for Fusion Message
Passing Technology (MPT) drivers.
--
2.39.2


2023-05-22 10:54:14

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 12/44] hwmon: add HAS_IOPORT dependencies

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.

Acked-by: Guenter Roeck <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/hwmon/Kconfig | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
index fc640201a2de..20bde0d888f9 100644
--- a/drivers/hwmon/Kconfig
+++ b/drivers/hwmon/Kconfig
@@ -578,6 +578,7 @@ config SENSORS_SPARX5

config SENSORS_F71805F
tristate "Fintek F71805F/FG, F71806F/FG and F71872F/FG"
+ depends on HAS_IOPORT
depends on !PPC
help
If you say yes here you get support for hardware monitoring
@@ -589,6 +590,7 @@ config SENSORS_F71805F

config SENSORS_F71882FG
tristate "Fintek F71882FG and compatibles"
+ depends on HAS_IOPORT
depends on !PPC
help
If you say yes here you get support for hardware monitoring
@@ -801,6 +803,7 @@ config SENSORS_CORETEMP

config SENSORS_IT87
tristate "ITE IT87xx and compatibles"
+ depends on HAS_IOPORT
depends on !PPC
select HWMON_VID
help
@@ -1465,6 +1468,7 @@ config SENSORS_LM95245

config SENSORS_PC87360
tristate "National Semiconductor PC87360 family"
+ depends on HAS_IOPORT
depends on !PPC
select HWMON_VID
help
@@ -1479,6 +1483,7 @@ config SENSORS_PC87360

config SENSORS_PC87427
tristate "National Semiconductor PC87427"
+ depends on HAS_IOPORT
depends on !PPC
help
If you say yes here you get access to the hardware monitoring
@@ -1510,6 +1515,7 @@ config SENSORS_NTC_THERMISTOR

config SENSORS_NCT6683
tristate "Nuvoton NCT6683D"
+ depends on HAS_IOPORT
depends on !PPC
help
If you say yes here you get support for the hardware monitoring
@@ -1531,6 +1537,7 @@ config SENSORS_NCT6775_CORE

config SENSORS_NCT6775
tristate "Platform driver for Nuvoton NCT6775F and compatibles"
+ depends on HAS_IOPORT
depends on !PPC
depends on ACPI || ACPI=n
select HWMON_VID
@@ -1767,7 +1774,7 @@ config SENSORS_SHTC1

config SENSORS_SIS5595
tristate "Silicon Integrated Systems Corp. SiS5595"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes here you get support for the integrated sensors in
SiS5595 South Bridges.
@@ -1787,6 +1794,7 @@ config SENSORS_SY7636A

config SENSORS_DME1737
tristate "SMSC DME1737, SCH311x and compatibles"
+ depends on HAS_IOPORT
depends on I2C && !PPC
select HWMON_VID
help
@@ -1843,6 +1851,7 @@ config SENSORS_EMC6W201

config SENSORS_SMSC47M1
tristate "SMSC LPC47M10x and compatibles"
+ depends on HAS_IOPORT
depends on !PPC
help
If you say yes here you get support for the integrated fan
@@ -1877,6 +1886,7 @@ config SENSORS_SMSC47M192

config SENSORS_SMSC47B397
tristate "SMSC LPC47B397-NC"
+ depends on HAS_IOPORT
depends on !PPC
help
If you say yes here you get support for the SMSC LPC47B397-NC
@@ -1890,6 +1900,7 @@ config SENSORS_SCH56XX_COMMON

config SENSORS_SCH5627
tristate "SMSC SCH5627"
+ depends on HAS_IOPORT
depends on !PPC && WATCHDOG
select SENSORS_SCH56XX_COMMON
select WATCHDOG_CORE
@@ -1903,6 +1914,7 @@ config SENSORS_SCH5627

config SENSORS_SCH5636
tristate "SMSC SCH5636"
+ depends on HAS_IOPORT
depends on !PPC && WATCHDOG
select SENSORS_SCH56XX_COMMON
select WATCHDOG_CORE
@@ -2155,7 +2167,7 @@ config SENSORS_VIA_CPUTEMP

config SENSORS_VIA686A
tristate "VIA686A"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes here you get support for the integrated sensors in
Via 686A/B South Bridges.
@@ -2165,6 +2177,7 @@ config SENSORS_VIA686A

config SENSORS_VT1211
tristate "VIA VT1211"
+ depends on HAS_IOPORT
depends on !PPC
select HWMON_VID
help
@@ -2176,7 +2189,7 @@ config SENSORS_VT1211

config SENSORS_VT8231
tristate "VIA VT8231"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select HWMON_VID
help
If you say yes here then you get support for the integrated sensors
@@ -2284,6 +2297,7 @@ config SENSORS_W83L786NG

config SENSORS_W83627HF
tristate "Winbond W83627HF, W83627THF, W83637HF, W83687THF, W83697HF"
+ depends on HAS_IOPORT
depends on !PPC
select HWMON_VID
help
@@ -2296,6 +2310,7 @@ config SENSORS_W83627HF

config SENSORS_W83627EHF
tristate "Winbond W83627EHF/EHG/DHG/UHG, W83667HG"
+ depends on HAS_IOPORT
depends on !PPC
select HWMON_VID
help
--
2.39.2


2023-05-22 10:54:20

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 20/44] mISDN: add HAS_IOPORT dependencies

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. With that the !S390 dependency on ISDN can be
removed as all drivers without HAS_IOPORT requirement now build.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/isdn/Kconfig | 1 -
drivers/isdn/hardware/mISDN/Kconfig | 12 ++++++------
2 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/drivers/isdn/Kconfig b/drivers/isdn/Kconfig
index 2690e2c5a158..6fd1b3f84a29 100644
--- a/drivers/isdn/Kconfig
+++ b/drivers/isdn/Kconfig
@@ -6,7 +6,6 @@
menuconfig ISDN
bool "ISDN support"
depends on NET && NETDEVICES
- depends on !S390 && !UML
help
ISDN ("Integrated Services Digital Network", called RNIS in France)
is a fully digital telephone service that can be used for voice and
diff --git a/drivers/isdn/hardware/mISDN/Kconfig b/drivers/isdn/hardware/mISDN/Kconfig
index 078eeadf707a..a35bff8a93f5 100644
--- a/drivers/isdn/hardware/mISDN/Kconfig
+++ b/drivers/isdn/hardware/mISDN/Kconfig
@@ -14,7 +14,7 @@ config MISDN_HFCPCI

config MISDN_HFCMULTI
tristate "Support for HFC multiport cards (HFC-4S/8S/E1)"
- depends on PCI || CPM1
+ depends on (PCI || CPM1) && HAS_IOPORT
depends on MISDN
help
Enable support for cards with Cologne Chip AG's HFC multiport
@@ -43,7 +43,7 @@ config MISDN_HFCUSB
config MISDN_AVMFRITZ
tristate "Support for AVM FRITZ!CARD PCI"
depends on MISDN
- depends on PCI
+ depends on PCI && HAS_IOPORT
select MISDN_IPAC
help
Enable support for AVMs FRITZ!CARD PCI cards
@@ -51,7 +51,7 @@ config MISDN_AVMFRITZ
config MISDN_SPEEDFAX
tristate "Support for Sedlbauer Speedfax+"
depends on MISDN
- depends on PCI
+ depends on PCI && HAS_IOPORT
select MISDN_IPAC
select MISDN_ISAR
help
@@ -60,7 +60,7 @@ config MISDN_SPEEDFAX
config MISDN_INFINEON
tristate "Support for cards with Infineon chipset"
depends on MISDN
- depends on PCI
+ depends on PCI && HAS_IOPORT
select MISDN_IPAC
help
Enable support for cards with ISAC + HSCX, IPAC or IPAC-SX
@@ -69,14 +69,14 @@ config MISDN_INFINEON
config MISDN_W6692
tristate "Support for cards with Winbond 6692"
depends on MISDN
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
Enable support for Winbond 6692 PCI chip based cards.

config MISDN_NETJET
tristate "Support for NETJet cards"
depends on MISDN
- depends on PCI
+ depends on PCI && HAS_IOPORT
depends on TTY
select MISDN_IPAC
select MISDN_HDLC
--
2.39.2


2023-05-22 10:54:36

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 26/44] pcmcia: add HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. Add dependencies for those drivers that use them.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/pcmcia/Kconfig | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig
index 44c16508ef14..e72419d7e72e 100644
--- a/drivers/pcmcia/Kconfig
+++ b/drivers/pcmcia/Kconfig
@@ -5,7 +5,6 @@

menuconfig PCCARD
tristate "PCCard (PCMCIA/CardBus) support"
- depends on !UML
help
Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
computer. These are credit-card size devices such as network cards,
@@ -113,7 +112,7 @@ config YENTA_TOSHIBA

config PD6729
tristate "Cirrus PD6729 compatible bridge support"
- depends on PCMCIA && PCI
+ depends on PCMCIA && PCI && HAS_IOPORT
select PCCARD_NONSTATIC
help
This provides support for the Cirrus PD6729 PCI-to-PCMCIA bridge
@@ -121,7 +120,7 @@ config PD6729

config I82092
tristate "i82092 compatible bridge support"
- depends on PCMCIA && PCI
+ depends on PCMCIA && PCI && HAS_IOPORT
select PCCARD_NONSTATIC
help
This provides support for the Intel I82092AA PCI-to-PCMCIA bridge device,
--
2.39.2


2023-05-22 10:55:01

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 29/44] power: add HAS_IOPORT dependencies

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.

Acked-by: Sebastian Reichel <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/power/reset/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/power/reset/Kconfig b/drivers/power/reset/Kconfig
index 8c87eeda0fec..fff07b2bd77b 100644
--- a/drivers/power/reset/Kconfig
+++ b/drivers/power/reset/Kconfig
@@ -158,6 +158,7 @@ config POWER_RESET_OXNAS
config POWER_RESET_PIIX4_POWEROFF
tristate "Intel PIIX4 power-off driver"
depends on PCI
+ depends on HAS_IOPORT
depends on MIPS || COMPILE_TEST
help
This driver supports powering off a system using the Intel PIIX4
--
2.39.2


2023-05-22 11:03:54

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 13/44] i2c: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/i2c/busses/Kconfig | 31 +++++++++++++++++--------------
1 file changed, 17 insertions(+), 14 deletions(-)

diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index 87600b4aacb3..6e89944fb8e9 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -18,7 +18,7 @@ config I2C_CCGX_UCSI

config I2C_ALI1535
tristate "ALI 1535"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the SMB
Host controller on Acer Labs Inc. (ALI) M1535 South Bridges. The SMB
@@ -30,7 +30,7 @@ config I2C_ALI1535

config I2C_ALI1563
tristate "ALI 1563"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the SMB
Host controller on Acer Labs Inc. (ALI) M1563 South Bridges. The SMB
@@ -42,7 +42,7 @@ config I2C_ALI1563

config I2C_ALI15X3
tristate "ALI 15x3"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the
Acer Labs Inc. (ALI) M1514 and M1543 motherboard I2C interfaces.
@@ -52,7 +52,7 @@ config I2C_ALI15X3

config I2C_AMD756
tristate "AMD 756/766/768/8111 and nVidia nForce"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the AMD
756/766/768 mainboard I2C interfaces. The driver also includes
@@ -77,7 +77,7 @@ config I2C_AMD756_S4882

config I2C_AMD8111
tristate "AMD 8111"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the
second (SMBus 2.0) AMD 8111 mainboard I2C interface.
@@ -107,7 +107,7 @@ config I2C_HIX5HD2

config I2C_I801
tristate "Intel 82801 (ICH/PCH)"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select P2SB if X86
select CHECK_SIGNATURE if X86 && DMI
select I2C_SMBUS
@@ -164,7 +164,7 @@ config I2C_I801

config I2C_ISCH
tristate "Intel SCH SMBus 1.0"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select LPC_SCH
help
Say Y here if you want to use SMBus controller on the Intel SCH
@@ -185,7 +185,7 @@ config I2C_ISMT

config I2C_PIIX4
tristate "Intel PIIX4 and compatible (ATI/AMD/Serverworks/Broadcom/SMSC)"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the Intel
PIIX4 family of mainboard I2C interfaces. Specifically, the following
@@ -231,7 +231,7 @@ config I2C_CHT_WC

config I2C_NFORCE2
tristate "Nvidia nForce2, nForce3 and nForce4"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the Nvidia
nForce2, nForce3 and nForce4 families of mainboard I2C interfaces.
@@ -264,7 +264,7 @@ config I2C_NVIDIA_GPU

config I2C_SIS5595
tristate "SiS 5595"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the
SiS5595 SMBus (a subset of I2C) interface.
@@ -274,7 +274,7 @@ config I2C_SIS5595

config I2C_SIS630
tristate "SiS 630/730/964"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the
SiS630, SiS730 and SiS964 SMBus (a subset of I2C) interface.
@@ -284,7 +284,7 @@ config I2C_SIS630

config I2C_SIS96X
tristate "SiS 96x"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the SiS
96x SMBus (a subset of I2C) interfaces. Specifically, the following
@@ -302,7 +302,7 @@ config I2C_SIS96X

config I2C_VIA
tristate "VIA VT82C586B"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select I2C_ALGOBIT
help
If you say yes to this option, support will be included for the VIA
@@ -313,7 +313,7 @@ config I2C_VIA

config I2C_VIAPRO
tristate "VIA VT82C596/82C686/82xx and CX700/VX8xx/VX900"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you say yes to this option, support will be included for the VIA
VT82C596 and later SMBus interface. Specifically, the following
@@ -884,6 +884,7 @@ config I2C_NPCM

config I2C_OCORES
tristate "OpenCores I2C Controller"
+ depends on HAS_IOPORT
help
If you say yes to this option, support will be included for the
OpenCores I2C controller. For details see
@@ -1277,6 +1278,7 @@ config I2C_CP2615
config I2C_PARPORT
tristate "Parallel port adapter"
depends on PARPORT
+ depends on HAS_IOPORT
select I2C_ALGOBIT
select I2C_SMBUS
help
@@ -1385,6 +1387,7 @@ config I2C_ICY
config I2C_MLXCPLD
tristate "Mellanox I2C driver"
depends on X86_64 || COMPILE_TEST
+ depends on HAS_IOPORT
help
This exposes the Mellanox platform I2C busses to the linux I2C layer
for X86 based systems.
--
2.39.2


2023-05-22 11:03:54

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 11/44] gpio: add HAS_IOPORT dependencies

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.

Reviewed-by: Linus Walleij <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/gpio/Kconfig | 26 +++++++++++++-------------
1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
index 5521f060d58e..a470ec8d617b 100644
--- a/drivers/gpio/Kconfig
+++ b/drivers/gpio/Kconfig
@@ -704,18 +704,6 @@ config GPIO_VISCONTI
help
Say yes here to support GPIO on Tohisba Visconti.

-config GPIO_VX855
- tristate "VIA VX855/VX875 GPIO"
- depends on (X86 || COMPILE_TEST) && PCI
- select MFD_CORE
- select MFD_VX855
- help
- Support access to the VX855/VX875 GPIO lines through the GPIO library.
-
- This driver provides common support for accessing the device.
- Additional drivers must be enabled in order to use the
- functionality of the device.
-
config GPIO_WCD934X
tristate "Qualcomm Technologies Inc WCD9340/WCD9341 GPIO controller driver"
depends on MFD_WCD934X && OF_GPIO
@@ -835,7 +823,19 @@ config GPIO_IDT3243X
endmenu

menu "Port-mapped I/O GPIO drivers"
- depends on X86 # Unconditional I/O space access
+ depends on X86 && HAS_IOPORT # I/O space access
+
+config GPIO_VX855
+ tristate "VIA VX855/VX875 GPIO"
+ depends on PCI
+ select MFD_CORE
+ select MFD_VX855
+ help
+ Support access to the VX855/VX875 GPIO lines through the GPIO library.
+
+ This driver provides common support for accessing the device.
+ Additional drivers must be enabled in order to use the
+ functionality of the device.

config GPIO_I8255
tristate
--
2.39.2


2023-05-22 11:05:59

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 25/44] PCI/sysfs: Make I/O resource depend on HAS_IOPORT

If legacy I/O spaces are not supported simply return an error when
trying to access them via pci_resource_io(). This allows inb() and
friends to become undefined when they are known at compile time to be
non-functional in a later patch.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Bjorn Helgaas <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/pci/pci-sysfs.c | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c
index ab32a91f287b..d9eede2dbc0e 100644
--- a/drivers/pci/pci-sysfs.c
+++ b/drivers/pci/pci-sysfs.c
@@ -1083,6 +1083,7 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
struct bin_attribute *attr, char *buf,
loff_t off, size_t count, bool write)
{
+#ifdef CONFIG_HAS_IOPORT
struct pci_dev *pdev = to_pci_dev(kobj_to_dev(kobj));
int bar = (unsigned long)attr->private;
unsigned long port = off;
@@ -1116,6 +1117,9 @@ static ssize_t pci_resource_io(struct file *filp, struct kobject *kobj,
return 4;
}
return -EINVAL;
+#else
+ return -ENXIO;
+#endif
}

static ssize_t pci_read_resource_io(struct file *filp, struct kobject *kobj,
--
2.39.2


2023-05-22 11:06:07

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 30/44] rtc: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/rtc/Kconfig | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
index 753872408615..a38a919b3f15 100644
--- a/drivers/rtc/Kconfig
+++ b/drivers/rtc/Kconfig
@@ -956,6 +956,7 @@ comment "Platform RTC drivers"
config RTC_DRV_CMOS
tristate "PC-style 'CMOS'"
depends on X86 || ARM || PPC || MIPS || SPARC64
+ depends on HAS_IOPORT || MACH_DECSTATION
default y if X86
select RTC_MC146818_LIB
help
@@ -976,6 +977,7 @@ config RTC_DRV_CMOS
config RTC_DRV_ALPHA
bool "Alpha PC-style CMOS"
depends on ALPHA
+ depends on HAS_IOPORT
select RTC_MC146818_LIB
default y
help
@@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242

config RTC_DRV_BQ4802
tristate "TI BQ4802"
- depends on HAS_IOMEM
+ depends on HAS_IOMEM && HAS_IOPORT
help
If you say Y here you will get support for the TI
BQ4802 RTC chip.
--
2.39.2


2023-05-22 11:06:09

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 27/44] platform: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Tzung-Bi Shih <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/platform/chrome/Kconfig | 1 +
drivers/platform/chrome/wilco_ec/Kconfig | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/platform/chrome/Kconfig b/drivers/platform/chrome/Kconfig
index 7d82a0946e1c..7eb1cfde29b4 100644
--- a/drivers/platform/chrome/Kconfig
+++ b/drivers/platform/chrome/Kconfig
@@ -132,6 +132,7 @@ config CROS_EC_UART
config CROS_EC_LPC
tristate "ChromeOS Embedded Controller (LPC)"
depends on CROS_EC && ACPI && (X86 || COMPILE_TEST)
+ depends on HAS_IOPORT
help
If you say Y here, you get support for talking to the ChromeOS EC
over an LPC bus, including the LPC Microchip EC (MEC) variant.
diff --git a/drivers/platform/chrome/wilco_ec/Kconfig b/drivers/platform/chrome/wilco_ec/Kconfig
index 49e8530ca0ac..d1648fb099ac 100644
--- a/drivers/platform/chrome/wilco_ec/Kconfig
+++ b/drivers/platform/chrome/wilco_ec/Kconfig
@@ -3,6 +3,7 @@ config WILCO_EC
tristate "ChromeOS Wilco Embedded Controller"
depends on X86 || COMPILE_TEST
depends on ACPI && CROS_EC_LPC && LEDS_CLASS
+ depends on HAS_IOPORT
help
If you say Y here, you get support for talking to the ChromeOS
Wilco EC over an eSPI bus. This uses a simple byte-level protocol
--
2.39.2


2023-05-22 11:06:09

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 22/44] net: handle HAS_IOPORT dependencies

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 requiring them. For the DEFXX driver the use of I/O
ports is optional and we only need to fence specific code paths. It also
turns out that with HAS_IOPORT handled explicitly HAMRADIO does not need
the !S390 dependency and successfully builds the bpqether driver.

Acked-by: Marc Kleine-Budde <[email protected]>
Acked-by: Jakub Kicinski <[email protected]>
Acked-by: Maciej W. Rozycki <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/net/Kconfig | 2 +-
drivers/net/arcnet/Kconfig | 2 +-
drivers/net/can/cc770/Kconfig | 1 +
drivers/net/can/sja1000/Kconfig | 1 +
drivers/net/ethernet/3com/Kconfig | 4 ++--
drivers/net/ethernet/8390/Kconfig | 6 +++---
drivers/net/ethernet/amd/Kconfig | 4 ++--
drivers/net/ethernet/fujitsu/Kconfig | 2 +-
drivers/net/ethernet/intel/Kconfig | 2 +-
drivers/net/ethernet/sis/Kconfig | 4 ++--
drivers/net/ethernet/smsc/Kconfig | 2 +-
drivers/net/ethernet/ti/Kconfig | 2 +-
drivers/net/ethernet/via/Kconfig | 1 +
drivers/net/ethernet/xircom/Kconfig | 2 +-
drivers/net/fddi/defxx.c | 2 +-
drivers/net/hamradio/Kconfig | 6 +++---
drivers/net/wan/Kconfig | 2 +-
net/ax25/Kconfig | 2 +-
18 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/drivers/net/Kconfig b/drivers/net/Kconfig
index d0a1ed216d15..817322605825 100644
--- a/drivers/net/Kconfig
+++ b/drivers/net/Kconfig
@@ -476,7 +476,7 @@ source "drivers/net/ipa/Kconfig"

config NET_SB1000
tristate "General Instruments Surfboard 1000"
- depends on PNP
+ depends on ISA && PNP
help
This is a driver for the General Instrument (also known as
NextLevel) SURFboard 1000 internal
diff --git a/drivers/net/arcnet/Kconfig b/drivers/net/arcnet/Kconfig
index a51b9dab6d3a..d1d07a1d4fbc 100644
--- a/drivers/net/arcnet/Kconfig
+++ b/drivers/net/arcnet/Kconfig
@@ -4,7 +4,7 @@
#

menuconfig ARCNET
- depends on NETDEVICES && (ISA || PCI || PCMCIA)
+ depends on NETDEVICES && (ISA || PCI || PCMCIA) && HAS_IOPORT
tristate "ARCnet support"
help
If you have a network card of this type, say Y and check out the
diff --git a/drivers/net/can/cc770/Kconfig b/drivers/net/can/cc770/Kconfig
index 9ef1359319f0..467ef19de1c1 100644
--- a/drivers/net/can/cc770/Kconfig
+++ b/drivers/net/can/cc770/Kconfig
@@ -7,6 +7,7 @@ if CAN_CC770

config CAN_CC770_ISA
tristate "ISA Bus based legacy CC770 driver"
+ depends on ISA
help
This driver adds legacy support for CC770 and AN82527 chips
connected to the ISA bus using I/O port, memory mapped or
diff --git a/drivers/net/can/sja1000/Kconfig b/drivers/net/can/sja1000/Kconfig
index 4b2f9cb17fc3..01168db4c106 100644
--- a/drivers/net/can/sja1000/Kconfig
+++ b/drivers/net/can/sja1000/Kconfig
@@ -87,6 +87,7 @@ config CAN_PLX_PCI

config CAN_SJA1000_ISA
tristate "ISA Bus based legacy SJA1000 driver"
+ depends on ISA
help
This driver adds legacy support for SJA1000 chips connected to
the ISA bus using I/O port, memory mapped or indirect access.
diff --git a/drivers/net/ethernet/3com/Kconfig b/drivers/net/ethernet/3com/Kconfig
index 706bd59bf645..1fbab79e2be4 100644
--- a/drivers/net/ethernet/3com/Kconfig
+++ b/drivers/net/ethernet/3com/Kconfig
@@ -44,7 +44,7 @@ config 3C515

config PCMCIA_3C574
tristate "3Com 3c574 PCMCIA support"
- depends on PCMCIA
+ depends on PCMCIA && HAS_IOPORT
help
Say Y here if you intend to attach a 3Com 3c574 or compatible PCMCIA
(PC-card) Fast Ethernet card to your computer.
@@ -54,7 +54,7 @@ config PCMCIA_3C574

config PCMCIA_3C589
tristate "3Com 3c589 PCMCIA support"
- depends on PCMCIA
+ depends on PCMCIA && HAS_IOPORT
help
Say Y here if you intend to attach a 3Com 3c589 or compatible PCMCIA
(PC-card) Ethernet card to your computer.
diff --git a/drivers/net/ethernet/8390/Kconfig b/drivers/net/ethernet/8390/Kconfig
index a4130e643342..345f250781c6 100644
--- a/drivers/net/ethernet/8390/Kconfig
+++ b/drivers/net/ethernet/8390/Kconfig
@@ -19,7 +19,7 @@ if NET_VENDOR_8390

config PCMCIA_AXNET
tristate "Asix AX88190 PCMCIA support"
- depends on PCMCIA
+ depends on PCMCIA && HAS_IOPORT
help
Say Y here if you intend to attach an Asix AX88190-based PCMCIA
(PC-card) Fast Ethernet card to your computer. These cards are
@@ -117,7 +117,7 @@ config NE2000

config NE2K_PCI
tristate "PCI NE2000 and clones support (see help)"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select CRC32
help
This driver is for NE2000 compatible PCI cards. It will not work
@@ -146,7 +146,7 @@ config APNE

config PCMCIA_PCNET
tristate "NE2000 compatible PCMCIA support"
- depends on PCMCIA
+ depends on PCMCIA && HAS_IOPORT
select CRC32
help
Say Y here if you intend to attach an NE2000 compatible PCMCIA
diff --git a/drivers/net/ethernet/amd/Kconfig b/drivers/net/ethernet/amd/Kconfig
index f8cc8925161c..b39c6f3e1eda 100644
--- a/drivers/net/ethernet/amd/Kconfig
+++ b/drivers/net/ethernet/amd/Kconfig
@@ -56,7 +56,7 @@ config LANCE

config PCNET32
tristate "AMD PCnet32 PCI support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select CRC32
select MII
help
@@ -122,7 +122,7 @@ config MVME147_NET

config PCMCIA_NMCLAN
tristate "New Media PCMCIA support"
- depends on PCMCIA
+ depends on PCMCIA && HAS_IOPORT
help
Say Y here if you intend to attach a New Media Ethernet or LiveWire
PCMCIA (PC-card) Ethernet card to your computer.
diff --git a/drivers/net/ethernet/fujitsu/Kconfig b/drivers/net/ethernet/fujitsu/Kconfig
index 0a1400cb410a..06a28bce5d27 100644
--- a/drivers/net/ethernet/fujitsu/Kconfig
+++ b/drivers/net/ethernet/fujitsu/Kconfig
@@ -18,7 +18,7 @@ if NET_VENDOR_FUJITSU

config PCMCIA_FMVJ18X
tristate "Fujitsu FMV-J18x PCMCIA support"
- depends on PCMCIA
+ depends on PCMCIA && HAS_IOPORT
select CRC32
help
Say Y here if you intend to attach a Fujitsu FMV-J18x or compatible
diff --git a/drivers/net/ethernet/intel/Kconfig b/drivers/net/ethernet/intel/Kconfig
index 9bc0a9519899..f48289a82a16 100644
--- a/drivers/net/ethernet/intel/Kconfig
+++ b/drivers/net/ethernet/intel/Kconfig
@@ -41,7 +41,7 @@ config E100

config E1000
tristate "Intel(R) PRO/1000 Gigabit Ethernet support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This driver supports Intel(R) PRO/1000 gigabit ethernet family of
adapters. For more information on how to identify your adapter, go
diff --git a/drivers/net/ethernet/sis/Kconfig b/drivers/net/ethernet/sis/Kconfig
index 775d76d9890e..7e498bdbca73 100644
--- a/drivers/net/ethernet/sis/Kconfig
+++ b/drivers/net/ethernet/sis/Kconfig
@@ -19,7 +19,7 @@ if NET_VENDOR_SIS

config SIS900
tristate "SiS 900/7016 PCI Fast Ethernet Adapter support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select CRC32
select MII
help
@@ -35,7 +35,7 @@ config SIS900

config SIS190
tristate "SiS190/SiS191 gigabit ethernet support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select CRC32
select MII
help
diff --git a/drivers/net/ethernet/smsc/Kconfig b/drivers/net/ethernet/smsc/Kconfig
index 5f22a8a4d27b..13ce9086a9ca 100644
--- a/drivers/net/ethernet/smsc/Kconfig
+++ b/drivers/net/ethernet/smsc/Kconfig
@@ -54,7 +54,7 @@ config SMC91X

config PCMCIA_SMC91C92
tristate "SMC 91Cxx PCMCIA support"
- depends on PCMCIA
+ depends on PCMCIA && HAS_IOPORT
select CRC32
select MII
help
diff --git a/drivers/net/ethernet/ti/Kconfig b/drivers/net/ethernet/ti/Kconfig
index fce06663e1e1..20068acce9fe 100644
--- a/drivers/net/ethernet/ti/Kconfig
+++ b/drivers/net/ethernet/ti/Kconfig
@@ -161,7 +161,7 @@ config TI_KEYSTONE_NETCP_ETHSS

config TLAN
tristate "TI ThunderLAN support"
- depends on (PCI || EISA)
+ depends on (PCI || EISA) && HAS_IOPORT
help
If you have a PCI Ethernet network card based on the ThunderLAN chip
which is supported by this driver, say Y here.
diff --git a/drivers/net/ethernet/via/Kconfig b/drivers/net/ethernet/via/Kconfig
index da287ef65be7..00773f5e4d7e 100644
--- a/drivers/net/ethernet/via/Kconfig
+++ b/drivers/net/ethernet/via/Kconfig
@@ -20,6 +20,7 @@ config VIA_RHINE
tristate "VIA Rhine support"
depends on PCI || (OF_IRQ && GENERIC_PCI_IOMAP)
depends on PCI || ARCH_VT8500 || COMPILE_TEST
+ depends on HAS_IOPORT
depends on HAS_DMA
select CRC32
select MII
diff --git a/drivers/net/ethernet/xircom/Kconfig b/drivers/net/ethernet/xircom/Kconfig
index 7497b9bea511..bfbdcf758afb 100644
--- a/drivers/net/ethernet/xircom/Kconfig
+++ b/drivers/net/ethernet/xircom/Kconfig
@@ -19,7 +19,7 @@ if NET_VENDOR_XIRCOM

config PCMCIA_XIRC2PS
tristate "Xircom 16-bit PCMCIA support"
- depends on PCMCIA
+ depends on PCMCIA && HAS_IOPORT
help
Say Y here if you intend to attach a Xircom 16-bit PCMCIA (PC-card)
Ethernet or Fast Ethernet card to your computer.
diff --git a/drivers/net/fddi/defxx.c b/drivers/net/fddi/defxx.c
index 1fef8a9b1a0f..0fbbb7286008 100644
--- a/drivers/net/fddi/defxx.c
+++ b/drivers/net/fddi/defxx.c
@@ -254,7 +254,7 @@ static const char version[] =
#define DFX_BUS_TC(dev) 0
#endif

-#if defined(CONFIG_EISA) || defined(CONFIG_PCI)
+#ifdef CONFIG_HAS_IOPORT
#define dfx_use_mmio bp->mmio
#else
#define dfx_use_mmio true
diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig
index a94c7bd5db2e..887c61971841 100644
--- a/drivers/net/hamradio/Kconfig
+++ b/drivers/net/hamradio/Kconfig
@@ -83,7 +83,7 @@ config SCC_TRXECHO

config BAYCOM_SER_FDX
tristate "BAYCOM ser12 fullduplex driver for AX.25"
- depends on AX25 && !S390
+ depends on AX25 && HAS_IOPORT
select CRC_CCITT
help
This is one of two drivers for Baycom style simple amateur radio
@@ -103,7 +103,7 @@ config BAYCOM_SER_FDX

config BAYCOM_SER_HDX
tristate "BAYCOM ser12 halfduplex driver for AX.25"
- depends on AX25 && !S390
+ depends on AX25 && HAS_IOPORT
select CRC_CCITT
help
This is one of two drivers for Baycom style simple amateur radio
@@ -151,7 +151,7 @@ config BAYCOM_EPP

config YAM
tristate "YAM driver for AX.25"
- depends on AX25 && !S390
+ depends on AX25 && HAS_IOPORT
help
The YAM is a modem for packet radio which connects to the serial
port and includes some of the functions of a Terminal Node
diff --git a/drivers/net/wan/Kconfig b/drivers/net/wan/Kconfig
index dcb069dde66b..417e2c2d349d 100644
--- a/drivers/net/wan/Kconfig
+++ b/drivers/net/wan/Kconfig
@@ -178,7 +178,7 @@ config C101

config FARSYNC
tristate "FarSync T-Series support"
- depends on HDLC && PCI
+ depends on HDLC && PCI && HAS_IOPORT
help
Support for the FarSync T-Series X.21 (and V.35/V.24) cards by
FarSite Communications Ltd.
diff --git a/net/ax25/Kconfig b/net/ax25/Kconfig
index d3a9843a043d..f769e8f4bd02 100644
--- a/net/ax25/Kconfig
+++ b/net/ax25/Kconfig
@@ -4,7 +4,7 @@
#

menuconfig HAMRADIO
- depends on NET && !S390
+ depends on NET
bool "Amateur Radio support"
help
If you want to connect your Linux box to an amateur radio, answer Y
--
2.39.2


2023-05-22 11:07:39

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 35/44] tty: serial: handle HAS_IOPORT dependencies

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 unconditionally. For 8250 based drivers some
support MMIO only use so fence only the parts requiring I/O ports.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/tty/Kconfig | 4 +--
drivers/tty/serial/8250/8250_early.c | 4 +++
drivers/tty/serial/8250/8250_pci.c | 14 +++++++++
drivers/tty/serial/8250/8250_port.c | 44 +++++++++++++++++++++++-----
drivers/tty/serial/8250/Kconfig | 5 ++--
drivers/tty/serial/Kconfig | 2 +-
6 files changed, 60 insertions(+), 13 deletions(-)

diff --git a/drivers/tty/Kconfig b/drivers/tty/Kconfig
index 341abaed4ce2..bdd267dbd5e4 100644
--- a/drivers/tty/Kconfig
+++ b/drivers/tty/Kconfig
@@ -222,7 +222,7 @@ config MOXA_INTELLIO

config MOXA_SMARTIO
tristate "Moxa SmartIO support v. 2.0"
- depends on SERIAL_NONSTANDARD && PCI
+ depends on SERIAL_NONSTANDARD && PCI && HAS_IOPORT
help
Say Y here if you have a Moxa SmartIO multiport serial card and/or
want to help develop a new version of this driver.
@@ -303,7 +303,7 @@ config GOLDFISH_TTY_EARLY_CONSOLE

config IPWIRELESS
tristate "IPWireless 3G UMTS PCMCIA card support"
- depends on PCMCIA && NETDEVICES
+ depends on PCMCIA && NETDEVICES && HAS_IOPORT
select PPP
help
This is a driver for 3G UMTS PCMCIA card from IPWireless company. In
diff --git a/drivers/tty/serial/8250/8250_early.c b/drivers/tty/serial/8250/8250_early.c
index 0ebde0ab8167..4192b1ae2736 100644
--- a/drivers/tty/serial/8250/8250_early.c
+++ b/drivers/tty/serial/8250/8250_early.c
@@ -48,8 +48,10 @@ static unsigned int serial8250_early_in(struct uart_port *port, int offset)
return readl(port->membase + offset);
case UPIO_MEM32BE:
return ioread32be(port->membase + offset);
+#ifdef CONFIG_HAS_IOPORT
case UPIO_PORT:
return inb(port->iobase + offset);
+#endif
case UPIO_AU:
return port->serial_in(port, reg_offset);
default:
@@ -75,9 +77,11 @@ static void serial8250_early_out(struct uart_port *port, int offset, int value)
case UPIO_MEM32BE:
iowrite32be(value, port->membase + offset);
break;
+#ifdef CONFIG_HAS_IOPORT
case UPIO_PORT:
outb(value, port->iobase + offset);
break;
+#endif
case UPIO_AU:
port->serial_out(port, reg_offset, value);
break;
diff --git a/drivers/tty/serial/8250/8250_pci.c b/drivers/tty/serial/8250/8250_pci.c
index e80c4f6551a1..d0c602952f92 100644
--- a/drivers/tty/serial/8250/8250_pci.c
+++ b/drivers/tty/serial/8250/8250_pci.c
@@ -847,6 +847,7 @@ static int pci_netmos_init(struct pci_dev *dev)
return num_serial;
}

+#ifdef CONFIG_HAS_IOPORT
/*
* These chips are available with optionally one parallel port and up to
* two serial ports. Unfortunately they all have the same product id.
@@ -973,6 +974,7 @@ static void pci_ite887x_exit(struct pci_dev *dev)
ioport &= 0xffff;
release_region(ioport, ITE_887x_IOSIZE);
}
+#endif /* CONFIG_HAS_IOPORT */

/*
* Oxford Semiconductor Inc.
@@ -1255,6 +1257,7 @@ static int pci_asix_setup(struct serial_private *priv,
#define QOPR_CLOCK_X8 0x0003
#define QOPR_CLOCK_RATE_MASK 0x0003

+#ifdef CONFIG_HAS_IOPORT
/* Quatech devices have their own extra interface features */
static struct pci_device_id quatech_cards[] = {
{ PCI_DEVICE_DATA(QUATECH, QSC100, 1) },
@@ -1474,6 +1477,7 @@ static int pci_quatech_setup(struct serial_private *priv,
pci_warn(priv->dev, "software control of RS422 features not currently supported.\n");
return pci_default_setup(priv, board, port, idx);
}
+#endif /* CONFIG_HAS_IOPORT */

static int pci_default_setup(struct serial_private *priv,
const struct pciserial_board *board,
@@ -1753,6 +1757,7 @@ static int skip_tx_en_setup(struct serial_private *priv,
return pci_default_setup(priv, board, port, idx);
}

+#ifdef CONFIG_HAS_IOPORT
static void kt_handle_break(struct uart_port *p)
{
struct uart_8250_port *up = up_to_u8250p(p);
@@ -1796,6 +1801,7 @@ static int kt_serial_setup(struct serial_private *priv,
port->port.handle_break = kt_handle_break;
return skip_tx_en_setup(priv, board, port, idx);
}
+#endif /* CONFIG_HAS_IOPORT */

static int pci_eg20t_init(struct pci_dev *dev)
{
@@ -1840,6 +1846,7 @@ pci_wch_ch38x_setup(struct serial_private *priv,
#define CH384_XINT_ENABLE_REG 0xEB
#define CH384_XINT_ENABLE_BIT 0x02

+#ifdef CONFIG_HAS_IOPORT
static int pci_wch_ch38x_init(struct pci_dev *dev)
{
int max_port;
@@ -1867,6 +1874,7 @@ static void pci_wch_ch38x_exit(struct pci_dev *dev)
iobase = pci_resource_start(dev, 0);
outb(0x0, iobase + CH384_XINT_ENABLE_REG);
}
+#endif /* CONFIG_HAS_IOPORT */


static int
@@ -2072,6 +2080,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
.subdevice = PCI_ANY_ID,
.setup = ce4100_serial_setup,
},
+#ifdef CONFIG_HAS_IOPORT
{
.vendor = PCI_VENDOR_ID_INTEL,
.device = PCI_DEVICE_ID_INTEL_PATSBURG_KT,
@@ -2091,6 +2100,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
.setup = pci_default_setup,
.exit = pci_ite887x_exit,
},
+#endif
/*
* National Instruments
*/
@@ -2212,6 +2222,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
.exit = pci_ni8430_exit,
},
/* Quatech */
+#ifdef CONFIG_HAS_IOPORT
{
.vendor = PCI_VENDOR_ID_QUATECH,
.device = PCI_ANY_ID,
@@ -2220,6 +2231,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
.init = pci_quatech_init,
.setup = pci_quatech_setup,
},
+#endif
/*
* Panacom
*/
@@ -2590,6 +2602,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
.subdevice = PCI_ANY_ID,
.setup = pci_wch_ch38x_setup,
},
+#ifdef CONFIG_HAS_IOPORT
/* WCH CH384 8S card (16850 clone) */
{
.vendor = PCIE_VENDOR_ID_WCH,
@@ -2600,6 +2613,7 @@ static struct pci_serial_quirk pci_serial_quirks[] = {
.exit = pci_wch_ch38x_exit,
.setup = pci_wch_ch38x_setup,
},
+#endif
/*
* ASIX devices with FIFO bug
*/
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index c153ba3a018a..6890ef8a5ede 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -401,6 +401,7 @@ static void au_serial_dl_write(struct uart_8250_port *up, int value)

#endif

+#ifdef CONFIG_HAS_IOPORT
static unsigned int hub6_serial_in(struct uart_port *p, int offset)
{
offset = offset << p->regshift;
@@ -414,6 +415,7 @@ static void hub6_serial_out(struct uart_port *p, int offset, int value)
outb(p->hub6 - 1 + offset, p->iobase);
outb(value, p->iobase + 1);
}
+#endif /* CONFIG_HAS_IOPORT */

static unsigned int mem_serial_in(struct uart_port *p, int offset)
{
@@ -463,6 +465,7 @@ static unsigned int mem32be_serial_in(struct uart_port *p, int offset)
return ioread32be(p->membase + offset);
}

+#ifdef CONFIG_HAS_IOPORT
static unsigned int io_serial_in(struct uart_port *p, int offset)
{
offset = offset << p->regshift;
@@ -474,6 +477,24 @@ static void io_serial_out(struct uart_port *p, int offset, int value)
offset = offset << p->regshift;
outb(value, p->iobase + offset);
}
+#endif
+static unsigned int no_serial_in(struct uart_port *p, int offset)
+{
+ return (unsigned int)-1;
+}
+
+static void no_serial_out(struct uart_port *p, int offset, int value)
+{
+}
+
+#ifdef CONFIG_HAS_IOPORT
+static inline bool is_upf_fourport(struct uart_port *port)
+{
+ return port->flags & UPF_FOURPORT;
+}
+#else
+#define is_upf_fourport(x) false
+#endif

static int serial8250_default_handle_irq(struct uart_port *port);

@@ -485,10 +506,12 @@ static void set_io_from_upio(struct uart_port *p)
up->dl_write = default_serial_dl_write;

switch (p->iotype) {
+#ifdef CONFIG_HAS_IOPORT
case UPIO_HUB6:
p->serial_in = hub6_serial_in;
p->serial_out = hub6_serial_out;
break;
+#endif

case UPIO_MEM:
p->serial_in = mem_serial_in;
@@ -519,10 +542,17 @@ static void set_io_from_upio(struct uart_port *p)
break;
#endif

- default:
+#ifdef CONFIG_HAS_IOPORT
+ case UPIO_PORT:
p->serial_in = io_serial_in;
p->serial_out = io_serial_out;
break;
+#endif
+
+ default:
+ WARN(1, "Unsupported UART type %x\n", p->iotype);
+ p->serial_in = no_serial_in;
+ p->serial_out = no_serial_out;
}
/* Remember loaded iotype */
up->cur_iotype = p->iotype;
@@ -1380,7 +1410,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
unsigned long irqs;
int irq;

- if (port->flags & UPF_FOURPORT) {
+ if (is_upf_fourport(port)) {
ICP = (port->iobase & 0xfe0) | 0x1f;
save_ICP = inb_p(ICP);
outb_p(0x80, ICP);
@@ -1399,7 +1429,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
irqs = probe_irq_on();
serial8250_out_MCR(up, 0);
udelay(10);
- if (port->flags & UPF_FOURPORT) {
+ if (is_upf_fourport(port)) {
serial8250_out_MCR(up, UART_MCR_DTR | UART_MCR_RTS);
} else {
serial8250_out_MCR(up,
@@ -1417,7 +1447,7 @@ static void autoconfig_irq(struct uart_8250_port *up)
serial8250_out_MCR(up, save_mcr);
serial_out(up, UART_IER, save_ier);

- if (port->flags & UPF_FOURPORT)
+ if (is_upf_fourport(port))
outb_p(save_ICP, ICP);

if (uart_console(port))
@@ -2382,7 +2412,7 @@ int serial8250_do_startup(struct uart_port *port)
serial_port_out(port, UART_LCR, UART_LCR_WLEN8);

spin_lock_irqsave(&port->lock, flags);
- if (up->port.flags & UPF_FOURPORT) {
+ if (is_upf_fourport(&up->port)) {
if (!up->port.irq)
up->port.mctrl |= TIOCM_OUT1;
} else
@@ -2464,7 +2494,7 @@ int serial8250_do_startup(struct uart_port *port)
*/
up->ier = UART_IER_RLSI | UART_IER_RDI;

- if (port->flags & UPF_FOURPORT) {
+ if (is_upf_fourport(port)) {
unsigned int icp;
/*
* Enable interrupts on the AST Fourport board
@@ -2507,7 +2537,7 @@ void serial8250_do_shutdown(struct uart_port *port)
serial8250_release_dma(up);

spin_lock_irqsave(&port->lock, flags);
- if (port->flags & UPF_FOURPORT) {
+ if (is_upf_fourport(port)) {
/* reset interrupts on the AST Fourport board */
inb((port->iobase & 0xfe0) | 0x1f);
port->mctrl |= TIOCM_OUT1;
diff --git a/drivers/tty/serial/8250/Kconfig b/drivers/tty/serial/8250/Kconfig
index 5313aa31930f..2a43bea7d7c3 100644
--- a/drivers/tty/serial/8250/Kconfig
+++ b/drivers/tty/serial/8250/Kconfig
@@ -6,7 +6,6 @@

config SERIAL_8250
tristate "8250/16550 and compatible serial support"
- depends on !S390
select SERIAL_CORE
select SERIAL_MCTRL_GPIO if GPIOLIB
help
@@ -72,7 +71,7 @@ config SERIAL_8250_16550A_VARIANTS

config SERIAL_8250_FINTEK
bool "Support for Fintek F81216A LPC to 4 UART RS485 API"
- depends on SERIAL_8250
+ depends on SERIAL_8250 && HAS_IOPORT
help
Selecting this option will add support for the RS485 capabilities
of the Fintek F81216A LPC to 4 UART.
@@ -160,7 +159,7 @@ config SERIAL_8250_HP300

config SERIAL_8250_CS
tristate "8250/16550 PCMCIA device support"
- depends on PCMCIA && SERIAL_8250
+ depends on PCMCIA && SERIAL_8250 && HAS_IOPORT
help
Say Y here to enable support for 16-bit PCMCIA serial devices,
including serial port cards, modems, and the modem functions of
diff --git a/drivers/tty/serial/Kconfig b/drivers/tty/serial/Kconfig
index 398e5aac2e77..dc41b3be6800 100644
--- a/drivers/tty/serial/Kconfig
+++ b/drivers/tty/serial/Kconfig
@@ -871,7 +871,7 @@ config SERIAL_TXX9_STDSERIAL

config SERIAL_JSM
tristate "Digi International NEO and Classic PCI Support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select SERIAL_CORE
help
This is a driver for Digi International's Neo and Classic series
--
2.39.2


2023-05-22 11:08:35

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 34/44] staging: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/staging/sm750fb/Kconfig | 2 +-
drivers/staging/vt6655/Kconfig | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/sm750fb/Kconfig b/drivers/staging/sm750fb/Kconfig
index 1461c89701c3..ab3d9b057d56 100644
--- a/drivers/staging/sm750fb/Kconfig
+++ b/drivers/staging/sm750fb/Kconfig
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0
config FB_SM750
tristate "Silicon Motion SM750 framebuffer support"
- depends on FB && PCI
+ depends on FB && PCI && HAS_IOPORT
select FB_MODE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
diff --git a/drivers/staging/vt6655/Kconfig b/drivers/staging/vt6655/Kconfig
index d1cd5de46dcf..077f62ebe80c 100644
--- a/drivers/staging/vt6655/Kconfig
+++ b/drivers/staging/vt6655/Kconfig
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
config VT6655
tristate "VIA Technologies VT6655 support"
- depends on PCI && MAC80211 && m
+ depends on PCI && HAS_IOPORT && MAC80211 && m
help
This is a vendor-written driver for VIA VT6655.
--
2.39.2


2023-05-22 11:08:49

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 37/44] usb: uhci: handle HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to guard sections of code calling them
as alternative access methods with CONFIG_HAS_IOPORT checks. For
uhci-hcd there are a lot of I/O port uses that do have MMIO alternatives
all selected by uhci_has_pci_registers() so this can be handled by
UHCI_IN/OUT macros and making uhci_has_pci_registers() constant 0 if
CONFIG_HAS_IOPORT is unset.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/usb/host/uhci-hcd.c | 2 +-
drivers/usb/host/uhci-hcd.h | 24 +++++++++++++++++-------
2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index 7cdc2fa7c28f..fd2408b553cf 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -841,7 +841,7 @@ static int uhci_count_ports(struct usb_hcd *hcd)

static const char hcd_name[] = "uhci_hcd";

-#ifdef CONFIG_USB_PCI
+#if defined(CONFIG_USB_PCI) && defined(CONFIG_HAS_IOPORT)
#include "uhci-pci.c"
#define PCI_DRIVER uhci_pci_driver
#endif
diff --git a/drivers/usb/host/uhci-hcd.h b/drivers/usb/host/uhci-hcd.h
index 0688c3e5bfe2..13ee2a6144b2 100644
--- a/drivers/usb/host/uhci-hcd.h
+++ b/drivers/usb/host/uhci-hcd.h
@@ -505,6 +505,14 @@ static inline bool uhci_is_aspeed(const struct uhci_hcd *uhci)
* we use memory mapped registers.
*/

+#ifdef CONFIG_HAS_IOPORT
+#define UHCI_IN(x) x
+#define UHCI_OUT(x) x
+#else
+#define UHCI_IN(x) 0
+#define UHCI_OUT(x) do { } while (0)
+#endif
+
#ifndef CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC
/* Support PCI only */
static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
@@ -539,7 +547,7 @@ static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)

#else
/* Support non-PCI host controllers */
-#ifdef CONFIG_USB_PCI
+#if defined(CONFIG_USB_PCI) && defined(HAS_IOPORT)
/* Support PCI and non-PCI host controllers */
#define uhci_has_pci_registers(u) ((u)->io_addr != 0)
#else
@@ -587,7 +595,7 @@ static inline int uhci_aspeed_reg(unsigned int reg)
static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
{
if (uhci_has_pci_registers(uhci))
- return inl(uhci->io_addr + reg);
+ return UHCI_IN(inl(uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
return readl(uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -601,7 +609,7 @@ static inline u32 uhci_readl(const struct uhci_hcd *uhci, int reg)
static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
{
if (uhci_has_pci_registers(uhci))
- outl(val, uhci->io_addr + reg);
+ UHCI_OUT(outl(val, uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
writel(val, uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -615,7 +623,7 @@ static inline void uhci_writel(const struct uhci_hcd *uhci, u32 val, int reg)
static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
{
if (uhci_has_pci_registers(uhci))
- return inw(uhci->io_addr + reg);
+ return UHCI_IN(inw(uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
return readl(uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -629,7 +637,7 @@ static inline u16 uhci_readw(const struct uhci_hcd *uhci, int reg)
static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
{
if (uhci_has_pci_registers(uhci))
- outw(val, uhci->io_addr + reg);
+ UHCI_OUT(outw(val, uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
writel(val, uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -643,7 +651,7 @@ static inline void uhci_writew(const struct uhci_hcd *uhci, u16 val, int reg)
static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
{
if (uhci_has_pci_registers(uhci))
- return inb(uhci->io_addr + reg);
+ return UHCI_IN(inb(uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
return readl(uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -657,7 +665,7 @@ static inline u8 uhci_readb(const struct uhci_hcd *uhci, int reg)
static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
{
if (uhci_has_pci_registers(uhci))
- outb(val, uhci->io_addr + reg);
+ UHCI_OUT(outb(val, uhci->io_addr + reg));
else if (uhci_is_aspeed(uhci))
writel(val, uhci->regs + uhci_aspeed_reg(reg));
#ifdef CONFIG_USB_UHCI_BIG_ENDIAN_MMIO
@@ -668,6 +676,8 @@ static inline void uhci_writeb(const struct uhci_hcd *uhci, u8 val, int reg)
writeb(val, uhci->regs + reg);
}
#endif /* CONFIG_USB_UHCI_SUPPORT_NON_PCI_HC */
+#undef UHCI_IN
+#undef UHCI_OUT

/*
* The GRLIB GRUSBHC controller can use big endian format for its descriptors.
--
2.39.2


2023-05-22 11:09:56

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 38/44] usb: pci-quirks: handle HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. In the pci-quirks case the I/O port acceses are
used in the quirks for several AMD south bridges. Move unrelated
ASMEDIA quirks out of the way and introduce an additional config option
for the AMD quirks that depends on HAS_IOPORT.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/usb/Kconfig | 10 +++
drivers/usb/core/hcd-pci.c | 2 +
drivers/usb/host/pci-quirks.c | 125 ++++++++++++++++++----------------
drivers/usb/host/pci-quirks.h | 30 ++++++--
4 files changed, 101 insertions(+), 66 deletions(-)

diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
index 7f33bcc315f2..abf8c6cdea9e 100644
--- a/drivers/usb/Kconfig
+++ b/drivers/usb/Kconfig
@@ -91,6 +91,16 @@ config USB_PCI
If you have such a device you may say N here and PCI related code
will not be built in the USB driver.

+config USB_PCI_AMD
+ bool "AMD PCI USB host support"
+ depends on USB_PCI && HAS_IOPORT
+ default X86 || MACH_LOONGSON64 || PPC_PASEMI
+ help
+ Enable workarounds for USB implementation quirks in SB600/SB700/SB800
+ and later south bridge implementations. These are common on x86 PCs
+ with AMD CPUs but rarely used elsewhere, with the exception of a few
+ powerpc and mips desktop machines.
+
if USB

source "drivers/usb/core/Kconfig"
diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
index ab2f3737764e..85a0aeae85cd 100644
--- a/drivers/usb/core/hcd-pci.c
+++ b/drivers/usb/core/hcd-pci.c
@@ -206,8 +206,10 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct hc_driver *driver)
goto free_irq_vectors;
}

+#ifdef CONFIG_USB_PCI_AMD
hcd->amd_resume_bug = (usb_hcd_amd_remote_wakeup_quirk(dev) &&
driver->flags & (HCD_USB11 | HCD_USB3)) ? 1 : 0;
+#endif /* CONFIG_USB_PCI_AMD */

if (driver->flags & HCD_MEMORY) {
/* EHCI, OHCI */
diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
index 2665832f9add..e0612f909fad 100644
--- a/drivers/usb/host/pci-quirks.c
+++ b/drivers/usb/host/pci-quirks.c
@@ -60,6 +60,23 @@
#define EHCI_USBLEGCTLSTS 4 /* legacy control/status */
#define EHCI_USBLEGCTLSTS_SOOE (1 << 13) /* SMI on ownership change */

+/* ASMEDIA quirk use */
+#define ASMT_DATA_WRITE0_REG 0xF8
+#define ASMT_DATA_WRITE1_REG 0xFC
+#define ASMT_CONTROL_REG 0xE0
+#define ASMT_CONTROL_WRITE_BIT 0x02
+#define ASMT_WRITEREG_CMD 0x10423
+#define ASMT_FLOWCTL_ADDR 0xFA30
+#define ASMT_FLOWCTL_DATA 0xBA
+#define ASMT_PSEUDO_DATA 0
+
+/* Intel quirk use */
+#define USB_INTEL_XUSB2PR 0xD0
+#define USB_INTEL_USB2PRM 0xD4
+#define USB_INTEL_USB3_PSSEN 0xD8
+#define USB_INTEL_USB3PRM 0xDC
+
+#ifdef CONFIG_USB_PCI_AMD
/* AMD quirk use */
#define AB_REG_BAR_LOW 0xe0
#define AB_REG_BAR_HIGH 0xe1
@@ -93,21 +110,6 @@
#define NB_PIF0_PWRDOWN_0 0x01100012
#define NB_PIF0_PWRDOWN_1 0x01100013

-#define USB_INTEL_XUSB2PR 0xD0
-#define USB_INTEL_USB2PRM 0xD4
-#define USB_INTEL_USB3_PSSEN 0xD8
-#define USB_INTEL_USB3PRM 0xDC
-
-/* ASMEDIA quirk use */
-#define ASMT_DATA_WRITE0_REG 0xF8
-#define ASMT_DATA_WRITE1_REG 0xFC
-#define ASMT_CONTROL_REG 0xE0
-#define ASMT_CONTROL_WRITE_BIT 0x02
-#define ASMT_WRITEREG_CMD 0x10423
-#define ASMT_FLOWCTL_ADDR 0xFA30
-#define ASMT_FLOWCTL_DATA 0xBA
-#define ASMT_PSEUDO_DATA 0
-
/*
* amd_chipset_gen values represent AMD different chipset generations
*/
@@ -458,50 +460,6 @@ void usb_amd_quirk_pll_disable(void)
}
EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_disable);

-static int usb_asmedia_wait_write(struct pci_dev *pdev)
-{
- unsigned long retry_count;
- unsigned char value;
-
- for (retry_count = 1000; retry_count > 0; --retry_count) {
-
- pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);
-
- if (value == 0xff) {
- dev_err(&pdev->dev, "%s: check_ready ERROR", __func__);
- return -EIO;
- }
-
- if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
- return 0;
-
- udelay(50);
- }
-
- dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__);
- return -ETIMEDOUT;
-}
-
-void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev)
-{
- if (usb_asmedia_wait_write(pdev) != 0)
- return;
-
- /* send command and address to device */
- pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD);
- pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR);
- pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
-
- if (usb_asmedia_wait_write(pdev) != 0)
- return;
-
- /* send data to device */
- pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA);
- pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA);
- pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
-}
-EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol);
-
void usb_amd_quirk_pll_enable(void)
{
usb_amd_quirk_pll(0);
@@ -630,7 +588,53 @@ bool usb_amd_pt_check_port(struct device *device, int port)
return !(value & BIT(port_shift));
}
EXPORT_SYMBOL_GPL(usb_amd_pt_check_port);
+#endif /* CONFIG_USB_PCI_AMD */

+static int usb_asmedia_wait_write(struct pci_dev *pdev)
+{
+ unsigned long retry_count;
+ unsigned char value;
+
+ for (retry_count = 1000; retry_count > 0; --retry_count) {
+
+ pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);
+
+ if (value == 0xff) {
+ dev_err(&pdev->dev, "%s: check_ready ERROR", __func__);
+ return -EIO;
+ }
+
+ if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
+ return 0;
+
+ udelay(50);
+ }
+
+ dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__);
+ return -ETIMEDOUT;
+}
+
+void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev)
+{
+ if (usb_asmedia_wait_write(pdev) != 0)
+ return;
+
+ /* send command and address to device */
+ pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD);
+ pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR);
+ pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
+
+ if (usb_asmedia_wait_write(pdev) != 0)
+ return;
+
+ /* send data to device */
+ pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA);
+ pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA);
+ pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
+}
+EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol);
+
+#if defined(CONFIG_HAS_IOPORT) && defined(CONFIG_USB_UHCI_HCD)
/*
* Make sure the controller is completely inactive, unable to
* generate interrupts or do DMA.
@@ -711,6 +715,7 @@ int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base)
return 1;
}
EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc);
+#endif /* defined(CONFIG_HAS_IOPORT && defined(CONFIG_USB_UHCI_HCD) */

static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
{
@@ -723,6 +728,7 @@ static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)

static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
{
+#ifdef CONFIG_HAS_IOPORT
unsigned long base = 0;
int i;

@@ -737,6 +743,7 @@ static void quirk_usb_handoff_uhci(struct pci_dev *pdev)

if (base)
uhci_check_and_reset_hc(pdev, base);
+#endif /* CONFIG_HAS_IOPORT */
}

static int mmio_resource_enabled(struct pci_dev *pdev, int idx)
diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
index e729de21fad7..8c87505f0abc 100644
--- a/drivers/usb/host/pci-quirks.h
+++ b/drivers/usb/host/pci-quirks.h
@@ -2,9 +2,10 @@
#ifndef __LINUX_USB_PCI_QUIRKS_H
#define __LINUX_USB_PCI_QUIRKS_H

-#ifdef CONFIG_USB_PCI
void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
+
+#ifdef CONFIG_USB_PCI_AMD
int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev);
bool usb_amd_hang_symptom_quirk(void);
bool usb_amd_prefetch_quirk(void);
@@ -12,23 +13,38 @@ void usb_amd_dev_put(void);
bool usb_amd_quirk_pll_check(void);
void usb_amd_quirk_pll_disable(void);
void usb_amd_quirk_pll_enable(void);
-void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
-void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
-void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
void sb800_prefetch(struct device *dev, int on);
bool usb_amd_pt_check_port(struct device *device, int port);
#else
-struct pci_dev;
+static inline bool usb_amd_hang_symptom_quirk(void)
+{
+ return false;
+};
+static inline bool usb_amd_prefetch_quirk(void)
+{
+ return false;
+}
+static inline bool usb_amd_quirk_pll_check(void)
+{
+ return false;
+}
static inline void usb_amd_quirk_pll_disable(void) {}
static inline void usb_amd_quirk_pll_enable(void) {}
-static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
static inline void usb_amd_dev_put(void) {}
-static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
static inline void sb800_prefetch(struct device *dev, int on) {}
static inline bool usb_amd_pt_check_port(struct device *device, int port)
{
return false;
}
+#endif /* CONFIG_USB_PCI_AMD */
+
+#ifdef CONFIG_USB_PCI
+void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
+void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
+void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
+#else
+static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
+static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
#endif /* CONFIG_USB_PCI */

#endif /* __LINUX_USB_PCI_QUIRKS_H */
--
2.39.2


2023-05-22 11:09:59

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 40/44] fbdev: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/video/fbdev/Kconfig | 23 ++++++++++++-----------
1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 0fdf5f46802c..4eea398ebbfe 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
@@ -531,7 +532,7 @@ config FB_IMSTT

config FB_VGA16
tristate "VGA 16-color graphics support"
- depends on FB && (X86 || PPC)
+ depends on FB && HAS_IOPORT
select APERTURE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
@@ -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
--
2.39.2


2023-05-22 11:10:34

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 18/44] media: add HAS_IOPORT dependencies

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.

Reviewed-by: Sean Young <[email protected]> # media/rc
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/media/pci/dm1105/Kconfig | 2 +-
drivers/media/radio/Kconfig | 14 +++++++++++++-
drivers/media/rc/Kconfig | 6 ++++++
3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/media/pci/dm1105/Kconfig b/drivers/media/pci/dm1105/Kconfig
index e0e3af67c99c..4498c37f4990 100644
--- a/drivers/media/pci/dm1105/Kconfig
+++ b/drivers/media/pci/dm1105/Kconfig
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config DVB_DM1105
tristate "SDMC DM1105 based PCI cards"
- depends on DVB_CORE && PCI && I2C && I2C_ALGOBIT
+ depends on DVB_CORE && PCI && I2C && I2C_ALGOBIT && HAS_IOPORT
select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT
select DVB_STV0299 if MEDIA_SUBDRV_AUTOSELECT
select DVB_STV0288 if MEDIA_SUBDRV_AUTOSELECT
diff --git a/drivers/media/radio/Kconfig b/drivers/media/radio/Kconfig
index 616a38feb641..d52eccdc7eb9 100644
--- a/drivers/media/radio/Kconfig
+++ b/drivers/media/radio/Kconfig
@@ -15,7 +15,7 @@ if RADIO_ADAPTERS

config RADIO_MAXIRADIO
tristate "Guillemot MAXI Radio FM 2000 radio"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select RADIO_TEA575X
help
Choose Y here if you have this radio card. This card may also be
@@ -232,6 +232,7 @@ source "drivers/media/radio/wl128x/Kconfig"
menuconfig V4L_RADIO_ISA_DRIVERS
bool "ISA radio devices"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
help
Say Y here to enable support for these ISA drivers.

@@ -240,6 +241,7 @@ if V4L_RADIO_ISA_DRIVERS
config RADIO_AZTECH
tristate "Aztech/Packard Bell Radio"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
select RADIO_ISA
help
Choose Y here if you have one of these FM radio cards, and then fill
@@ -260,6 +262,7 @@ config RADIO_AZTECH_PORT
config RADIO_CADET
tristate "ADS Cadet AM/FM Tuner"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
help
Choose Y here if you have one of these AM/FM radio cards, and then
fill in the port address below.
@@ -270,6 +273,7 @@ config RADIO_CADET
config RADIO_GEMTEK
tristate "GemTek Radio card (or compatible) support"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
select RADIO_ISA
help
Choose Y here if you have this FM radio card, and then fill in the
@@ -309,6 +313,7 @@ config RADIO_GEMTEK_PROBE

config RADIO_ISA
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
tristate

config RADIO_MIROPCM20
@@ -329,6 +334,7 @@ config RADIO_MIROPCM20
config RADIO_RTRACK
tristate "AIMSlab RadioTrack (aka RadioReveal) support"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
select RADIO_ISA
help
Choose Y here if you have one of these FM radio cards, and then fill
@@ -383,6 +389,7 @@ config RADIO_RTRACK_PORT
config RADIO_SF16FMI
tristate "SF16-FMI/SF16-FMP/SF16-FMD Radio"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
help
Choose Y here if you have one of these FM radio cards.

@@ -392,6 +399,7 @@ config RADIO_SF16FMI
config RADIO_SF16FMR2
tristate "SF16-FMR2/SF16-FMD2 Radio"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
select RADIO_TEA575X
help
Choose Y here if you have one of these FM radio cards.
@@ -402,6 +410,7 @@ config RADIO_SF16FMR2
config RADIO_TERRATEC
tristate "TerraTec ActiveRadio ISA Standalone"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
select RADIO_ISA
help
Choose Y here if you have this FM radio card.
@@ -416,6 +425,7 @@ config RADIO_TERRATEC
config RADIO_TRUST
tristate "Trust FM radio card"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
select RADIO_ISA
help
This is a driver for the Trust FM radio cards. Say Y if you have
@@ -439,6 +449,7 @@ config RADIO_TRUST_PORT
config RADIO_TYPHOON
tristate "Typhoon Radio (a.k.a. EcoRadio)"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
select RADIO_ISA
help
Choose Y here if you have one of these FM radio cards, and then fill
@@ -473,6 +484,7 @@ config RADIO_TYPHOON_PORT
config RADIO_ZOLTRIX
tristate "Zoltrix Radio"
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT
select RADIO_ISA
help
Choose Y here if you have one of these FM radio cards, and then fill
diff --git a/drivers/media/rc/Kconfig b/drivers/media/rc/Kconfig
index ac4172feb6f9..922c790b577e 100644
--- a/drivers/media/rc/Kconfig
+++ b/drivers/media/rc/Kconfig
@@ -148,6 +148,7 @@ if RC_DEVICES
config IR_ENE
tristate "ENE eHome Receiver/Transceiver (pnp id: ENE0100/ENE02xxx)"
depends on PNP || COMPILE_TEST
+ depends on HAS_IOPORT
help
Say Y here to enable support for integrated infrared receiver
/transceiver made by ENE.
@@ -161,6 +162,7 @@ config IR_ENE
config IR_FINTEK
tristate "Fintek Consumer Infrared Transceiver"
depends on PNP || COMPILE_TEST
+ depends on HAS_IOPORT
help
Say Y here to enable support for integrated infrared receiver
/transceiver made by Fintek. This chip is found on assorted
@@ -249,6 +251,7 @@ config IR_IMON_RAW
config IR_ITE_CIR
tristate "ITE Tech Inc. IT8712/IT8512 Consumer Infrared Transceiver"
depends on PNP || COMPILE_TEST
+ depends on HAS_IOPORT
help
Say Y here to enable support for integrated infrared receivers
/transceivers made by ITE Tech Inc. These are found in
@@ -301,6 +304,7 @@ config IR_MTK
config IR_NUVOTON
tristate "Nuvoton w836x7hg Consumer Infrared Transceiver"
depends on PNP || COMPILE_TEST
+ depends on HAS_IOPORT
help
Say Y here to enable support for integrated infrared receiver
/transceiver made by Nuvoton (formerly Winbond). This chip is
@@ -345,6 +349,7 @@ config IR_RX51

config IR_SERIAL
tristate "Homebrew Serial Port Receiver"
+ depends on HAS_IOPORT
help
Say Y if you want to use Homebrew Serial Port Receivers and
Transceivers.
@@ -412,6 +417,7 @@ config IR_TTUSBIR
config IR_WINBOND_CIR
tristate "Winbond IR remote control"
depends on (X86 && PNP) || COMPILE_TEST
+ depends on HAS_IOPORT
select NEW_LEDS
select LEDS_CLASS
select BITREVERSE
--
2.39.2


2023-05-22 11:11:17

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 39/44] vgacon: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/video/console/Kconfig | 1 +
1 file changed, 1 insertion(+)

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


2023-05-22 11:11:19

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 44/44] asm-generic/io.h: Remove I/O port accessors for HAS_IOPORT=n

With all subsystems and drivers either declaring their dependence on
HAS_IOPORT or fencing I/O port specific code sections we can finally
make inb()/outb() and friends compile-time dependent on HAS_IOPORT as
suggested by Linus in the linked mail. The main benefit of this is that
on platforms such as s390 which have no meaningful way of implementing
inb()/outb() their use without the proper HAS_IOPORT dependency will
result in easy to catch and fix compile-time errors instead of compiling
code that can never work.

Link: https://lore.kernel.org/lkml/CAHk-=wg80je=K7madF4e7WrRNp37e3qh6y10Svhdc7O8SZ_-8g@mail.gmail.com/
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
include/asm-generic/io.h | 60 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 60 insertions(+)

diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
index 587e7e9b9a37..6ab2b6dfb6b1 100644
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -539,6 +539,7 @@ static inline void writesq(volatile void __iomem *addr, const void *buffer,

#if !defined(inb) && !defined(_inb)
#define _inb _inb
+#ifdef CONFIG_HAS_IOPORT
static inline u8 _inb(unsigned long addr)
{
u8 val;
@@ -548,10 +549,15 @@ static inline u8 _inb(unsigned long addr)
__io_par(val);
return val;
}
+#else
+u8 _inb(unsigned long addr)
+ __compiletime_error("inb()) requires CONFIG_HAS_IOPORT");
+#endif
#endif

#if !defined(inw) && !defined(_inw)
#define _inw _inw
+#ifdef CONFIG_HAS_IOPORT
static inline u16 _inw(unsigned long addr)
{
u16 val;
@@ -561,10 +567,15 @@ static inline u16 _inw(unsigned long addr)
__io_par(val);
return val;
}
+#else
+u16 _inw(unsigned long addr)
+ __compiletime_error("inw() requires CONFIG_HAS_IOPORT");
+#endif
#endif

#if !defined(inl) && !defined(_inl)
#define _inl _inl
+#ifdef CONFIG_HAS_IOPORT
static inline u32 _inl(unsigned long addr)
{
u32 val;
@@ -574,36 +585,55 @@ static inline u32 _inl(unsigned long addr)
__io_par(val);
return val;
}
+#else
+u32 _inl(unsigned long addr)
+ __compiletime_error("inl() requires CONFIG_HAS_IOPORT");
+#endif
#endif

#if !defined(outb) && !defined(_outb)
#define _outb _outb
+#ifdef CONFIG_HAS_IOPORT
static inline void _outb(u8 value, unsigned long addr)
{
__io_pbw();
__raw_writeb(value, PCI_IOBASE + addr);
__io_paw();
}
+#else
+void _outb(u8 value, unsigned long addr)
+ __compiletime_error("outb() requires CONFIG_HAS_IOPORT");
+#endif
#endif

#if !defined(outw) && !defined(_outw)
#define _outw _outw
+#ifdef CONFIG_HAS_IOPORT
static inline void _outw(u16 value, unsigned long addr)
{
__io_pbw();
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
__io_paw();
}
+#else
+void _outw(u16 value, unsigned long addr)
+ __compiletime_error("outw() requires CONFIG_HAS_IOPORT");
+#endif
#endif

#if !defined(outl) && !defined(_outl)
#define _outl _outl
+#ifdef CONFIG_HAS_IOPORT
static inline void _outl(u32 value, unsigned long addr)
{
__io_pbw();
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
__io_paw();
}
+#else
+void _outl(u32 value, unsigned long addr)
+ __compiletime_error("outl() requires CONFIG_HAS_IOPORT");
+#endif
#endif

#include <linux/logic_pio.h>
@@ -687,53 +717,83 @@ static inline void outl_p(u32 value, unsigned long addr)

#ifndef insb
#define insb insb
+#ifdef CONFIG_HAS_IOPORT
static inline void insb(unsigned long addr, void *buffer, unsigned int count)
{
readsb(PCI_IOBASE + addr, buffer, count);
}
+#else
+void insb(unsigned long addr, void *buffer, unsigned int count)
+ __compiletime_error("insb() requires HAS_IOPORT");
+#endif
#endif

#ifndef insw
#define insw insw
+#ifdef CONFIG_HAS_IOPORT
static inline void insw(unsigned long addr, void *buffer, unsigned int count)
{
readsw(PCI_IOBASE + addr, buffer, count);
}
+#else
+void insw(unsigned long addr, void *buffer, unsigned int count)
+ __compiletime_error("insw() requires HAS_IOPORT");
+#endif
#endif

#ifndef insl
#define insl insl
+#ifdef CONFIG_HAS_IOPORT
static inline void insl(unsigned long addr, void *buffer, unsigned int count)
{
readsl(PCI_IOBASE + addr, buffer, count);
}
+#else
+void insl(unsigned long addr, void *buffer, unsigned int count)
+ __compiletime_error("insl() requires HAS_IOPORT");
+#endif
#endif

#ifndef outsb
#define outsb outsb
+#ifdef CONFIG_HAS_IOPORT
static inline void outsb(unsigned long addr, const void *buffer,
unsigned int count)
{
writesb(PCI_IOBASE + addr, buffer, count);
}
+#else
+void outsb(unsigned long addr, const void *buffer, unsigned int count)
+ __compiletime_error("outsb() requires HAS_IOPORT");
+#endif
#endif

#ifndef outsw
#define outsw outsw
+#ifdef CONFIG_HAS_IOPORT
static inline void outsw(unsigned long addr, const void *buffer,
unsigned int count)
{
writesw(PCI_IOBASE + addr, buffer, count);
}
+#else
+void outsw(unsigned long addr, const void *buffer, unsigned int count)
+ __compiletime_error("outsw() requires HAS_IOPORT");
+#endif
#endif

#ifndef outsl
#define outsl outsl
+#ifdef CONFIG_HAS_IOPORT
static inline void outsl(unsigned long addr, const void *buffer,
unsigned int count)
{
writesl(PCI_IOBASE + addr, buffer, count);
}
+#else
+void outsl(unsigned long addr, const void *buffer, unsigned int count)
+ __compiletime_error("outsl() requires HAS_IOPORT");
+#endif
#endif

#ifndef insb_p
--
2.39.2


2023-05-22 11:12:57

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 17/44] leds: add HAS_IOPORT dependencies

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.

Acked-by: Pavel Machek <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/leds/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
index 2c5fdf848210..6573a4473fe5 100644
--- a/drivers/leds/Kconfig
+++ b/drivers/leds/Kconfig
@@ -676,7 +676,7 @@ config LEDS_LM355x

config LEDS_OT200
tristate "LED support for the Bachmann OT200"
- depends on LEDS_CLASS && HAS_IOMEM && (X86_32 || COMPILE_TEST)
+ depends on LEDS_CLASS && HAS_IOPORT && (X86_32 || COMPILE_TEST)
help
This option enables support for the LEDs on the Bachmann OT200.
Say Y to enable LEDs on the Bachmann OT200.
--
2.39.2


2023-05-22 11:12:57

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 14/44] iio: ad7606: Kconfig: add HAS_IOPORT dependencies

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.

Acked-by: Jonathan Cameron <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/iio/adc/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
index eb2b09ef5d5b..53098aca06ea 100644
--- a/drivers/iio/adc/Kconfig
+++ b/drivers/iio/adc/Kconfig
@@ -145,7 +145,7 @@ config AD7606

config AD7606_IFACE_PARALLEL
tristate "Analog Devices AD7606 ADC driver with parallel interface support"
- depends on HAS_IOMEM
+ depends on HAS_IOPORT
select AD7606
help
Say yes here to build parallel interface support for Analog Devices:
--
2.39.2


2023-05-22 11:12:58

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 28/44] pnp: add HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to depend on HAS_IOPORT even when
compile testing only.

Acked-by: Rafael J. Wysocki <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/pnp/isapnp/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/pnp/isapnp/Kconfig b/drivers/pnp/isapnp/Kconfig
index d0479a563123..79bd48f1dd94 100644
--- a/drivers/pnp/isapnp/Kconfig
+++ b/drivers/pnp/isapnp/Kconfig
@@ -4,7 +4,7 @@
#
config ISAPNP
bool "ISA Plug and Play support"
- depends on ISA || COMPILE_TEST
+ depends on ISA || (HAS_IOPORT && COMPILE_TEST)
help
Say Y here if you would like support for ISA Plug and Play devices.
Some information is in <file:Documentation/driver-api/isapnp.rst>.
--
2.39.2


2023-05-22 11:12:58

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 36/44] usb: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/usb/host/Kconfig | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index c170672f847e..4448d0ab06f0 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -376,7 +376,7 @@ config USB_ISP116X_HCD

config USB_ISP1362_HCD
tristate "ISP1362 HCD support"
- depends on HAS_IOMEM
+ depends on HAS_IOPORT
depends on COMPILE_TEST # nothing uses this
help
Supports the Philips ISP1362 chip as a host controller
@@ -578,7 +578,7 @@ endif # USB_OHCI_HCD

config USB_UHCI_HCD
tristate "UHCI HCD (most Intel and VIA) support"
- depends on USB_PCI || USB_UHCI_SUPPORT_NON_PCI_HC
+ depends on (USB_PCI && HAS_IOPORT) || USB_UHCI_SUPPORT_NON_PCI_HC
help
The Universal Host Controller Interface is a standard by Intel for
accessing the USB hardware in the PC (which is also called the USB
--
2.39.2


2023-05-22 11:12:58

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 32/44] sound: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
sound/drivers/Kconfig | 3 +++
sound/isa/Kconfig | 1 +
sound/pci/Kconfig | 45 ++++++++++++++++++++++++++++++++-----------
sound/pcmcia/Kconfig | 1 +
4 files changed, 39 insertions(+), 11 deletions(-)

diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
index be3009746f3a..864991d8776d 100644
--- a/sound/drivers/Kconfig
+++ b/sound/drivers/Kconfig
@@ -128,6 +128,7 @@ config SND_VIRMIDI

config SND_MTPAV
tristate "MOTU MidiTimePiece AV multiport MIDI"
+ depends on HAS_IOPORT
select SND_RAWMIDI
help
To use a MOTU MidiTimePiece AV multiport MIDI adapter
@@ -152,6 +153,7 @@ config SND_MTS64

config SND_SERIAL_U16550
tristate "UART16550 serial MIDI driver"
+ depends on HAS_IOPORT
select SND_RAWMIDI
help
To include support for MIDI serial port interfaces, say Y here
@@ -185,6 +187,7 @@ config SND_SERIAL_GENERIC

config SND_MPU401
tristate "Generic MPU-401 UART driver"
+ depends on HAS_IOPORT
select SND_MPU401_UART
help
Say Y here to include support for MIDI ports compatible with
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 6ffa48dd5983..f8159179e38d 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -23,6 +23,7 @@ menuconfig SND_ISA
bool "ISA sound devices"
depends on ISA || COMPILE_TEST
depends on ISA_DMA_API
+ depends on HAS_IOPORT
default y
help
Support for sound devices connected via the ISA bus.
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 861958451ef5..787868c9e91b 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -26,7 +26,7 @@ config SND_ALS300
select SND_PCM
select SND_AC97_CODEC
select SND_OPL3_LIB
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say 'Y' or 'M' to include support for Avance Logic ALS300/ALS300+

@@ -36,6 +36,7 @@ config SND_ALS300
config SND_ALS4000
tristate "Avance Logic ALS4000"
depends on ISA_DMA_API
+ depends on HAS_IOPORT
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_PCM
@@ -51,7 +52,7 @@ config SND_ALI5451
tristate "ALi M5451 PCI Audio Controller"
select SND_MPU401_UART
select SND_AC97_CODEC
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for the integrated AC97 sound
device on motherboards using the ALi M5451 Audio Controller
@@ -96,6 +97,7 @@ config SND_ATIIXP_MODEM

config SND_AU8810
tristate "Aureal Advantage"
+ depends on HAS_IOPORT
select SND_MPU401_UART
select SND_AC97_CODEC
help
@@ -110,6 +112,7 @@ config SND_AU8810

config SND_AU8820
tristate "Aureal Vortex"
+ depends on HAS_IOPORT
select SND_MPU401_UART
select SND_AC97_CODEC
help
@@ -123,6 +126,7 @@ config SND_AU8820

config SND_AU8830
tristate "Aureal Vortex 2"
+ depends on HAS_IOPORT
select SND_MPU401_UART
select SND_AC97_CODEC
help
@@ -157,7 +161,7 @@ config SND_AZT3328
select SND_RAWMIDI
select SND_AC97_CODEC
select SND_TIMER
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for Aztech AZF3328 (PCI168)
soundcards.
@@ -193,6 +197,7 @@ config SND_BT87X_OVERCLOCK

config SND_CA0106
tristate "SB Audigy LS / Live 24bit"
+ depends on HAS_IOPORT
select SND_AC97_CODEC
select SND_RAWMIDI
select SND_VMASTER
@@ -205,6 +210,7 @@ config SND_CA0106

config SND_CMIPCI
tristate "C-Media 8338, 8738, 8768, 8770"
+ depends on HAS_IOPORT
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_PCM
@@ -221,6 +227,7 @@ config SND_OXYGEN_LIB

config SND_OXYGEN
tristate "C-Media 8786, 8787, 8788 (Oxygen)"
+ depends on HAS_IOPORT
select SND_OXYGEN_LIB
select SND_PCM
select SND_MPU401_UART
@@ -246,6 +253,7 @@ config SND_OXYGEN

config SND_CS4281
tristate "Cirrus Logic (Sound Fusion) CS4281"
+ depends on HAS_IOPORT
select SND_OPL3_LIB
select SND_RAWMIDI
select SND_AC97_CODEC
@@ -257,6 +265,7 @@ config SND_CS4281

config SND_CS46XX
tristate "Cirrus Logic (Sound Fusion) CS4280/CS461x/CS462x/CS463x"
+ depends on HAS_IOPORT
select SND_RAWMIDI
select SND_AC97_CODEC
select FW_LOADER
@@ -290,6 +299,7 @@ config SND_CS5530
config SND_CS5535AUDIO
tristate "CS5535/CS5536 Audio"
depends on X86_32 || MIPS || COMPILE_TEST
+ depends on HAS_IOPORT
select SND_PCM
select SND_AC97_CODEC
help
@@ -307,6 +317,7 @@ config SND_CS5535AUDIO

config SND_CTXFI
tristate "Creative Sound Blaster X-Fi"
+ depends on HAS_IOPORT
select SND_PCM
help
If you want to use soundcards based on Creative Sound Blastr X-Fi
@@ -468,7 +479,7 @@ config SND_EMU10K1
select SND_AC97_CODEC
select SND_TIMER
select SND_SEQ_DEVICE if SND_SEQUENCER != n
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y to include support for Sound Blaster PCI 512, Live!,
Audigy and E-MU APS/0404/1010/1212/1616/1820 soundcards.
@@ -491,7 +502,7 @@ config SND_EMU10K1X
tristate "Emu10k1X (Dell OEM Version)"
select SND_AC97_CODEC
select SND_RAWMIDI
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for the Dell OEM version of the
Sound Blaster Live!.
@@ -501,6 +512,7 @@ config SND_EMU10K1X

config SND_ENS1370
tristate "(Creative) Ensoniq AudioPCI 1370"
+ depends on HAS_IOPORT
select SND_RAWMIDI
select SND_PCM
help
@@ -511,6 +523,7 @@ config SND_ENS1370

config SND_ENS1371
tristate "(Creative) Ensoniq AudioPCI 1371/1373"
+ depends on HAS_IOPORT
select SND_RAWMIDI
select SND_AC97_CODEC
help
@@ -525,7 +538,7 @@ config SND_ES1938
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_AC97_CODEC
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for soundcards based on ESS Solo-1
(ES1938, ES1946, ES1969) chips.
@@ -537,7 +550,7 @@ config SND_ES1968
tristate "ESS ES1968/1978 (Maestro-1/2/2E)"
select SND_MPU401_UART
select SND_AC97_CODEC
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for soundcards based on ESS Maestro
1/2/2E chips.
@@ -569,6 +582,7 @@ config SND_ES1968_RADIO

config SND_FM801
tristate "ForteMedia FM801"
+ depends on HAS_IOPORT
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_AC97_CODEC
@@ -624,7 +638,7 @@ config SND_ICE1712
select SND_MPU401_UART
select SND_AC97_CODEC
select BITREVERSE
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for soundcards based on the
ICE1712 (Envy24) chip.
@@ -640,6 +654,7 @@ config SND_ICE1712

config SND_ICE1724
tristate "ICE/VT1724/1720 (Envy24HT/PT)"
+ depends on HAS_IOPORT
select SND_RAWMIDI
select SND_AC97_CODEC
select SND_VMASTER
@@ -712,7 +727,7 @@ config SND_LX6464ES
config SND_MAESTRO3
tristate "ESS Allegro/Maestro3"
select SND_AC97_CODEC
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for soundcards based on ESS Maestro 3
(Allegro) chips.
@@ -753,6 +768,7 @@ config SND_NM256

config SND_PCXHR
tristate "Digigram PCXHR"
+ depends on HAS_IOPORT
select FW_LOADER
select SND_PCM
select SND_HWDEP
@@ -764,6 +780,7 @@ config SND_PCXHR

config SND_RIPTIDE
tristate "Conexant Riptide"
+ depends on HAS_IOPORT
select FW_LOADER
select SND_OPL3_LIB
select SND_MPU401_UART
@@ -808,6 +825,7 @@ config SND_RME9652
config SND_SE6X
tristate "Studio Evolution SE6X"
depends on SND_OXYGEN=n && SND_VIRTUOSO=n # PCI ID conflict
+ depends on HAS_IOPORT
select SND_OXYGEN_LIB
select SND_PCM
select SND_MPU401_UART
@@ -830,7 +848,7 @@ config SND_SONICVIBES
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_AC97_CODEC
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for soundcards based on the S3
SonicVibes chip.
@@ -842,7 +860,7 @@ config SND_TRIDENT
tristate "Trident 4D-Wave DX/NX; SiS 7018"
select SND_MPU401_UART
select SND_AC97_CODEC
- depends on ZONE_DMA
+ depends on ZONE_DMA && HAS_IOPORT
help
Say Y here to include support for soundcards based on Trident
4D-Wave DX/NX or SiS 7018 chips.
@@ -852,6 +870,7 @@ config SND_TRIDENT

config SND_VIA82XX
tristate "VIA 82C686A/B, 8233/8235 AC97 Controller"
+ depends on HAS_IOPORT
select SND_MPU401_UART
select SND_AC97_CODEC
help
@@ -863,6 +882,7 @@ config SND_VIA82XX

config SND_VIA82XX_MODEM
tristate "VIA 82C686A/B, 8233 based Modems"
+ depends on HAS_IOPORT
select SND_AC97_CODEC
help
Say Y here to include support for the integrated MC97 modem on
@@ -873,6 +893,7 @@ config SND_VIA82XX_MODEM

config SND_VIRTUOSO
tristate "Asus Virtuoso 66/100/200 (Xonar)"
+ depends on HAS_IOPORT
select SND_OXYGEN_LIB
select SND_PCM
select SND_MPU401_UART
@@ -889,6 +910,7 @@ config SND_VIRTUOSO

config SND_VX222
tristate "Digigram VX222"
+ depends on HAS_IOPORT
select SND_VX_LIB
help
Say Y here to include support for Digigram VX222 soundcards.
@@ -898,6 +920,7 @@ config SND_VX222

config SND_YMFPCI
tristate "Yamaha YMF724/740/744/754"
+ depends on HAS_IOPORT
select SND_OPL3_LIB
select SND_MPU401_UART
select SND_AC97_CODEC
diff --git a/sound/pcmcia/Kconfig b/sound/pcmcia/Kconfig
index 10291c43cb18..2e3dfc1ff540 100644
--- a/sound/pcmcia/Kconfig
+++ b/sound/pcmcia/Kconfig
@@ -4,6 +4,7 @@
menuconfig SND_PCMCIA
bool "PCMCIA sound devices"
depends on PCMCIA
+ depends on HAS_IOPORT
default y
help
Support for sound devices connected via the PCMCIA bus.
--
2.39.2


2023-05-22 11:13:10

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 19/44] misc: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/misc/altera-stapl/Makefile | 3 ++-
drivers/misc/altera-stapl/altera.c | 6 +++++-
2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/misc/altera-stapl/Makefile b/drivers/misc/altera-stapl/Makefile
index dd0f8189666b..90f18e7bf9b0 100644
--- a/drivers/misc/altera-stapl/Makefile
+++ b/drivers/misc/altera-stapl/Makefile
@@ -1,4 +1,5 @@
# SPDX-License-Identifier: GPL-2.0-only
-altera-stapl-objs = altera-lpt.o altera-jtag.o altera-comp.o altera.o
+altera-stapl-y = altera-jtag.o altera-comp.o altera.o
+altera-stapl-$(CONFIG_HAS_IOPORT) += altera-lpt.o

obj-$(CONFIG_ALTERA_STAPL) += altera-stapl.o
diff --git a/drivers/misc/altera-stapl/altera.c b/drivers/misc/altera-stapl/altera.c
index a58b7cb81d98..587427b73914 100644
--- a/drivers/misc/altera-stapl/altera.c
+++ b/drivers/misc/altera-stapl/altera.c
@@ -2407,6 +2407,10 @@ int altera_init(struct altera_config *config, const struct firmware *fw)

astate->config = config;
if (!astate->config->jtag_io) {
+ if (!IS_ENABLED(CONFIG_HAS_IOPORT)) {
+ retval = -ENODEV;
+ goto free_state;
+ }
dprintk("%s: using byteblaster!\n", __func__);
astate->config->jtag_io = netup_jtag_io_lpt;
}
@@ -2481,7 +2485,7 @@ int altera_init(struct altera_config *config, const struct firmware *fw)

} else if (exec_result)
printk(KERN_ERR "%s: error %d\n", __func__, exec_result);
-
+free_state:
kfree(astate);
free_value:
kfree(value);
--
2.39.2


2023-05-22 11:13:14

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 33/44] speakup: add HAS_IOPORT dependency for SPEAKUP_SERIALIO

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. SPEAKUP_SERIALIO thus needs to depend on HAS_IOPORT.

Reviewed-by: Samuel Thibault <[email protected]>
Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/accessibility/speakup/Kconfig | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/accessibility/speakup/Kconfig b/drivers/accessibility/speakup/Kconfig
index 07ecbbde0384..e84fb617acc4 100644
--- a/drivers/accessibility/speakup/Kconfig
+++ b/drivers/accessibility/speakup/Kconfig
@@ -46,6 +46,7 @@ if SPEAKUP
config SPEAKUP_SERIALIO
def_bool y
depends on ISA || COMPILE_TEST
+ depends on HAS_IOPORT

config SPEAKUP_SYNTH_ACNTSA
tristate "Accent SA synthesizer support"
--
2.39.2


2023-05-22 11:13:39

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 41/44] video: Handle HAS_IOPORT dependencies

In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. We thus need to #ifdef functions and their callsites
which unconditionally use these I/O accessors. In the
include/video/vga.h these are conveniently all those functions with the
vga_io_* prefix.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/video/fbdev/Kconfig | 3 ++-
include/video/vga.h | 35 +++++++++++++++++++++++++----------
2 files changed, 27 insertions(+), 11 deletions(-)

diff --git a/drivers/video/fbdev/Kconfig b/drivers/video/fbdev/Kconfig
index 4eea398ebbfe..598d06bddf6a 100644
--- a/drivers/video/fbdev/Kconfig
+++ b/drivers/video/fbdev/Kconfig
@@ -532,7 +532,8 @@ config FB_IMSTT

config FB_VGA16
tristate "VGA 16-color graphics support"
- depends on FB && HAS_IOPORT
+ depends on FB && (X86 || PPC)
+ depends on HAS_IOPORT
select APERTURE_HELPERS
select FB_CFB_FILLRECT
select FB_CFB_COPYAREA
diff --git a/include/video/vga.h b/include/video/vga.h
index 947c0abd04ef..ed89295941c4 100644
--- a/include/video/vga.h
+++ b/include/video/vga.h
@@ -201,6 +201,7 @@ extern int restore_vga(struct vgastate *state);
* generic VGA port read/write
*/

+#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_r (unsigned short port)
{
return inb_p(port);
@@ -210,12 +211,12 @@ static inline void vga_io_w (unsigned short port, unsigned char val)
{
outb_p(val, port);
}
-
static inline void vga_io_w_fast (unsigned short port, unsigned char reg,
unsigned char val)
{
outw(VGA_OUT16VAL (val, reg), port);
}
+#endif /* CONFIG_HAS_IOPORT */

static inline unsigned char vga_mm_r (void __iomem *regbase, unsigned short port)
{
@@ -235,28 +236,34 @@ static inline void vga_mm_w_fast (void __iomem *regbase, unsigned short port,

static inline unsigned char vga_r (void __iomem *regbase, unsigned short port)
{
- if (regbase)
- return vga_mm_r (regbase, port);
- else
+#ifdef CONFIG_HAS_IOPORT
+ if (!regbase)
return vga_io_r (port);
+ else
+#endif /* CONFIG_HAS_IOPORT */
+ return vga_mm_r (regbase, port);
}

static inline void vga_w (void __iomem *regbase, unsigned short port, unsigned char val)
{
- if (regbase)
- vga_mm_w (regbase, port, val);
- else
+#ifdef CONFIG_HAS_IOPORT
+ if (!regbase)
vga_io_w (port, val);
+ else
+#endif /* CONFIG_HAS_IOPORT */
+ vga_mm_w (regbase, port, val);
}


static inline void vga_w_fast (void __iomem *regbase, unsigned short port,
unsigned char reg, unsigned char val)
{
- if (regbase)
- vga_mm_w_fast (regbase, port, reg, val);
- else
+#ifdef CONFIG_HAS_IOPORT
+ if (!regbase)
vga_io_w_fast (port, reg, val);
+ else
+#endif /* CONFIG_HAS_IOPORT */
+ vga_mm_w_fast (regbase, port, reg, val);
}


@@ -280,6 +287,7 @@ static inline void vga_wcrt (void __iomem *regbase, unsigned char reg, unsigned
#endif /* VGA_OUTW_WRITE */
}

+#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_rcrt (unsigned char reg)
{
vga_io_w (VGA_CRT_IC, reg);
@@ -295,6 +303,7 @@ static inline void vga_io_wcrt (unsigned char reg, unsigned char val)
vga_io_w (VGA_CRT_DC, val);
#endif /* VGA_OUTW_WRITE */
}
+#endif /* CONFIG_HAS_IOPORT */

static inline unsigned char vga_mm_rcrt (void __iomem *regbase, unsigned char reg)
{
@@ -333,6 +342,7 @@ static inline void vga_wseq (void __iomem *regbase, unsigned char reg, unsigned
#endif /* VGA_OUTW_WRITE */
}

+#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_rseq (unsigned char reg)
{
vga_io_w (VGA_SEQ_I, reg);
@@ -348,6 +358,7 @@ static inline void vga_io_wseq (unsigned char reg, unsigned char val)
vga_io_w (VGA_SEQ_D, val);
#endif /* VGA_OUTW_WRITE */
}
+#endif /* CONFIG_HAS_IOPORT */

static inline unsigned char vga_mm_rseq (void __iomem *regbase, unsigned char reg)
{
@@ -385,6 +396,7 @@ static inline void vga_wgfx (void __iomem *regbase, unsigned char reg, unsigned
#endif /* VGA_OUTW_WRITE */
}

+#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_rgfx (unsigned char reg)
{
vga_io_w (VGA_GFX_I, reg);
@@ -400,6 +412,7 @@ static inline void vga_io_wgfx (unsigned char reg, unsigned char val)
vga_io_w (VGA_GFX_D, val);
#endif /* VGA_OUTW_WRITE */
}
+#endif /* CONFIG_HAS_IOPORT */

static inline unsigned char vga_mm_rgfx (void __iomem *regbase, unsigned char reg)
{
@@ -434,6 +447,7 @@ static inline void vga_wattr (void __iomem *regbase, unsigned char reg, unsigned
vga_w (regbase, VGA_ATT_W, val);
}

+#ifdef CONFIG_HAS_IOPORT
static inline unsigned char vga_io_rattr (unsigned char reg)
{
vga_io_w (VGA_ATT_IW, reg);
@@ -445,6 +459,7 @@ static inline void vga_io_wattr (unsigned char reg, unsigned char val)
vga_io_w (VGA_ATT_IW, reg);
vga_io_w (VGA_ATT_W, val);
}
+#endif /* CONFIG_HAS_IOPORT */

static inline unsigned char vga_mm_rattr (void __iomem *regbase, unsigned char reg)
{
--
2.39.2


2023-05-22 11:20:32

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 42/44] watchdog: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Acked-by: Guenter Roeck <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/watchdog/Kconfig | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index f22138709bf5..affe25b96cfe 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -453,6 +453,7 @@ config 21285_WATCHDOG
config 977_WATCHDOG
tristate "NetWinder WB83C977 watchdog"
depends on (FOOTBRIDGE && ARCH_NETWINDER) || (ARM && COMPILE_TEST)
+ depends on HAS_IOPORT
help
Say Y here to include support for the WB977 watchdog included in
NetWinder machines. Alternatively say M to compile the driver as
@@ -1271,6 +1272,7 @@ config ITCO_WDT
select WATCHDOG_CORE
depends on I2C || I2C=n
depends on MFD_INTEL_PMC_BXT || !MFD_INTEL_PMC_BXT
+ depends on HAS_IOPORT # for I2C_I801
select LPC_ICH if !EXPERT
select I2C_I801 if !EXPERT && I2C
help
@@ -2159,7 +2161,7 @@ comment "PCI-based Watchdog Cards"

config PCIPCWATCHDOG
tristate "Berkshire Products PCI-PC Watchdog"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
This is the driver for the Berkshire Products PCI-PC Watchdog card.
This card simply watches your kernel to make sure it doesn't freeze,
@@ -2174,7 +2176,7 @@ config PCIPCWATCHDOG

config WDTPCI
tristate "PCI-WDT500/501 Watchdog timer"
- depends on PCI
+ depends on PCI && HAS_IOPORT
help
If you have a PCI-WDT500/501 watchdog board, say Y here, otherwise N.

--
2.39.2


2023-05-22 11:50:52

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v5 00/44] treewide: Remove I/O port accessors for HAS_IOPORT=n

On Mon, May 22, 2023, at 12:50, Niklas Schnelle wrote:

> A few patches have already been applied but I've kept those which are not yet
> in v6.4-rc3.
>
> This version is based on v6.4-rc3 and is also available on my kernel.org tree
> in the has_ioport_v5:
>
> https://git.kernel.org/pub/scm/linux/kernel/git/niks/linux.git

I think it would be best if as many patches as possible get merged
into v6.5 through the individidual subsystems, though I can take
whatever is left through the asm-generic tree.

Since the goal is to have maintainers pick up part of this, I would
recommend splitting the series per subsystem, having either a
separate patch or a small series for each maintainer that should
pick them up.

More importantly, I think you should rebase the series against
linux-next in order to find and drop the patches that are queued
up for 6.5 already. The patches will be applied into branches
that are based on 6.4-rc of course, but basing on linux-next
is usually the easiest when targeting multiple maintainer
trees.

Maybe let's give it another week to have more maintainers pick
up stuff from v5, and then send out a v6 as separate submissions.

Arnd

2023-05-22 11:52:36

by Niklas Schnelle

[permalink] [raw]
Subject: [PATCH v5 31/44] scsi: add HAS_IOPORT dependencies

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.

Co-developed-by: Arnd Bergmann <[email protected]>
Signed-off-by: Arnd Bergmann <[email protected]>
Signed-off-by: Niklas Schnelle <[email protected]>
---
drivers/scsi/Kconfig | 25 +++++++++++++------------
drivers/scsi/aic7xxx/Kconfig.aic79xx | 2 +-
drivers/scsi/aic7xxx/Kconfig.aic7xxx | 2 +-
drivers/scsi/aic94xx/Kconfig | 2 +-
drivers/scsi/megaraid/Kconfig.megaraid | 6 +++---
drivers/scsi/mvsas/Kconfig | 2 +-
drivers/scsi/pcmcia/Kconfig | 6 +++++-
drivers/scsi/qla2xxx/Kconfig | 2 +-
8 files changed, 26 insertions(+), 21 deletions(-)

diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig
index 0704809d9d99..4962ce989113 100644
--- a/drivers/scsi/Kconfig
+++ b/drivers/scsi/Kconfig
@@ -334,7 +334,7 @@ config SGIWD93_SCSI

config BLK_DEV_3W_XXXX_RAID
tristate "3ware 5/6/7/8xxx ATA-RAID support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
help
3ware is the only hardware ATA-Raid product in Linux to date.
This card is 2,4, or 8 channel master mode support only.
@@ -381,7 +381,7 @@ config SCSI_3W_SAS

config SCSI_ACARD
tristate "ACARD SCSI support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
help
This driver supports the ACARD SCSI host adapter.
Support Chip <ATP870 ATP876 ATP880 ATP885>
@@ -462,7 +462,7 @@ config SCSI_MVUMI
config SCSI_ADVANSYS
tristate "AdvanSys SCSI support"
depends on SCSI
- depends on ISA || EISA || PCI
+ depends on (ISA || EISA || PCI) && HAS_IOPORT
depends on ISA_DMA_API || !ISA
help
This is a driver for all SCSI host adapters manufactured by
@@ -503,7 +503,7 @@ config SCSI_HPTIOP

config SCSI_BUSLOGIC
tristate "BusLogic SCSI support"
- depends on PCI && SCSI
+ depends on SCSI && PCI && HAS_IOPORT
help
This is support for BusLogic MultiMaster and FlashPoint SCSI Host
Adapters. Consult the SCSI-HOWTO, available from
@@ -518,7 +518,7 @@ config SCSI_BUSLOGIC

config SCSI_FLASHPOINT
bool "FlashPoint support"
- depends on SCSI_BUSLOGIC && PCI
+ depends on SCSI_BUSLOGIC && PCI && HAS_IOPORT
help
This option allows you to add FlashPoint support to the
BusLogic SCSI driver. The FlashPoint SCCB Manager code is
@@ -632,7 +632,7 @@ config SCSI_SNIC_DEBUG_FS

config SCSI_DMX3191D
tristate "DMX3191D SCSI support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
select SCSI_SPI_ATTRS
help
This is support for Domex DMX3191D SCSI Host Adapters.
@@ -646,7 +646,7 @@ config SCSI_FDOMAIN

config SCSI_FDOMAIN_PCI
tristate "Future Domain TMC-3260/AHA-2920A PCI SCSI support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
select SCSI_FDOMAIN
help
This is support for Future Domain's PCI SCSI host adapters (TMC-3260)
@@ -699,7 +699,7 @@ config SCSI_GENERIC_NCR5380

config SCSI_IPS
tristate "IBM ServeRAID support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
help
This is support for the IBM ServeRAID hardware RAID controllers.
See <http://www.developer.ibm.com/welcome/netfinity/serveraid.html>
@@ -759,7 +759,7 @@ config SCSI_IBMVFC_TRACE

config SCSI_INITIO
tristate "Initio 9100U(W) support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
help
This is support for the Initio 91XXU(W) SCSI host adapter. Please
read the SCSI-HOWTO, available from
@@ -770,7 +770,7 @@ config SCSI_INITIO

config SCSI_INIA100
tristate "Initio INI-A100U2W support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
help
This is support for the Initio INI-A100U2W SCSI host adapter.
Please read the SCSI-HOWTO, available from
@@ -782,6 +782,7 @@ config SCSI_INIA100
config SCSI_PPA
tristate "IOMEGA parallel port (ppa - older drives)"
depends on SCSI && PARPORT_PC
+ depends on HAS_IOPORT
help
This driver supports older versions of IOMEGA's parallel port ZIP
drive (a 100 MB removable media device).
@@ -1175,7 +1176,7 @@ config SCSI_SIM710

config SCSI_DC395x
tristate "Tekram DC395(U/UW/F) and DC315(U) SCSI support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
select SCSI_SPI_ATTRS
help
This driver supports PCI SCSI host adapters based on the ASIC
@@ -1207,7 +1208,7 @@ config SCSI_AM53C974

config SCSI_NSP32
tristate "Workbit NinjaSCSI-32Bi/UDE support"
- depends on PCI && SCSI && !64BIT
+ depends on PCI && SCSI && !64BIT && HAS_IOPORT
help
This is support for the Workbit NinjaSCSI-32Bi/UDE PCI/Cardbus
SCSI host adapter. Please read the SCSI-HOWTO, available from
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic79xx b/drivers/scsi/aic7xxx/Kconfig.aic79xx
index a47dbd500e9a..4bc53eec4c83 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic79xx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic79xx
@@ -5,7 +5,7 @@
#
config SCSI_AIC79XX
tristate "Adaptec AIC79xx U320 support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
select SCSI_SPI_ATTRS
help
This driver supports all of Adaptec's Ultra 320 PCI-X
diff --git a/drivers/scsi/aic7xxx/Kconfig.aic7xxx b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
index 0cfd92ce750a..f0425145a5f4 100644
--- a/drivers/scsi/aic7xxx/Kconfig.aic7xxx
+++ b/drivers/scsi/aic7xxx/Kconfig.aic7xxx
@@ -5,7 +5,7 @@
#
config SCSI_AIC7XXX
tristate "Adaptec AIC7xxx Fast -> U160 support"
- depends on (PCI || EISA) && SCSI
+ depends on (PCI || EISA) && HAS_IOPORT && SCSI
select SCSI_SPI_ATTRS
help
This driver supports all of Adaptec's Fast through Ultra 160 PCI
diff --git a/drivers/scsi/aic94xx/Kconfig b/drivers/scsi/aic94xx/Kconfig
index 71931c371b1c..aaa8dadc6e1c 100644
--- a/drivers/scsi/aic94xx/Kconfig
+++ b/drivers/scsi/aic94xx/Kconfig
@@ -8,7 +8,7 @@

config SCSI_AIC94XX
tristate "Adaptec AIC94xx SAS/SATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select SCSI_SAS_LIBSAS
select FW_LOADER
help
diff --git a/drivers/scsi/megaraid/Kconfig.megaraid b/drivers/scsi/megaraid/Kconfig.megaraid
index 2adc2afd9f91..3f2ce1eb081c 100644
--- a/drivers/scsi/megaraid/Kconfig.megaraid
+++ b/drivers/scsi/megaraid/Kconfig.megaraid
@@ -1,13 +1,13 @@
# SPDX-License-Identifier: GPL-2.0-only
config MEGARAID_NEWGEN
bool "LSI Logic New Generation RAID Device Drivers"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
help
LSI Logic RAID Device Drivers

config MEGARAID_MM
tristate "LSI Logic Management Module (New Driver)"
- depends on PCI && SCSI && MEGARAID_NEWGEN
+ depends on PCI && HAS_IOPORT && SCSI && MEGARAID_NEWGEN
help
Management Module provides ioctl, sysfs support for LSI Logic
RAID controllers.
@@ -67,7 +67,7 @@ config MEGARAID_MAILBOX

config MEGARAID_LEGACY
tristate "LSI Logic Legacy MegaRAID Driver"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
help
This driver supports the LSI MegaRAID 418, 428, 438, 466, 762, 490
and 467 SCSI host adapters. This driver also support the all U320
diff --git a/drivers/scsi/mvsas/Kconfig b/drivers/scsi/mvsas/Kconfig
index 79812b80743b..5ac7fd593b17 100644
--- a/drivers/scsi/mvsas/Kconfig
+++ b/drivers/scsi/mvsas/Kconfig
@@ -9,7 +9,7 @@

config SCSI_MVSAS
tristate "Marvell 88SE64XX/88SE94XX SAS/SATA support"
- depends on PCI
+ depends on PCI && HAS_IOPORT
select SCSI_SAS_LIBSAS
select FW_LOADER
help
diff --git a/drivers/scsi/pcmcia/Kconfig b/drivers/scsi/pcmcia/Kconfig
index 9696b6b5591f..449bd85db7bb 100644
--- a/drivers/scsi/pcmcia/Kconfig
+++ b/drivers/scsi/pcmcia/Kconfig
@@ -12,6 +12,7 @@ if SCSI_LOWLEVEL_PCMCIA && SCSI && PCMCIA && m

config PCMCIA_AHA152X
tristate "Adaptec AHA152X PCMCIA support"
+ depends on HAS_IOPORT
select SCSI_SPI_ATTRS
help
Say Y here if you intend to attach this type of PCMCIA SCSI host
@@ -22,6 +23,7 @@ config PCMCIA_AHA152X

config PCMCIA_FDOMAIN
tristate "Future Domain PCMCIA support"
+ depends on HAS_IOPORT
select SCSI_FDOMAIN
help
Say Y here if you intend to attach this type of PCMCIA SCSI host
@@ -32,7 +34,7 @@ config PCMCIA_FDOMAIN

config PCMCIA_NINJA_SCSI
tristate "NinjaSCSI-3 / NinjaSCSI-32Bi (16bit) PCMCIA support"
- depends on !64BIT || COMPILE_TEST
+ depends on (!64BIT || COMPILE_TEST) && HAS_IOPORT
help
If you intend to attach this type of PCMCIA SCSI host adapter to
your computer, say Y here and read
@@ -66,6 +68,7 @@ config PCMCIA_NINJA_SCSI

config PCMCIA_QLOGIC
tristate "Qlogic PCMCIA support"
+ depends on HAS_IOPORT
help
Say Y here if you intend to attach this type of PCMCIA SCSI host
adapter to your computer.
@@ -75,6 +78,7 @@ config PCMCIA_QLOGIC

config PCMCIA_SYM53C500
tristate "Symbios 53c500 PCMCIA support"
+ depends on HAS_IOPORT
help
Say Y here if you have a New Media Bus Toaster or other PCMCIA
SCSI adapter based on the Symbios 53c500 controller.
diff --git a/drivers/scsi/qla2xxx/Kconfig b/drivers/scsi/qla2xxx/Kconfig
index 802c373fd6d9..a584708d3056 100644
--- a/drivers/scsi/qla2xxx/Kconfig
+++ b/drivers/scsi/qla2xxx/Kconfig
@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0-only
config SCSI_QLA_FC
tristate "QLogic QLA2XXX Fibre Channel Support"
- depends on PCI && SCSI
+ depends on PCI && HAS_IOPORT && SCSI
depends on SCSI_FC_ATTRS
depends on NVME_FC || !NVME_FC
select FW_LOADER
--
2.39.2


2023-05-22 11:57:12

by Damien Le Moal

[permalink] [raw]
Subject: Re: [PATCH v5 02/44] ata: add HAS_IOPORT dependencies

On 5/22/23 19:50, Niklas Schnelle wrote:
> 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.
>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Acked-by: Damien Le Moal <[email protected]>

This new version looks much nicer !

Please change my Ack to:

Acked-by: Damien Le Moal <[email protected]>

> Signed-off-by: Niklas Schnelle <[email protected]>
> ---
> drivers/ata/Kconfig | 28 ++++++++++++++--------------
> drivers/ata/libata-sff.c | 4 ++++
> 2 files changed, 18 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
> index 42b51c9812a0..c521cdc51f8c 100644
> --- a/drivers/ata/Kconfig
> +++ b/drivers/ata/Kconfig
> @@ -557,7 +557,7 @@ comment "PATA SFF controllers with BMDMA"
>
> config PATA_ALI
> tristate "ALi PATA support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> select PATA_TIMINGS
> help
> This option enables support for the ALi ATA interfaces
> @@ -567,7 +567,7 @@ config PATA_ALI
>
> config PATA_AMD
> tristate "AMD/NVidia PATA support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> select PATA_TIMINGS
> help
> This option enables support for the AMD and NVidia PATA
> @@ -585,7 +585,7 @@ config PATA_ARASAN_CF
>
> config PATA_ARTOP
> tristate "ARTOP 6210/6260 PATA support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> help
> This option enables support for ARTOP PATA controllers.
>
> @@ -612,7 +612,7 @@ config PATA_ATP867X
>
> config PATA_CMD64X
> tristate "CMD64x PATA support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> select PATA_TIMINGS
> help
> This option enables support for the CMD64x series chips
> @@ -659,7 +659,7 @@ config PATA_CS5536
>
> config PATA_CYPRESS
> tristate "Cypress CY82C693 PATA support (Very Experimental)"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> select PATA_TIMINGS
> help
> This option enables support for the Cypress/Contaq CY82C693
> @@ -707,7 +707,7 @@ config PATA_HPT366
>
> config PATA_HPT37X
> tristate "HPT 370/370A/371/372/374/302 PATA support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> help
> This option enables support for the majority of the later HPT
> PATA controllers via the new ATA layer.
> @@ -716,7 +716,7 @@ config PATA_HPT37X
>
> config PATA_HPT3X2N
> tristate "HPT 371N/372N/302N PATA support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> help
> This option enables support for the N variant HPT PATA
> controllers via the new ATA layer.
> @@ -819,7 +819,7 @@ config PATA_MPC52xx
>
> config PATA_NETCELL
> tristate "NETCELL Revolution RAID support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> help
> This option enables support for the Netcell Revolution RAID
> PATA controller.
> @@ -855,7 +855,7 @@ config PATA_OLDPIIX
>
> config PATA_OPTIDMA
> tristate "OPTI FireStar PATA support (Very Experimental)"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> help
> This option enables DMA/PIO support for the later OPTi
> controllers found on some old motherboards and in some
> @@ -865,7 +865,7 @@ config PATA_OPTIDMA
>
> config PATA_PDC2027X
> tristate "Promise PATA 2027x support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> help
> This option enables support for Promise PATA pdc20268 to pdc20277 host adapters.
>
> @@ -873,7 +873,7 @@ config PATA_PDC2027X
>
> config PATA_PDC_OLD
> tristate "Older Promise PATA controller support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> help
> This option enables support for the Promise 20246, 20262, 20263,
> 20265 and 20267 adapters.
> @@ -901,7 +901,7 @@ config PATA_RDC
>
> config PATA_SC1200
> tristate "SC1200 PATA support"
> - depends on PCI && (X86_32 || COMPILE_TEST)
> + depends on PCI && (X86_32 || COMPILE_TEST) && HAS_IOPORT
> help
> This option enables support for the NatSemi/AMD SC1200 SoC
> companion chip used with the Geode processor family.
> @@ -919,7 +919,7 @@ config PATA_SCH
>
> config PATA_SERVERWORKS
> tristate "SERVERWORKS OSB4/CSB5/CSB6/HT1000 PATA support"
> - depends on PCI
> + depends on PCI && HAS_IOPORT
> help
> This option enables support for the Serverworks OSB4/CSB5/CSB6 and
> HT1000 PATA controllers, via the new ATA layer.
> @@ -1183,7 +1183,7 @@ config ATA_GENERIC
>
> config PATA_LEGACY
> tristate "Legacy ISA PATA support (Experimental)"
> - depends on (ISA || PCI)
> + depends on (ISA || PCI) && HAS_IOPORT
> select PATA_TIMINGS
> help
> This option enables support for ISA/VLB/PCI bus legacy PATA
> diff --git a/drivers/ata/libata-sff.c b/drivers/ata/libata-sff.c
> index 9d28badfe41d..c8cb7ed28f83 100644
> --- a/drivers/ata/libata-sff.c
> +++ b/drivers/ata/libata-sff.c
> @@ -3042,6 +3042,7 @@ EXPORT_SYMBOL_GPL(ata_bmdma_port_start32);
> */
> int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
> {
> +#ifdef CONFIG_HAS_IOPORT
> unsigned long bmdma = pci_resource_start(pdev, 4);
> u8 simplex;
>
> @@ -3054,6 +3055,9 @@ int ata_pci_bmdma_clear_simplex(struct pci_dev *pdev)
> if (simplex & 0x80)
> return -EOPNOTSUPP;
> return 0;
> +#else
> + return -ENOENT;
> +#endif /* CONFIG_HAS_IOPORT */
> }
> EXPORT_SYMBOL_GPL(ata_pci_bmdma_clear_simplex);
>

--
Damien Le Moal
Western Digital Research


2023-05-22 12:05:38

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v5 32/44] sound: add HAS_IOPORT dependencies

On Mon, 22 May 2023 12:50:37 +0200,
Niklas Schnelle wrote:
>
> 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.
>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>

Looks good to me. Would you like the patch picked up through
sound.git tree, or rather apply all through a different tree?
In the latter case:

Reviewed-by: Takashi Iwai <[email protected]>


thanks,

Takashi

2023-05-22 12:14:38

by Jaroslav Kysela

[permalink] [raw]
Subject: Re: [PATCH v5 28/44] pnp: add HAS_IOPORT dependencies

On 22. 05. 23 12:50, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to depend on HAS_IOPORT even when
> compile testing only.
>
> Acked-by: Rafael J. Wysocki <[email protected]>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>

Acked-by: Jaroslav Kysela <[email protected]>

--
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.


2023-05-22 12:26:37

by Jaroslav Kysela

[permalink] [raw]
Subject: Re: [PATCH v5 32/44] sound: add HAS_IOPORT dependencies

On 22. 05. 23 12:50, Niklas Schnelle wrote:
> 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.
>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>

Acked-by: Jaroslav Kysela <[email protected]>

--
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.


2023-05-22 13:28:12

by Thomas Zimmermann

[permalink] [raw]
Subject: Re: [PATCH v5 09/44] drm: handle HAS_IOPORT dependencies

Hi

Am 22.05.23 um 12:50 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.

I think we should consider making cirrus depend on HAS_IOPORT. The
driver is only for qemu's cirrus emulation, which IIRC can only be
enabled for i586. And it has all been deprecated long ago.

>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>
> ---
> 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>

Why not <linux/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

Would it be feasible to define inb, inw, outb and outw at the top of
bochs.c if no HAS_IOPORT has been set? That would avoid the ifdef
branching within the code.

> }
> }
>
> @@ -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");

Use drm_err() here.

Best regards
Thomas

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


Attachments:
OpenPGP_signature (855.00 B)
OpenPGP digital signature

2023-05-22 13:28:50

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v5 09/44] drm: handle HAS_IOPORT dependencies

On Mon, May 22, 2023, at 14:38, Thomas Zimmermann wrote:
> Am 22.05.23 um 12:50 schrieb Niklas Schnelle:

>> 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.
>
> I think we should consider making cirrus depend on HAS_IOPORT. The
> driver is only for qemu's cirrus emulation, which IIRC can only be
> enabled for i586. And it has all been deprecated long ago.

I tried it out in arm64 debvm, and both the kernel and Xorg drivers
are detected just fine according to the log. I only get a black
screen, which could be the result of a missing VGA BIOS or the missing
unblank Port I/O in the driver (I doubt the VGA ports are hooked up
on arm64 qemu), but there is a good chance that it's currently
working for someone else.

Arnd

2023-05-22 13:29:35

by Maciej W. Rozycki

[permalink] [raw]
Subject: Re: [PATCH v5 30/44] rtc: add HAS_IOPORT dependencies

On Mon, 22 May 2023, Niklas Schnelle wrote:

> diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig
> index 753872408615..a38a919b3f15 100644
> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -956,6 +956,7 @@ comment "Platform RTC drivers"
> config RTC_DRV_CMOS
> tristate "PC-style 'CMOS'"
> depends on X86 || ARM || PPC || MIPS || SPARC64
> + depends on HAS_IOPORT || MACH_DECSTATION
> default y if X86
> select RTC_MC146818_LIB
> help

For the DECstation part:

Acked-by: Maciej W. Rozycki <[email protected]>

Maciej

2023-05-22 13:52:47

by Gerd Hoffmann

[permalink] [raw]
Subject: Re: [PATCH v5 09/44] drm: handle HAS_IOPORT dependencies

Hi,

> > 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.
>
> I think we should consider making cirrus depend on HAS_IOPORT. The driver is
> only for qemu's cirrus emulation, which IIRC can only be enabled for i586.

Agree. cirrus is x86 only (both i386 / x86_64 though). Just require
HAS_IOPORT and be done with it.

> And it has all been deprecated long ago.

The fact that cirrus used to be the qemu default for many years is
pretty much the only reason it is still somewhat relevant today ...

take care,
Gerd


2023-05-22 14:15:10

by Alan Stern

[permalink] [raw]
Subject: Re: [PATCH v5 37/44] usb: uhci: handle HAS_IOPORT dependencies

On Mon, May 22, 2023 at 12:50:42PM +0200, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. We thus need to guard sections of code calling them
> as alternative access methods with CONFIG_HAS_IOPORT checks. For
> uhci-hcd there are a lot of I/O port uses that do have MMIO alternatives
> all selected by uhci_has_pci_registers() so this can be handled by
> UHCI_IN/OUT macros and making uhci_has_pci_registers() constant 0 if
> CONFIG_HAS_IOPORT is unset.
>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>
> ---

Reviewed-by: Alan Stern <[email protected]>

2023-05-22 14:57:30

by Niklas Schnelle

[permalink] [raw]
Subject: Re: [PATCH v5 32/44] sound: add HAS_IOPORT dependencies

On Mon, 2023-05-22 at 13:59 +0200, Takashi Iwai wrote:
> On Mon, 22 May 2023 12:50:37 +0200,
> Niklas Schnelle wrote:
> >
> > 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.
> >
> > Co-developed-by: Arnd Bergmann <[email protected]>
> > Signed-off-by: Arnd Bergmann <[email protected]>
> > Signed-off-by: Niklas Schnelle <[email protected]>
>
> Looks good to me. Would you like the patch picked up through
> sound.git tree, or rather apply all through a different tree?
> In the latter case:
>
> Reviewed-by: Takashi Iwai <[email protected]>
>
>
> thanks,
>
> Takashi

With the Kconfig addition of HAS_IOPORT merged in v6.4-rc1 this patch
can now go independently via the the sound.git tree. Our plan is to get
as many of these per-subsystem patches merged for v6.5 as possible such
that then only a small number (ideally zero) of patches remain before
the last one can be merged removing inb()/outb() etc for HAS_IOPORT=n.

Thanks,
Niklas

2023-05-22 14:57:40

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v5 32/44] sound: add HAS_IOPORT dependencies

On Mon, 22 May 2023 15:54:36 +0200,
Niklas Schnelle wrote:
>
> On Mon, 2023-05-22 at 13:59 +0200, Takashi Iwai wrote:
> > On Mon, 22 May 2023 12:50:37 +0200,
> > Niklas Schnelle wrote:
> > >
> > > 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.
> > >
> > > Co-developed-by: Arnd Bergmann <[email protected]>
> > > Signed-off-by: Arnd Bergmann <[email protected]>
> > > Signed-off-by: Niklas Schnelle <[email protected]>
> >
> > Looks good to me. Would you like the patch picked up through
> > sound.git tree, or rather apply all through a different tree?
> > In the latter case:
> >
> > Reviewed-by: Takashi Iwai <[email protected]>
> >
> >
> > thanks,
> >
> > Takashi
>
> With the Kconfig addition of HAS_IOPORT merged in v6.4-rc1 this patch
> can now go independently via the the sound.git tree. Our plan is to get
> as many of these per-subsystem patches merged for v6.5 as possible such
> that then only a small number (ideally zero) of patches remain before
> the last one can be merged removing inb()/outb() etc for HAS_IOPORT=n.

OK, then I applied the patch now on for-next branch.


Thanks!

Takashi

2023-05-22 22:32:51

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH v5 31/44] scsi: add HAS_IOPORT dependencies


Niklas,

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

Do you intend for me to pick these up?

--
Martin K. Petersen Oracle Linux Engineering

2023-05-22 22:46:13

by Dmitry Torokhov

[permalink] [raw]
Subject: Re: [PATCH v5 16/44] Input: gameport: add ISA and HAS_IOPORT dependencies

Hi Niklas,

On Mon, May 22, 2023 at 12:50:21PM +0200, Niklas Schnelle wrote:
> diff --git a/include/linux/gameport.h b/include/linux/gameport.h
> index 8c2f00018e89..4d5720022b63 100644
> --- a/include/linux/gameport.h
> +++ b/include/linux/gameport.h
> @@ -167,16 +167,21 @@ static inline void gameport_trigger(struct gameport *gameport)
> {
> if (gameport->trigger)
> gameport->trigger(gameport);
> +#ifdef CONFIG_HAS_IOPORT
> else
> outb(0xff, gameport->io);
> +#endif

Contrary to the cover letter, this is still kind-of runtime detection
(i.e. broken drivers will silently stop working), we need to have
dev_err[_ratelimited?] here and below.

I also just posted a patch reworking this a bit so this and the chunk
below can be hidden in gameport.c.

Thanks.

--
Dmitry

2023-05-23 07:36:06

by Niklas Schnelle

[permalink] [raw]
Subject: Re: [PATCH v5 31/44] scsi: add HAS_IOPORT dependencies

On Mon, 2023-05-22 at 18:28 -0400, Martin K. Petersen wrote:
> Niklas,
>
> > 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.
>
> Do you intend for me to pick these up?
>

Hi Martin,

Yes if you're okay with the changes go ahead and pick them up for the
subsystems you maintain. Our plan is to get as many of these picked up
for v6.5 as possible, then deal with the stragglers and finally merge
the last patch in this series that disables inb()/outb() for
HAS_IOPORT=n.

Thanks,
Niklas

2023-05-23 08:25:32

by Bartosz Golaszewski

[permalink] [raw]
Subject: Re: [PATCH v5 11/44] gpio: add HAS_IOPORT dependencies

On Mon, May 22, 2023 at 12:51 PM Niklas Schnelle <[email protected]> wrote:
>
> 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.
>
> Reviewed-by: Linus Walleij <[email protected]>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>
> ---
> drivers/gpio/Kconfig | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpio/Kconfig b/drivers/gpio/Kconfig
> index 5521f060d58e..a470ec8d617b 100644
> --- a/drivers/gpio/Kconfig
> +++ b/drivers/gpio/Kconfig
> @@ -704,18 +704,6 @@ config GPIO_VISCONTI
> help
> Say yes here to support GPIO on Tohisba Visconti.
>
> -config GPIO_VX855
> - tristate "VIA VX855/VX875 GPIO"
> - depends on (X86 || COMPILE_TEST) && PCI
> - select MFD_CORE
> - select MFD_VX855
> - help
> - Support access to the VX855/VX875 GPIO lines through the GPIO library.
> -
> - This driver provides common support for accessing the device.
> - Additional drivers must be enabled in order to use the
> - functionality of the device.
> -
> config GPIO_WCD934X
> tristate "Qualcomm Technologies Inc WCD9340/WCD9341 GPIO controller driver"
> depends on MFD_WCD934X && OF_GPIO
> @@ -835,7 +823,19 @@ config GPIO_IDT3243X
> endmenu
>
> menu "Port-mapped I/O GPIO drivers"
> - depends on X86 # Unconditional I/O space access
> + depends on X86 && HAS_IOPORT # I/O space access
> +
> +config GPIO_VX855
> + tristate "VIA VX855/VX875 GPIO"
> + depends on PCI
> + select MFD_CORE
> + select MFD_VX855
> + help
> + Support access to the VX855/VX875 GPIO lines through the GPIO library.
> +
> + This driver provides common support for accessing the device.
> + Additional drivers must be enabled in order to use the
> + functionality of the device.
>
> config GPIO_I8255
> tristate
> --
> 2.39.2
>

I already applied v4. Has this changed since the last version? If not,
then you can drop it now from your series.

Bart

2023-05-25 11:43:06

by Lee Jones

[permalink] [raw]
Subject: Re: [PATCH v5 17/44] leds: add HAS_IOPORT dependencies

On Mon, 22 May 2023, Niklas Schnelle wrote:

> 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.
>
> Acked-by: Pavel Machek <[email protected]>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>
> ---
> drivers/leds/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks

--
Lee Jones [李琼斯]

2023-05-28 19:05:29

by Jonathan Cameron

[permalink] [raw]
Subject: Re: [PATCH v5 14/44] iio: ad7606: Kconfig: add HAS_IOPORT dependencies

On Mon, 22 May 2023 12:50:19 +0200
Niklas Schnelle <[email protected]> wrote:

> 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.
>
> Acked-by: Jonathan Cameron <[email protected]>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>

I already picked this up for the IIO tree already as I don't think there are
any dependencies.

Jonathan

> ---
> drivers/iio/adc/Kconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig
> index eb2b09ef5d5b..53098aca06ea 100644
> --- a/drivers/iio/adc/Kconfig
> +++ b/drivers/iio/adc/Kconfig
> @@ -145,7 +145,7 @@ config AD7606
>
> config AD7606_IFACE_PARALLEL
> tristate "Analog Devices AD7606 ADC driver with parallel interface support"
> - depends on HAS_IOMEM
> + depends on HAS_IOPORT
> select AD7606
> help
> Say yes here to build parallel interface support for Analog Devices:


2023-05-29 14:50:37

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH v5 38/44] usb: pci-quirks: handle HAS_IOPORT dependencies

On Mon, May 22, 2023 at 12:50:43PM +0200, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. In the pci-quirks case the I/O port acceses are
> used in the quirks for several AMD south bridges. Move unrelated
> ASMEDIA quirks out of the way and introduce an additional config option
> for the AMD quirks that depends on HAS_IOPORT.

This is really messy and hard to review in one commit. I know I got
lost a bunch, and it's still messy:

>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>
> ---
> drivers/usb/Kconfig | 10 +++
> drivers/usb/core/hcd-pci.c | 2 +
> drivers/usb/host/pci-quirks.c | 125 ++++++++++++++++++----------------
> drivers/usb/host/pci-quirks.h | 30 ++++++--
> 4 files changed, 101 insertions(+), 66 deletions(-)
>
> diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig
> index 7f33bcc315f2..abf8c6cdea9e 100644
> --- a/drivers/usb/Kconfig
> +++ b/drivers/usb/Kconfig
> @@ -91,6 +91,16 @@ config USB_PCI
> If you have such a device you may say N here and PCI related code
> will not be built in the USB driver.
>
> +config USB_PCI_AMD
> + bool "AMD PCI USB host support"
> + depends on USB_PCI && HAS_IOPORT
> + default X86 || MACH_LOONGSON64 || PPC_PASEMI
> + help
> + Enable workarounds for USB implementation quirks in SB600/SB700/SB800
> + and later south bridge implementations. These are common on x86 PCs
> + with AMD CPUs but rarely used elsewhere, with the exception of a few
> + powerpc and mips desktop machines.

This is fine, make one commit for this, and then we can argue if you
really need it. :)

> +
> if USB
>
> source "drivers/usb/core/Kconfig"
> diff --git a/drivers/usb/core/hcd-pci.c b/drivers/usb/core/hcd-pci.c
> index ab2f3737764e..85a0aeae85cd 100644
> --- a/drivers/usb/core/hcd-pci.c
> +++ b/drivers/usb/core/hcd-pci.c
> @@ -206,8 +206,10 @@ int usb_hcd_pci_probe(struct pci_dev *dev, const struct hc_driver *driver)
> goto free_irq_vectors;
> }
>
> +#ifdef CONFIG_USB_PCI_AMD
> hcd->amd_resume_bug = (usb_hcd_amd_remote_wakeup_quirk(dev) &&
> driver->flags & (HCD_USB11 | HCD_USB3)) ? 1 : 0;
> +#endif /* CONFIG_USB_PCI_AMD */

No #ifdef in .c files if at all possible please. Why is this needed?

And I hate ? : logic, please spell it out.

>
> if (driver->flags & HCD_MEMORY) {
> /* EHCI, OHCI */
> diff --git a/drivers/usb/host/pci-quirks.c b/drivers/usb/host/pci-quirks.c
> index 2665832f9add..e0612f909fad 100644
> --- a/drivers/usb/host/pci-quirks.c
> +++ b/drivers/usb/host/pci-quirks.c
> @@ -60,6 +60,23 @@
> #define EHCI_USBLEGCTLSTS 4 /* legacy control/status */
> #define EHCI_USBLEGCTLSTS_SOOE (1 << 13) /* SMI on ownership change */
>
> +/* ASMEDIA quirk use */
> +#define ASMT_DATA_WRITE0_REG 0xF8
> +#define ASMT_DATA_WRITE1_REG 0xFC
> +#define ASMT_CONTROL_REG 0xE0
> +#define ASMT_CONTROL_WRITE_BIT 0x02
> +#define ASMT_WRITEREG_CMD 0x10423
> +#define ASMT_FLOWCTL_ADDR 0xFA30
> +#define ASMT_FLOWCTL_DATA 0xBA
> +#define ASMT_PSEUDO_DATA 0
> +
> +/* Intel quirk use */
> +#define USB_INTEL_XUSB2PR 0xD0
> +#define USB_INTEL_USB2PRM 0xD4
> +#define USB_INTEL_USB3_PSSEN 0xD8
> +#define USB_INTEL_USB3PRM 0xDC
> +
> +#ifdef CONFIG_USB_PCI_AMD
> /* AMD quirk use */
> #define AB_REG_BAR_LOW 0xe0
> #define AB_REG_BAR_HIGH 0xe1
> @@ -93,21 +110,6 @@
> #define NB_PIF0_PWRDOWN_0 0x01100012
> #define NB_PIF0_PWRDOWN_1 0x01100013
>
> -#define USB_INTEL_XUSB2PR 0xD0
> -#define USB_INTEL_USB2PRM 0xD4
> -#define USB_INTEL_USB3_PSSEN 0xD8
> -#define USB_INTEL_USB3PRM 0xDC
> -
> -/* ASMEDIA quirk use */
> -#define ASMT_DATA_WRITE0_REG 0xF8
> -#define ASMT_DATA_WRITE1_REG 0xFC
> -#define ASMT_CONTROL_REG 0xE0
> -#define ASMT_CONTROL_WRITE_BIT 0x02
> -#define ASMT_WRITEREG_CMD 0x10423
> -#define ASMT_FLOWCTL_ADDR 0xFA30
> -#define ASMT_FLOWCTL_DATA 0xBA
> -#define ASMT_PSEUDO_DATA 0
> -
> /*
> * amd_chipset_gen values represent AMD different chipset generations
> */
> @@ -458,50 +460,6 @@ void usb_amd_quirk_pll_disable(void)
> }
> EXPORT_SYMBOL_GPL(usb_amd_quirk_pll_disable);
>
> -static int usb_asmedia_wait_write(struct pci_dev *pdev)

Moving these is odd, why? They are just doing pci accesses.


> -{
> - unsigned long retry_count;
> - unsigned char value;
> -
> - for (retry_count = 1000; retry_count > 0; --retry_count) {
> -
> - pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);
> -
> - if (value == 0xff) {
> - dev_err(&pdev->dev, "%s: check_ready ERROR", __func__);
> - return -EIO;
> - }
> -
> - if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
> - return 0;
> -
> - udelay(50);
> - }
> -
> - dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__);
> - return -ETIMEDOUT;
> -}
> -
> -void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev)
> -{
> - if (usb_asmedia_wait_write(pdev) != 0)
> - return;
> -
> - /* send command and address to device */
> - pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD);
> - pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR);
> - pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
> -
> - if (usb_asmedia_wait_write(pdev) != 0)
> - return;
> -
> - /* send data to device */
> - pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA);
> - pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA);
> - pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
> -}
> -EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol);
> -
> void usb_amd_quirk_pll_enable(void)
> {
> usb_amd_quirk_pll(0);
> @@ -630,7 +588,53 @@ bool usb_amd_pt_check_port(struct device *device, int port)
> return !(value & BIT(port_shift));
> }
> EXPORT_SYMBOL_GPL(usb_amd_pt_check_port);
> +#endif /* CONFIG_USB_PCI_AMD */
>
> +static int usb_asmedia_wait_write(struct pci_dev *pdev)
> +{
> + unsigned long retry_count;
> + unsigned char value;
> +
> + for (retry_count = 1000; retry_count > 0; --retry_count) {
> +
> + pci_read_config_byte(pdev, ASMT_CONTROL_REG, &value);
> +
> + if (value == 0xff) {
> + dev_err(&pdev->dev, "%s: check_ready ERROR", __func__);
> + return -EIO;
> + }
> +
> + if ((value & ASMT_CONTROL_WRITE_BIT) == 0)
> + return 0;
> +
> + udelay(50);
> + }
> +
> + dev_warn(&pdev->dev, "%s: check_write_ready timeout", __func__);
> + return -ETIMEDOUT;
> +}
> +
> +void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev)
> +{
> + if (usb_asmedia_wait_write(pdev) != 0)
> + return;
> +
> + /* send command and address to device */
> + pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_WRITEREG_CMD);
> + pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_FLOWCTL_ADDR);
> + pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
> +
> + if (usb_asmedia_wait_write(pdev) != 0)
> + return;
> +
> + /* send data to device */
> + pci_write_config_dword(pdev, ASMT_DATA_WRITE0_REG, ASMT_FLOWCTL_DATA);
> + pci_write_config_dword(pdev, ASMT_DATA_WRITE1_REG, ASMT_PSEUDO_DATA);
> + pci_write_config_byte(pdev, ASMT_CONTROL_REG, ASMT_CONTROL_WRITE_BIT);
> +}
> +EXPORT_SYMBOL_GPL(usb_asmedia_modifyflowcontrol);
> +
> +#if defined(CONFIG_HAS_IOPORT) && defined(CONFIG_USB_UHCI_HCD)

Is this really needed? This feels wrong, why is ioport odd like this?

> /*
> * Make sure the controller is completely inactive, unable to
> * generate interrupts or do DMA.
> @@ -711,6 +715,7 @@ int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base)
> return 1;
> }
> EXPORT_SYMBOL_GPL(uhci_check_and_reset_hc);
> +#endif /* defined(CONFIG_HAS_IOPORT && defined(CONFIG_USB_UHCI_HCD) */
>
> static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
> {
> @@ -723,6 +728,7 @@ static inline int io_type_enabled(struct pci_dev *pdev, unsigned int mask)
>
> static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
> {
> +#ifdef CONFIG_HAS_IOPORT
> unsigned long base = 0;
> int i;
>
> @@ -737,6 +743,7 @@ static void quirk_usb_handoff_uhci(struct pci_dev *pdev)
>
> if (base)
> uhci_check_and_reset_hc(pdev, base);
> +#endif /* CONFIG_HAS_IOPORT */
> }
>
> static int mmio_resource_enabled(struct pci_dev *pdev, int idx)
> diff --git a/drivers/usb/host/pci-quirks.h b/drivers/usb/host/pci-quirks.h
> index e729de21fad7..8c87505f0abc 100644
> --- a/drivers/usb/host/pci-quirks.h
> +++ b/drivers/usb/host/pci-quirks.h
> @@ -2,9 +2,10 @@
> #ifndef __LINUX_USB_PCI_QUIRKS_H
> #define __LINUX_USB_PCI_QUIRKS_H
>
> -#ifdef CONFIG_USB_PCI
> void uhci_reset_hc(struct pci_dev *pdev, unsigned long base);
> int uhci_check_and_reset_hc(struct pci_dev *pdev, unsigned long base);
> +
> +#ifdef CONFIG_USB_PCI_AMD
> int usb_hcd_amd_remote_wakeup_quirk(struct pci_dev *pdev);
> bool usb_amd_hang_symptom_quirk(void);
> bool usb_amd_prefetch_quirk(void);
> @@ -12,23 +13,38 @@ void usb_amd_dev_put(void);
> bool usb_amd_quirk_pll_check(void);
> void usb_amd_quirk_pll_disable(void);
> void usb_amd_quirk_pll_enable(void);
> -void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
> -void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
> -void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
> void sb800_prefetch(struct device *dev, int on);
> bool usb_amd_pt_check_port(struct device *device, int port);
> #else
> -struct pci_dev;
> +static inline bool usb_amd_hang_symptom_quirk(void)
> +{
> + return false;
> +};
> +static inline bool usb_amd_prefetch_quirk(void)
> +{
> + return false;
> +}
> +static inline bool usb_amd_quirk_pll_check(void)
> +{
> + return false;
> +}
> static inline void usb_amd_quirk_pll_disable(void) {}
> static inline void usb_amd_quirk_pll_enable(void) {}
> -static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
> static inline void usb_amd_dev_put(void) {}
> -static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
> static inline void sb800_prefetch(struct device *dev, int on) {}
> static inline bool usb_amd_pt_check_port(struct device *device, int port)
> {
> return false;
> }
> +#endif /* CONFIG_USB_PCI_AMD */
> +
> +#ifdef CONFIG_USB_PCI
> +void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev);
> +void usb_enable_intel_xhci_ports(struct pci_dev *xhci_pdev);
> +void usb_disable_xhci_ports(struct pci_dev *xhci_pdev);
> +#else
> +static inline void usb_asmedia_modifyflowcontrol(struct pci_dev *pdev) {}
> +static inline void usb_disable_xhci_ports(struct pci_dev *xhci_pdev) {}
> #endif /* CONFIG_USB_PCI */

Again, the changes here are hard to follow, why?

Please break up into smaller pieces.

thanks,

greg k-h

2023-05-30 09:41:45

by Niklas Schnelle

[permalink] [raw]
Subject: Re: [PATCH v5 14/44] iio: ad7606: Kconfig: add HAS_IOPORT dependencies

On Sun, 2023-05-28 at 19:55 +0100, Jonathan Cameron wrote:
> On Mon, 22 May 2023 12:50:19 +0200
> Niklas Schnelle <[email protected]> wrote:
>
> > 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.
> >
> > Acked-by: Jonathan Cameron <[email protected]>
> > Co-developed-by: Arnd Bergmann <[email protected]>
> > Signed-off-by: Arnd Bergmann <[email protected]>
> > Signed-off-by: Niklas Schnelle <[email protected]>
>
> I already picked this up for the IIO tree already as I don't think there are
> any dependencies.
>
> Jonathan
>
>

Yes thanks, I only resent it as part of this series such that applying
the series on a current -rc directly does not break the last commit. In
the future I'll sent remaining patches per-subsystem and based on
linux-next so I won't have to resent those patches that have already
been applied.

Thanks,
Niklas

2023-05-30 14:47:49

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH v5 35/44] tty: serial: handle HAS_IOPORT dependencies

On Mon, May 22, 2023 at 12:50:40PM +0200, Niklas Schnelle wrote:
> 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 unconditionally. For 8250 based drivers some
> support MMIO only use so fence only the parts requiring I/O ports.
>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>
> ---
> drivers/tty/Kconfig | 4 +--
> drivers/tty/serial/8250/8250_early.c | 4 +++
> drivers/tty/serial/8250/8250_pci.c | 14 +++++++++
> drivers/tty/serial/8250/8250_port.c | 44 +++++++++++++++++++++++-----
> drivers/tty/serial/8250/Kconfig | 5 ++--
> drivers/tty/serial/Kconfig | 2 +-
> 6 files changed, 60 insertions(+), 13 deletions(-)

This doesn't apply at all to my tree, so I'll just let you take it as
there must be some merge issues somewhere:

Acked-by: Greg Kroah-Hartman <[email protected]>

2023-06-01 00:16:00

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH v5 31/44] scsi: add HAS_IOPORT dependencies


Niklas,

> Yes if you're okay with the changes go ahead and pick them up for the
> subsystems you maintain. Our plan is to get as many of these picked up
> for v6.5 as possible, then deal with the stragglers and finally merge
> the last patch in this series that disables inb()/outb() for
> HAS_IOPORT=n.

Applied patches 21 and 31 to 6.5/scsi-staging, thanks!

--
Martin K. Petersen Oracle Linux Engineering

2023-06-06 22:06:09

by Alexandre Belloni

[permalink] [raw]
Subject: Re: (subset) [PATCH v5 30/44] rtc: add HAS_IOPORT dependencies


On Mon, 22 May 2023 12:50:35 +0200, Niklas Schnelle wrote:
> 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.
>
>

Applied, thanks!

[30/44] rtc: add HAS_IOPORT dependencies
commit: 8bb12adb214b2d7cdad84f89db2cbab4b2908b61

Best regards,
--
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

2023-06-08 01:51:53

by Martin K. Petersen

[permalink] [raw]
Subject: Re: [PATCH v5 00/44] treewide: Remove I/O port accessors for HAS_IOPORT=n

On Mon, 22 May 2023 12:50:05 +0200, Niklas Schnelle wrote:

> Some platforms such as s390 do not support PCI I/O spaces. On such platforms
> I/O space accessors like inb()/outb() are stubs that can never actually work.
> The way these stubs are implemented in asm-generic/io.h leads to compiler
> warnings because any use will be a NULL pointer access on these platforms. In
> a previous patch we tried handling this with a run-time warning on access. This
> approach however was rejected by Linus[0] with the argument that this really
> should be a compile-time check and, though a much more invasive change, we
> believe that is indeed the right approach.
>
> [...]

Applied to 6.5/scsi-queue, thanks!

[21/44] mpt fusion: add HAS_IOPORT dependencies
https://git.kernel.org/mkp/scsi/c/c3f903472ffa
[31/44] scsi: add HAS_IOPORT dependencies
https://git.kernel.org/mkp/scsi/c/b58b2ba351b0

--
Martin K. Petersen Oracle Linux Engineering

2023-06-27 09:54:41

by Niklas Schnelle

[permalink] [raw]
Subject: Re: [PATCH v5 00/44] treewide: Remove I/O port accessors for HAS_IOPORT=n

On Mon, 2023-05-22 at 13:29 +0200, Arnd Bergmann wrote:
> On Mon, May 22, 2023, at 12:50, Niklas Schnelle wrote:
>
> > A few patches have already been applied but I've kept those which are not yet
> > in v6.4-rc3.
> >
> > This version is based on v6.4-rc3 and is also available on my kernel.org tree
> > in the has_ioport_v5:
> >
> > https://git.kernel.org/pub/scm/linux/kernel/git/niks/linux.git
>
> I think it would be best if as many patches as possible get merged
> into v6.5 through the individidual subsystems, though I can take
> whatever is left through the asm-generic tree.
>
> Since the goal is to have maintainers pick up part of this, I would
> recommend splitting the series per subsystem, having either a
> separate patch or a small series for each maintainer that should
> pick them up.
>
> More importantly, I think you should rebase the series against
> linux-next in order to find and drop the patches that are queued
> up for 6.5 already. The patches will be applied into branches
> that are based on 6.4-rc of course, but basing on linux-next
> is usually the easiest when targeting multiple maintainer
> trees.
>
> Maybe let's give it another week to have more maintainers pick
> up stuff from v5, and then send out a v6 as separate submissions.
>
> Arnd

Hi Arnd and All,

I'm sorry there hasn't been an updated in a long time and we're missing
v6.5. I've been quite busy with other work and life. Speaking of, I
will be mostly out for around a month starting some time mid to end
July as, if all goes well, I'm expecting to become a dad. That said, I
haven't forgotten about this and your overall plan of sending per-
subsystem patches sounds good, just haven't had the time to also
incorporate the feedback.

Thanks,
Niklas

2023-06-27 13:11:38

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v5 00/44] treewide: Remove I/O port accessors for HAS_IOPORT=n

On Tue, Jun 27, 2023, at 11:12, Niklas Schnelle wrote:
> On Mon, 2023-05-22 at 13:29 +0200, Arnd Bergmann wrote:
>>
>> Maybe let's give it another week to have more maintainers pick
>> up stuff from v5, and then send out a v6 as separate submissions.
>>
>> Arnd
>
> Hi Arnd and All,
>
> I'm sorry there hasn't been an updated in a long time and we're missing
> v6.5. I've been quite busy with other work and life. Speaking of, I
> will be mostly out for around a month starting some time mid to end
> July as, if all goes well, I'm expecting to become a dad. That said, I
> haven't forgotten about this and your overall plan of sending per-
> subsystem patches sounds good, just haven't had the time to also
> incorporate the feedback.

Ok, thanks for letting us know. I just checked to see that about half
of your series has already made it into linux-next and is likely to
be part of v6.5 or already in v6.4.

Maybe you can start out by taking a pass at just resending the ones
that don't need any changes and can just get picked up after -rc1,
and then I'll try to have a look at whatever remains after that.

Arnd

2023-06-29 13:33:58

by Niklas Schnelle

[permalink] [raw]
Subject: Re: [PATCH v5 00/44] treewide: Remove I/O port accessors for HAS_IOPORT=n

On Tue, 2023-06-27 at 14:53 +0200, Arnd Bergmann wrote:
> On Tue, Jun 27, 2023, at 11:12, Niklas Schnelle wrote:
> > On Mon, 2023-05-22 at 13:29 +0200, Arnd Bergmann wrote:
> > >
> > > Maybe let's give it another week to have more maintainers pick
> > > up stuff from v5, and then send out a v6 as separate submissions.
> > >
> > > Arnd
> >
> > Hi Arnd and All,
> >
> > I'm sorry there hasn't been an updated in a long time and we're missing
> > v6.5. I've been quite busy with other work and life. Speaking of, I
> > will be mostly out for around a month starting some time mid to end
> > July as, if all goes well, I'm expecting to become a dad. That said, I
> > haven't forgotten about this and your overall plan of sending per-
> > subsystem patches sounds good, just haven't had the time to also
> > incorporate the feedback.
>
> Ok, thanks for letting us know. I just checked to see that about half
> of your series has already made it into linux-next and is likely to
> be part of v6.5 or already in v6.4.
>
> Maybe you can start out by taking a pass at just resending the ones
> that don't need any changes and can just get picked up after -rc1,
> and then I'll try to have a look at whatever remains after that.
>
> Arnd


Oh yeah looks better than I anticipated. I seem to have picked an odd
base commit for "tty: serial: .." because of which Greg couldn't apply
it so res-ending + rebase might be enough for that. By my count it
looks like only "usb: pci-quirksL ..." needs real work and possibly the
"drm: .." part though the discussion around cirrus doesn't look like it
would require much work. So I'll do rebase/re-send of the easy ones
tomorrow/next week.

Thanks,
Niklas

2023-07-04 08:34:24

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH v5 30/44] rtc: add HAS_IOPORT dependencies

Hi Niklas,

On Mon, May 22, 2023 at 12:51 PM Niklas Schnelle <[email protected]> wrote:
> 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.
>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>

Thanks for your patch, which is now commit 8bb12adb214b2d7c ("rtc:
add HAS_IOPORT dependencies") upstream.

> --- a/drivers/rtc/Kconfig
> +++ b/drivers/rtc/Kconfig
> @@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242
>
> config RTC_DRV_BQ4802
> tristate "TI BQ4802"
> - depends on HAS_IOMEM
> + depends on HAS_IOMEM && HAS_IOPORT
> help
> If you say Y here you will get support for the TI
> BQ4802 RTC chip.

This driver can use either iomem or ioport.
By adding a dependency on HAS_IOPORT, it can no longer be used
on platforms that provide HAS_IOMEM only.

Probably the driver should be refactored to make it use only
the accessors that are available.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2023-07-04 11:35:06

by Arnd Bergmann

[permalink] [raw]
Subject: Re: [PATCH v5 30/44] rtc: add HAS_IOPORT dependencies

On Tue, Jul 4, 2023, at 10:06, Geert Uytterhoeven wrote:
> Hi Niklas,
>
> On Mon, May 22, 2023 at 12:51 PM Niklas Schnelle <[email protected]> wrote:
>> 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.
>>
>> Co-developed-by: Arnd Bergmann <[email protected]>
>> Signed-off-by: Arnd Bergmann <[email protected]>
>> Signed-off-by: Niklas Schnelle <[email protected]>
>
> Thanks for your patch, which is now commit 8bb12adb214b2d7c ("rtc:
> add HAS_IOPORT dependencies") upstream.
>
>> --- a/drivers/rtc/Kconfig
>> +++ b/drivers/rtc/Kconfig
>> @@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242
>>
>> config RTC_DRV_BQ4802
>> tristate "TI BQ4802"
>> - depends on HAS_IOMEM
>> + depends on HAS_IOMEM && HAS_IOPORT
>> help
>> If you say Y here you will get support for the TI
>> BQ4802 RTC chip.
>
> This driver can use either iomem or ioport.
> By adding a dependency on HAS_IOPORT, it can no longer be used
> on platforms that provide HAS_IOMEM only.

You are correct, we could allow building this driver even
without IOPORT and make it use ioport_map() or an #ifdef.

> Probably the driver should be refactored to make it use only
> the accessors that are available.

Since the driver itself has no DT support, it looks like the
only way it can be used is from the sparc64/ultra45 wrapper,
but that architecture always provides CONFIG_IOPORT, so I
don't think it makes any difference in the end. We can change
this again if another user comes up.

It might be good to know whether the machine uses a memory or
I/O resource in its device tree.

Arnd

2023-07-04 12:53:00

by Geert Uytterhoeven

[permalink] [raw]
Subject: Re: [PATCH v5 30/44] rtc: add HAS_IOPORT dependencies

Hi Arnd,

On Tue, Jul 4, 2023 at 1:25 PM Arnd Bergmann <[email protected]> wrote:
> On Tue, Jul 4, 2023, at 10:06, Geert Uytterhoeven wrote:
> > On Mon, May 22, 2023 at 12:51 PM Niklas Schnelle <[email protected]> wrote:
> >> 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.
> >>
> >> Co-developed-by: Arnd Bergmann <[email protected]>
> >> Signed-off-by: Arnd Bergmann <[email protected]>
> >> Signed-off-by: Niklas Schnelle <[email protected]>
> >
> > Thanks for your patch, which is now commit 8bb12adb214b2d7c ("rtc:
> > add HAS_IOPORT dependencies") upstream.
> >
> >> --- a/drivers/rtc/Kconfig
> >> +++ b/drivers/rtc/Kconfig
> >> @@ -1193,7 +1195,7 @@ config RTC_DRV_MSM6242
> >>
> >> config RTC_DRV_BQ4802
> >> tristate "TI BQ4802"
> >> - depends on HAS_IOMEM
> >> + depends on HAS_IOMEM && HAS_IOPORT
> >> help
> >> If you say Y here you will get support for the TI
> >> BQ4802 RTC chip.
> >
> > This driver can use either iomem or ioport.
> > By adding a dependency on HAS_IOPORT, it can no longer be used
> > on platforms that provide HAS_IOMEM only.
>
> You are correct, we could allow building this driver even
> without IOPORT and make it use ioport_map() or an #ifdef.
>
> > Probably the driver should be refactored to make it use only
> > the accessors that are available.
>
> Since the driver itself has no DT support, it looks like the
> only way it can be used is from the sparc64/ultra45 wrapper,
> but that architecture always provides CONFIG_IOPORT, so I
> don't think it makes any difference in the end. We can change
> this again if another user comes up.

Correct, I made the same reasoning after sending my previous email...

> It might be good to know whether the machine uses a memory or
> I/O resource in its device tree.

Indeed.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

2023-09-24 21:03:07

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH v5 13/44] i2c: add HAS_IOPORT dependencies

On Mon, May 22, 2023 at 12:50:18PM +0200, Niklas Schnelle wrote:
> 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.
>
> Co-developed-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Arnd Bergmann <[email protected]>
> Signed-off-by: Niklas Schnelle <[email protected]>

In RFC v1, you agreed to drop PARPORT [1]. Is there a reason you haven't
done this so far?

[1] https://patchwork.ozlabs.org/project/linux-i2c/patch/[email protected]/


Attachments:
(No filename) (613.00 B)
signature.asc (849.00 B)
Download all attachments

2023-10-23 15:36:34

by Wolfram Sang

[permalink] [raw]
Subject: Re: [PATCH v5 13/44] i2c: add HAS_IOPORT dependencies

On Sun, Sep 24, 2023 at 11:01:47PM +0200, Wolfram Sang wrote:
> On Mon, May 22, 2023 at 12:50:18PM +0200, Niklas Schnelle wrote:
> > 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.
> >
> > Co-developed-by: Arnd Bergmann <[email protected]>
> > Signed-off-by: Arnd Bergmann <[email protected]>
> > Signed-off-by: Niklas Schnelle <[email protected]>
>
> In RFC v1, you agreed to drop PARPORT [1]. Is there a reason you haven't
> done this so far?
>
> [1] https://patchwork.ozlabs.org/project/linux-i2c/patch/[email protected]/

Shall I apply this with or without PARPORT?


Attachments:
(No filename) (749.00 B)
signature.asc (849.00 B)
Download all attachments