mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-07 17:53:56 -06:00
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>
This commit is contained in:
parent
c871bc70bb
commit
0cffce56ae
2 changed files with 73 additions and 38 deletions
|
@ -32,6 +32,7 @@ struct sPAPRRTCState {
|
|||
int64_t ns_offset;
|
||||
};
|
||||
|
||||
typedef struct sPAPRDIMMState sPAPRDIMMState;
|
||||
typedef struct sPAPRMachineClass sPAPRMachineClass;
|
||||
|
||||
#define TYPE_SPAPR_MACHINE "spapr-machine"
|
||||
|
@ -104,6 +105,11 @@ struct sPAPRMachineState {
|
|||
/* RTAS state */
|
||||
QTAILQ_HEAD(, sPAPRConfigureConnectorState) ccs_list;
|
||||
|
||||
/* Pending DIMM unplug cache. It is populated when a LMB
|
||||
* unplug starts. It can be regenerated if a migration
|
||||
* occurs during the unplug process. */
|
||||
QTAILQ_HEAD(, sPAPRDIMMState) pending_dimm_unplugs;
|
||||
|
||||
/*< public >*/
|
||||
char *kvm_type;
|
||||
MemoryHotplugState hotplug_memory;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue