From: Borislav Petkov <bp@alien8.de>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: LKML <linux-kernel@vger.kernel.org>,
Jiang Liu <jiang.liu@linux.intel.com>,
x86@kernel.org, Bjorn Helgaas <bhelgaas@google.com>,
"Rafael J. Wysocki" <rjw@rjwysocki.net>,
Yinghai Lu <yinghai@kernel.org>
Subject: Re: [patch 3/4] x86: pci: acpi: Fix the range check for IO resources
Date: Fri, 12 Dec 2014 15:56:57 +0100 [thread overview]
Message-ID: <20141212145657.GC30699@pd.tnic> (raw)
In-Reply-To: <20141211193112.725667793@linutronix.de>
On Thu, Dec 11, 2014 at 07:48:22PM -0000, Thomas Gleixner wrote:
> The range check in setup_res() checks the IO range against
> iomem_resource. That's just wrong.
>
> Move the check into a separate function and use ioport_resource for IO
> ranges.
>
> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
> ---
> arch/x86/pci/acpi.c | 51 +++++++++++++++++++++++++++++++++------------------
> 1 file changed, 33 insertions(+), 18 deletions(-)
>
> Index: tip/arch/x86/pci/acpi.c
> ===================================================================
> --- tip.orig/arch/x86/pci/acpi.c
> +++ tip/arch/x86/pci/acpi.c
> @@ -240,12 +240,41 @@ static acpi_status count_resource(struct
> return AE_OK;
> }
>
> +static bool valid_resource_range(struct resource *r, struct device *dev)
> +{
> + struct resource *ior;
> + u64 end;
> +
> + ior = (r->flags & IORESOURCE_IO) ? &ioport_resource : &iomem_resource;
> +
> + /*
> + * Exclude non-addressable range or non-addressable portion of
> + * range. We only check end because ior->start is always 0.
> + */
> + end = r->end;
> + r->end = min(r->end, ior->end);
> + if (r->end <= r->start) {
> + dev_info(dev, "host bridge %s window [%#llx-%#llx] invalid range\n",
> + r->flags & IORESOURCE_IO ? "io" : "mem",
I think you can simplify this and below even further as the check
Iagainst ORESOURCE_IO is done already when selecting the ior thing (diff
Iontop):
---
Index: b/arch/x86/pci/acpi.c
===================================================================
--- a/arch/x86/pci/acpi.c 2014-12-12 15:54:40.856317113 +0100
+++ b/arch/x86/pci/acpi.c 2014-12-12 15:53:16.832319561 +0100
@@ -255,7 +255,7 @@ static bool valid_resource_range(struct
r->end = min(r->end, ior->end);
if (r->end <= r->start) {
dev_info(dev, "host bridge %s window [%#llx-%#llx] invalid range\n",
- r->flags & IORESOURCE_IO ? "io" : "mem",
+ ior->name,
(unsigned long long)r->start, end);
return false;
}
@@ -264,7 +264,7 @@ static bool valid_resource_range(struct
return true;
dev_info(dev, "host bridge %s window [%#llx-%#llx] truncated to [%#llx-%#llx]\n",
- r->flags & IORESOURCE_IO ? "io" : "mem",
+ ior->name,
(unsigned long long)r->start, end,
(unsigned long long)r->start, (unsigned long long)r->end);
return true;
--
Regards/Gruss,
Boris.
Sent from a fat crate under my desk. Formatting is fine.
--
next prev parent reply other threads:[~2014-12-12 14:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-11 19:48 [patch 0/4] x86: Fix the ACPI resource handling and range checking Thomas Gleixner
2014-12-11 19:48 ` [patch 1/4] x86, pci, acpi: Redo sanity checks for root brigde probing Thomas Gleixner
2014-12-12 11:33 ` Borislav Petkov
2014-12-11 19:48 ` [patch 2/4] x86: pci: acpi: Respect ioresource flags Thomas Gleixner
2014-12-12 13:39 ` Borislav Petkov
2014-12-11 19:48 ` [patch 3/4] x86: pci: acpi: Fix the range check for IO resources Thomas Gleixner
2014-12-12 14:56 ` Borislav Petkov [this message]
2014-12-11 19:48 ` [patch 4/4] acpi: ioapic: Respect the resource flags Thomas Gleixner
2014-12-12 2:44 ` Yinghai Lu
2014-12-12 7:53 ` Thomas Gleixner
2014-12-12 8:24 ` Yinghai Lu
2014-12-12 8:46 ` Jiang Liu
2014-12-12 11:43 ` Thomas Gleixner
2014-12-17 5:44 ` Jiang Liu
2014-12-17 8:55 ` Thomas Gleixner
2014-12-12 11:39 ` Thomas Gleixner
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=20141212145657.GC30699@pd.tnic \
--to=bp@alien8.de \
--cc=bhelgaas@google.com \
--cc=jiang.liu@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rjw@rjwysocki.net \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yinghai@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.