From patchwork Tue Jun 20 01:53:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Gibson X-Patchwork-Id: 9798333 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6F0A860328 for ; Tue, 20 Jun 2017 01:55:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CFBD26B41 for ; Tue, 20 Jun 2017 01:55:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 517B527031; Tue, 20 Jun 2017 01:55:05 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D06D726B41 for ; Tue, 20 Jun 2017 01:55:03 +0000 (UTC) Received: from localhost ([::1]:45173 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dN8Ni-0005ov-S7 for patchwork-qemu-devel@patchwork.kernel.org; Mon, 19 Jun 2017 21:55:03 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60073) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dN8MX-0005oZ-V3 for qemu-devel@nongnu.org; Mon, 19 Jun 2017 21:53:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dN8MX-0004CH-8V for qemu-devel@nongnu.org; Mon, 19 Jun 2017 21:53:50 -0400 Received: from ozlabs.org ([2401:3900:2:1::2]:60493) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1dN8MW-0004AR-SV; Mon, 19 Jun 2017 21:53:49 -0400 Received: by ozlabs.org (Postfix, from userid 1007) id 3ws9qY3pp4z9s76; Tue, 20 Jun 2017 11:53:45 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1497923625; bh=XgO6nrzYXOPE07SUAIlGT+9PRj30NOo/1Ac0kYyechQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UKIiNdC4KctLfBbyP3GqqqIbbAoNMnl8+ExR9mV8tVJyqBFvaEgGtta+Ba/fh9se5 Dr4s4nvmbYO5/dJA+rm0FY2cvKMZnUHuk70obMHlBpe7MDVS98EYdqRQS32etfqMLs YT8p3flKd9Mtm9FznODo+FYDjZQVl6DxxM7VmyDY= From: David Gibson To: mdroth@linux.vnet.ibm.com Date: Tue, 20 Jun 2017 09:53:28 +0800 Message-Id: <20170620015332.13874-2-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.9.4 In-Reply-To: <20170620015332.13874-1-david@gibson.dropbear.id.au> References: <20170620015332.13874-1-david@gibson.dropbear.id.au> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2401:3900:2:1::2 Subject: [Qemu-devel] [PATCH 1/5] spapr: Leave DR-indicator management to the guest X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: sursingh@redhat.com, qemu-devel@nongnu.org, groug@kaod.org, qemu-ppc@nongnu.org, bharata@linux.vnet.ibm.com, David Gibson Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The DR-indicator is essentially a "virtual LED" attached to a hotpluggable device, which the guest can set to various states for the attention of the operator or management layers. It's mostly guest managed, except that we once-off set it to ACTIVE/INACTIVE in the attach/detach path. While that makes certain sense, there's no indication in PAPR that the hypervisor should do this, and the drmgr code on the guest side doesn't appear to need it (it will already set the indicator to ACTIVE on hotplug, and INACTIVE on remove). So, leave the DR-indicator entirely to the guest; the only thing we need to do is ensure it's in a sane state on reset. Signed-off-by: David Gibson Reviewed-by: Laurent Vivier Reviewed-by: Greg Kurz --- hw/ppc/spapr_drc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hw/ppc/spapr_drc.c b/hw/ppc/spapr_drc.c index fd9e07d..0bc9046 100644 --- a/hw/ppc/spapr_drc.c +++ b/hw/ppc/spapr_drc.c @@ -353,8 +353,6 @@ void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, } g_assert(fdt || coldplug); - drc->dr_indicator = SPAPR_DR_INDICATOR_ACTIVE; - drc->dev = d; drc->fdt = fdt; drc->fdt_start_offset = fdt_start_offset; @@ -372,8 +370,6 @@ void spapr_drc_attach(sPAPRDRConnector *drc, DeviceState *d, void *fdt, static void spapr_drc_release(sPAPRDRConnector *drc) { - drc->dr_indicator = SPAPR_DR_INDICATOR_INACTIVE; - /* Calling release callbacks based on spapr_drc_type(drc). */ switch (spapr_drc_type(drc)) { case SPAPR_DR_CONNECTOR_TYPE_CPU: @@ -452,12 +448,14 @@ static void reset(DeviceState *d) if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) { drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_USABLE; } + drc->dr_indicator = SPAPR_DR_INDICATOR_ACTIVE; } else { /* Otherwise device is absent, but might be hotplugged */ drc->isolation_state = SPAPR_DR_ISOLATION_STATE_ISOLATED; if (spapr_drc_type(drc) != SPAPR_DR_CONNECTOR_TYPE_PCI) { drc->allocation_state = SPAPR_DR_ALLOCATION_STATE_UNUSABLE; } + drc->dr_indicator = SPAPR_DR_INDICATOR_INACTIVE; } }