qemu-e2k/hw
Daniel Henrique Barboza 7a87ba8956 hw/riscv/virt.c: do create_fdt() earlier, add finalize_fdt()
Commit 49554856f0 fixed a problem, where TPM devices were not appearing
in the FDT, by delaying the FDT creation up until virt_machine_done().
This create a side effect (see gitlab #1925) - devices that need access
to the '/chosen' FDT node during realize() stopped working because, at
that point, we don't have a FDT.

This happens because our FDT creation is monolithic, but it doesn't need
to be. We can add the needed FDT components for realize() time and, at
the same time, do another FDT round where we account for dynamic sysbus
devices.  In other words, the problem fixed by 49554856f0 could also be
fixed by postponing only create_fdt_sockets() and its dependencies,
leaving everything else from create_fdt() to be done during init().

Split the FDT creation in two parts:

- create_fdt(), now moved back to virt_machine_init(), will create FDT
  nodes that doesn't depend on additional (dynamic) devices from the
  sysbus;

- a new finalize_fdt() step is added, where create_fdt_sockets() and
  friends is executed, accounting for the dynamic sysbus devices that
  were added during realize().

This will make both use cases happy: TPM devices are still working as
intended, and devices such as 'guest-loader' have a FDT to work on
during realize().

Fixes: 49554856f0 ("riscv: Generate devicetree only after machine initialization is complete")
Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1925
Signed-off-by: Daniel Henrique Barboza <dbarboza@ventanamicro.com>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-ID: <20231110172559.73209-1-dbarboza@ventanamicro.com>
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2023-11-22 13:55:07 +10:00
..
9pfs migration: simplify blockers 2023-10-20 08:51:41 +02:00
acpi virtio,pc,pci: features, cleanups 2023-10-23 14:45:29 -07:00
adc meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
alpha hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
arm hw/arm/fsl-imx: Do not ignore Error argument 2023-11-20 15:34:19 +00:00
audio hw/audio/virtio-snd.c: spelling: initalize 2023-11-15 11:09:17 +03:00
avr Remove qemu-common.h include from most units 2022-04-06 14:31:55 +02:00
block hw/xen: clean up xen_block_find_free_vdev() to avoid Coverity false positive 2023-11-21 11:45:06 +00:00
char hw/xen: add support for Xen primary console in emulated mode 2023-11-07 08:54:20 +00:00
core igb: Add Function Level Reset to PF and VF 2023-11-13 15:33:37 +08:00
cpu hw/other: spelling fixes 2023-09-21 11:31:16 +03:00
cris Do not include exec/address-spaces.h if it's not really necessary 2021-05-02 17:24:51 +02:00
cxl hw/cxl: spelling fixes: limitaions, potentialy, intialized 2023-11-15 11:09:17 +03:00
display hw/display/vmware_vga: fix probably typo 2023-11-13 16:56:24 +01:00
dma hw/dma: Declare link using static DEFINE_PROP_LINK() macro 2023-10-19 23:13:28 +02:00
gpio hw/gpio/nrf51: implement DETECT signal 2023-08-22 17:30:59 +01:00
hppa hw/core/machine: Constify MachineClass::valid_cpu_types[] 2023-11-20 15:30:59 +00:00
hyperv vfio queue: 2023-11-07 09:41:52 +08:00
i2c hw/i2c: pmbus: reset page register for out of range reads 2023-11-07 13:08:49 +01:00
i386 hw/i386/pc: Use qdev_prop_set_array() 2023-11-10 18:19:07 +01:00
ide hw/ide/via: implement legacy/native mode switching 2023-11-21 12:45:21 +01:00
input target-arm queue: 2023-11-03 10:04:12 +08:00
intc hw/intc/arm_gicv3: ICC_PMR_EL1 high bits should be RAZ 2023-11-20 15:11:35 +00:00
ipack meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
ipmi hw/ipmi: Don't call vmstate_register() from instance_init() functions 2023-11-01 16:13:58 +01:00
isa hw/isa/i82378: Propagate error if PC_SPEAKER device creation failed 2023-11-07 13:08:48 +01:00
loongarch hw/acpi: Realize ACPI_GED sysbus device before accessing it 2023-10-19 23:13:28 +02:00
m68k hw/core/machine: Constify MachineClass::valid_cpu_types[] 2023-11-20 15:30:59 +00:00
mem hw/mem/memory-device.c: spelling fix: ontaining 2023-11-15 11:59:54 +03:00
microblaze hw/microblaze: Clean up local variable shadowing 2023-09-29 10:07:16 +02:00
mips hw/mips: LOONGSON3V depends on UNIMP device 2023-11-13 16:56:06 +01:00
misc hw/misc: Introduce AMD/Xilix Versal TRNG device 2023-11-02 14:42:03 +00:00
net net: Provide MemReentrancyGuard * to qemu_new_nic() 2023-11-21 15:42:34 +08:00
nios2 hw/nios2: Clean up local variable shadowing 2023-09-29 10:07:16 +02:00
nubus trace-events: Fix the name of the tracing.rst file 2023-09-08 13:08:51 +03:00
nvme hw/nvme: Clean up local variable shadowing in nvme_ns_init() 2023-09-29 10:07:20 +02:00
nvram migration: Use vmstate_register_any() for eeprom93xx 2023-11-01 16:13:58 +01:00
openrisc *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
pci hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
pci-bridge hw/pci-bridge/cxl_downstream: Set default link width and link speed 2023-11-07 03:39:11 -05:00
pci-host hw/pci-host/astro: Fix boot for C3700 machine 2023-11-13 09:21:32 -08:00
pcmcia hw/pcmcia/pxa2xx: Inline pxa2xx_pcmcia_init() 2023-10-27 12:48:57 +01:00
ppc ppc/pnv: Fix PNV I2C invalid status after reset 2023-11-21 08:39:58 +01:00
rdma hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port() 2023-10-21 15:00:22 +03:00
remote hw/pci: modify pci_setup_iommu() to set PCIIOMMUOps 2023-11-03 09:20:31 +01:00
riscv hw/riscv/virt.c: do create_fdt() earlier, add finalize_fdt() 2023-11-22 13:55:07 +10:00
rtc mc146818rtc: rtc_set_time(): initialize tm to zeroes 2023-11-06 15:00:27 +00:00
rx hw/rx/rx62n: Use qdev_prop_set_array() 2023-11-10 18:19:13 +01:00
s390x s390x/pci: only limit DMA aperture if vfio DMA limit reported 2023-11-13 11:35:47 +01:00
scsi cpr: relax vhost migration blockers 2023-11-01 16:13:59 +01:00
sd hw/sd: Declare QOM types using DEFINE_TYPES() macro 2023-11-07 13:08:49 +01:00
sensor hw/sensor: add ADM1266 device model 2023-11-07 13:08:49 +01:00
sh4 hw/other: spelling fixes 2023-09-21 11:31:16 +03:00
smbios hw/acpi: changes towards enabling -Wshadow=local 2023-09-29 10:07:18 +02:00
sparc other architectures: spelling fixes 2023-07-25 17:14:07 +03:00
sparc64 hw/sparc64/ebus: Access memory regions via pci_address_space_io() 2023-10-19 23:13:28 +02:00
ssi hw/ssi: ibex_spi_host: Clear the interrupt even if disabled 2023-11-07 11:06:02 +10:00
timer migration: Use vmstate_register_any() 2023-11-01 16:13:58 +01:00
tpm hw/tpm: spelling fixes 2023-09-20 07:54:34 +03:00
tricore hw/tricore: Log failing test in testdevice 2023-09-29 08:28:02 +02:00
ufs hw/ufs: Modify lu.c to share codes with SCSI subsystem 2023-10-30 10:28:04 +09:00
usb net: Provide MemReentrancyGuard * to qemu_new_nic() 2023-11-21 15:42:34 +08:00
vfio vfio/common: Move vfio_host_win_add/del into spapr.c 2023-11-06 13:23:23 +01:00
virtio virtio-mem: fix division by zero in virtio_mem_activate_memslots_to_plug() 2023-11-13 09:35:44 +01:00
watchdog hw/watchdog/wdt_aspeed: Remove unused 'hw/misc/aspeed_scu.h' header 2023-11-15 11:09:17 +03:00
xen hw/i386/pc: support '-nic' for xen-net-device 2023-11-07 08:54:20 +00:00
xenpv hw/xen: update Xen PV NIC to XenDevice model 2023-11-07 08:54:20 +00:00
xtensa trivial: Simplify the spots that use TARGET_BIG_ENDIAN as a numeric value 2023-09-08 13:08:52 +03:00
Kconfig hw/ufs: Initial commit for emulated Universal-Flash-Storage 2023-09-07 14:01:29 -04:00
meson.build hw/ufs: Initial commit for emulated Universal-Flash-Storage 2023-09-07 14:01:29 -04:00