From: Bjorn Helgaas <helgaas@kernel.org>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
linux-pci@vger.kernel.org, Sinan Kaya <okaya@kernel.org>,
Zeev Zilberman <zeev@amazon.com>,
linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
Ali Saidi <alisaidi@amazon.com>
Subject: Re: [PATCH 2/4] pci: acpi: Read _DSM #5 from ACPI on root bridges
Date: Fri, 21 Jun 2019 15:07:33 -0500 [thread overview]
Message-ID: <20190621200733.GC127746@google.com> (raw)
In-Reply-To: <20190615002359.29577-2-benh@kernel.crashing.org>
Match the subject line convention for this file, e.g.,
PCI/ACPI: Evaluate PCI Boot Configuration _DSM
On Sat, Jun 15, 2019 at 10:23:57AM +1000, Benjamin Herrenschmidt wrote:
> This reads _DSM #5 value on root bridges, and when 0, sets a "preserve_config"
> flag in the host bridge structure indicating that the FW has requested that
> the existing configuration be preserved.
Wrap to 75 or so, so this doesn't overflow 80 columns when "git log" adds
its indentation.
> The upcoming spec change to define _DSM #5 for host bridges states that
> this should be the default behaviour, however doing so would be very
> intrusive and break existing setups. So we leave the default to be
> the existing behaviour.
This paragraph is incorrect. Just remove it completely.
I would silently fix stuff like this if I applied these, but you can
do it if you repost these.
> Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
> ---
> drivers/acpi/pci_root.c | 23 +++++++++++++++++++++++
> include/linux/pci-acpi.h | 7 ++++---
> include/linux/pci.h | 2 ++
> 3 files changed, 29 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index 39f5d172e84f..217b3916f0f1 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -881,6 +881,7 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
> int node = acpi_get_node(device->handle);
> struct pci_bus *bus;
> struct pci_host_bridge *host_bridge;
> + union acpi_object *obj;
>
> info->root = root;
> info->bridge = device;
> @@ -917,6 +918,28 @@ struct pci_bus *acpi_pci_root_create(struct acpi_pci_root *root,
> if (!(root->osc_control_set & OSC_PCI_EXPRESS_LTR_CONTROL))
> host_bridge->native_ltr = 0;
>
> + /*
> + * Invoke the PCI device specific method (_DSM) #5 'Ignore PCI Boot
> + * Configuration', on the host bridge. This tells us whether the
> + * firmware wants us to preserve or reassign the configuration of
> + * the PCI resource tree for this root bridge.
> + *
> + * For now, we only care about the function being present and returning
> + * 0, which we use to set a flag indicating that we'll preserve the
> + * FW configuration.
> + *
> + * This diverges from the spec which states that 0 is also the default
> + * in absence of _DSM #5. We do that today to work around the fact that
> + * our arm64 code doesn't implement the right defaults otherwise. This
> + * will be superseeded by a more thorough handling of _DSM #5 once the
> + * resource survey code has been consolidated further.
> + */
> + obj = acpi_evaluate_dsm(ACPI_HANDLE(bus->bridge), &pci_acpi_dsm_guid, 1,
> + IGNORE_PCI_BOOT_CONFIG_DSM, NULL);
> + if (obj && obj->type == ACPI_TYPE_INTEGER && obj->integer.value == 0)
> + host_bridge->preserve_config = 1;
> + ACPI_FREE(obj);
> +
> pci_scan_child_bus(bus);
> pci_set_host_bridge_release(host_bridge, acpi_pci_root_release_info,
> info);
> diff --git a/include/linux/pci-acpi.h b/include/linux/pci-acpi.h
> index 8082b612f561..62b7fdcc661c 100644
> --- a/include/linux/pci-acpi.h
> +++ b/include/linux/pci-acpi.h
> @@ -107,9 +107,10 @@ static inline void acpiphp_check_host_bridge(struct acpi_device *adev) { }
> #endif
>
> extern const guid_t pci_acpi_dsm_guid;
> -#define DEVICE_LABEL_DSM 0x07
> -#define RESET_DELAY_DSM 0x08
> -#define FUNCTION_DELAY_DSM 0x09
> +#define IGNORE_PCI_BOOT_CONFIG_DSM 0x05
> +#define DEVICE_LABEL_DSM 0x07
> +#define RESET_DELAY_DSM 0x08
> +#define FUNCTION_DELAY_DSM 0x09
>
> #else /* CONFIG_ACPI */
> static inline void acpi_pci_add_bus(struct pci_bus *bus) { }
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index dd436da7eccc..c50389b8df3c 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -506,6 +506,8 @@ struct pci_host_bridge {
> unsigned int native_shpc_hotplug:1; /* OS may use SHPC hotplug */
> unsigned int native_pme:1; /* OS may use PCIe PME */
> unsigned int native_ltr:1; /* OS may use PCIe LTR */
> + unsigned int preserve_config:1; /* Preserve FW resources setup */
> +
> /* Resource alignment requirements */
> resource_size_t (*align_resource)(struct pci_dev *dev,
> const struct resource *res,
> --
> 2.17.1
>
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-21 20:07 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-15 0:23 [PATCH 1/4] arm64: pci: acpi: Use pci_assign_unassigned_root_bus_resources() Benjamin Herrenschmidt
2019-06-15 0:23 ` [PATCH 2/4] pci: acpi: Read _DSM #5 from ACPI on root bridges Benjamin Herrenschmidt
2019-06-21 20:07 ` Bjorn Helgaas [this message]
2019-06-15 0:23 ` [PATCH 3/4] pci: Do not auto-enable PCI reallocation when _DSM #5 returns 0 Benjamin Herrenschmidt
2019-06-21 20:07 ` Bjorn Helgaas
2019-06-15 0:23 ` [PATCH 4/4] arm64: pci: acpi: Preserve PCI resources configuration when asked by ACPI Benjamin Herrenschmidt
2019-06-21 14:57 ` Lorenzo Pieralisi
2019-06-21 23:07 ` Benjamin Herrenschmidt
2019-06-21 15:44 ` Ard Biesheuvel
2019-06-21 20:08 ` Bjorn Helgaas
2019-06-20 17:13 ` [PATCH 1/4] arm64: pci: acpi: Use pci_assign_unassigned_root_bus_resources() Lorenzo Pieralisi
2019-06-20 22:55 ` Benjamin Herrenschmidt
2019-06-21 20:06 ` Bjorn Helgaas
2019-06-21 20:48 ` Bjorn Helgaas
2019-06-21 22:58 ` Benjamin Herrenschmidt
2019-06-21 23:00 ` Benjamin Herrenschmidt
2019-06-21 23:15 ` Bjorn Helgaas
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=20190621200733.GC127746@google.com \
--to=helgaas@kernel.org \
--cc=alisaidi@amazon.com \
--cc=ard.biesheuvel@linaro.org \
--cc=benh@kernel.crashing.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lorenzo.pieralisi@arm.com \
--cc=okaya@kernel.org \
--cc=zeev@amazon.com \
/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;
as well as URLs for NNTP newsgroup(s).