From patchwork Mon Sep 7 06:07:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bharata B Rao X-Patchwork-Id: 514974 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id D86D11401CB for ; Mon, 7 Sep 2015 16:07:46 +1000 (AEST) Received: from localhost ([::1]:53435 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYpai-0006SH-MH for incoming@patchwork.ozlabs.org; Mon, 07 Sep 2015 02:07:44 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59867) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYpaU-0006AL-Du for qemu-devel@nongnu.org; Mon, 07 Sep 2015 02:07:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZYpaR-0005dy-5w for qemu-devel@nongnu.org; Mon, 07 Sep 2015 02:07:30 -0400 Received: from e28smtp05.in.ibm.com ([122.248.162.5]:48436) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZYpaQ-0005d8-Ep for qemu-devel@nongnu.org; Mon, 07 Sep 2015 02:07:27 -0400 Received: from /spool/local by e28smtp05.in.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 7 Sep 2015 11:37:22 +0530 Received: from d28dlp03.in.ibm.com (9.184.220.128) by e28smtp05.in.ibm.com (192.168.1.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 7 Sep 2015 11:37:18 +0530 X-Helo: d28dlp03.in.ibm.com X-MailFrom: bharata@linux.vnet.ibm.com X-RcptTo: qemu-ppc@nongnu.org Received: from d28relay03.in.ibm.com (d28relay03.in.ibm.com [9.184.220.60]) by d28dlp03.in.ibm.com (Postfix) with ESMTP id 5AF9A125801D; Mon, 7 Sep 2015 11:36:37 +0530 (IST) Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay03.in.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t8767G5u31326430; Mon, 7 Sep 2015 11:37:16 +0530 Received: from d28av04.in.ibm.com (localhost [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t8767E4u012408; Mon, 7 Sep 2015 11:37:14 +0530 Received: from bharata.in.ibm.com ([9.124.35.228]) by d28av04.in.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id t8767DtR012262; Mon, 7 Sep 2015 11:37:13 +0530 From: Bharata B Rao To: qemu-devel@nongnu.org Date: Mon, 7 Sep 2015 11:37:04 +0530 Message-Id: <1441606024-1238-1-git-send-email-bharata@linux.vnet.ibm.com> X-Mailer: git-send-email 2.1.0 X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 15090706-0017-0000-0000-0000071E40C0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 122.248.162.5 Cc: Bharata B Rao , qemu-ppc@nongnu.org, Michael Roth , david@gibson.dropbear.id.au Subject: [Qemu-devel] [FIX PATCH] spapr_drc: Return correct state for logical DR in entity_sense() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 Cc: Michael Roth Reviewed-by: David Gibson --- 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; + } } }