spapr_drc.c (fbddc2e5608eb655493253d080598375db61a748) spapr_drc.c (fe6824d12642b005c69123ecf8631f9b13553f8b)
1/*
2 * QEMU SPAPR Dynamic Reconfiguration Connector Implementation
3 *
4 * Copyright IBM Corp. 2014
5 *
6 * Authors:
7 * Michael Roth <mdroth@linux.vnet.ibm.com>
8 *

--- 121 unchanged lines hidden (view full) ---

130 /* if there's no resource/device associated with the DRC, there's
131 * no way for us to put it in an allocation state consistent with
132 * being 'USABLE'. PAPR 2.7, 13.5.3.4 documents that this should
133 * result in an RTAS return code of -3 / "no such indicator"
134 */
135 if (!drc->dev) {
136 return RTAS_OUT_NO_SUCH_INDICATOR;
137 }
1/*
2 * QEMU SPAPR Dynamic Reconfiguration Connector Implementation
3 *
4 * Copyright IBM Corp. 2014
5 *
6 * Authors:
7 * Michael Roth <mdroth@linux.vnet.ibm.com>
8 *

--- 121 unchanged lines hidden (view full) ---

130 /* if there's no resource/device associated with the DRC, there's
131 * no way for us to put it in an allocation state consistent with
132 * being 'USABLE'. PAPR 2.7, 13.5.3.4 documents that this should
133 * result in an RTAS return code of -3 / "no such indicator"
134 */
135 if (!drc->dev) {
136 return RTAS_OUT_NO_SUCH_INDICATOR;
137 }
138 if (drc->awaiting_release && drc->awaiting_allocation) {
139 /* kernel is acknowledging a previous hotplug event
140 * while we are already removing it.
141 * it's safe to ignore awaiting_allocation here since we know the
142 * situation is predicated on the guest either already having done
143 * so (boot-time hotplug), or never being able to acquire in the
144 * first place (hotplug followed by immediate unplug).
145 */
146 drc->awaiting_allocation_skippable = true;
147 return RTAS_OUT_NO_SUCH_INDICATOR;
148 }
138 }
139
140 if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI) {
141 drc->allocation_state = state;
142 if (drc->awaiting_release &&
143 drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
144 trace_spapr_drc_set_allocation_state_finalizing(get_index(drc));
145 drck->detach(drc, DEVICE(drc->dev), drc->detach_cb,

--- 285 unchanged lines hidden (view full) ---

431 if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI &&
432 drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
433 trace_spapr_drc_awaiting_unusable(get_index(drc));
434 drc->awaiting_release = true;
435 return;
436 }
437
438 if (drc->awaiting_allocation) {
149 }
150
151 if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI) {
152 drc->allocation_state = state;
153 if (drc->awaiting_release &&
154 drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
155 trace_spapr_drc_set_allocation_state_finalizing(get_index(drc));
156 drck->detach(drc, DEVICE(drc->dev), drc->detach_cb,

--- 285 unchanged lines hidden (view full) ---

442 if (drc->type != SPAPR_DR_CONNECTOR_TYPE_PCI &&
443 drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
444 trace_spapr_drc_awaiting_unusable(get_index(drc));
445 drc->awaiting_release = true;
446 return;
447 }
448
449 if (drc->awaiting_allocation) {
439 drc->awaiting_release = true;
440 trace_spapr_drc_awaiting_allocation(get_index(drc));
441 return;
450 if (!drc->awaiting_allocation_skippable) {
451 drc->awaiting_release = true;
452 trace_spapr_drc_awaiting_allocation(get_index(drc));
453 return;
454 }
442 }
443
444 drc->indicator_state = SPAPR_DR_INDICATOR_STATE_INACTIVE;
445
446 if (drc->detach_cb) {
447 drc->detach_cb(drc->dev, drc->detach_cb_opaque);
448 }
449
450 drc->awaiting_release = false;
455 }
456
457 drc->indicator_state = SPAPR_DR_INDICATOR_STATE_INACTIVE;
458
459 if (drc->detach_cb) {
460 drc->detach_cb(drc->dev, drc->detach_cb_opaque);
461 }
462
463 drc->awaiting_release = false;
464 drc->awaiting_allocation_skippable = false;
451 g_free(drc->fdt);
452 drc->fdt = NULL;
453 drc->fdt_start_offset = 0;
454 object_property_del(OBJECT(drc), "device", NULL);
455 drc->dev = NULL;
456 drc->detach_cb = NULL;
457 drc->detach_cb_opaque = NULL;
458}

--- 402 unchanged lines hidden ---
465 g_free(drc->fdt);
466 drc->fdt = NULL;
467 drc->fdt_start_offset = 0;
468 object_property_del(OBJECT(drc), "device", NULL);
469 drc->dev = NULL;
470 drc->detach_cb = NULL;
471 drc->detach_cb_opaque = NULL;
472}

--- 402 unchanged lines hidden ---