Re: [PATCH v3] PCI: ACPI: IA64: fix IO port generic range check
From: Rafael J. Wysocki
Date: Tue Mar 22 2016 - 10:41:05 EST
On Tuesday, March 22, 2016 08:02:19 AM Bjorn Helgaas wrote:
> On Mon, Mar 21, 2016 at 01:42:01PM +0100, Rafael J. Wysocki wrote:
> > On Mon, Mar 21, 2016 at 12:12 PM, Lorenzo Pieralisi
[cut]
> > >
> > > Fixes: 3772aea7d6f3 ("ia64/PCI/ACPI: Use common ACPI resource parsing
> > > interface for host bridge")
> > > Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>
> > > Cc: Bjorn Helgaas <bhelgaas@xxxxxxxxxx>
> > > Cc: Hanjun Guo <hanjun.guo@xxxxxxxxxx>
> > > Cc: Jiang Liu <jiang.liu@xxxxxxxxxxxxxxx>
> > > Cc: Tony Luck <tony.luck@xxxxxxxxx>
> > > Cc: Tomasz Nowicki <tn@xxxxxxxxxxxx>
> > > Cc: Mark Salter <msalter@xxxxxxxxxx>
> > > Cc: "Rafael J. Wysocki" <rjw@xxxxxxxxxxxxx>
> > > ---
> > > v2 -> v3
> > >
> > > - Moved IO resource check to generic ACPI resource code
> > > - Dropped Tested-by tags
> > > - Rebased against v4.5
> > >
> > > v2: https://marc.info/?l=linux-acpi&m=145521271330332&w=2
> > >
> > > v1 -> v2
> > >
> > > - Updated commit log to report missing IO resources
> > > - Fixed function ioport_valid() comment 16k/64k typo
> > >
> > > v1: https://marc.info/?l=linux-acpi&m=145432228025354&w=2
> > >
> > > drivers/acpi/resource.c | 14 +++++++++++++-
> > > 1 file changed, 13 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/acpi/resource.c b/drivers/acpi/resource.c
> > > index d02fd53..56241eb 100644
> > > --- a/drivers/acpi/resource.c
> > > +++ b/drivers/acpi/resource.c
> > > @@ -27,8 +27,20 @@
> > >
> > > #ifdef CONFIG_X86
> > > #define valid_IRQ(i) (((i) != 0) && ((i) != 2))
> > > +static inline bool acpi_iospace_resource_valid(struct resource *res)
> > > +{
> > > + /* On X86 IO space is limited to the [0 - 64K] IO port range */
> > > + return res->end < 0x10003;
> > > +}
> > > #else
> > > #define valid_IRQ(i) (true)
> > > +/*
> > > + * ACPI IO descriptors on arches other than X86 contain MMIO CPU physical
> > > + * addresses mapping IO space in CPU physical address space, IO space
> > > + * resources can be placed anywhere in the 64-bit physical address space.
> > > + */
> > > +static inline bool
> > > +acpi_iospace_resource_valid(struct resource *res) { return true; }
> > > #endif
> > >
> > > static bool acpi_dev_resource_len_valid(u64 start, u64 end, u64 len, bool io)
> > > @@ -127,7 +139,7 @@ static void acpi_dev_ioresource_flags(struct resource *res, u64 len,
> > > if (!acpi_dev_resource_len_valid(res->start, res->end, len, true))
> > > res->flags |= IORESOURCE_DISABLED | IORESOURCE_UNSET;
> > >
> > > - if (res->end >= 0x10003)
> > > + if (!acpi_iospace_resource_valid(res))
> > > res->flags |= IORESOURCE_DISABLED | IORESOURCE_UNSET;
> > >
> > > if (io_decode == ACPI_DECODE_16)
> > > --
> >
> > This is fine by me.
> >
> > Bjorn?
>
> Looks good to me.
OK, thanks!
May I take this as an ACK? :-)