From: Christian Borntraeger <[EMAIL PROTECTED]>

This patch changes the interrupt defintions for virtio on s390. We now use
the extint number 0x2603, which is used as a host interrupt already by z/VM
for pfault and dasd_diag.

We will use subcode 0x0D to distinguish virtio from dasd and pfault.

Signed-off-by: Christian Borntraeger <[EMAIL PROTECTED]>
Signed-off-by: Carsten Otte <[EMAIL PROTECTED]>
Signed-off-by: Avi Kivity <[EMAIL PROTECTED]>

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index 399c462..fcd1ed8 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -50,7 +50,7 @@ static int __interrupt_is_deliverable(struct kvm_vcpu *vcpu,
                if (psw_extint_disabled(vcpu))
                        return 0;
                if (vcpu->arch.sie_block->gcr[0] & 0x200ul)
-                       return 1; /*FIXME virtio control register bit */
+                       return 1;
                return 0;
        case KVM_S390_PROGRAM_INT:
        case KVM_S390_SIGP_STOP:
@@ -162,7 +162,11 @@ static void __do_deliver_interrupt(struct kvm_vcpu *vcpu,
                VCPU_EVENT(vcpu, 4, "interrupt: virtio parm:%x,parm64:%lx",
                           inti->ext.ext_params, inti->ext.ext_params2);
                vcpu->stat.deliver_virtio_interrupt++;
-               rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x1237);
+               rc = put_guest_u16(vcpu, __LC_EXT_INT_CODE, 0x2603);
+               if (rc == -EFAULT)
+                       exception = 1;
+
+               rc = put_guest_u16(vcpu, __LC_CPU_ADDRESS, 0x0d00);
                if (rc == -EFAULT)
                        exception = 1;
 
diff --git a/drivers/s390/kvm/kvm_virtio.c b/drivers/s390/kvm/kvm_virtio.c
index cb46cf2..bbef376 100644
--- a/drivers/s390/kvm/kvm_virtio.c
+++ b/drivers/s390/kvm/kvm_virtio.c
@@ -23,6 +23,8 @@
 #include <asm/setup.h>
 #include <asm/s390_ext.h>
 
+#define VIRTIO_SUBCODE_64 0x0D00
+
 /*
  * The pointer to our (page) of device descriptions.
  */
@@ -291,6 +293,10 @@ static void scan_devices(void)
 static void kvm_extint_handler(u16 code)
 {
        void *data = (void *) *(long *) __LC_PFAULT_INTPARM;
+       u16 subcode = S390_lowcore.cpu_addr;
+
+       if ((subcode & 0xff00) != VIRTIO_SUBCODE_64)
+               return;
 
        vring_interrupt(0, data);
 }
@@ -319,8 +325,8 @@ static int __init kvm_devices_init(void)
 
        kvm_devices  = (void *) (max_pfn << PAGE_SHIFT);
 
-       register_external_interrupt(0x1237, kvm_extint_handler);
        ctl_set_bit(0, 9);
+       register_external_interrupt(0x2603, kvm_extint_handler);
 
        scan_devices();
        return 0;
diff --git a/include/linux/kvm.h b/include/linux/kvm.h
index c5675e8..f8e211d 100644
--- a/include/linux/kvm.h
+++ b/include/linux/kvm.h
@@ -250,7 +250,7 @@ struct kvm_s390_psw {
 #define KVM_S390_PROGRAM_INT           0xfffe0001u
 #define KVM_S390_SIGP_SET_PREFIX       0xfffe0002u
 #define KVM_S390_RESTART               0xfffe0003u
-#define KVM_S390_INT_VIRTIO            0xffff1237u /*FIXME arch number */
+#define KVM_S390_INT_VIRTIO            0xffff2603u
 #define KVM_S390_INT_SERVICE           0xffff2401u
 #define KVM_S390_INT_EMERGENCY         0xffff1201u
 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
kvm-commits mailing list
kvm-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/kvm-commits

Reply via email to