2021-08-24 12:23:18

by Joerg Roedel

[permalink] [raw]
Subject: [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation

From: Joerg Roedel <[email protected]>

Hi,

here is the third version of my patches to simplify the _OSC
negotiation of PCIe features between Linux and the firmware.

This version is a complete rewrite, so there is no changelog to the
previous version. Patches 1-3 are cleanups and small restructurings of
the code as a preparation for patch 4.

The last patch gets rid of the dedicated _OSC query to check for _OSC
support and merges that functionality into acpi_pci_osc_control_set().

This allows to simplify and/or remove other functions and consilidate
error handling in negotiate_os_control().

I have tested the patches with and without 'pcie_ports=compat' and
found no regressions on my test machine.

Please review.

Thanks,

Joerg



Joerg Roedel (4):
PCI/ACPI: Remove OSC_PCI_SUPPORT_MASKS and OSC_PCI_CONTROL_MASKS
PCI/ACPI: Move supported and control calculations to separaten
functions
PCI/ACPI: Move _OSC query checks to separate function
PCI/ACPI: Check for _OSC support in acpi_pci_osc_control_set()

drivers/acpi/pci_root.c | 161 +++++++++++++++++++++-------------------
include/linux/acpi.h | 2 -
2 files changed, 84 insertions(+), 79 deletions(-)

--
2.32.0


2021-08-24 12:23:49

by Joerg Roedel

[permalink] [raw]
Subject: [PATCH v3 3/4] PCI/ACPI: Move _OSC query checks to separate function

From: Joerg Roedel <[email protected]>

Move the checks about whether the _OSC controls are requested from the
firmware to a separate function.

Signed-off-by: Joerg Roedel <[email protected]>
---
drivers/acpi/pci_root.c | 28 +++++++++++++++++++---------
1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index ed4e6b55e9bc..f12e512bcddc 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -449,6 +449,24 @@ static u32 calculate_control(void)
return control;
}

+static bool os_control_query_checks(struct acpi_pci_root *root, u32 support)
+{
+ struct acpi_device *device = root->device;
+
+ if (pcie_ports_disabled) {
+ dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n");
+ return false;
+ }
+
+ if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) {
+ decode_osc_support(root, "not requesting OS control; OS requires",
+ ACPI_PCIE_REQ_SUPPORT);
+ return false;
+ }
+
+ return true;
+}
+
static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
bool is_pcie)
{
@@ -485,16 +503,8 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
return;
}

- if (pcie_ports_disabled) {
- dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n");
+ if (!os_control_query_checks(root, support))
return;
- }
-
- if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) {
- decode_osc_support(root, "not requesting OS control; OS requires",
- ACPI_PCIE_REQ_SUPPORT);
- return;
- }

requested = control = calculate_control();

--
2.32.0

2021-09-01 20:24:13

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation

On Tue, Aug 24, 2021 at 2:21 PM Joerg Roedel <[email protected]> wrote:
>
> From: Joerg Roedel <[email protected]>
>
> Hi,
>
> here is the third version of my patches to simplify the _OSC
> negotiation of PCIe features between Linux and the firmware.
>
> This version is a complete rewrite, so there is no changelog to the
> previous version. Patches 1-3 are cleanups and small restructurings of
> the code as a preparation for patch 4.
>
> The last patch gets rid of the dedicated _OSC query to check for _OSC
> support and merges that functionality into acpi_pci_osc_control_set().
>
> This allows to simplify and/or remove other functions and consilidate
> error handling in negotiate_os_control().
>
> I have tested the patches with and without 'pcie_ports=compat' and
> found no regressions on my test machine.

I have reviewed the patches, so if you want me to queue up this
series, please let me know.

Thanks,
Rafael


> Joerg Roedel (4):
> PCI/ACPI: Remove OSC_PCI_SUPPORT_MASKS and OSC_PCI_CONTROL_MASKS
> PCI/ACPI: Move supported and control calculations to separaten
> functions
> PCI/ACPI: Move _OSC query checks to separate function
> PCI/ACPI: Check for _OSC support in acpi_pci_osc_control_set()
>
> drivers/acpi/pci_root.c | 161 +++++++++++++++++++++-------------------
> include/linux/acpi.h | 2 -
> 2 files changed, 84 insertions(+), 79 deletions(-)
>
> --
> 2.32.0
>

2021-09-01 23:30:37

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v3 3/4] PCI/ACPI: Move _OSC query checks to separate function

On Tue, Aug 24, 2021 at 2:21 PM Joerg Roedel <[email protected]> wrote:
>
> From: Joerg Roedel <[email protected]>
>
> Move the checks about whether the _OSC controls are requested from the
> firmware to a separate function.
>
> Signed-off-by: Joerg Roedel <[email protected]>

Reviewed-by: Rafael J. Wysocki <[email protected]>

> ---
> drivers/acpi/pci_root.c | 28 +++++++++++++++++++---------
> 1 file changed, 19 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
> index ed4e6b55e9bc..f12e512bcddc 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -449,6 +449,24 @@ static u32 calculate_control(void)
> return control;
> }
>
> +static bool os_control_query_checks(struct acpi_pci_root *root, u32 support)
> +{
> + struct acpi_device *device = root->device;
> +
> + if (pcie_ports_disabled) {
> + dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n");
> + return false;
> + }
> +
> + if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) {
> + decode_osc_support(root, "not requesting OS control; OS requires",
> + ACPI_PCIE_REQ_SUPPORT);
> + return false;
> + }
> +
> + return true;
> +}
> +
> static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
> bool is_pcie)
> {
> @@ -485,16 +503,8 @@ static void negotiate_os_control(struct acpi_pci_root *root, int *no_aspm,
> return;
> }
>
> - if (pcie_ports_disabled) {
> - dev_info(&device->dev, "PCIe port services disabled; not requesting _OSC control\n");
> + if (!os_control_query_checks(root, support))
> return;
> - }
> -
> - if ((support & ACPI_PCIE_REQ_SUPPORT) != ACPI_PCIE_REQ_SUPPORT) {
> - decode_osc_support(root, "not requesting OS control; OS requires",
> - ACPI_PCIE_REQ_SUPPORT);
> - return;
> - }
>
> requested = control = calculate_control();
>
> --
> 2.32.0
>

2021-09-14 00:41:09

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation

On Wed, Sep 1, 2021 at 9:33 PM Rafael J. Wysocki <[email protected]> wrote:
>
> On Tue, Aug 24, 2021 at 2:21 PM Joerg Roedel <[email protected]> wrote:
> >
> > From: Joerg Roedel <[email protected]>
> >
> > Hi,
> >
> > here is the third version of my patches to simplify the _OSC
> > negotiation of PCIe features between Linux and the firmware.
> >
> > This version is a complete rewrite, so there is no changelog to the
> > previous version. Patches 1-3 are cleanups and small restructurings of
> > the code as a preparation for patch 4.
> >
> > The last patch gets rid of the dedicated _OSC query to check for _OSC
> > support and merges that functionality into acpi_pci_osc_control_set().
> >
> > This allows to simplify and/or remove other functions and consilidate
> > error handling in negotiate_os_control().
> >
> > I have tested the patches with and without 'pcie_ports=compat' and
> > found no regressions on my test machine.
>
> I have reviewed the patches, so if you want me to queue up this
> series, please let me know.

Should I assume that Bjorn will be taking it?

2021-09-14 13:51:24

by Joerg Roedel

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation

On Mon, Sep 13, 2021 at 06:14:38PM +0200, Rafael J. Wysocki wrote:
> Should I assume that Bjorn will be taking it?

No idea, checking git-log on the file shows mixed Signed-off-bys from
both of you. Bjorn?


Joerg

2021-09-14 13:53:55

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation

On Tue, Sep 14, 2021 at 8:50 AM Joerg Roedel <[email protected]> wrote:
>
> On Mon, Sep 13, 2021 at 06:14:38PM +0200, Rafael J. Wysocki wrote:
> > Should I assume that Bjorn will be taking it?
>
> No idea, checking git-log on the file shows mixed Signed-off-bys from
> both of you. Bjorn?

I'll merge it, hopefully this week. Thanks!

Bjorn

2021-09-28 21:26:08

by Bjorn Helgaas

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation

On Tue, Aug 24, 2021 at 02:20:50PM +0200, Joerg Roedel wrote:
> From: Joerg Roedel <[email protected]>
>
> Hi,
>
> here is the third version of my patches to simplify the _OSC
> negotiation of PCIe features between Linux and the firmware.
>
> This version is a complete rewrite, so there is no changelog to the
> previous version. Patches 1-3 are cleanups and small restructurings of
> the code as a preparation for patch 4.
>
> The last patch gets rid of the dedicated _OSC query to check for _OSC
> support and merges that functionality into acpi_pci_osc_control_set().
>
> This allows to simplify and/or remove other functions and consilidate
> error handling in negotiate_os_control().
>
> I have tested the patches with and without 'pcie_ports=compat' and
> found no regressions on my test machine.
>
> Please review.
>
> Thanks,
>
> Joerg
>
>
>
> Joerg Roedel (4):
> PCI/ACPI: Remove OSC_PCI_SUPPORT_MASKS and OSC_PCI_CONTROL_MASKS
> PCI/ACPI: Move supported and control calculations to separaten
> functions
> PCI/ACPI: Move _OSC query checks to separate function
> PCI/ACPI: Check for _OSC support in acpi_pci_osc_control_set()
>
> drivers/acpi/pci_root.c | 161 +++++++++++++++++++++-------------------
> include/linux/acpi.h | 2 -
> 2 files changed, 84 insertions(+), 79 deletions(-)

Applied with Rafael's reviewed-by to pci/acpi for v5.16, thanks!

2021-09-29 08:15:16

by Jörg Rödel

[permalink] [raw]
Subject: Re: [PATCH v3 0/4] PCI/ACPI: Simplify PCIe _OSC feature negotiation

On Tue, Sep 28, 2021 at 04:21:19PM -0500, Bjorn Helgaas wrote:
> Applied with Rafael's reviewed-by to pci/acpi for v5.16, thanks!

Thanks Bjorn!