From: Laszlo Ersek <lersek@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Jordan Justen (Intel address)" <jordan.l.justen@intel.com>,
crobinso@redhat.com, edk2-devel@lists.sourceforge.net,
Markus Armbruster <armbru@redhat.com>,
qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [edk2] [qemu PATCH] hw/i386/pc_sysfw: support more than one flash drive
Date: Tue, 26 Nov 2013 14:53:21 +0100 [thread overview]
Message-ID: <5294A7D1.1000501@redhat.com> (raw)
In-Reply-To: <5294A4F0.1020608@redhat.com>
On 11/26/13 14:41, Paolo Bonzini wrote:
> Il 25/11/2013 20:45, Laszlo Ersek ha scritto:
>> From looking at "hw/block/pflash_cfi01.c", it seems that the guest can
>> interrogate the flash device about its size (nb_blocs is stored in
>> cfi_table starting at 0x2D, and cfi_table can be queried by command 0x98
>> in pflash_read()). So, if the guest cares, it can figure out that there
>> are multiple devices backing the range. I think.
>
> IIUC in the case of OVMF the guest "just knows" that there are multiple
> devices backing the range. Is that right?
No, the guest (the flash driver) is unaware of that. It could know if it
wanted to, but it doesn't care. It cares about a base address and a
size, and that range is subdivided into various roles. But how many
flash devices back the range is not interesting for the driver.
Jordan wrote the driver with one flash device in mind, and when I split
the image in two parts, I took care to map them so that the base
address, the size, and those boundaries stay the same. It's sufficient
for the driver to continue working.
> But yes, I think that the guest can figure out that there are multiple
> devices backing the range. From reading the pflash code further:
>
> * the pflash device doesn't care about the location where you write the
> command (the exception is the "block erase" command)
>
> * the pflash device only cares about the LSB you read from when you read
> data from it
>
> So you can use the last 256 bytes of the first flash (you know it ends
> at 4GB) to check for the device (there's probably some suggested
> protocol to do that, I don't know) and query its size. Example with
> "-qtest stdio":
>
> writeb 0xffffff00 0x98
> OK
> readb 0xfffffff2d
> OK 0x000000000000001f
> readb 0xfffffff2e
> OK 0x0000000000000000
> readb 0xfffffff2f
> OK 0x0000000000000010
> readb 0xfffffff30
> OK 0x0000000000000000
> writeb 0xffffff00 0x98
> OK
>
> This means the device has 31+1 blocks each 4KB in size. You can then
> query the next device at 4GB-128KB-256, and so on.
Thanks for testing this in practice.
Laszlo
next prev parent reply other threads:[~2013-11-26 13:53 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-21 22:21 [Qemu-devel] [qemu PATCH] hw/i386/pc_sysfw: support more than one flash drive Laszlo Ersek
2013-11-21 22:21 ` [Qemu-devel] [edk2 PATCH] OvmfPkg: split the variable store to a separate file Laszlo Ersek
2013-11-22 9:27 ` [Qemu-devel] [edk2] " Paolo Bonzini
2013-11-22 11:46 ` Laszlo Ersek
2013-11-22 11:56 ` Paolo Bonzini
2013-11-22 12:12 ` Laszlo Ersek
2013-11-22 17:37 ` [Qemu-devel] " Jordan Justen
2013-11-22 18:43 ` Laszlo Ersek
2013-11-22 20:51 ` Jordan Justen
2013-11-22 20:54 ` Eric Blake
2013-11-22 21:18 ` Jordan Justen
2013-11-22 21:40 ` Laszlo Ersek
2013-11-22 21:45 ` Laszlo Ersek
2013-11-21 22:26 ` [Qemu-devel] [qemu PATCH] hw/i386/pc_sysfw: support more than one flash drive Eric Blake
2013-11-21 22:33 ` Laszlo Ersek
2013-11-22 12:21 ` Markus Armbruster
2013-11-22 18:30 ` Laszlo Ersek
2013-11-25 15:22 ` Markus Armbruster
2013-11-25 19:45 ` Laszlo Ersek
2013-11-26 12:36 ` Markus Armbruster
2013-11-26 13:32 ` Laszlo Ersek
2013-11-26 17:54 ` Jordan Justen
2013-11-27 13:52 ` Markus Armbruster
2013-11-27 14:01 ` Laszlo Ersek
2013-11-27 14:45 ` Markus Armbruster
2013-11-27 15:18 ` Laszlo Ersek
2013-11-27 17:22 ` Markus Armbruster
2013-11-27 17:34 ` Laszlo Ersek
2013-11-27 20:35 ` Markus Armbruster
2013-11-26 13:41 ` [Qemu-devel] [edk2] " Paolo Bonzini
2013-11-26 13:53 ` Laszlo Ersek [this message]
2013-11-26 14:06 ` Paolo Bonzini
2013-11-26 12:53 ` [Qemu-devel] " Markus Armbruster
2013-11-26 13:27 ` Laszlo Ersek
2013-11-27 13:49 ` Markus Armbruster
2013-11-27 14:01 ` Laszlo Ersek
2013-11-25 15:32 ` Markus Armbruster
2013-11-25 20:17 ` Laszlo Ersek
2013-11-26 13:11 ` Markus Armbruster
2013-11-26 13:39 ` Laszlo Ersek
2013-11-26 15:35 ` Markus Armbruster
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=5294A7D1.1000501@redhat.com \
--to=lersek@redhat.com \
--cc=armbru@redhat.com \
--cc=crobinso@redhat.com \
--cc=edk2-devel@lists.sourceforge.net \
--cc=jordan.l.justen@intel.com \
--cc=pbonzini@redhat.com \
--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).