spapr_drc.c (798083361950ec3fed946bbcf22c924ef820e45e) spapr_drc.c (593080936a06a04eacc589350e3a7ebc02f2ed8e)
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 *

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

123 /* if there's no resource/device associated with the DRC, there's
124 * no way for us to put it in an allocation state consistent with
125 * being 'USABLE'. PAPR 2.7, 13.5.3.4 documents that this should
126 * result in an RTAS return code of -3 / "no such indicator"
127 */
128 if (!drc->dev) {
129 return RTAS_OUT_NO_SUCH_INDICATOR;
130 }
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 *

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

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

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

386 if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI &&
387 drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
388 trace_spapr_drc_awaiting_unusable(spapr_drc_index(drc));
389 drc->awaiting_release = true;
390 return;
391 }
392
393 if (drc->awaiting_allocation) {
131 }
132
133 if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) {
134 drc->allocation_state = state;
135 if (drc->awaiting_release &&
136 drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
137 uint32_t drc_index = spapr_drc_index(drc);
138 trace_spapr_drc_set_allocation_state_finalizing(drc_index);

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

375 if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI &&
376 drc->allocation_state != SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
377 trace_spapr_drc_awaiting_unusable(spapr_drc_index(drc));
378 drc->awaiting_release = true;
379 return;
380 }
381
382 if (drc->awaiting_allocation) {
394 if (!drc->awaiting_allocation_skippable) {
395 drc->awaiting_release = true;
396 trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc));
397 return;
398 }
383 drc->awaiting_release = true;
384 trace_spapr_drc_awaiting_allocation(spapr_drc_index(drc));
385 return;
399 }
400
401 drc->dr_indicator = SPAPR_DR_INDICATOR_INACTIVE;
402
403 /* Calling release callbacks based on spapr_drc_type(drc). */
404 switch (spapr_drc_type(drc)) {
405 case SPAPR_DR_CONNECTOR_TYPE_CPU:
406 spapr_core_release(drc->dev);

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

413 break;
414 case SPAPR_DR_CONNECTOR_TYPE_PHB:
415 case SPAPR_DR_CONNECTOR_TYPE_VIO:
416 default:
417 g_assert(false);
418 }
419
420 drc->awaiting_release = false;
386 }
387
388 drc->dr_indicator = SPAPR_DR_INDICATOR_INACTIVE;
389
390 /* Calling release callbacks based on spapr_drc_type(drc). */
391 switch (spapr_drc_type(drc)) {
392 case SPAPR_DR_CONNECTOR_TYPE_CPU:
393 spapr_core_release(drc->dev);

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

400 break;
401 case SPAPR_DR_CONNECTOR_TYPE_PHB:
402 case SPAPR_DR_CONNECTOR_TYPE_VIO:
403 default:
404 g_assert(false);
405 }
406
407 drc->awaiting_release = false;
421 drc->awaiting_allocation_skippable = false;
422 g_free(drc->fdt);
423 drc->fdt = NULL;
424 drc->fdt_start_offset = 0;
425 object_property_del(OBJECT(drc), "device", NULL);
426 drc->dev = NULL;
427}
428
429static bool release_pending(sPAPRDRConnector *drc)

--- 711 unchanged lines hidden ---
408 g_free(drc->fdt);
409 drc->fdt = NULL;
410 drc->fdt_start_offset = 0;
411 object_property_del(OBJECT(drc), "device", NULL);
412 drc->dev = NULL;
413}
414
415static bool release_pending(sPAPRDRConnector *drc)

--- 711 unchanged lines hidden ---