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 + */ + +/ { + pflash { + compatible = "cfi-flash"; + reg = <(0x100000000 - CONFIG_ROM_SIZE) CONFIG_ROM_SIZE>; + bank-width = <1>; + }; +}; diff --git a/arch/x86/dts/qemu-x86_i440fx.dts b/arch/x86/dts/qemu-x86_i440fx.dts index 3bb2f121de3..7f9ff6b1cfb 100644 --- a/arch/x86/dts/qemu-x86_i440fx.dts +++ b/arch/x86/dts/qemu-x86_i440fx.dts @@ -15,6 +15,7 @@ #include "tsc_timer.dtsi" #include "smbios.dtsi" +#include "pflash.dtsi" / { model = "QEMU x86 (I440FX)"; diff --git a/arch/x86/dts/qemu-x86_q35.dts b/arch/x86/dts/qemu-x86_q35.dts index 63931cd6dd9..24c93c45677 100644 --- a/arch/x86/dts/qemu-x86_q35.dts +++ b/arch/x86/dts/qemu-x86_q35.dts @@ -25,6 +25,7 @@ #include "tsc_timer.dtsi" #include "smbios.dtsi" +#include "pflash.dtsi" / { model = "QEMU x86 (Q35)"; -- 2.54.0
