diff mbox series

[RFC,v2,02/39] ACPI: add dependency on HAS_IOPORT

Message ID 20220429135108.2781579-3-schnelle@linux.ibm.com (mailing list archive)
State RFC, archived
Headers show
Series None | expand

Commit Message

Niklas Schnelle April 29, 2022, 1:50 p.m. UTC
In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
not being declared. As ACPI always uses I/O port access we simply depend
on HAS_IOPORT.

Co-developed-by: Arnd Bergmann <arnd@kernel.org>
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
---
 drivers/acpi/Kconfig | 1 +
 1 file changed, 1 insertion(+)

Comments

Rafael J. Wysocki May 4, 2022, 1:23 p.m. UTC | #1
On Fri, Apr 29, 2022 at 3:51 PM Niklas Schnelle <schnelle@linux.ibm.com> wrote:
>
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. As ACPI always uses I/O port access we simply depend
> on HAS_IOPORT.
>
> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/acpi/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 1e34f846508f..8ad0d168004c 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -5,6 +5,7 @@
>
>  config ARCH_SUPPORTS_ACPI
>         bool
> +       depends on HAS_IOPORT

This and the analogous PNP change are both fine with me.

Thanks!

>
>  menuconfig ACPI
>         bool "ACPI (Advanced Configuration and Power Interface) Support"
> --
> 2.32.0
>
Bjorn Helgaas May 4, 2022, 5:53 p.m. UTC | #2
On Fri, Apr 29, 2022 at 03:50:00PM +0200, Niklas Schnelle wrote:
> In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> not being declared. As ACPI always uses I/O port access we simply depend
> on HAS_IOPORT.

CONFIG_ACPI depends on ARCH_SUPPORTS_ACPI, which is only set by arm64,
ia64, and x86, all of which support I/O port access.  So does this
actually solve a problem?  I wouldn't think you'd be able to build
ACPI on s390 even without this patch.

"ACPI always uses I/O port access" is a pretty broad brush, and it
would be useful to know specifically what the dependencies are.

Many ACPI hardware accesses use acpi_hw_read()/acpi_hw_write(), which
use either MMIO or I/O port accesses depending on what the firmware
told us.

> Co-developed-by: Arnd Bergmann <arnd@kernel.org>
> Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
> ---
>  drivers/acpi/Kconfig | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 1e34f846508f..8ad0d168004c 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -5,6 +5,7 @@
>  
>  config ARCH_SUPPORTS_ACPI
>  	bool
> +	depends on HAS_IOPORT
>  
>  menuconfig ACPI
>  	bool "ACPI (Advanced Configuration and Power Interface) Support"
> -- 
> 2.32.0
>
Arnd Bergmann May 4, 2022, 7:58 p.m. UTC | #3
On Wed, May 4, 2022 at 7:53 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> On Fri, Apr 29, 2022 at 03:50:00PM +0200, Niklas Schnelle wrote:
> > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> > not being declared. As ACPI always uses I/O port access we simply depend
> > on HAS_IOPORT.
>
> CONFIG_ACPI depends on ARCH_SUPPORTS_ACPI, which is only set by arm64,
> ia64, and x86, all of which support I/O port access.  So does this
> actually solve a problem?  I wouldn't think you'd be able to build
> ACPI on s390 even without this patch.
> "ACPI always uses I/O port access" is a pretty broad brush, and it
> would be useful to know specifically what the dependencies are.
>
> Many ACPI hardware accesses use acpi_hw_read()/acpi_hw_write(), which
> use either MMIO or I/O port accesses depending on what the firmware
> told us.

I think this came from my original prototype of the series where I tested it
out on arm64 with HAS_IOPORT disabled. I would like to hide the definition
of inb()/outb() from include/asm-generic/io.h whenever CONFIG_HAS_IOPORT
is not set, and I was prototyping this on arm64.

There are uses of inb()/outb() in drivers/acpi/ec.c and drivers/acpi/osl.c,
which in turn are not optional in ACPI, so it seems that those are
required.

If we want to allow building arm64 without HAS_IOPORT for some reason,
that means either force-disabling ACPI as well, or changin ACPI to not
rely on port I/O. I think it's fine to leave that as a problem for whoever
wants to make HAS_IOPORT optional in the future, and drop the
dependency here.

       Arnd
Niklas Schnelle May 5, 2022, 8:20 a.m. UTC | #4
On Wed, 2022-05-04 at 21:58 +0200, Arnd Bergmann wrote:
> On Wed, May 4, 2022 at 7:53 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > On Fri, Apr 29, 2022 at 03:50:00PM +0200, Niklas Schnelle wrote:
> > > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> > > not being declared. As ACPI always uses I/O port access we simply depend
> > > on HAS_IOPORT.
> > 
> > CONFIG_ACPI depends on ARCH_SUPPORTS_ACPI, which is only set by arm64,
> > ia64, and x86, all of which support I/O port access.  So does this
> > actually solve a problem?  I wouldn't think you'd be able to build
> > ACPI on s390 even without this patch.
> > "ACPI always uses I/O port access" is a pretty broad brush, and it
> > would be useful to know specifically what the dependencies are.
> > 
> > Many ACPI hardware accesses use acpi_hw_read()/acpi_hw_write(), which
> > use either MMIO or I/O port accesses depending on what the firmware
> > told us.
> 
> I think this came from my original prototype of the series where I tested it
> out on arm64 with HAS_IOPORT disabled. I would like to hide the definition
> of inb()/outb() from include/asm-generic/io.h whenever CONFIG_HAS_IOPORT
> is not set, and I was prototyping this on arm64.
> 
> There are uses of inb()/outb() in drivers/acpi/ec.c and drivers/acpi/osl.c,
> which in turn are not optional in ACPI, so it seems that those are
> required.
> 
> If we want to allow building arm64 without HAS_IOPORT for some reason,
> that means either force-disabling ACPI as well, or changin ACPI to not
> rely on port I/O. I think it's fine to leave that as a problem for whoever
> wants to make HAS_IOPORT optional in the future, and drop the
> dependency here.
> 
>        Arnd

I'll improve the commit message to make the dependency on HAS_IOPORT
more clear. I also agree with Arnd that since all architectures where
ACPI is useful have I/O ports making it work without I/O port access
compiled in is for another day.
Bjorn Helgaas May 5, 2022, 7:36 p.m. UTC | #5
On Thu, May 05, 2022 at 10:20:28AM +0200, Niklas Schnelle wrote:
> On Wed, 2022-05-04 at 21:58 +0200, Arnd Bergmann wrote:
> > On Wed, May 4, 2022 at 7:53 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
> > > On Fri, Apr 29, 2022 at 03:50:00PM +0200, Niklas Schnelle wrote:
> > > > In a future patch HAS_IOPORT=n will result in inb()/outb() and friends
> > > > not being declared. As ACPI always uses I/O port access we simply depend
> > > > on HAS_IOPORT.
> > > 
> > > CONFIG_ACPI depends on ARCH_SUPPORTS_ACPI, which is only set by arm64,
> > > ia64, and x86, all of which support I/O port access.  So does this
> > > actually solve a problem?  I wouldn't think you'd be able to build
> > > ACPI on s390 even without this patch.
> > > "ACPI always uses I/O port access" is a pretty broad brush, and it
> > > would be useful to know specifically what the dependencies are.
> > > 
> > > Many ACPI hardware accesses use acpi_hw_read()/acpi_hw_write(), which
> > > use either MMIO or I/O port accesses depending on what the firmware
> > > told us.
> > 
> > I think this came from my original prototype of the series where I tested it
> > out on arm64 with HAS_IOPORT disabled. I would like to hide the definition
> > of inb()/outb() from include/asm-generic/io.h whenever CONFIG_HAS_IOPORT
> > is not set, and I was prototyping this on arm64.
> > 
> > There are uses of inb()/outb() in drivers/acpi/ec.c and drivers/acpi/osl.c,
> > which in turn are not optional in ACPI, so it seems that those are
> > required.
> > 
> > If we want to allow building arm64 without HAS_IOPORT for some reason,
> > that means either force-disabling ACPI as well, or changin ACPI to not
> > rely on port I/O. I think it's fine to leave that as a problem for whoever
> > wants to make HAS_IOPORT optional in the future, and drop the
> > dependency here.
> 
> I'll improve the commit message to make the dependency on HAS_IOPORT
> more clear. I also agree with Arnd that since all architectures where
> ACPI is useful have I/O ports making it work without I/O port access
> compiled in is for another day.

I don't really see the point of including this patch at all.  It
doesn't solve any existing problem.
diff mbox series

Patch

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 1e34f846508f..8ad0d168004c 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -5,6 +5,7 @@ 
 
 config ARCH_SUPPORTS_ACPI
 	bool
+	depends on HAS_IOPORT
 
 menuconfig ACPI
 	bool "ACPI (Advanced Configuration and Power Interface) Support"