qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: qemu-devel@nongnu.org
Cc: Cornelia Huck <cornelia.huck@de.ibm.com>,
	borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com, agraf@suse.de
Subject: [Qemu-devel] [PATCH 07/10] s390x: consolidate floating interrupts
Date: Tue,  3 Jun 2014 16:08:02 +0200	[thread overview]
Message-ID: <1401804485-14801-8-git-send-email-cornelia.huck@de.ibm.com> (raw)
In-Reply-To: <1401804485-14801-1-git-send-email-cornelia.huck@de.ibm.com>

Move the injection code for all floating interrupts to interrupt.c
and add a comment.

Also get rid of the #ifdef CONFIG_KVM for the service interrupt.

Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
---
 hw/s390x/s390-virtio-bus.c |   11 -----------
 target-s390x/cpu.h         |   32 +++++++++-----------------------
 target-s390x/interrupt.c   |   44 ++++++++++++++++++++++++++++++++++++++------
 target-s390x/kvm.c         |    5 +++++
 4 files changed, 52 insertions(+), 40 deletions(-)

diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c
index 9c71afa..45c6b1f 100644
--- a/hw/s390x/s390-virtio-bus.c
+++ b/hw/s390x/s390-virtio-bus.c
@@ -45,8 +45,6 @@
     do { } while (0)
 #endif
 
-#define VIRTIO_EXT_CODE   0x2603
-
 static void virtio_s390_bus_new(VirtioBusState *bus, size_t bus_size,
                                 VirtIOS390Device *dev);
 
@@ -113,15 +111,6 @@ VirtIOS390Bus *s390_virtio_bus_init(ram_addr_t *ram_size)
     return bus;
 }
 
-static void s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token)
-{
-    if (kvm_enabled()) {
-        kvm_s390_virtio_irq(cpu, config_change, token);
-    } else {
-        cpu_inject_ext(cpu, VIRTIO_EXT_CODE, config_change, token);
-    }
-}
-
 static int s390_virtio_device_init(VirtIOS390Device *dev, VirtIODevice *vdev)
 {
     VirtIOS390Bus *bus;
diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
index 808b906..5940f22 100644
--- a/target-s390x/cpu.h
+++ b/target-s390x/cpu.h
@@ -357,6 +357,7 @@ void s390x_tod_timer(void *opaque);
 void s390x_cpu_timer(void *opaque);
 
 int s390_virtio_hypercall(CPUS390XState *env);
+void s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token);
 
 #ifdef CONFIG_KVM
 void kvm_s390_reset_vcpu(S390CPU *cpu);
@@ -364,6 +365,7 @@ void kvm_s390_interrupt(S390CPU *cpu, int type, uint32_t code);
 void kvm_s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token);
 void kvm_s390_interrupt_internal(S390CPU *cpu, int type, uint32_t parm,
                                  uint64_t parm64, int vm);
+void kvm_s390_service_interrupt(S390CPU *cpu, uint32_t parm);
 #else
 static inline void kvm_s390_reset_vcpu(S390CPU *cpu)
 {
@@ -383,6 +385,9 @@ static inline void kvm_s390_interrupt_internal(S390CPU *cpu, int type,
                                                int vm)
 {
 }
+static inline void kvm_s390_service_interrupt(S390CPU *cpu, uint32_t parm)
+{
+}
 #endif
 S390CPU *s390_cpu_addr2state(uint16_t cpu_addr);
 void s390_add_running_cpu(S390CPU *cpu);
@@ -1120,29 +1125,10 @@ static inline int s390_cpu_restart(S390CPU *cpu)
     return -ENOSYS;
 }
 
-static inline void s390_io_interrupt(S390CPU *cpu,
-                                     uint16_t subchannel_id,
-                                     uint16_t subchannel_nr,
-                                     uint32_t io_int_parm,
-                                     uint32_t io_int_word)
-{
-    if (kvm_enabled()) {
-        kvm_s390_io_interrupt(cpu, subchannel_id, subchannel_nr, io_int_parm,
-                              io_int_word);
-    } else {
-        cpu_inject_io(cpu, subchannel_id, subchannel_nr, io_int_parm,
-                      io_int_word);
-    }
-}
-
-static inline void s390_crw_mchk(S390CPU *cpu)
-{
-    if (kvm_enabled()) {
-        kvm_s390_crw_mchk(cpu);
-    } else {
-        cpu_inject_crw_mchk(cpu);
-    }
-}
+void s390_io_interrupt(S390CPU *cpu, uint16_t subchannel_id,
+                       uint16_t subchannel_nr, uint32_t io_int_parm,
+                       uint32_t io_int_word);
+void s390_crw_mchk(S390CPU *cpu);
 
 static inline int s390_assign_subch_ioeventfd(EventNotifier *notifier,
                                               uint32_t sch_id, int vq,
diff --git a/target-s390x/interrupt.c b/target-s390x/interrupt.c
index 6d6580d..c32bdcb 100644
--- a/target-s390x/interrupt.c
+++ b/target-s390x/interrupt.c
@@ -1,7 +1,7 @@
 /*
  * QEMU S/390 Interrupt support
  *
- * Copyright IBM, Corp. 2012
+ * Copyright IBM Corp. 2012, 2014
  *
  * This work is licensed under the terms of the GNU GPL, version 2 or (at your
  * option) any later version.  See the COPYING file in the top-level directory.
@@ -10,21 +10,53 @@
 #include "cpu.h"
 #include "sysemu/kvm.h"
 
+/*
+ * All of the following interrupts are floating, i.e. not per-vcpu.
+ * We just need a dummy cpustate in order to be able to inject.
+ */
 #if !defined(CONFIG_USER_ONLY)
-/* service interrupts are floating therefore we must not pass an cpustate */
 void s390_sclp_extint(uint32_t parm)
 {
     S390CPU *dummy_cpu = s390_cpu_addr2state(0);
     CPUS390XState *env = &dummy_cpu->env;
 
     if (kvm_enabled()) {
-#ifdef CONFIG_KVM
-        kvm_s390_interrupt_internal(dummy_cpu, KVM_S390_INT_SERVICE, parm,
-                                    0, 1);
-#endif
+        kvm_s390_service_interrupt(dummy_cpu, parm);
     } else {
         env->psw.addr += 4;
         cpu_inject_ext(dummy_cpu, EXT_SERVICE, parm, 0);
     }
 }
+
+void s390_virtio_irq(S390CPU *cpu, int config_change, uint64_t token)
+{
+    if (kvm_enabled()) {
+        kvm_s390_virtio_irq(cpu, config_change, token);
+    } else {
+        cpu_inject_ext(cpu, EXT_VIRTIO, config_change, token);
+    }
+}
+
+void s390_io_interrupt(S390CPU *cpu, uint16_t subchannel_id,
+                       uint16_t subchannel_nr, uint32_t io_int_parm,
+                       uint32_t io_int_word)
+{
+    if (kvm_enabled()) {
+        kvm_s390_io_interrupt(cpu, subchannel_id, subchannel_nr, io_int_parm,
+                              io_int_word);
+    } else {
+        cpu_inject_io(cpu, subchannel_id, subchannel_nr, io_int_parm,
+                      io_int_word);
+    }
+}
+
+void s390_crw_mchk(S390CPU *cpu)
+{
+    if (kvm_enabled()) {
+        kvm_s390_crw_mchk(cpu);
+    } else {
+        cpu_inject_crw_mchk(cpu);
+    }
+}
+
 #endif
diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
index 9adda1b..9474f81 100644
--- a/target-s390x/kvm.c
+++ b/target-s390x/kvm.c
@@ -593,6 +593,11 @@ void kvm_s390_interrupt(S390CPU *cpu, int type, uint32_t code)
     kvm_s390_interrupt_internal(cpu, type, code, 0, 0);
 }
 
+void kvm_s390_service_interrupt(S390CPU *cpu, uint32_t parm)
+{
+    kvm_s390_interrupt_internal(cpu, KVM_S390_INT_SERVICE, parm, 0 , 1);
+}
+
 static void enter_pgmcheck(S390CPU *cpu, uint16_t code)
 {
     kvm_s390_interrupt(cpu, KVM_S390_PROGRAM_INT, code);
-- 
1.7.9.5

  parent reply	other threads:[~2014-06-03 14:08 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-03 14:07 [Qemu-devel] [PATCH 00/10] pending s390 patches Cornelia Huck
2014-06-03 14:07 ` [Qemu-devel] [PATCH 01/10] s390x/css: handle emw correctly for tsch Cornelia Huck
2014-06-03 14:07 ` [Qemu-devel] [PATCH 02/10] s390x/kvm: make flic play well with old kernels Cornelia Huck
2014-06-03 14:07 ` [Qemu-devel] [PATCH 03/10] s390x/kvm: enable/reset cmma via vm attributes Cornelia Huck
2014-06-03 14:07 ` [Qemu-devel] [PATCH 04/10] s390x/kvm: Log unmanageable external interruptions Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 05/10] s390x/kvm: Log unmanageable program interruptions Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 06/10] s390/virtio-ccw: migration support Cornelia Huck
2014-06-03 14:08 ` Cornelia Huck [this message]
2014-06-03 14:08 ` [Qemu-devel] [PATCH 08/10] s390x/kvm: add alternative injection interface Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 09/10] s390x: cleanup interrupt injection Cornelia Huck
2014-06-03 14:08 ` [Qemu-devel] [PATCH 10/10] s390x/kvm: inject via flic Cornelia Huck

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=1401804485-14801-8-git-send-email-cornelia.huck@de.ibm.com \
    --to=cornelia.huck@de.ibm.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=jfrei@linux.vnet.ibm.com \
    --cc=qemu-devel@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 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).