diff mbox

[1/2] bus: mvebu-mbus: Fix incorrect size for PCI aperture resources

Message ID 1392245828-23244-1-git-send-email-jgunthorpe@obsidianresearch.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jason Gunthorpe Feb. 12, 2014, 10:57 p.m. UTC
reg[0] is the DT base, reg[1] is the DT length in bytes,
struct resource.end is the inclusive end address, so a -1 is
required.

Tested on kirkwood.

Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
---
 drivers/bus/mvebu-mbus.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Arnd Bergmann Feb. 12, 2014, 11:22 p.m. UTC | #1
On Wednesday 12 February 2014 15:57:07 Jason Gunthorpe wrote:
> reg[0] is the DT base, reg[1] is the DT length in bytes,
> struct resource.end is the inclusive end address, so a -1 is
> required.
> 
> Tested on kirkwood.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Acked-by: Arnd Bergmann <arnd@arndb.de>
Bjorn Helgaas Feb. 14, 2014, 6:29 p.m. UTC | #2
On Wed, Feb 12, 2014 at 03:57:07PM -0700, Jason Gunthorpe wrote:
> reg[0] is the DT base, reg[1] is the DT length in bytes,
> struct resource.end is the inclusive end address, so a -1 is
> required.
> 
> Tested on kirkwood.
> 
> Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>

Do these two patches need to go together?  I don't maintain
drivers/bus/mvebu-mbus.c, but if these should be kept together, I'd be
happy to merge them both, given the appropriate ack from Jason C or Thomas.

> ---
>  drivers/bus/mvebu-mbus.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
> index 2394e97..7fd54e9 100644
> --- a/drivers/bus/mvebu-mbus.c
> +++ b/drivers/bus/mvebu-mbus.c
> @@ -876,14 +876,14 @@ static void __init mvebu_mbus_get_pcie_resources(struct device_node *np,
>  	ret = of_property_read_u32_array(np, "pcie-mem-aperture", reg, ARRAY_SIZE(reg));
>  	if (!ret) {
>  		mem->start = reg[0];
> -		mem->end = mem->start + reg[1];
> +		mem->end = mem->start + reg[1] - 1;
>  		mem->flags = IORESOURCE_MEM;
>  	}
>  
>  	ret = of_property_read_u32_array(np, "pcie-io-aperture", reg, ARRAY_SIZE(reg));
>  	if (!ret) {
>  		io->start = reg[0];
> -		io->end = io->start + reg[1];
> +		io->end = io->start + reg[1] - 1;
>  		io->flags = IORESOURCE_IO;
>  	}
>  }
> -- 
> 1.8.1.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jason Cooper Feb. 17, 2014, 1:39 a.m. UTC | #3
On Fri, Feb 14, 2014 at 11:29:10AM -0700, Bjorn Helgaas wrote:
> On Wed, Feb 12, 2014 at 03:57:07PM -0700, Jason Gunthorpe wrote:
> > reg[0] is the DT base, reg[1] is the DT length in bytes,
> > struct resource.end is the inclusive end address, so a -1 is
> > required.
> > 
> > Tested on kirkwood.
> > 
> > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> Do these two patches need to go together?  I don't maintain
> drivers/bus/mvebu-mbus.c, but if these should be kept together, I'd be
> happy to merge them both, given the appropriate ack from Jason C or Thomas.

I have one small change for mvebu-mbus queued up, which won't conflict
here.  Please take both:

Acked-by: Jason Cooper <jason@lakedaemon.net>

thx,

Jason.
Jason Gunthorpe Feb. 18, 2014, 5:05 p.m. UTC | #4
On Fri, Feb 14, 2014 at 11:29:10AM -0700, Bjorn Helgaas wrote:
> On Wed, Feb 12, 2014 at 03:57:07PM -0700, Jason Gunthorpe wrote:
> > reg[0] is the DT base, reg[1] is the DT length in bytes,
> > struct resource.end is the inclusive end address, so a -1 is
> > required.
> > 
> > Tested on kirkwood.
> > 
> > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> 
> Do these two patches need to go together?  I don't maintain
> drivers/bus/mvebu-mbus.c, but if these should be kept together, I'd be
> happy to merge them both, given the appropriate ack from Jason C or Thomas.

I recommend keeping them together, requesting the wrong resource size
range in PCI-E did not fail on my test system, but it has the
potential to fail on systems with a different memory layout.

Thanks,
Jason
Bjorn Helgaas Feb. 18, 2014, 8:38 p.m. UTC | #5
On Sun, Feb 16, 2014 at 08:39:49PM -0500, Jason Cooper wrote:
> On Fri, Feb 14, 2014 at 11:29:10AM -0700, Bjorn Helgaas wrote:
> > On Wed, Feb 12, 2014 at 03:57:07PM -0700, Jason Gunthorpe wrote:
> > > reg[0] is the DT base, reg[1] is the DT length in bytes,
> > > struct resource.end is the inclusive end address, so a -1 is
> > > required.
> > > 
> > > Tested on kirkwood.
> > > 
> > > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> > 
> > Do these two patches need to go together?  I don't maintain
> > drivers/bus/mvebu-mbus.c, but if these should be kept together, I'd be
> > happy to merge them both, given the appropriate ack from Jason C or Thomas.
> 
> I have one small change for mvebu-mbus queued up, which won't conflict
> here.  Please take both:
> 
> Acked-by: Jason Cooper <jason@lakedaemon.net>

I added the acks and applied both patches to pci/host-mvebu for v3.15,
thanks!

Bjorn
diff mbox

Patch

diff --git a/drivers/bus/mvebu-mbus.c b/drivers/bus/mvebu-mbus.c
index 2394e97..7fd54e9 100644
--- a/drivers/bus/mvebu-mbus.c
+++ b/drivers/bus/mvebu-mbus.c
@@ -876,14 +876,14 @@  static void __init mvebu_mbus_get_pcie_resources(struct device_node *np,
 	ret = of_property_read_u32_array(np, "pcie-mem-aperture", reg, ARRAY_SIZE(reg));
 	if (!ret) {
 		mem->start = reg[0];
-		mem->end = mem->start + reg[1];
+		mem->end = mem->start + reg[1] - 1;
 		mem->flags = IORESOURCE_MEM;
 	}
 
 	ret = of_property_read_u32_array(np, "pcie-io-aperture", reg, ARRAY_SIZE(reg));
 	if (!ret) {
 		io->start = reg[0];
-		io->end = io->start + reg[1];
+		io->end = io->start + reg[1] - 1;
 		io->flags = IORESOURCE_IO;
 	}
 }