qemu-patch-raspberry4/hw
Greg Kurz d9c95c71ac spapr_drc: Allow FDT fragment to be added later
The current logic is to provide the FDT fragment when attaching a device
to a DRC. This works perfectly fine for our current hotplug support, but
soon we will add support for PHB hotplug which has some constraints, that
CPU, PCI and LMB devices don't seem to have.

The first constraint is that the "ibm,dma-window" property of the PHB
node requires the IOMMU to be configured, ie, spapr_tce_table_enable()
has been called, which happens during PHB reset. It is okay in the case
of hotplug since the device is reset before the hotplug handler is
called. On the contrary with coldplug, the hotplug handler is called
first and device is only reset during the initial system reset. Trying
to create the FDT fragment on the hotplug path in this case, would
result in somthing like this:

ibm,dma-window = < 0x80000000 0x00 0x00 0x00 0x00 >;

This will cause linux in the guest to panic, by simply removing and
re-adding the PHB using the drmgr command:

	page = alloc_pages_node(nid, GFP_KERNEL, get_order(sz));
	if (!page)
		panic("iommu_init_table: Can't allocate %ld bytes\n", sz);

The second and maybe more problematic constraint is that the
"interrupt-map" property needs to reference the interrupt controller
node using the very same phandle that SLOF has already exposed to the
guest. QEMU requires SLOF to call the private KVMPPC_H_UPDATE_DT hcall
at some point to know about this phandle. With the latest QEMU and SLOF,
this happens when SLOF gets quiesced. This means that if the PHB gets
hotplugged after CAS but before SLOF quiesce, then we're sure that the
phandle is not known when the hotplug handler is called.

The FDT is only needed when the guest first invokes RTAS to configure
the connector actually, long after SLOF quiesce. Let's postpone the
creation of FDT fragments for PHBs to rtas_ibm_configure_connector().

Since we only need this for PHBs, introduce a new method in the base
DRC class for that. DRC subtypes will be converted to use it in
subsequent patches.

Allow spapr_drc_attach() to be passed a NULL fdt argument if the method
is available. When all DRC subtypes have been converted, the fdt argument
will eventually disappear.

Signed-off-by: Greg Kurz <groug@kaod.org>
Message-Id: <155059665823.1466090.18358845122627355537.stgit@bahia.lab.toulouse-stg.fr.ibm.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2019-02-26 09:21:25 +11:00
..
9pfs xen: re-name XenDevice to XenLegacyDevice... 2019-01-14 13:45:40 +00:00
acpi qdev: pass an Object * to qbus_set_hotplug_handler() 2019-02-17 21:54:02 +11:00
adc Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
alpha hw/alpha/Makefile.objs: Create CONFIG_* for alpha 2019-02-05 16:50:20 +01:00
arm hw/arm/armsse: Make 0x5... alias region work for per-CPU devices 2019-02-21 18:17:48 +00:00
audio audio: fix pc speaker init 2019-01-24 13:10:19 +01:00
block virtio-blk: set correct config size for the host driver 2019-02-13 16:18:17 +08:00
bt char: allow specifying a GMainContext at opening time 2019-02-13 14:23:39 +01:00
char hw/char/pl011: Use '0x' prefix when logging hex numbers 2019-02-21 18:17:46 +00:00
core qdev: pass an Object * to qbus_set_hotplug_handler() 2019-02-17 21:54:02 +11:00
cpu hw/cpu/cluster: Mark the cpu-cluster device with user_creatable = false 2019-02-06 15:55:56 +01:00
cris hw/cris/Makefile.objs: Create CONFIG_* for cris 2019-02-05 16:50:20 +01:00
display vga: bugfixes and edid support for virtio-vga 2019-02-25 12:49:07 +00:00
dma hw/dma/i8257: Use qemu_log_mask(UNIMP) instead of fprintf 2019-02-14 11:46:30 +01:00
gpio trace: enforce that every trace-events file has a final newline 2019-01-24 14:16:56 +00:00
hppa hw/hppa/dino: mask out lower 2 bits of PCI config addr 2019-02-21 10:16:19 -08:00
hyperv hw/hyperv: fix NULL dereference with pure-kvm SynIC 2018-11-26 14:14:38 -02:00
i2c hw/i2c/Makefile.objs: Create new CONFIG_* variables for EEPROM and ACPI controller 2019-02-05 16:50:21 +01:00
i386 * cpu-exec fixes (Emilio, Laurent) 2019-02-05 19:39:22 +00:00
ide ide: split ioport registration to a separate file 2019-02-05 16:50:19 +01:00
input pckbd: Convert DPRINTF->trace 2019-02-14 11:46:30 +01:00
intc target/ppc: Add POWER9 external interrupt model 2019-02-26 09:21:24 +11:00
ipack hw/ipack: Use the IEC binary prefix definitions 2018-07-02 15:41:12 +02:00
ipmi ipmi: Use proper struct reference for BT vmstate 2018-08-23 18:46:25 +02:00
isa char: allow specifying a GMainContext at opening time 2019-02-13 14:23:39 +01:00
lm32 hw/lm32/Makefile.objs: Conditionally build lm32 and milkmyst 2019-02-05 16:50:20 +01:00
m68k hw/m68k/Makefile.objs: Conditionally build boards 2019-02-05 16:50:19 +01:00
mem memory-device: rewrite address assignment using ranges 2019-01-09 22:09:31 -02:00
microblaze hw/microblaze/Makefile.objs: Create configs for petalogix and xilinx boards 2019-02-05 16:50:19 +01:00
mips target/mips: fulong2e: Dynamically generate SPD EEPROM data 2019-02-21 19:36:47 +01:00
misc MIPS queue for February 21st, 2019, v2 2019-02-22 11:26:17 +00:00
moxie hw/moxie/Makefile.objs: Conditionally build moxie 2019-02-05 16:50:20 +01:00
net hw/pci-host/Makefile.objs: make CONFIGS clear for PCI EXPRESS 2019-02-05 16:50:19 +01:00
nios2 hw/nios2/Makefile.objs: Conditionally build nios2 2019-02-05 16:50:20 +01:00
nvram fw_cfg: fix the life cycle and the name of "qemu_extra_params_fw" 2019-02-05 10:58:33 -05:00
openrisc hw/openrisc/Makefile.objs: Create CONFIG_* for openrisc 2019-02-05 16:50:21 +01:00
pci qdev: pass an Object * to qbus_set_hotplug_handler() 2019-02-17 21:54:02 +11:00
pci-bridge pci/shpc: perform unplug via the hotplug handler 2018-12-20 11:19:12 -05:00
pci-host hw/pci-host/bonito.c: Add PCI mem region mapped at the correct address 2019-02-21 19:36:47 +01:00
pcmcia hw: Clean up includes 2016-01-29 15:07:25 +00:00
ppc spapr_drc: Allow FDT fragment to be added later 2019-02-26 09:21:25 +11:00
rdma hw/rdma: modify struct initialization 2019-01-19 11:01:33 +02:00
riscv riscv: Ensure the kernel start address is correctly cast 2019-02-11 15:56:22 -08:00
s390x ppc patch queue 2019-02-19 2019-02-18 16:20:13 +00:00
scsi qdev: pass an Object * to qbus_set_hotplug_handler() 2019-02-17 21:54:02 +11:00
sd hw: sd: set category of the sd memory card 2019-01-30 10:24:20 +01:00
sh4 * cpu-exec fixes (Emilio, Laurent) 2019-02-05 19:39:22 +00:00
smbios hw/smbios: Move to the hw/firmware/ subdirectory 2018-12-19 16:48:16 -05:00
sparc qemu-sparc queue 2019-02-07 16:49:30 +00:00
sparc64 hw/sparc64: Explicitly set default_display = "std" 2019-02-14 11:46:30 +01:00
ssi aspeed/smc: snoop SPI transfers to fake dummy cycles 2019-01-29 11:46:05 +00:00
timer hw/timer/pl031: Convert to using trace events 2019-02-21 18:17:46 +00:00
tpm tpm: clear RAM when "memory overwrite" requested 2019-01-17 21:10:57 -05:00
tricore hw/tricore/Makefile.objs: Create CONFIG_* for tricore 2019-02-05 16:50:21 +01:00
unicore32 hw/unicore32/puv3: Drop useless inclusion of "hw/i386/pc.h" 2019-02-06 15:54:12 +01:00
usb usb: remove unnecessary NULL device check from usb_ep_get() 2019-02-20 09:41:23 +01:00
vfio hw/vfio/common: Refactor container initialization 2019-02-21 21:07:03 -07:00
virtio hw/virtio: Use CONFIG_VIRTIO_PCI switch instead of CONFIG_PCI 2019-02-05 10:58:33 -05:00
watchdog hw/watchdog/wdt_i6300esb: remove a unnecessary comment 2019-01-11 15:46:55 +01:00
xen xen: fix xen-bus state model to allow frontend re-connection 2019-02-04 11:04:49 +00:00
xenpv xen: Replace few mentions of xend by libxl 2019-01-14 13:45:40 +00:00
xtensa hw/xtensa/Makefile.objs: Build xtensa_sim and xtensa_fpga conditionally 2019-02-05 16:50:20 +01:00
Makefile.objs hw/vfio/Makefile.objs: Create new CONFIG_* variables for VFIO core and PCI 2019-02-05 16:50:21 +01:00