public inbox for linux-acpi@vger.kernel.org
 help / color / mirror / Atom feed
From: "Jitindar Singh, Suraj" <surajjs@amazon.com>
To: "rafael@kernel.org" <rafael@kernel.org>
Cc: "lenb@kernel.org" <lenb@kernel.org>,
	"acpica-devel@lists.linux.dev" <acpica-devel@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"okaya@kernel.org" <okaya@kernel.org>,
	"rafael.j.wysocki@intel.com" <rafael.j.wysocki@intel.com>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>,
	"robert.moore@intel.com" <robert.moore@intel.com>,
	"linux-acpi@vger.kernel.org" <linux-acpi@vger.kernel.org>
Subject: Re: [PATCH] acpi: Support CONFIG_ACPI without CONFIG_PCI
Date: Tue, 2 Jul 2024 23:01:28 +0000	[thread overview]
Message-ID: <703fd8504ca9541898ec920e15c05d673233218f.camel@amazon.com> (raw)
In-Reply-To: <CAJZ5v0iLtYOWc0w202kq8Tb-n=8ToQj2xHQ2_socwqqTyXufSw@mail.gmail.com>

On Fri, 2024-06-14 at 13:08 +0200, Rafael J. Wysocki wrote:
> On Thu, Jun 13, 2024 at 11:10 PM Suraj Jitindar Singh
> <surajjs@amazon.com> wrote:
> > 
> > Make is possible to use ACPI without having CONFIG_PCI set.
> > 
> > When initialising ACPI the following call chain occurs:
> > 
> >   acpi_init() ->
> >     acpi_bus_init() ->
> >       acpi_load_tables() ->
> >         acpi_ev_install_region_handlers() ->
> > 
> > acpi_ev_install_region_handlers() calls
> > acpi_ev_install_space_handler() on
> > each of the default address spaces defined as:
> > 
> >   u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
> >           ACPI_ADR_SPACE_SYSTEM_MEMORY,
> >           ACPI_ADR_SPACE_SYSTEM_IO,
> >           ACPI_ADR_SPACE_PCI_CONFIG,
> >           ACPI_ADR_SPACE_DATA_TABLE
> >   };
> > 
> > However in acpi_ev_install_space_handler() the case statement for
> > ACPI_ADR_SPACE_PCI_CONFIG is ifdef'd as:
> > 
> >   #ifdef ACPI_PCI_CONFIGURED
> >                   case ACPI_ADR_SPACE_PCI_CONFIG:
> > 
> >                           handler =
> > acpi_ex_pci_config_space_handler;
> >                           setup = acpi_ev_pci_config_region_setup;
> >                           break;
> >   #endif
> > 
> > ACPI_PCI_CONFIGURED is not defined if CONFIG_PCI is not enabled,
> > thus the
> > attempt to install the handler fails.
> > 
> > Fix this by ifdef'ing ACPI_ADR_SPACE_PCI_CONFIG in the list of
> > default
> > address spaces.
> 
> What if there are PCI operation regions in the AML on the platform?
> How are they going to be handled?

Hi,

Appreciate the response.

I think the short answer is that if there are PCI operation regions in
the AML on the platform then the kernel will need to be built with PCI
support (CONFIG_PCI) and if it isn't then there won't be a handler
installed and the operation will error.

Correct me if I'm wrong but it seems the intention of the patch series:

36ad7d2b9e9b ACPI: Move PCI reset to a separate function
86689776878f ACPI: Allow CONFIG_PCI to be unset for reboot
bd23fac3eaaa ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is
unset
5d32a66541c4 PCI/ACPI: Allow ACPI to be built without CONFIG_PCI set

was to decouple the dependency between CONFIG_PCI and CONFIG_ACPI.

bd23fac3eaaa ("ACPICA: Remove PCI bits from ACPICA when CONFIG_PCI is
unset") added an ifdef around the code to install the handler for the
PCI CONFIG region making it dependent on ACPI_PCI_CONFIGURED (and thus
CONFIG_PCI). Thus it is not possible to install the default handler for
the PCI CONFIG region unless CONFIG_PCI is set meaning it makes no
sense to have it in the list of default address spaces.

I can gather that this leads to 2 possibilities:

1. If there are PCI operation regions in the AML on the platform then
these will error on a kernel not compiled with CONFIG_PCI.

or,

2. The code to install the handler for the PCI CONFIG region should not
be ifdef'ed and should be executed irrespective of if the kernel is
compiled with CONFIG_PCI to allow for PCI CONFIG regions in the AML.

Thanks

> 
> > Fixes: bd23fac3eaaa ("ACPICA: Remove PCI bits from ACPICA when
> > CONFIG_PCI is unset")
> > CC: stable@vger.kernel.org # 5.0.x-
> > Signed-off-by: Suraj Jitindar Singh <surajjs@amazon.com>
> > ---
> >  drivers/acpi/acpica/evhandler.c | 2 ++
> >  1 file changed, 2 insertions(+)
> > 
> > diff --git a/drivers/acpi/acpica/evhandler.c
> > b/drivers/acpi/acpica/evhandler.c
> > index 1c8cb6d924df..371093acb362 100644
> > --- a/drivers/acpi/acpica/evhandler.c
> > +++ b/drivers/acpi/acpica/evhandler.c
> > @@ -26,7 +26,9 @@ acpi_ev_install_handler(acpi_handle obj_handle,
> >  u8 acpi_gbl_default_address_spaces[ACPI_NUM_DEFAULT_SPACES] = {
> >         ACPI_ADR_SPACE_SYSTEM_MEMORY,
> >         ACPI_ADR_SPACE_SYSTEM_IO,
> > +#ifdef ACPI_PCI_CONFIGURED
> >         ACPI_ADR_SPACE_PCI_CONFIG,
> > +#endif
> >         ACPI_ADR_SPACE_DATA_TABLE
> >  };
> > 
> > --
> > 2.34.1
> > 
> > 


  reply	other threads:[~2024-07-02 23:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-13 21:10 [PATCH] acpi: Support CONFIG_ACPI without CONFIG_PCI Suraj Jitindar Singh
2024-06-14 11:08 ` Rafael J. Wysocki
2024-07-02 23:01   ` Jitindar Singh, Suraj [this message]
2024-07-04 12:16     ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=703fd8504ca9541898ec920e15c05d673233218f.camel@amazon.com \
    --to=surajjs@amazon.com \
    --cc=acpica-devel@lists.linux.dev \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=okaya@kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rafael@kernel.org \
    --cc=robert.moore@intel.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox