Re: [GIT PULL 1/2] asm-generic: rework PCI I/O space access

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Jul 3, 2021 at 2:12 PM Arnd Bergmann <arnd@xxxxxxxxxx> wrote:
> The version we got here makes it no longer crash the kernel, but
> I see your point that the runtime warning is still wrong. I'll have
> a look at what it would take to guard all inb/outb callers with a
> Kconfig conditional, and will report back after that.

I created a preliminary patch and got it to cleanly build on my randconfig box,
here is what that involved:

- added 89 Kconfig dependencies on HAS_IOPORT for PC-style devices
  that are not on a PCI card.
- added 188 Kconfig dependencies on LEGACY_PCI for PCI drivers that
  require port I/O. The idea is to have that control drivers for both pre-PCIe
  devices and and PCIe devices that require long-deprecated features like
  I/O resources, but possibly other features as well.
- The ACPI subsystem needs access to I/O ports, so that also gets a
  dependency.
- CONFIG_INDIRECT_PIO requires HAS_IOPORT
-  /dev/ioport needs an #ifdef around it
- several graphics drivers need workarounds instead of a 'depends on'
  because they are used in virtual machines: vgaconsole, bochs, qxl,
  cirrus. They work with or without port I/O
- A usb-uhci rework to split pci from non-pci support
- Minor workarounds for optional I/O port usage in libata, ipmi, tpm,
  dmi-firmware, altera-stapl, parport, vga
- lots of #ifdefs in 8250
- some drivers/pci/ quirks are #ifdef'd
- drivers using ioport_map()/pci_iomap() to access ports could be
  kept working when I/O ports are memory mapped

I tested the patch on a 5.13-rc4 snapshot that already has other
patches applied as a baseline for randconfig testing, so it doesn't
apply as-is.

Linus, if you like this approach, then I can work on splitting it up into
meaningful patches and submit it for a future release. I think the
CONFIG_LEGACY_PCI option has value on its own, but the others
do introduce some churn.

Full patch (120KB): https://pastebin.com/yaFSmAuY

diffstat:
 drivers/accessibility/speakup/Kconfig        |   1 +
 drivers/acpi/Kconfig                         |   1 +
 drivers/ata/Kconfig                          |  34 ++++++++++-----------
 drivers/ata/ata_generic.c                    |   3 +-
 drivers/ata/libata-sff.c                     |   2 ++
 drivers/bus/Kconfig                          |   2 +-
 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              |  14 ++++++---
 drivers/char/tpm/tpm_tis_core.c              |  19 +++++-------
 drivers/comedi/Kconfig                       |  53
+++++++++++++++++++++++++++++++++
 drivers/firmware/dmi-sysfs.c                 |   4 +++
 drivers/gpio/Kconfig                         |   2 +-
 drivers/gpu/drm/bochs/Kconfig                |   1 +
 drivers/gpu/drm/bochs/bochs_hw.c             |  24 ++++++++-------
 drivers/gpu/drm/qxl/Kconfig                  |   1 +
 drivers/gpu/drm/tiny/cirrus.c                |   2 ++
 drivers/hwmon/Kconfig                        |  23 +++++++++++++--
 drivers/i2c/busses/Kconfig                   |  31 ++++++++++---------
 drivers/ide/Kconfig                          |   1 +
 drivers/iio/adc/Kconfig                      |   2 +-
 drivers/input/gameport/Kconfig               |   6 ++--
 drivers/input/serio/Kconfig                  |   2 ++
 drivers/input/touchscreen/Kconfig            |   1 +
 drivers/isdn/hardware/mISDN/Kconfig          |  14 ++++-----
 drivers/leds/Kconfig                         |   2 +-
 drivers/media/cec/platform/Kconfig           |   2 +-
 drivers/media/pci/dm1105/Kconfig             |   2 +-
 drivers/media/radio/Kconfig                  |  15 +++++++++-
 drivers/media/rc/Kconfig                     |   9 +++++-
 drivers/message/fusion/Kconfig               |   8 ++---
 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/8390/Kconfig            |   2 +-
 drivers/net/ethernet/amd/Kconfig             |   2 +-
 drivers/net/ethernet/intel/Kconfig           |   4 +--
 drivers/net/ethernet/sis/Kconfig             |   6 ++--
 drivers/net/ethernet/ti/Kconfig              |   4 +--
 drivers/net/ethernet/via/Kconfig             |   5 ++--
 drivers/net/fddi/Kconfig                     |   4 +--
 drivers/net/hamradio/Kconfig                 |   6 ++--
 drivers/net/wan/Kconfig                      |   2 +-
 drivers/net/wireless/atmel/Kconfig           |   4 +--
 drivers/net/wireless/intersil/hostap/Kconfig |   4 +--
 drivers/parport/Kconfig                      |   2 +-
 drivers/pci/pci-sysfs.c                      |  16 ++++++++++
 drivers/pci/quirks.c                         |   2 ++
 drivers/pcmcia/Kconfig                       |   2 +-
 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                         |  21 ++++++-------
 drivers/scsi/aic7xxx/Kconfig.aic79xx         |   2 +-
 drivers/scsi/aic7xxx/Kconfig.aic7xxx         |   2 +-
 drivers/scsi/aic94xx/Kconfig                 |   2 +-
 drivers/scsi/megaraid/Kconfig.megaraid       |   2 +-
 drivers/scsi/mvsas/Kconfig                   |   2 +-
 drivers/scsi/qla2xxx/Kconfig                 |   2 +-
 drivers/spi/Kconfig                          |   1 +
 drivers/staging/kpc2000/Kconfig              |   2 +-
 drivers/staging/sm750fb/Kconfig              |   2 +-
 drivers/staging/vt6655/Kconfig               |   2 +-
 drivers/tty/Kconfig                          |   2 +-
 drivers/tty/serial/8250/8250_early.c         |   4 +++
 drivers/tty/serial/8250/8250_pci.c           |  19 ++++++++++--
 drivers/tty/serial/8250/8250_port.c          |  22 ++++++++++++--
 drivers/tty/serial/8250/Kconfig              |   1 +
 drivers/tty/serial/Kconfig                   |   2 +-
 drivers/usb/core/hcd-pci.c                   |   4 +--
 drivers/usb/host/Kconfig                     |   4 +--
 drivers/usb/host/pci-quirks.c                | 128
+++++++++++++++++++++++++++++++++++++++++--------------------------------------
 drivers/usb/host/pci-quirks.h                |  33 ++++++++++++++++-----
 drivers/usb/host/uhci-hcd.c                  |   2 +-
 drivers/usb/host/uhci-hcd.h                  |  77
+++++++++++++++++++++++++++++++----------------
 drivers/video/console/Kconfig                |   4 ++-
 drivers/video/fbdev/Kconfig                  |  24 +++++++--------
 drivers/watchdog/Kconfig                     |   6 ++--
 include/asm-generic/io.h                     |   6 ++++
 include/linux/gameport.h                     |   9 ++++--
 include/linux/parport.h                      |   2 +-
 include/video/vga.h                          |   8 +++++
 lib/Kconfig                                  |   4 +++
 lib/Kconfig.kgdb                             |   1 +
 sound/drivers/Kconfig                        |   3 ++
 sound/isa/Kconfig                            |   1 +
 sound/pci/Kconfig                            |  44 ++++++++++++++++++++++-----
 96 files changed, 575 insertions(+), 272 deletions(-)



[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux