[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 18/21] spapr: Split DRC release from DRC detach
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 18/21] spapr: Split DRC release from DRC detach |
Date: |
Fri, 30 Jun 2017 20:46:29 +1000 |
spapr_drc_detach() is called when qemu generic code requests a device be
unplugged. It makes a number of tests, which could well delay further
action until later, before actually detach the device from the DRC.
This splits out the part which actually removes the device from the DRC
into spapr_drc_release(). This will be useful for further cleanups.
Signed-off-by: David Gibson <address@hidden>
Reviewed-by: Greg Kurz <address@hidden>
Reviewed-by: Michael Roth <address@hidden>
---
hw/ppc/spapr_drc.c | 49 +++++++++++++++++++++++++++----------------------
1 file changed, 27 insertions(+), 22 deletions(-)
diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 21f5bf1..8a2b8f5 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -315,29 +315,8 @@ void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState
*d, void *fdt,
NULL, 0, NULL);
}
-void spapr_drc_detach(sPAPRDRConnector *drc, DeviceState *d, Error **errp)
+static void spapr_drc_release(sPAPRDRConnector *drc)
{
- trace_spapr_drc_detach(spapr_drc_index(drc));
-
- if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) {
- trace_spapr_drc_awaiting_isolated(spapr_drc_index(drc));
- drc->awaiting_release = true;
- return;
- }
-
- if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI &&
- drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
- trace_spapr_drc_awaiting_unusable(spapr_drc_index(drc));
- drc->awaiting_release = true;
- return;
- }
-
- if (drc->awaiting_allocation) {
- drc->awaiting_release = true;
- trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc));
- return;
- }
-
drc->dr_indicator = SPAPR_DR_INDICATOR_INACTIVE;
/* Calling release callbacks based on spapr_drc_type(drc). */
@@ -365,6 +344,32 @@ void spapr_drc_detach(sPAPRDRConnector *drc, DeviceState
*d, Error **errp)
drc->dev = NULL;
}
+void spapr_drc_detach(sPAPRDRConnector *drc, DeviceState *d, Error **errp)
+{
+ trace_spapr_drc_detach(spapr_drc_index(drc));
+
+ if (drc->isolation_state != SPAPR_DR_ISOLATION_STATE_ISOLATED) {
+ trace_spapr_drc_awaiting_isolated(spapr_drc_index(drc));
+ drc->awaiting_release = true;
+ return;
+ }
+
+ if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI &&
+ drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
+ trace_spapr_drc_awaiting_unusable(spapr_drc_index(drc));
+ drc->awaiting_release = true;
+ return;
+ }
+
+ if (drc->awaiting_allocation) {
+ drc->awaiting_release = true;
+ trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc));
+ return;
+ }
+
+ spapr_drc_release(drc);
+}
+
static bool release_pending(sPAPRDRConnector *drc)
{
return drc->awaiting_release;
--
2.9.4
- [Qemu-ppc] [PULL 01/21] hw/ppc/prep: Remove superfluous call to soundhw_init(), (continued)
- [Qemu-ppc] [PULL 01/21] hw/ppc/prep: Remove superfluous call to soundhw_init(), David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 02/21] qapi: add explicit null to string input and output visitors, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 06/21] spapr: Add a "no HPT" encoding to HTAB migration stream, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 09/21] target/ppc: Fix return value in tcg radix mmu fault handler, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 07/21] spapr: Fix migration of Radix guests, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 08/21] target/ppc/excp_helper: Take BQL before calling cpu_interrupt(), David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 10/21] xics: directly register ICPState objects to vmstate, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 04/21] pseries: Reset CPU compatibility mode, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 14/21] hw/ppc/spapr.c: consecutive 'spapr->patb_entry = 0' statements, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 05/21] ppc: Rework CPU compatibility testing across migration, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 18/21] spapr: Split DRC release from DRC detach,
David Gibson <=
- [Qemu-ppc] [PULL 19/21] spapr: Make DRC reset force DRC into known state, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 15/21] target-ppc: Enable open-pic timers to count and generate interrupts, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 17/21] spapr: Eliminate DRC 'signalled' state variable, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 13/21] spapr: prevent QEMU crash when CPU realization fails, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 11/21] spapr: fix migration of ICPState objects from/to older QEMU, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 20/21] spapr: Clean up DRC set_allocation_state path, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 16/21] spapr: Start hotplugged PCI devices in ISOLATED state, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 12/21] target/ppc: Proper cleanup when ppc_cpu_realizefn fails, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 03/21] pseries: Move CPU compatibility property to machine, David Gibson, 2017/06/30
- [Qemu-ppc] [PULL 21/21] spapr: Clean up DRC set_isolation_state() path, David Gibson, 2017/06/30