Patchwork [08/17] s390x: Dispatch interrupts to KVM or the real CPU

login
register
mail settings
Submitter Alexander Graf
Date April 15, 2011, 3:32 p.m.
Message ID <1302881578-5357-9-git-send-email-agraf@suse.de>
Download mbox | patch
Permalink /patch/91403/
State New
Headers show

Comments

Alexander Graf - April 15, 2011, 3:32 p.m.
The KVM interrupt injection path is non-generic for now. So we need to push
knowledge of how to inject a device interrupt using KVM into the actual device
code.

Signed-off-by: Alexander Graf <agraf@suse.de>
---
 hw/s390-virtio-bus.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
Aurelien Jarno - April 18, 2011, 7:01 p.m.
On Fri, Apr 15, 2011 at 05:32:49PM +0200, Alexander Graf wrote:
> The KVM interrupt injection path is non-generic for now. So we need to push
> knowledge of how to inject a device interrupt using KVM into the actual device
> code.
> 
> Signed-off-by: Alexander Graf <agraf@suse.de>
> ---
>  hw/s390-virtio-bus.c |   10 ++++++++--
>  1 files changed, 8 insertions(+), 2 deletions(-)

Thanks, applied.

> diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
> index 175e5cb..bb49e39 100644
> --- a/hw/s390-virtio-bus.c
> +++ b/hw/s390-virtio-bus.c
> @@ -43,6 +43,8 @@
>      do { } while (0)
>  #endif
>  
> +#define VIRTIO_EXT_CODE   0x2603
> +
>  struct BusInfo s390_virtio_bus_info = {
>      .name       = "s390-virtio",
>      .size       = sizeof(VirtIOS390Bus),
> @@ -305,9 +307,13 @@ static void virtio_s390_notify(void *opaque, uint16_t vector)
>  {
>      VirtIOS390Device *dev = (VirtIOS390Device*)opaque;
>      uint64_t token = s390_virtio_device_vq_token(dev, vector);
> +    CPUState *env = s390_cpu_addr2state(0);
>  
> -    /* XXX kvm dependency! */
> -    kvm_s390_virtio_irq(s390_cpu_addr2state(0), 0, token);
> +    if (kvm_enabled()) {
> +        kvm_s390_virtio_irq(env, 0, token);
> +    } else {
> +        cpu_inject_ext(env, VIRTIO_EXT_CODE, 0, token);
> +    }
>  }
>  
>  static unsigned virtio_s390_get_features(void *opaque)
> -- 
> 1.6.0.2
> 
> 
>

Patch

diff --git a/hw/s390-virtio-bus.c b/hw/s390-virtio-bus.c
index 175e5cb..bb49e39 100644
--- a/hw/s390-virtio-bus.c
+++ b/hw/s390-virtio-bus.c
@@ -43,6 +43,8 @@ 
     do { } while (0)
 #endif
 
+#define VIRTIO_EXT_CODE   0x2603
+
 struct BusInfo s390_virtio_bus_info = {
     .name       = "s390-virtio",
     .size       = sizeof(VirtIOS390Bus),
@@ -305,9 +307,13 @@  static void virtio_s390_notify(void *opaque, uint16_t vector)
 {
     VirtIOS390Device *dev = (VirtIOS390Device*)opaque;
     uint64_t token = s390_virtio_device_vq_token(dev, vector);
+    CPUState *env = s390_cpu_addr2state(0);
 
-    /* XXX kvm dependency! */
-    kvm_s390_virtio_irq(s390_cpu_addr2state(0), 0, token);
+    if (kvm_enabled()) {
+        kvm_s390_virtio_irq(env, 0, token);
+    } else {
+        cpu_inject_ext(env, VIRTIO_EXT_CODE, 0, token);
+    }
 }
 
 static unsigned virtio_s390_get_features(void *opaque)