From: bhelgaas@google.com (Bjorn Helgaas)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 4/7] pci: mvebu: fix off-by-one in the computed size of the mbus windows
Date: Mon, 21 Apr 2014 10:47:54 -0600 [thread overview]
Message-ID: <20140421164754.GA17260@google.com> (raw)
In-Reply-To: <1397823593-1932-5-git-send-email-thomas.petazzoni@free-electrons.com>
On Fri, Apr 18, 2014 at 02:19:50PM +0200, Thomas Petazzoni wrote:
> From: Willy Tarreau <w@1wt.eu>
>
> mvebu_pcie_handle_membase_change() and
> mvebu_pcie_handle_iobase_change() do not correctly compute the window
> size. PCI uses an inclusive start/end address pair, which requires a
> +1 when converting to size.
>
> This only worked because a bug in the mbus driver allowed it to
> silently accept and round up bogus sizes.
>
> Fix this by adding one to the computed size.
>
> Fixes: 45361a4fe4464180815157654aabbd2afb4848ad ('PCIe driver for Marvell Armada 370/XP systems')
> Cc: <stable@vger.kernel.org> # v3.11+
> Signed-off-by: Willy Tarreau <w@1wt.eu>
> Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Tested-by: Neil Greatorex <neil@fatboyfat.co.uk>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>
If I were merging via my tree, I would tweak the subject capitalization
so "git log --oneline drivers/pci/host/pci-mvebu.c" looks consistent.
> ---
> drivers/pci/host/pci-mvebu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pci/host/pci-mvebu.c b/drivers/pci/host/pci-mvebu.c
> index d3d1cfd..4829921 100644
> --- a/drivers/pci/host/pci-mvebu.c
> +++ b/drivers/pci/host/pci-mvebu.c
> @@ -331,7 +331,7 @@ static void mvebu_pcie_handle_iobase_change(struct mvebu_pcie_port *port)
> port->iowin_base = port->pcie->io.start + iobase;
> port->iowin_size = ((0xFFF | ((port->bridge.iolimit & 0xF0) << 8) |
> (port->bridge.iolimitupper << 16)) -
> - iobase);
> + iobase) + 1;
>
> mvebu_mbus_add_window_remap_by_id(port->io_target, port->io_attr,
> port->iowin_base, port->iowin_size,
> @@ -364,7 +364,7 @@ static void mvebu_pcie_handle_membase_change(struct mvebu_pcie_port *port)
> port->memwin_base = ((port->bridge.membase & 0xFFF0) << 16);
> port->memwin_size =
> (((port->bridge.memlimit & 0xFFF0) << 16) | 0xFFFFF) -
> - port->memwin_base;
> + port->memwin_base + 1;
>
> mvebu_mbus_add_window_by_id(port->mem_target, port->mem_attr,
> port->memwin_base, port->memwin_size);
> --
> 1.9.2
>
next prev parent reply other threads:[~2014-04-21 16:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-18 12:19 [PATCH 0/7] Fixes for Armada 370/XP PCIe Thomas Petazzoni
2014-04-18 12:19 ` [PATCH 1/7] irqchip: armada-370-xp: fix invalid cast of signed value into unsigned variable Thomas Petazzoni
2014-04-18 12:19 ` [PATCH 2/7] irqchip: armada-370-xp: implement the ->check_device() msi_chip operation Thomas Petazzoni
2014-04-18 12:19 ` [PATCH 3/7] irqchip: armada-370-xp: Fix releasing of MSIs Thomas Petazzoni
2014-04-18 12:19 ` [PATCH 4/7] pci: mvebu: fix off-by-one in the computed size of the mbus windows Thomas Petazzoni
2014-04-21 16:47 ` Bjorn Helgaas [this message]
2014-04-24 2:51 ` Jason Cooper
2014-04-18 12:19 ` [PATCH 5/7] bus: mvebu-mbus: Avoid setting an undefined window size Thomas Petazzoni
2014-04-18 12:19 ` [PATCH 6/7] bus: mvebu-mbus: allow several windows with the same target/attribute Thomas Petazzoni
2014-04-18 12:19 ` [PATCH 7/7] pci: pci-mvebu: split PCIe BARs into multiple MBus windows when needed Thomas Petazzoni
2014-04-21 16:48 ` Bjorn Helgaas
2014-04-20 19:11 ` [PATCH 0/7] Fixes for Armada 370/XP PCIe Jason Cooper
2014-04-20 20:04 ` Jason Cooper
2014-04-20 21:08 ` Thomas Petazzoni
2014-04-20 21:21 ` Jason Cooper
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=20140421164754.GA17260@google.com \
--to=bhelgaas@google.com \
--cc=linux-arm-kernel@lists.infradead.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).