From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
qemu-block@nongnu.org, Laszlo Ersek <lersek@redhat.com>,
"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Alistair Francis <alistair.francis@wdc.com>,
John Snow <jsnow@redhat.com>,
Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH-for-4.1 v7 1/1] hw/block/pflash_cfi01: Add missing DeviceReset() handler
Date: Mon, 22 Jul 2019 18:55:51 +0200 [thread overview]
Message-ID: <0d848010-5f3d-c6ee-86a8-d4b501863048@redhat.com> (raw)
In-Reply-To: <20190718104837.13905-2-philmd@redhat.com>
On 7/18/19 12:48 PM, Philippe Mathieu-Daudé wrote:
> To avoid incoherent states when the machine resets (see but report
> below), add the device reset callback.
>
> A "system reset" sets the device state machine in READ_ARRAY mode
> and, after some delay, set the SR.7 READY bit.
>
> Since we do not model timings, we set the SR.7 bit directly.
>
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1678713
> Reported-by: Laszlo Ersek <lersek@redhat.com>
> Reviewed-by: John Snow <jsnow@redhat.com>
> Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> ---
> hw/block/pflash_cfi01.c | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/hw/block/pflash_cfi01.c b/hw/block/pflash_cfi01.c
> index 435be1e35c..a1ec1faae5 100644
> --- a/hw/block/pflash_cfi01.c
> +++ b/hw/block/pflash_cfi01.c
> @@ -865,6 +865,24 @@ static void pflash_cfi01_realize(DeviceState *dev, Error **errp)
> pfl->cfi_table[0x3f] = 0x01; /* Number of protection fields */
> }
>
> +static void pflash_cfi01_system_reset(DeviceState *dev)
> +{
> + PFlashCFI01 *pfl = PFLASH_CFI01(dev);
> +
> + /*
> + * The command 0x00 is not assigned by the CFI open standard,
> + * but QEMU historically uses it for the READ_ARRAY command (0xff).
> + */
> + pfl->cmd = 0x00;
> + pfl->wcycle = 0;
> + memory_region_rom_device_set_romd(&pfl->mem, true);
> + /*
> + * The WSM ready timer occurs at most 150ns after system reset.
> + * This model deliberately ignores this delay.
> + */
> + pfl->status = 0x80;
> +}
> +
> static Property pflash_cfi01_properties[] = {
> DEFINE_PROP_DRIVE("drive", PFlashCFI01, blk),
> /* num-blocks is the number of blocks actually visible to the guest,
> @@ -909,6 +927,7 @@ static void pflash_cfi01_class_init(ObjectClass *klass, void *data)
> {
> DeviceClass *dc = DEVICE_CLASS(klass);
>
> + dc->reset = pflash_cfi01_system_reset;
> dc->realize = pflash_cfi01_realize;
> dc->props = pflash_cfi01_properties;
> dc->vmsd = &vmstate_pflash;
>
Queued to pflash/next, thanks.
prev parent reply other threads:[~2019-07-22 16:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-18 10:48 [Qemu-devel] [PATCH-for-4.1 v7 0/1] hw/block/pflash_cfi01: Add DeviceReset() handler Philippe Mathieu-Daudé
2019-07-18 10:48 ` [Qemu-devel] [PATCH-for-4.1 v7 1/1] hw/block/pflash_cfi01: Add missing " Philippe Mathieu-Daudé
2019-07-18 15:03 ` Laszlo Ersek
2019-07-18 18:38 ` Laszlo Ersek
2019-07-18 19:35 ` Philippe Mathieu-Daudé
2019-07-19 16:19 ` Philippe Mathieu-Daudé
2019-07-22 16:51 ` Laszlo Ersek
2019-07-22 16:55 ` Philippe Mathieu-Daudé
2019-07-22 17:12 ` Peter Maydell
2019-07-23 7:38 ` Laszlo Ersek
2019-07-22 16:55 ` Philippe Mathieu-Daudé [this message]
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=0d848010-5f3d-c6ee-86a8-d4b501863048@redhat.com \
--to=philmd@redhat.com \
--cc=alistair.francis@wdc.com \
--cc=armbru@redhat.com \
--cc=dgilbert@redhat.com \
--cc=jsnow@redhat.com \
--cc=kwolf@redhat.com \
--cc=lersek@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 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).