diff mbox

ACPICA / hwreg: Use acpi_gbl_reduced_hardware to prevent accessing PM registers

Message ID 52397239.9080606@linaro.org
State New
Headers show

Commit Message

Hanjun Guo Sept. 18, 2013, 9:28 a.m. UTC
On 2013-9-17 1:26, Moore, Robert wrote:
> + #define ACPI_REDUCED_HARDWARE           TRUE
> 
> The intent of this feature is of course, to remove all code that is not needed -- specifically for hardware-reduced machines where the size of the kernel is important.

Ok, how about this patch below, is it reasonable to you?

From b10bc1d2f9a3ff09abfb6990412aa1cf62d56937 Mon Sep 17 00:00:00 2001
From: Hanjun Guo <hanjun.guo@linaro.org>
Date: Wed, 18 Sep 2013 17:19:23 +0800
Subject: [PATCH] ACPI: Introduce CONFIG_ACPI_REDUCED_HARDWARE to enable
 reduced hardware

If we want to enable reduced hardware ACPI on some platform (such as ARM),
we need to modify the kernel code and set ACPI_REDUCED_HARDWARE to TRUE.

This is not reasonable, so introduce a kernel config to enable it, and
no need for kernel modification when we use hardware-reduced ACPI.

Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
---
 drivers/acpi/Kconfig    |    8 ++++++++
 include/acpi/acconfig.h |    4 ++++
 2 files changed, 12 insertions(+)

Comments

Zheng, Lv Sept. 24, 2013, 12:09 a.m. UTC | #1
> -----Original Message-----
> From: linux-acpi-owner@vger.kernel.org [mailto:linux-acpi-owner@vger.kernel.org] On Behalf Of Hanjun Guo
> Sent: Wednesday, September 18, 2013 5:28 PM
> To: Moore, Robert
> Cc: 'Rafael J. Wysocki'; 'Len Brown'; Box, David E; Zheng, Lv; 'linux-acpi@vger.kernel.org'; 'patches@linaro.org';
> 'linaro-kernel@lists.linaro.org'; 'linaro-acpi@lists.linaro.org'
> Subject: Re: [PATCH] ACPICA / hwreg: Use acpi_gbl_reduced_hardware to prevent accessing PM registers
> 
> On 2013-9-17 1:26, Moore, Robert wrote:
> > + #define ACPI_REDUCED_HARDWARE           TRUE
> >
> > The intent of this feature is of course, to remove all code that is not needed -- specifically for hardware-reduced machines where the size
> of the kernel is important.
> 
> Ok, how about this patch below, is it reasonable to you?
> 
> From b10bc1d2f9a3ff09abfb6990412aa1cf62d56937 Mon Sep 17 00:00:00 2001
> From: Hanjun Guo <hanjun.guo@linaro.org>
> Date: Wed, 18 Sep 2013 17:19:23 +0800
> Subject: [PATCH] ACPI: Introduce CONFIG_ACPI_REDUCED_HARDWARE to enable
>  reduced hardware
> 
> If we want to enable reduced hardware ACPI on some platform (such as ARM),
> we need to modify the kernel code and set ACPI_REDUCED_HARDWARE to TRUE.
> 
> This is not reasonable, so introduce a kernel config to enable it, and
> no need for kernel modification when we use hardware-reduced ACPI.
> 
> Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> ---
>  drivers/acpi/Kconfig    |    8 ++++++++
>  include/acpi/acconfig.h |    4 ++++
>  2 files changed, 12 insertions(+)
> 
> diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> index 0d7f6eb..1232a7b 100644
> --- a/drivers/acpi/Kconfig
> +++ b/drivers/acpi/Kconfig
> @@ -413,6 +413,14 @@ config ACPI_BGRT
>           data from the firmware boot splash. It will appear under
>           /sys/firmware/acpi/bgrt/ .
> 
> +config ACPI_REDUCED_HARDWARE
> +       bool "Hardware-reduced ACPI support"
> +       depends on ARM || ARM64
> +        help
> +         This config adds support for Hardware-reduced ACPI. When this option
> +         is selected, will generate a specialized version of ACPICA that ONLY
> +         supports the ACPI 5.0 "reduced hardware".
> +
>  source "drivers/acpi/apei/Kconfig"
> 
>  endif  # ACPI
> diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
> index 1c16f82..15254f5 100644
> --- a/include/acpi/acconfig.h
> +++ b/include/acpi/acconfig.h
> @@ -100,7 +100,11 @@
>   *      ACPI PM timer
>   *      FACS table (Waking vectors and Global Lock)
>   */
> +#ifdef CONFIG_ACPI_REDUCED_HARDWARE
> +#define ACPI_REDUCED_HARDWARE           TRUE
> +#else
>  #define ACPI_REDUCED_HARDWARE           FALSE
> +#endif /* CONFIG_ACPI_REDUCED_HARDWARE */

The acconfig.h is not meant to be modified by OSPM and CONFIG_ACPI_REDUCED_HARDWARE does not belong to ACPICA, so it should go into include/acpi/platform/aclinux.h.
Well, I believe no one has ever tested the codes marked out by the ACPI_REDUCED_HARDWARE configurable.

Thanks
-Lv

> 
>  /******************************************************************************
>   *
> --
> 1.7.9.5
> --
> To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Hanjun Guo Sept. 24, 2013, 3:17 p.m. UTC | #2
Hi Lv,

Thanks for your comments.

On 24 September 2013 08:09, Zheng, Lv <lv.zheng@intel.com> wrote:

>
>
> > -----Original Message-----
> > From: linux-acpi-owner@vger.kernel.org [mailto:
> linux-acpi-owner@vger.kernel.org] On Behalf Of Hanjun Guo
> > Sent: Wednesday, September 18, 2013 5:28 PM
> > To: Moore, Robert
> > Cc: 'Rafael J. Wysocki'; 'Len Brown'; Box, David E; Zheng, Lv; '
> linux-acpi@vger.kernel.org'; 'patches@linaro.org';
> > 'linaro-kernel@lists.linaro.org'; 'linaro-acpi@lists.linaro.org'
> > Subject: Re: [PATCH] ACPICA / hwreg: Use acpi_gbl_reduced_hardware to
> prevent accessing PM registers
> >
> > On 2013-9-17 1:26, Moore, Robert wrote:
> > > + #define ACPI_REDUCED_HARDWARE           TRUE
> > >
> > > The intent of this feature is of course, to remove all code that is
> not needed -- specifically for hardware-reduced machines where the size
> > of the kernel is important.
> >
> > Ok, how about this patch below, is it reasonable to you?
> >
> > From b10bc1d2f9a3ff09abfb6990412aa1cf62d56937 Mon Sep 17 00:00:00 2001
> > From: Hanjun Guo <hanjun.guo@linaro.org>
> > Date: Wed, 18 Sep 2013 17:19:23 +0800
> > Subject: [PATCH] ACPI: Introduce CONFIG_ACPI_REDUCED_HARDWARE to enable
> >  reduced hardware
> >
> > If we want to enable reduced hardware ACPI on some platform (such as
> ARM),
> > we need to modify the kernel code and set ACPI_REDUCED_HARDWARE to TRUE.
> >
> > This is not reasonable, so introduce a kernel config to enable it, and
> > no need for kernel modification when we use hardware-reduced ACPI.
> >
> > Signed-off-by: Hanjun Guo <hanjun.guo@linaro.org>
> > ---
> >  drivers/acpi/Kconfig    |    8 ++++++++
> >  include/acpi/acconfig.h |    4 ++++
> >  2 files changed, 12 insertions(+)
> >
> > diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
> > index 0d7f6eb..1232a7b 100644
> > --- a/drivers/acpi/Kconfig
> > +++ b/drivers/acpi/Kconfig
> > @@ -413,6 +413,14 @@ config ACPI_BGRT
> >           data from the firmware boot splash. It will appear under
> >           /sys/firmware/acpi/bgrt/ .
> >
> > +config ACPI_REDUCED_HARDWARE
> > +       bool "Hardware-reduced ACPI support"
> > +       depends on ARM || ARM64
> > +        help
> > +         This config adds support for Hardware-reduced ACPI. When this
> option
> > +         is selected, will generate a specialized version of ACPICA
> that ONLY
> > +         supports the ACPI 5.0 "reduced hardware".
> > +
> >  source "drivers/acpi/apei/Kconfig"
> >
> >  endif  # ACPI
> > diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
> > index 1c16f82..15254f5 100644
> > --- a/include/acpi/acconfig.h
> > +++ b/include/acpi/acconfig.h
> > @@ -100,7 +100,11 @@
> >   *      ACPI PM timer
> >   *      FACS table (Waking vectors and Global Lock)
> >   */
> > +#ifdef CONFIG_ACPI_REDUCED_HARDWARE
> > +#define ACPI_REDUCED_HARDWARE           TRUE
> > +#else
> >  #define ACPI_REDUCED_HARDWARE           FALSE
> > +#endif /* CONFIG_ACPI_REDUCED_HARDWARE */
>
> The acconfig.h is not meant to be modified by OSPM and
> CONFIG_ACPI_REDUCED_HARDWARE does not belong to ACPICA, so it should go
> into include/acpi/platform/aclinux.h.
>

Ok, Thanks for the reminding.



> Well, I believe no one has ever tested the codes marked out by the
> ACPI_REDUCED_HARDWARE configurable.
>

Actually, Linaro ACPI team did this, we had tested the ACPI
driver with the ACPI_REDUCED_HARDWARE is true on ARM platform.

 and the oops raised by accessing to ACPI hardware is gone
when set ACPI_REDUCED_HARDWARE  true, but we had to
change the kernel code to do that, this is not the correct way.
 so I sent out the patch to disable the accessing ACPI hardware
in ACPICA APIs.

Thanks
Hanjun
diff mbox

Patch

diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 0d7f6eb..1232a7b 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -413,6 +413,14 @@  config ACPI_BGRT
          data from the firmware boot splash. It will appear under
          /sys/firmware/acpi/bgrt/ .

+config ACPI_REDUCED_HARDWARE
+       bool "Hardware-reduced ACPI support"
+       depends on ARM || ARM64
+        help
+         This config adds support for Hardware-reduced ACPI. When this option
+         is selected, will generate a specialized version of ACPICA that ONLY
+         supports the ACPI 5.0 "reduced hardware".
+
 source "drivers/acpi/apei/Kconfig"

 endif  # ACPI
diff --git a/include/acpi/acconfig.h b/include/acpi/acconfig.h
index 1c16f82..15254f5 100644
--- a/include/acpi/acconfig.h
+++ b/include/acpi/acconfig.h
@@ -100,7 +100,11 @@ 
  *      ACPI PM timer
  *      FACS table (Waking vectors and Global Lock)
  */
+#ifdef CONFIG_ACPI_REDUCED_HARDWARE
+#define ACPI_REDUCED_HARDWARE           TRUE
+#else
 #define ACPI_REDUCED_HARDWARE           FALSE
+#endif /* CONFIG_ACPI_REDUCED_HARDWARE */

 /******************************************************************************
  *