mbox series

[v2,0/3] x86/PCI: Log E820 clipping

Message ID 20220414182252.758742-1-helgaas@kernel.org
Headers show
Series x86/PCI: Log E820 clipping | expand

Message

Bjorn Helgaas April 14, 2022, 6:22 p.m. UTC
From: Bjorn Helgaas <bhelgaas@google.com>

This is still work-in-progress on the issue of PNP0A03 _CRS methods that
are buggy or not interpreted correctly by Linux.

The previous try at:
  https://lore.kernel.org/r/20220304035110.988712-1-helgaas@kernel.org
caused regressions on some Chromebooks:
  https://lore.kernel.org/r/Yjyv03JsetIsTJxN@sirena.org.uk

This v2 drops the commit that caused the Chromebook regression, so it also
doesn't fix the issue we were *trying* to fix on Lenovo Yoga and Clevo
Barebones.

The point of this v2 update is to split the logging patch into (1) a pure
logging addition and (2) the change to only clip PCI windows, which was
previously hidden inside the logging patch and not well documented.

Bjorn Helgaas (3):
  x86/PCI: Eliminate remove_e820_regions() common subexpressions
  x86: Log resource clipping for E820 regions
  x86/PCI: Clip only host bridge windows for E820 regions

 arch/x86/include/asm/e820/api.h |  5 +++++
 arch/x86/kernel/resource.c      | 23 ++++++++++++++++-------
 arch/x86/pci/acpi.c             |  5 +++++
 3 files changed, 26 insertions(+), 7 deletions(-)

Comments

Rafael J. Wysocki April 15, 2022, 2:12 p.m. UTC | #1
On Thu, Apr 14, 2022 at 8:23 PM Bjorn Helgaas <helgaas@kernel.org> wrote:
>
> From: Bjorn Helgaas <bhelgaas@google.com>
>
> When remove_e820_regions() clips a resource because an E820 region overlaps
> it, log a note in dmesg to add in debugging.
>
> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  arch/x86/kernel/resource.c | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/arch/x86/kernel/resource.c b/arch/x86/kernel/resource.c
> index 8ffe68437744..30d524adb012 100644
> --- a/arch/x86/kernel/resource.c
> +++ b/arch/x86/kernel/resource.c
> @@ -1,5 +1,6 @@
>  // SPDX-License-Identifier: GPL-2.0
>  #include <linux/ioport.h>
> +#include <linux/printk.h>
>  #include <asm/e820/api.h>
>
>  static void resource_clip(struct resource *res, resource_size_t start,
> @@ -28,6 +29,7 @@ static void remove_e820_regions(struct resource *avail)
>         int i;
>         struct e820_entry *entry;
>         u64 e820_start, e820_end;
> +       struct resource orig = *avail;
>
>         for (i = 0; i < e820_table->nr_entries; i++) {
>                 entry = &e820_table->entries[i];
> @@ -35,6 +37,11 @@ static void remove_e820_regions(struct resource *avail)
>                 e820_end = entry->addr + entry->size - 1;
>
>                 resource_clip(avail, e820_start, e820_end);
> +               if (orig.start != avail->start || orig.end != avail->end) {
> +                       pr_info("clipped %pR to %pR for e820 entry [mem %#010Lx-%#010Lx]\n",
> +                                &orig, avail, e820_start, e820_end);
> +                       orig = *avail;
> +               }
>         }
>  }
>
> --
> 2.25.1
>
Hans de Goede April 19, 2022, 9:59 a.m. UTC | #2
Hi All,

On 1/1/70 01:00, Bjorn Helgaas wrote:
> This is still work-in-progress on the issue of PNP0A03 _CRS methods that
> are buggy or not interpreted correctly by Linux.
> 
> The previous try at:
>   https://lore.kernel.org/r/20220304035110.988712-1-helgaas@kernel.org
> caused regressions on some Chromebooks:
>   https://lore.kernel.org/r/Yjyv03JsetIsTJxN@sirena.org.uk
> 
> This v2 drops the commit that caused the Chromebook regression, so it also
> doesn't fix the issue we were *trying* to fix on Lenovo Yoga and Clevo
> Barebones.
> 
> The point of this v2 update is to split the logging patch into (1) a pure
> logging addition and (2) the change to only clip PCI windows, which was
> previously hidden inside the logging patch and not well documented.
> 
> Bjorn Helgaas (3):
>   x86/PCI: Eliminate remove_e820_regions() common subexpressions
>   x86: Log resource clipping for E820 regions
>   x86/PCI: Clip only host bridge windows for E820 regions

Thanks, the entire series looks good to me:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

For the series.

So what is the plan to actually fix the issue seen on some Lenovo models
and Clevo Barebones ?   As I mentioned previously I think that since all
our efforts have failed so far that we should maybe reconsider just
using DMI quirks to ignore the E820 reservation windows for host bridges
on affected models ?

That or implement 3 of:

> So I think the progression is:
>
>  1) Remove anything mentioned in E820 from _CRS (4dc2287c1805 [7]).
>     This worked around some issues on Dell systems.
>
>  2) Remove things mentioned in E820 unless they cover the entire
>     window (5949965ec934 [8])
>
>  3) Coalesce adjacent _CRS windows, *then* remove things mentioned in
>     E820 unless they cover the entire (coalesced) window (current
>     proposal)

Regards,

Hans