All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kurz <groug@kaod.org>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: "Cédric Le Goater" <clg@kaod.org>, "Greg Kurz" <groug@kaod.org>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org
Subject: [Qemu-devel] [PATCH 02/10] xics: Handle KVM ICP reset from the common code
Date: Fri, 15 Feb 2019 12:39:54 +0100	[thread overview]
Message-ID: <155023079461.1011724.12644984391500635645.stgit@bahia.lan> (raw)
In-Reply-To: <155023078266.1011724.5995737218088270486.stgit@bahia.lan>

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 <groug@kaod.org>
---
 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 988b53abd17d..822d367e6388 100644
--- a/hw/intc/xics.c
+++ b/hw/intc/xics.c
@@ -289,7 +289,7 @@ static const VMStateDescription vmstate_icp_server = {
     },
 };
 
-static void icp_reset(DeviceState *dev)
+static void icp_reset_handler(void *dev)
 {
     ICPState *icp = ICP(dev);
 
@@ -299,13 +299,10 @@ static void icp_reset(DeviceState *dev)
 
     /* Make all outputs are deasserted */
     qemu_set_irq(icp->output, 0);
-}
 
-static void icp_reset_handler(void *dev)
-{
-    DeviceClass *dc = DEVICE_GET_CLASS(dev);
-
-    dc->reset(dev);
+    if (kvm_irqchip_in_kernel()) {
+        icp_set_kvm_state(ICP(dev));
+    }
 }
 
 static void icp_realize(DeviceState *dev, Error **errp)
@@ -370,7 +367,6 @@ static void icp_class_init(ObjectClass *klass, void *data)
 
     dc->realize = icp_realize;
     dc->unrealize = icp_unrealize;
-    dc->reset = icp_reset;
 }
 
 static const TypeInfo icp_info = {
diff --git a/hw/intc/xics_kvm.c b/hw/intc/xics_kvm.c
index 7efa99b8b434..80321e9b75ab 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;
 }
 
-static void icp_kvm_reset(DeviceState *dev)
-{
-    ICPStateClass *icpc = 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 = ICP(dev);
@@ -176,8 +167,6 @@ static void icp_kvm_class_init(ObjectClass *klass, void *data)
 
     device_class_set_parent_realize(dc, icp_kvm_realize,
                                     &icpc->parent_realize);
-    device_class_set_parent_reset(dc, icp_kvm_reset,
-                                  &icpc->parent_reset);
 }
 
 static const TypeInfo icp_kvm_info = {
diff --git a/include/hw/ppc/xics.h b/include/hw/ppc/xics.h
index 3236ccec924c..e33282a576d0 100644
--- a/include/hw/ppc/xics.h
+++ b/include/hw/ppc/xics.h
@@ -65,7 +65,6 @@ struct ICPStateClass {
     DeviceClass parent_class;
 
     DeviceRealize parent_realize;
-    DeviceReset parent_reset;
 };
 
 struct ICPState {

  parent reply	other threads:[~2019-02-15 11:40 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-15 11:39 [Qemu-devel] [PATCH 00/10] xics: Get rid of KVM specific classes Greg Kurz
2019-02-15 11:39 ` [Qemu-devel] [PATCH 01/10] xics: Explicitely call KVM ICP methods from the common code Greg Kurz
2019-02-15 12:49   ` Cédric Le Goater
2019-02-17 23:14   ` David Gibson
2019-02-18 20:10     ` Eric Blake
2019-02-19  5:36       ` David Gibson
2019-02-15 11:39 ` Greg Kurz [this message]
2019-02-15 12:50   ` [Qemu-devel] [PATCH 02/10] xics: Handle KVM ICP reset " Cédric Le Goater
2019-02-17 23:32   ` David Gibson
2019-02-15 11:40 ` [Qemu-devel] [PATCH 03/10] xics: Handle KVM ICP realize " Greg Kurz
2019-02-15 12:54   ` Cédric Le Goater
2019-02-15 13:03     ` Greg Kurz
2019-02-15 13:09       ` Cédric Le Goater
2019-02-15 13:27         ` Greg Kurz
2019-02-15 13:35           ` Cédric Le Goater
2019-02-17 23:33           ` David Gibson
2019-02-15 11:40 ` [Qemu-devel] [PATCH 04/10] spapr/irq: Use the base ICP class for KVM Greg Kurz
2019-02-15 12:54   ` Cédric Le Goater
2019-02-17 23:35   ` David Gibson
2019-02-15 11:40 ` [Qemu-devel] [PATCH 05/10] xics: Drop the KVM ICP class Greg Kurz
2019-02-15 12:55   ` Cédric Le Goater
2019-02-15 13:18     ` Greg Kurz
2019-02-15 13:35       ` Cédric Le Goater
2019-02-15 13:35         ` Greg Kurz
2019-02-17 23:37         ` David Gibson
2019-02-18  7:08           ` Cédric Le Goater
2019-02-15 11:40 ` [Qemu-devel] [PATCH 06/10] xics: Explicitely call KVM ICS methods from the common code Greg Kurz
2019-02-15 12:56   ` Cédric Le Goater
2019-02-17 23:39   ` David Gibson
2019-02-15 11:40 ` [Qemu-devel] [PATCH 07/10] xics: Handle KVM ICS reset from the "simple" ICS code Greg Kurz
2019-02-15 12:57   ` Cédric Le Goater
2019-02-17 23:41   ` David Gibson
2019-02-15 11:40 ` [Qemu-devel] [PATCH 08/10] xics: Handle KVM interrupt presentation from " Greg Kurz
2019-02-15 12:59   ` Cédric Le Goater
2019-02-15 13:25     ` Greg Kurz
2019-02-17 23:43   ` David Gibson
2019-02-15 11:40 ` [Qemu-devel] [PATCH 09/10] spapr/irq: Use the "simple" ICS class for KVM Greg Kurz
2019-02-15 13:02   ` Cédric Le Goater
2019-02-15 13:32     ` Greg Kurz
2019-02-15 13:37       ` Cédric Le Goater
2019-02-17 23:49     ` David Gibson
2019-02-17 23:51   ` David Gibson
2019-02-15 11:40 ` [Qemu-devel] [PATCH 10/10] xics: Drop the KVM ICS class Greg Kurz
2019-02-15 13:02   ` Cédric Le Goater

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=155023079461.1011724.12644984391500635645.stgit@bahia.lan \
    --to=groug@kaod.org \
    --cc=clg@kaod.org \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.