Re: [PATCH 1/3] x86: qemu: Describe pflash
Simon Glass <[email protected]> Mon, 3 Aug 2026 13:25:21 -0600
| Newsgroups | gmane.comp.boot-loaders.u-boot |
|---|---|
| Message-ID | <CAFLszThAUP-wJb_J5aX=jA-Wr_HawkUQvaAa1GVwSt+150FbNg@mail.gmail.com> |
Hi Elliot, On 2026-07-30T19:37:45, Elliot Berman <[email protected]> wrote: > x86: qemu: Describe pflash > > QEMU pflash is mapped just below 4GiB. Describe it as a cfi-flash > node so the MTD subsystem can probe it. When a flash device is not > exposed to the guest by QEMU, the address is still backed by ROM, so > we'll just see no flash found rather than faulting. > > Signed-off-by: Elliot Berman <[email protected]> > > arch/x86/dts/pflash.dtsi | 14 ++++++++++++++ > arch/x86/dts/qemu-x86_i440fx.dts | 1 + > arch/x86/dts/qemu-x86_q35.dts | 1 + > 3 files changed, 16 insertions(+) > diff --git a/arch/x86/dts/pflash.dtsi b/arch/x86/dts/pflash.dtsi > new file mode 100644 > index 00000000000..ce69bcc6865 > --- /dev/null > +++ b/arch/x86/dts/pflash.dtsi > @@ -0,0 +1,14 @@ > +// SPDX-License-Identifier: GPL-2.0+ > +/* > + * QEMU pflash (CFI NOR) mapped just below 4GiB. QEMU aligns the pflash so > + * that it ends at the top of the 32-bit address space. > + * https://gitlab.com/qemu-project/qemu/-/blob/e1705a25aff35635c360bbaba4c2731d019a422a/hw/i386/pc_sysfw.c#L128 > + */ The link pins a QEMU commit hash which might go away. Please point at a stable ref (a release tag, or just hw/i386/pc_sysfw.c on -master). > diff --git a/arch/x86/dts/pflash.dtsi b/arch/x86/dts/pflash.dtsi > @@ -0,0 +1,14 @@ > +/ { > + pflash { > + compatible = "cfi-flash"; > + reg = <(0x100000000 - CONFIG_ROM_SIZE) CONFIG_ROM_SIZE>; > + bank-width = <1>; > + }; > +}; The convention would be to name it flash@<addr> - but in this case the address varies, so what you have seems fine. This ties the pflash window to CONFIG_ROM_SIZE, but the two aren't the same thing - CONFIG_ROM_SIZE is what U-Boot builds itself for, whereas QEMU's pflash1 window size is the size of the file passed to -pflash. If a user runs QEMU with a pflash image whose size differs from CONFIG_ROM_SIZE the reg will be wrong. Please call this out in the comment, or better, drive it from a dedicated symbol whose name reflects the pflash size. Regards, Simon