mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-08 18:23:57 -06:00
spapr: Consolidate DRC state variables
Each DRC has three fields describing its state: isolation_state, allocation_state and configured. At first this seems like a reasonable representation, since its based directly on the PAPR defined isolation-state and allocation-state indicators. However: * Only a few combinations of the two fields' values are permitted * allocation_state isn't used at all for physical DRCs * The indicators are write only so they don't really have a well defined current value independent of each other This replaces these variables with a single state variable, whose names and numbers are based on the diagram in LoPAPR section 13.4. Along with this we add code to check the current state on various operations and make sure the requested transition is permitted. Strictly speaking, this makes guest visible changes to behaviour (since we probably allowed some transitions we shouldn't have before). However, a hypothetical guest broken by that wasn't PAPR compliant, and probably wouldn't have worked under PowerVM. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Reviewed-by: Daniel Barboza <danielhb@linux.vnet.ibm.com> Tested-by: Daniel Barboza <danielhb@linux.vnet.ibm.com>
This commit is contained in:
parent
f1c52354e5
commit
9d4c0f4f0a
3 changed files with 145 additions and 108 deletions
|
@ -173,6 +173,24 @@ typedef enum {
|
|||
SPAPR_DR_CC_RESPONSE_NOT_CONFIGURABLE = -9003,
|
||||
} sPAPRDRCCResponse;
|
||||
|
||||
typedef enum {
|
||||
/*
|
||||
* Values come from Fig. 12 in LoPAPR section 13.4
|
||||
*
|
||||
* These are exposed in the migration stream, so don't change
|
||||
* them.
|
||||
*/
|
||||
SPAPR_DRC_STATE_INVALID = 0,
|
||||
SPAPR_DRC_STATE_LOGICAL_UNUSABLE = 1,
|
||||
SPAPR_DRC_STATE_LOGICAL_AVAILABLE = 2,
|
||||
SPAPR_DRC_STATE_LOGICAL_UNISOLATE = 3,
|
||||
SPAPR_DRC_STATE_LOGICAL_CONFIGURED = 4,
|
||||
SPAPR_DRC_STATE_PHYSICAL_AVAILABLE = 5,
|
||||
SPAPR_DRC_STATE_PHYSICAL_POWERON = 6,
|
||||
SPAPR_DRC_STATE_PHYSICAL_UNISOLATE = 7,
|
||||
SPAPR_DRC_STATE_PHYSICAL_CONFIGURED = 8,
|
||||
} sPAPRDRCState;
|
||||
|
||||
/* rtas-configure-connector state */
|
||||
typedef struct sPAPRConfigureConnectorState {
|
||||
int fdt_offset;
|
||||
|
@ -189,14 +207,11 @@ typedef struct sPAPRDRConnector {
|
|||
/* DR-indicator */
|
||||
uint32_t dr_indicator;
|
||||
|
||||
/* sensor/indicator states */
|
||||
uint32_t isolation_state;
|
||||
uint32_t allocation_state;
|
||||
uint32_t state;
|
||||
|
||||
/* configure-connector state */
|
||||
void *fdt;
|
||||
int fdt_start_offset;
|
||||
bool configured;
|
||||
sPAPRConfigureConnectorState *ccs;
|
||||
|
||||
/* device pointer, via link property */
|
||||
|
@ -207,6 +222,8 @@ typedef struct sPAPRDRConnector {
|
|||
typedef struct sPAPRDRConnectorClass {
|
||||
/*< private >*/
|
||||
DeviceClass parent;
|
||||
sPAPRDRCState empty_state;
|
||||
sPAPRDRCState ready_state;
|
||||
|
||||
/*< public >*/
|
||||
sPAPRDRConnectorTypeShift typeshift;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue