From: jgunthorpe@obsidianresearch.com (Jason Gunthorpe)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2] bus: mvebu-mbus: Avoid setting an undefined window size
Date: Wed, 9 Apr 2014 10:20:40 -0600 [thread overview]
Message-ID: <20140409162040.GA19743@obsidianresearch.com> (raw)
In-Reply-To: <20140409061128.GC16465@1wt.eu>
On Wed, Apr 09, 2014 at 08:11:29AM +0200, Willy Tarreau wrote:
> OK I just got it by adding two printk() in pci-mvebu.c. Both functions
> mvebu_pcie_handle_iobase_change() and mvebu_pcie_handle_membase_change()
> do pass a size which is in fact a mask (size - 1) and not the real size.
> So the mbus is fed with an incorrect size which is off by one :
Yes, that is right. I tested my patch here and didn't see any problem,
but I realize now that the mbus code is bailing early due to this:
kernel: mvebu_mbus: cannot add window '4:e8', conflicts with another window
Which I've never got around to fixing.. (whole other story there)
Your patch looks fine, and it obviously needs to be sequenced before
mine. (Thomas/Jason C: how do you want to do this?)
Reviewed-By: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
> From de000611015c7490a07ced6e36bfffbfdd136832 Mon Sep 17 00:00:00 2001
> From: Willy Tarreau <w@1wt.eu>
> Date: Wed, 9 Apr 2014 08:05:09 +0200
> Subject: pci: mvebu: fix off-by-one in the computed size of the mbus windows
>
> mvebu_pcie_handle_membase_change() and mvebu_pcie_handle_iobase_change()
> compute a window size which is in fact a mask. This size is fed to
> mvebu_mbus_add_window_by_id() which itself subtracts 1 to get the
> mask. So clearly the two functions above are wrong.
Mask isn't the right word, maybe:
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.
Regards,
Jason
next prev parent reply other threads:[~2014-04-09 16:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-04-08 23:44 [PATCH v2] bus: mvebu-mbus: Avoid setting an undefined window size Jason Gunthorpe
2014-04-09 6:11 ` Willy Tarreau
2014-04-09 7:12 ` Thomas Petazzoni
2014-04-09 7:47 ` Willy Tarreau
2014-04-09 7:53 ` Thomas Petazzoni
2014-04-09 7:56 ` Willy Tarreau
2014-04-09 16:30 ` Jason Gunthorpe
2014-04-09 16:20 ` Jason Gunthorpe [this message]
2014-04-10 6:35 ` Willy Tarreau
2014-04-10 6:53 ` Thomas Petazzoni
2014-04-10 11:59 ` 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=20140409162040.GA19743@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.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).