From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
To: Andrew Jones <drjones@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>,
David Engraf <david.engraf@sysgo.com>,
Kevin Wolf <kwolf@redhat.com>,
QEMU Developers <qemu-devel@nongnu.org>,
Qemu-block <qemu-block@nongnu.org>, Max Reitz <mreitz@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] pflash_cfi01: fix per device sector length in CFI table
Date: Mon, 16 Jan 2017 10:26:06 +0000 [thread overview]
Message-ID: <20170116102606.GB2136@work-vm> (raw)
In-Reply-To: <20170112113619.zuc5tuhmhzvawnmz@hawk.localdomain>
* Andrew Jones (drjones@redhat.com) wrote:
> On Thu, Jan 12, 2017 at 10:42:41AM +0000, Peter Maydell wrote:
> > On 12 January 2017 at 10:35, David Engraf <david.engraf@sysgo.com> wrote:
> > > The CFI entry for sector length must be set to sector length per device.
> > > This is important for boards using multiple devices like the ARM Vexpress
> > > board (width = 4, device-width = 2).
> > >
> > > Linux and u-boots calculate the size ratio by dividing both values:
> > >
> > > size_ratio = info->portwidth / info->chipwidth;
> > >
> > > After that the sector length will be multiplied by the size_ratio, thus the
> > > CFI entry for sector length is doubled. When Linux or u-boot send a sector
> > > erase, they expect to erase the doubled sector length, but QEMU only erases
> > > the board specified sector length.
> > >
> > > This patch fixes the sector length in the CFI table to match the length per
> > > device, equal to blocks_per_device.
> >
> > Thanks for the patch. I haven't checked against the pflash spec yet,
> > but this looks like it's probably the right thing.
> >
> > The only two machines which use a setup with multiple devices (ie
> > which specify device_width to the pflash_cfi01) are vexpress and virt.
> > For all other machines this patch leaves the behaviour unchanged.
> >
> > Q: do we need to have some kind of nasty hack so that pre-2.9 virt
> > still gets the old broken values in the CFI table, for version and
> > migration compatibility? Ccing Drew for an opinion...
> >
>
> I'm pretty sure we need the nasty hack, but I'm also Ccing David for
> his opinion.
Hmm I don't understand enough about pflash to understand the change here;
but generally if you need to keep something unchanged for older
machine types, add a property and then set that property in
the compatibility macros.
See include/hw/compat.h, I think you'd add the entry to HW_COMPAT_2_8
and follow a simple example like old_msi_addr on intel-hda.c,
that should get picked up by aarch, x86, ppc etc versioned machine types.
Dave
> Thanks,
> drew
--
Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK
next prev parent reply other threads:[~2017-01-16 10:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-12 10:35 [Qemu-devel] [PATCH] pflash_cfi01: fix per device sector length in CFI table David Engraf
2017-01-12 10:42 ` Peter Maydell
2017-01-12 11:36 ` Andrew Jones
2017-01-12 12:01 ` David Engraf
2017-01-16 10:26 ` Dr. David Alan Gilbert [this message]
2017-01-17 16:48 ` [Qemu-devel] [PATCH v2] " David Engraf
2017-01-27 14:31 ` [Qemu-devel] [PATCH] " Peter Maydell
2017-01-27 14:54 ` Peter Maydell
2017-01-27 15:13 ` Andrew Jones
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=20170116102606.GB2136@work-vm \
--to=dgilbert@redhat.com \
--cc=david.engraf@sysgo.com \
--cc=drjones@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.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.