From nobody Fri Mar 29 11:33:53 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1550501908820160.10109504681452; Mon, 18 Feb 2019 06:58:28 -0800 (PST) Received: from localhost ([127.0.0.1]:59975 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvkNC-0002id-LZ for importer@patchew.org; Mon, 18 Feb 2019 09:58:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:39147) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gvjxo-0006Q2-0C for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gvjxh-00032L-Si for qemu-devel@nongnu.org; Mon, 18 Feb 2019 09:32:07 -0500 Received: from ozlabs.org ([203.11.71.1]:59641) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gvjxe-0002iR-4i; Mon, 18 Feb 2019 09:32:00 -0500 Received: by ozlabs.org (Postfix, from userid 1007) id 4435rl2khJz9sRG; Tue, 19 Feb 2019 01:31:01 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gibson.dropbear.id.au; s=201602; t=1550500263; bh=Dz1eO6oE7FED4kbYFa7CAjuehFxZ1F9OInOLu2+BCM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+LbFjYxj+S4/lBV9WcwZDfZNMifNJmKqhJSVZyG9K5AwXc2EbFQox6gIHFauIafM 5hEAw44k18kaOOa4m2m1lNDpD2aTYcPacsx8XoPeulFugELV1uVFk4UvvA88vVj0cz 2hyb4R6NHnTDOCGMRmt68+LxBLBylbNL21uj85YA= From: David Gibson To: peter.maydell@linaro.org Date: Tue, 19 Feb 2019 01:30:24 +1100 Message-Id: <20190218143049.17142-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218143049.17142-1-david@gibson.dropbear.id.au> References: <20190218143049.17142-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 203.11.71.1 Subject: [Qemu-devel] [PULL 18/43] xics: Handle KVM ICP reset from the common code 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: clg@kaod.org, David Gibson , qemu-ppc@nongnu.org, groug@kaod.org, qemu-devel@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" From: Greg Kurz The KVM ICP reset handler simply writes the ICP state to KVM. This doesn't need the overkill parent_reset logic we have today. Call icp_set_kvm_state() from the base ICP reset function instead. Since there are no other users for ICPStateClass::parent_reset, and it isn't currently expected to change, drop it as well. Signed-off-by: Greg Kurz Message-Id: <155023079461.1011724.12644984391500635645.stgit@bahia.lan> Reviewed-by: C=C3=A9dric Le Goater Signed-off-by: David Gibson --- hw/intc/xics.c | 12 ++++-------- hw/intc/xics_kvm.c | 11 ----------- include/hw/ppc/xics.h | 1 - 3 files changed, 4 insertions(+), 20 deletions(-) diff --git a/hw/intc/xics.c b/hw/intc/xics.c index 988b53abd1..822d367e63 100644 --- a/hw/intc/xics.c +++ b/hw/intc/xics.c @@ -289,7 +289,7 @@ static const VMStateDescription vmstate_icp_server =3D { }, }; =20 -static void icp_reset(DeviceState *dev) +static void icp_reset_handler(void *dev) { ICPState *icp =3D ICP(dev); =20 @@ -299,13 +299,10 @@ static void icp_reset(DeviceState *dev) =20 /* Make all outputs are deasserted */ qemu_set_irq(icp->output, 0); -} =20 -static void icp_reset_handler(void *dev) -{ - DeviceClass *dc =3D DEVICE_GET_CLASS(dev); - - dc->reset(dev); + if (kvm_irqchip_in_kernel()) { + icp_set_kvm_state(ICP(dev)); + } } =20 static void icp_realize(DeviceState *dev, Error **errp) @@ -370,7 +367,6 @@ static void icp_class_init(ObjectClass *klass, void *da= ta) =20 dc->realize =3D icp_realize; dc->unrealize =3D icp_unrealize; - dc->reset =3D icp_reset; } =20 static const TypeInfo icp_info =3D { diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c index 7efa99b8b4..80321e9b75 100644 --- a/hw/intc/xics_kvm.c +++ b/hw/intc/xics_kvm.c @@ -115,15 +115,6 @@ int icp_set_kvm_state(ICPState *icp) return 0; } =20 -static void icp_kvm_reset(DeviceState *dev) -{ - ICPStateClass *icpc =3D ICP_GET_CLASS(dev); - - icpc->parent_reset(dev); - - icp_set_kvm_state(ICP(dev)); -} - static void icp_kvm_realize(DeviceState *dev, Error **errp) { ICPState *icp =3D ICP(dev); @@ -176,8 +167,6 @@ static void icp_kvm_class_init(ObjectClass *klass, void= *data) =20 device_class_set_parent_realize(dc, icp_kvm_realize, &icpc->parent_realize); - device_class_set_parent_reset(dc, icp_kvm_reset, - &icpc->parent_reset); } =20 static const TypeInfo icp_kvm_info =3D { diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h index 3236ccec92..e33282a576 100644 --- a/include/hw/ppc/xics.h +++ b/include/hw/ppc/xics.h @@ -65,7 +65,6 @@ struct ICPStateClass { DeviceClass parent_class; =20 DeviceRealize parent_realize; - DeviceReset parent_reset; }; =20 struct ICPState { --=20 2.20.1