qemu-e2k/include/hw
Markus Armbruster 06f1521795 pflash: Require backend size to match device, improve errors
We reject undersized backends with a rather enigmatic "failed to read
the initial flash content" error.  For instance:

    $ qemu-system-ppc64 -S -display none -M sam460ex -drive if=pflash,format=raw,file=eins.img
    qemu-system-ppc64: Initialization of device cfi.pflash02 failed: failed to read the initial flash content

We happily accept oversized images, ignoring their tail.  Throwing
away parts of firmware that way is pretty much certain to end in an
even more enigmatic failure to boot.

Require the backend's size to match the device's size exactly.  Report
mismatch like this:

    qemu-system-ppc64: Initialization of device cfi.pflash01 failed: device requires 1048576 bytes, block backend provides 512 bytes

Improve the error for actual read failures to "can't read block
backend".

To avoid duplicating even more code between the two pflash device
models, do all that in new helper blk_check_size_and_read_all().

The error reporting can still be confusing.  For instance:

    qemu-system-ppc64 -S -display none -M taihu -drive if=pflash,format=raw,file=eins.img  -drive if=pflash,unit=1,format=raw,file=zwei.img
    qemu-system-ppc64: Initialization of device cfi.pflash02 failed: device requires 2097152 bytes, block backend provides 512 bytes

Leaves the user guessing which of the two -drive is wrong.  Mention
the issue in a TODO comment.

Suggested-by: Alex Bennée <alex.bennee@linaro.org>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Message-Id: <20190319163551.32499-2-armbru@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
2019-03-26 08:16:24 +01:00
..
acpi i386, acpi: check acpi_memory_hotplug capacity in pre_plug 2019-03-12 22:31:21 -04:00
adc
arm hw/arm/virt: Dynamic memory map depending on RAM requirements 2019-03-05 15:55:09 +00:00
audio
block pflash: Require backend size to match device, improve errors 2019-03-26 08:16:24 +01:00
char hw/char/pl011: Support all interrupt lines 2019-02-21 18:17:46 +00:00
core
cpu qom/cpu: Add cluster_index to CPUState 2019-01-29 11:46:05 +00:00
cris
display hw/display/milkymist-tmu2: Move inlined code from header to source 2019-02-01 11:58:50 +01:00
dma
firmware hw/smbios: fix offset of type 3 sku field 2019-02-22 10:51:31 -05:00
gpio
hyperv
i2c i2c:smbus_slave: Add an SMBus vmstate structure 2019-02-27 21:06:08 -06:00
i386 intel_iommu: add scalable-mode option to make scalable mode work 2019-03-12 22:31:21 -04:00
ide hw/ide: drop iov field from IDEDMA 2019-02-22 09:42:13 +00:00
input
intc hw/intc/bcm2836_control: Implement local timer 2019-03-15 11:12:28 +00:00
ipack
ipmi
isa
kvm
lm32
m68k
mem nvdimm: Rename AcpiNVDIMMState into NVDIMMState 2019-03-11 10:44:21 -03:00
mips
misc hw/arm/armsse: Unify init-svtor and cpuwait handling 2019-02-28 11:03:04 +00:00
net
nvram hw/nvram/nrf51_nvm: Add nRF51 non-volatile memories 2019-02-01 15:31:26 +00:00
pci gen_pcie_root_port: Add ACS (Access Control Services) capability 2019-03-12 22:31:21 -04:00
pci-bridge
pci-host spapr: Use CamelCase properly 2019-03-12 14:33:05 +11:00
ppc spapr: Use CamelCase properly 2019-03-12 14:33:05 +11:00
rdma {hmp, hw/pvrdma}: Expose device internals via monitor interface 2019-03-16 15:52:44 +02:00
riscv
s390x target/s390x: Split out s390-tod.h 2019-02-18 11:25:43 +01:00
scsi
sd
sh4
sparc
ssi aspeed/smc: snoop SPI transfers to fake dummy cycles 2019-01-29 11:46:05 +00:00
timer hw/timer/pl031: Allow use as an embedded-struct device 2019-02-21 18:17:46 +00:00
tricore
unicore32
usb
vfio VFIO updates 2019-03-11 2019-03-12 13:37:29 +00:00
virtio virtio-gpu: delay virglrenderer reset when blocked. 2019-03-18 13:10:57 +01:00
watchdog hw/arm/stellaris: Implement watchdog timer 2019-03-05 15:55:09 +00:00
xen pvh: Add x86/HVM direct boot ABI header file 2019-02-05 16:50:16 +01:00
xtensa target/xtensa: add MX interrupt controller 2019-01-28 11:55:20 -08:00
boards.h machine: Move nvdimms state into struct MachineState 2019-03-11 10:44:25 -03:00
bt.h
devices.h hw/devices: Remove unused TC6393XB_RAM definition 2019-03-07 22:16:22 +01:00
elf_ops.h elf-ops.h: Add get_elf_note_type() 2019-02-05 16:50:16 +01:00
empty_slot.h
fw-path-provider.h
hotplug.h
hw.h
ide.h ide/via: Rename functions to match device name 2019-01-25 14:52:12 -05:00
irq.h
loader-fit.h
loader.h elf: Add optional function ptr to load_elf() to parse ELF notes 2019-02-05 16:50:16 +01:00
nmi.h
or-irq.h
pcmcia.h
platform-bus.h
ptimer.h
qdev-core.h qom: Move compat_props machinery from qdev to QOM 2019-03-11 22:53:44 +01:00
qdev-dma.h
qdev-properties.h
qdev.h
register.h
registerfields.h
stream.h
sysbus.h
usb.h