On 01/28/19 14:06, Peter Maydell wrote:
On Mon, 28 Jan 2019 at 12:40, Gerd Hoffmann <kraxel(a)redhat.com>
wrote:
> The tricky part is the access control here. On physical hardware you
> typically have one flash rom, say 16M below 4G (on x86).
>
> Our pflash device doesn't allow to define multiple regions, so we use
> multiple pflash devices instead, each with different access permissions
> (code vs. vars). Because of that they are more dynamic than they are on
> phyiscal hardware, x86 sizes them according to the size of the firmware
> images (arm is easier here, we have fixed size and location no matter
> how big the firmware images are).
>
> So I think the options we have are:
> (a) leave pflash as-is, which pretty much implies physaddr and size
> must be user-configurable.
> (b) add support for multiple regions to pflash, so one can attach
> multiple blockdev at different offsets to a single pflash device.
The latter makes more sense to me -- we should model what the
hardware actually has, because the guest can tell the difference.
Regarding OVMF, I kept the flash driver intentionally in the dark about
split vs. unified pflash, so OVMF will not care, as long as the same
GPAs behave the same as before.
Regarding ArmVirtQemu, I'm not so sure. It think it already depends on
two separate pflash chips, through the DTB that QEMU exposes. So
unifying the chips (albeit with multiple regions) might actually confuse
the firmware. I'm CC'ing Ard, he's done some work on the ARM NOR flash
driver recently, incl. updates to its usage in ArmVirtQemu:
*
https://github.com/tianocore/edk2/commit/5e27deed438b
[edk2] [PATCH v2 3/4]
ArmVirtPkg/NorFlashQemuLib: disregard our primary FV
*
https://github.com/tianocore/edk2/commit/51bb05c79595
[edk2] [PATCH v2 4/4]
ArmVirtPkg/QemuVirtMemInfoLib: trim the MMIO region mapping
Thanks
Laszlo
(Migration compat is left as an exercise for the reader :-))
thanks
-- PMM