public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Aaron Sierra <asierra@xes-inc.com>
To: Brian Norris <computersforpeace@gmail.com>
Cc: David Woodhouse <dwmw2@infradead.org>, linux-mtd@lists.infradead.org
Subject: Re: [PATCH 2/2] mtd: map_rom: Support UBI on ROM
Date: Wed, 17 Dec 2014 14:13:55 -0600 (CST)	[thread overview]
Message-ID: <173348604.130724.1418847235940.JavaMail.zimbra@xes-inc.com> (raw)
In-Reply-To: <20141217023344.GS9759@ld-irv-0074>

Brian, I have responses to your questions inline below.

----- Original Message -----
> From: "Brian Norris" <computersforpeace@gmail.com>
> Sent: Tuesday, December 16, 2014 8:33:44 PM
> 
> Hi Aaron,
> 
> I see this has been sitting around way too long...
> 
> On Thu, Sep 25, 2014 at 12:20:24PM -0500, Aaron Sierra wrote:
> > UBI needs to know the physical erase block size, even on read-only
> > devices, since it defines the on-device layout. Use a device-tree
> > provided value to support previously written UBI on read-only NOR.
> > 
> > UBI also needs a non-zero writebufsize, so we set it to one.
> 
> Hmm, this one is a pretty big bug IIRC (don't you get an OOPS or
> BUG()?). Do you think it might be worth splitting into a separate patch
> and sending to stable?

The following assumes an initially unpatched map_rom.c.

Attempting to ubiattach a ROM partition (/dev/mtd5) with the default
map_rom writebufsize set to zero, I get the following error in the kernel
log:

UBI: attaching mtd5 to ubi0
UBI error: io_init: bad write buffer size 0 for 1 min. I/O unit
ubiattach: error!: cannot attach "/dev/mtd5"
           error 22 (Invalid argument)

After assigning writebufsize to one and recompiling, attempting to
ubiattach without specifying an erase-size in the device-tree results
in the following error in the kernel log:

UBI: attaching mtd5 to ubi0
UBI: MTD device 5 is write-protected, attach in read-only mode
UBI: scanning is finished
UBI: empty MTD device detected
UBI error: ubi_early_get_peb: no free eraseblocks
UBI error: ubi_attach_mtd_dev: failed to attach mtd5, error -28
ubiattach: error!: cannot attach "/dev/mtd5"
           error 28 (No space left on device)

Neither of those errors are horrible, but both result in an inaccessible
read-only UBIFS.

> > 
> > Note: This was implemented because hardware write-protected CFI
> >       NOR cannot be probed for the physical erase block size.
> > 
> > Signed-off-by: Joe Schultz <jschultz@xes-inc.ccom>
> > Signed-off-by: Aaron Sierra <asierra@xes-inc.ccom>
> > ---
> >  Documentation/devicetree/bindings/mtd/mtd-physmap.txt |  5 +++++
> >  drivers/mtd/chips/map_rom.c                           | 13 ++++++++++++-
> >  2 files changed, 17 insertions(+), 1 deletion(-)
> > 

[ snip ]

> > +static unsigned int default_erasesize(struct map_info *map)
> > +{
> > +	const __be32 *erase_size = NULL;
> > +#ifdef CONFIG_OF
> > +	erase_size = of_get_property(map->device_node, "erase-size", NULL);
> > +#endif
> 
> I think you can just drop the #ifdef and have the same effect, no?

Yes, you are correct. I was being too cautious.

-Aaron

  parent reply	other threads:[~2014-12-17 20:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1683475520.65208.1411665491176.JavaMail.zimbra@xes-inc.com>
2014-09-25 17:20 ` [PATCH 2/2] mtd: map_rom: Support UBI on ROM Aaron Sierra
2014-12-17  2:33   ` Brian Norris
2014-12-17  9:37     ` Ricard Wanderlof
2014-12-17 16:04       ` Aaron Sierra
2014-12-17 20:13     ` Aaron Sierra [this message]
2015-01-10  7:31   ` Brian Norris

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=173348604.130724.1418847235940.JavaMail.zimbra@xes-inc.com \
    --to=asierra@xes-inc.com \
    --cc=computersforpeace@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-mtd@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