qemu-e2k/hw/ppc
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
..
Makefile.objs ppc/pnv: add initial IPMI sensors for the BMC simulator 2017-04-26 12:41:56 +10:00
e500-ccsr.h ppc: do not use ../ in include files 2013-03-01 13:57:33 +01:00
e500.c target-ppc: Add MMU model check for booke machines 2017-02-02 09:30:06 +11:00
e500.h target-ppc: Eliminate redundant and incorrect function booke206_page_size_to_tlb 2016-07-01 09:57:01 +10:00
e500plat.c dma: do not depend on kvm_enabled() 2016-05-19 16:42:28 +02:00
fdt.c Move target-* CPU file into a target/ folder 2016-12-20 21:52:12 +01:00
mac.h Clean up ill-advised or unusual header guards 2016-07-12 16:20:46 +02:00
mac_newworld.c ppc: add qemu_vga.ndrv ROM to fw_cfg interface for NewWorld Macs 2017-05-11 09:45:15 +10:00
mac_oldworld.c ppc: add qemu_vga.ndrv ROM to fw_cfg interface for OldWorld Macs 2017-05-11 09:45:15 +10:00
mpc8544_guts.c hw: explicitly include qemu-common.h and cpu.h 2016-03-22 22:20:17 +01:00
mpc8544ds.c ppc: Clean up includes 2016-01-29 15:07:22 +00:00
pnv.c ppc patch queue for 2017-05-11 2017-05-15 14:00:15 +01:00
pnv_bmc.c ppc/pnv: generate an OEM SEL event on shutdown 2017-04-26 12:41:56 +10:00
pnv_core.c ppc/pnv: create the ICP object under PnvCore 2017-04-26 12:00:42 +10:00
pnv_lpc.c ppc/pnv: enable only one LPC bus 2017-04-26 12:41:55 +10:00
pnv_occ.c ppc/pnv: Add OCC model stub with interrupt support 2017-04-26 12:00:42 +10:00
pnv_psi.c ppc/pnv: Add cut down PSI bridge model and hookup external interrupt 2017-04-26 12:00:42 +10:00
pnv_xscom.c kvm: move cpu synchronization code 2017-01-19 22:07:46 +01:00
ppc.c tcg: drop global lock during TCG code execution 2017-02-24 10:32:45 +00:00
ppc4xx_devs.c qemu-common: push cpu.h inclusion out of qemu-common.h 2016-05-19 16:42:29 +02:00
ppc4xx_pci.c qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
ppc405.h Remove unused function declarations 2016-09-15 15:32:22 +03:00
ppc405_boards.c clean-up: removed duplicate #includes 2016-10-28 18:17:24 +03:00
ppc405_uc.c hw/ppc/ppc405_uc.c: Avoid integer overflows 2017-02-22 14:28:53 +11:00
ppc440_bamboo.c target-ppc: Add MMU model check for booke machines 2017-02-02 09:30:06 +11:00
ppc_booke.c ppc_booke: drop useless assignment 2017-05-07 09:57:51 +03:00
ppce500_spin.c hw/ppc: QOM'ify ppce500_spin.c 2017-01-31 10:10:13 +11:00
prep.c audio: Rename hw/audio/audio.h to hw/audio/soundhw.h 2017-05-19 10:48:54 +02:00
prep_systemio.c prep: add PReP System I/O 2017-01-31 10:10:13 +11:00
rs6000_mc.c prep: add IBM RS/6000 7020 (40p) memory controller 2017-01-31 10:10:13 +11:00
spapr.c hw/ppc/spapr.c: adding pending_dimm_unplugs to sPAPRMachineState 2017-05-25 11:31:28 +10:00
spapr_cpu_core.c spapr_cpu_core: drop reference on ICP object during CPU realization 2017-05-24 11:39:53 +10:00
spapr_drc.c qdev: Replace cannot_instantiate_with_device_add_yet with !user_creatable 2017-05-17 10:37:00 -03:00
spapr_events.c hw/ppc/spapr_events.c: removing 'exception' from sPAPREventLogEntry 2017-05-24 11:39:53 +10:00
spapr_hcall.c pseries: Split CAS PVR negotiation out into a separate function 2017-05-24 11:39:53 +10:00
spapr_iommu.c target-ppc: kvm: make use of KVM_CREATE_SPAPR_TCE_64 2017-04-26 12:00:41 +10:00
spapr_ovec.c spapr: replace debug printf with trace points 2017-02-22 11:28:28 +11:00
spapr_pci.c sysbus: Set user_creatable=false by default on TYPE_SYS_BUS_DEVICE 2017-05-17 10:37:01 -03:00
spapr_pci_vfio.c Use #include "..." for our own headers, <...> for others 2016-07-12 16:19:16 +02:00
spapr_rng.c hw: explicitly include qemu-common.h and cpu.h 2016-03-22 22:20:17 +01:00
spapr_rtas.c report guest crash information in GUEST_PANICKED event 2017-02-16 15:30:49 +01:00
spapr_rtas_ddw.c spapr_pci/spapr_pci_vfio: Support Dynamic DMA Windows (DDW) 2016-07-05 14:31:08 +10:00
spapr_rtc.c ppc/spapr: QOM'ify sPAPRRTCState 2017-04-26 12:00:41 +10:00
spapr_vio.c ppc/xics: store the ICS object under the sPAPR machine 2017-03-01 11:23:39 +11:00
trace-events spapr: replace debug printf with trace points 2017-02-22 11:28:28 +11:00
virtex_ml507.c target-ppc: Add MMU model check for booke machines 2017-02-02 09:30:06 +11:00