qemu/hw
David Gibson 0cffce56ae hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState
The LMB DRC release callback, spapr_lmb_release(), uses an opaque
parameter, a sPAPRDIMMState struct that stores the current LMBs that
are allocated to a DIMM (nr_lmbs). After each call to this callback,
the nr_lmbs is decremented by one and, when it reaches zero, the callback
proceeds with the qdev calls to hot unplug the LMB.

Using drc->detach_cb_opaque is problematic because it can't be migrated in
the future DRC migration work. This patch makes the following changes to
eliminate the usage of this opaque callback inside spapr_lmb_release:

- sPAPRDIMMState was moved from spapr.c and added to spapr.h. A new
attribute called 'addr' was added to it. This is used as an unique
identifier to associate a sPAPRDIMMState to a PCDIMM element.

- sPAPRMachineState now hosts a new QTAILQ called 'pending_dimm_unplugs'.
This queue of sPAPRDIMMState elements will store the DIMM state of DIMMs
that are currently going under an unplug process.

- spapr_lmb_release() will now retrieve the nr_lmbs value by getting the
correspondent sPAPRDIMMState. A helper function called spapr_dimm_get_address
was created to fetch the address of a PCDIMM device inside spapr_lmb_release.
When nr_lmbs reaches zero and the callback proceeds with the qdev hot unplug
calls, the sPAPRDIMMState struct is removed from spapr->pending_dimm_unplugs.

After these changes, the opaque argument for spapr_lmb_release is now
unused and is passed as NULL inside spapr_del_lmbs. This and the other
opaque arguments can now be safely removed from the code.

As an additional cleanup made by this patch, the spapr_del_lmbs function
was merged with spapr_memory_unplug_request. The former was being called
only by the latter and both were small enough to fit one single function.

Signed-off-by: Daniel Henrique Barboza <danielhb@linux.vnet.ibm.com>
[dwg: Minor stylistic cleanups]
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-05-25 11:31:28 +10:00
..
9pfs migration/next for 20170517 2017-05-18 10:05:52 +01:00
acpi pci, virtio, vhost: fixes 2017-05-18 10:01:08 +01:00
adc STM32F2xx: Add the ADC device 2016-10-04 13:28:07 +01:00
alpha hw: Default -drive to if=ide explicitly where it works 2017-02-21 13:10:53 +01:00
arm pci, virtio, vhost: fixes 2017-05-18 10:01:08 +01:00
audio audio: Rename hw/audio/audio.h to hw/audio/soundhw.h 2017-05-19 10:48:54 +02:00
block pflash_cfi01: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
bt chardev: qom-ify 2017-01-27 18:08:00 +01:00
char s390x/3270: Mark non-migratable and enable the device 2017-05-04 10:34:37 +02:00
core migration/next for 20170517 2017-05-18 10:05:52 +01:00
cpu Introduce DEVICE_CATEGORY_CPU for CPU devices 2017-01-27 18:07:31 +01:00
cris cris: Fix broken header guard in hw/cris/boot.h 2016-07-12 16:20:46 +02:00
display migration: Create migration/blocker.h 2017-05-17 12:04:59 +02:00
dma qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
gpio qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
i2c qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
i386 migration: migration.h was not needed 2017-05-18 19:20:59 +02:00
ide allwinner-ahci: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
input qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
intc xics_kvm: cache already enabled vCPU ids 2017-05-24 11:39:52 +10:00
ipack ipack: Update e-mail address 2016-05-18 15:04:27 +03:00
ipmi ipmi: introduce an ipmi_bmc_gen_event() API 2017-04-26 12:41:55 +10:00
isa isabus-bridge: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
lm32 char: rename CharDriverState Chardev 2017-01-27 18:07:59 +01:00
m68k hw/m68k: QOMify the ColdFire interrupt controller 2017-02-18 22:23:31 +01:00
mem pc: memhp: enable nvdimm device hotplug 2016-11-01 19:21:09 +02:00
microblaze Remove reduntant qemu: from error functions 2017-05-07 09:57:51 +03:00
mips qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
misc migration/next for 20170517 2017-05-18 10:05:52 +01:00
moxie hw: explicitly include qemu-common.h and cpu.h 2016-03-22 22:20:17 +01:00
net e1000e: Fix ICR "Other" causes clear logic 2017-05-23 10:10:38 +08:00
nios2 Remove reduntant qemu: from error functions 2017-05-07 09:57:51 +03:00
nvram fw_cfg: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
openrisc target/openrisc: Support non-busy idle state using PMR SPR 2017-05-04 09:39:14 +09:00
pci pci: deassert intx when pci device unrealize 2017-05-18 00:35:15 +03:00
pci-bridge pci, virtio, vhost: fixes 2017-05-18 10:01:08 +01:00
pci-host qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
pcmcia hw: Clean up includes 2016-01-29 15:07:25 +00:00
ppc hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState 2017-05-25 11:31:28 +10:00
s390x s390-pcibus: No need to set user_creatable=false explicitly 2017-05-17 10:37:01 -03:00
scsi esp: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
sd generic-sdhci: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
sh4 qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
smbios stubs: move smbios stubs to hw/smbios 2017-01-16 17:52:35 +01:00
sparc tcx: switch to load_image_mr() and remove prom_addr hack 2017-04-21 09:02:04 +01:00
sparc64 sparc/sparc64: grab BQL before calling cpu_check_irqs 2017-03-09 10:41:38 +00:00
ssi aspeed/smc: use a modulo to check segment limits 2017-02-10 17:40:30 +00:00
timer hpet: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
tpm clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
tricore Remove reduntant qemu: from error functions 2017-05-07 09:57:51 +03:00
unicore32 clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
usb sysbus-ohci: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
vfio sysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE 2017-05-17 10:37:01 -03:00
virtio migration: migration.h was not needed 2017-05-18 19:20:59 +02:00
watchdog wdt: Add Aspeed watchdog device model 2017-02-07 18:29:59 +00:00
xen xen-sysdev: Remove user_creatable flag 2017-05-17 10:37:01 -03:00
xenpv xenpv: Fix qemu_uuid compiling error 2016-09-29 11:43:17 +08:00
xtensa target/xtensa: xtfpga: load DTB only when FDT support is enabled 2017-03-11 14:59:03 -08:00
Makefile.objs acpi: filter based on CONFIG_ACPI_X86 rather than TARGET 2017-01-16 17:52:35 +01:00