qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [FIX PATCH] spapr_drc: Return correct state for logical DR in entity_sense()
@ 2015-09-07  6:07 Bharata B Rao
  2015-09-08  1:22 ` David Gibson
  0 siblings, 1 reply; 8+ messages in thread
From: Bharata B Rao @ 2015-09-07  6:07 UTC (permalink / raw)
  To: qemu-devel; +Cc: Bharata B Rao, qemu-ppc, Michael Roth, david

When drmgr is run in the guest to add a device for which device_add
hasn't been issued in QEMU, configure-connector call fails.
When configure-connector call fails, the guest would release (*)
the previously acquired DRC by setting back the DRC isolation state
to ISOLATED and allocation state to UNUSABLE. These calls will be issued
only if get-sensor-state call returns PRESENT state. However currently for
a logical DR, entity_sense() would unconditinally return UNUSABLE
state only. This prevents any subsequent hotplug of the device with
that DRC.

Fix this by returning the right state in entity_sense() by checking
the allocation_state of DRC.

(*) https://lists.ozlabs.org/pipermail/linuxppc-dev/2015-September/133430.html

Signed-off-by: Bharata B Rao <bharata@linux.vnet.ibm.com>
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 hw/ppc/spapr_drc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c
index 9ce844a..2586065 100644
--- a/hw/ppc/spapr_drc.c
+++ b/hw/ppc/spapr_drc.c
@@ -186,7 +186,11 @@ static sPAPRDREntitySense entity_sense(sPAPRDRConnector *drc)
              */
             state = SPAPR_DR_ENTITY_SENSE_EMPTY;
         } else {
-            state = SPAPR_DR_ENTITY_SENSE_UNUSABLE;
+            if (drc->allocation_state == SPAPR_DR_ALLOCATION_STATE_UNUSABLE) {
+                state = SPAPR_DR_ENTITY_SENSE_UNUSABLE;
+            } else {
+                state = SPAPR_DR_ENTITY_SENSE_PRESENT;
+            }
         }
     }
 
-- 
2.1.0

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-09-09  7:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-07  6:07 [Qemu-devel] [FIX PATCH] spapr_drc: Return correct state for logical DR in entity_sense() Bharata B Rao
2015-09-08  1:22 ` David Gibson
2015-09-08 21:03   ` Michael Roth
2015-09-08 21:06     ` Michael Roth
2015-09-08 22:03     ` Michael Roth
2015-09-09  4:02       ` Bharata B Rao
2015-09-09  6:05         ` David Gibson
2015-09-09  4:13       ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).