From mboxrd@z Thu Jan 1 00:00:00 1970 From: Christian Borntraeger Subject: Re: [PATCH 8/8] s390: Add new channel I/O based virtio transport. Date: Tue, 11 Dec 2012 13:06:10 +0100 Message-ID: <50C721B2.9030200@de.ibm.com> References: <1354884626-15060-1-git-send-email-cornelia.huck@de.ibm.com> <1354884626-15060-9-git-send-email-cornelia.huck@de.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: kvm-owner@vger.kernel.org List-Archive: List-Post: To: Alexander Graf Cc: Cornelia Huck , qemu-devel , KVM , linux-s390 , Marcelo Tosatti , Gleb Natapov , Anthony Liguori , Carsten Otte , Heiko Carstens , Martin Schwidefsky , Sebastian Ott List-ID: On 11/12/12 11:53, Alexander Graf wrote: > > On 07.12.2012, at 13:50, Cornelia Huck wrote: > >> Add a new virtio transport that uses channel commands to perform >> virtio operations. >> >> Add a new machine type s390-ccw that uses this virtio-ccw transport >> and make it the default machine for s390. >> >> Signed-off-by: Cornelia Huck >> --- >> hw/s390-virtio.c | 149 ++++++-- >> hw/s390x/Makefile.objs | 1 + >> hw/s390x/virtio-ccw.c | 909 +++++++++++++++++++++++++++++++++++++++++++++++++ >> hw/s390x/virtio-ccw.h | 81 +++++ >> trace-events | 4 + >> 5 files changed, 1124 insertions(+), 20 deletions(-) >> create mode 100644 hw/s390x/virtio-ccw.c >> create mode 100644 hw/s390x/virtio-ccw.h >> >> diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c >> index 9e1afb2..f29ff74 100644 >> --- a/hw/s390-virtio.c >> +++ b/hw/s390-virtio.c >> @@ -33,6 +33,8 @@ >> >> #include "hw/s390-virtio-bus.h" >> #include "hw/s390x/sclp.h" >> +#include "hw/s390x/css.h" >> +#include "hw/s390x/virtio-ccw.h" >> >> //#define DEBUG_S390 >> >> @@ -47,6 +49,7 @@ >> #define KVM_S390_VIRTIO_NOTIFY 0 >> #define KVM_S390_VIRTIO_RESET 1 >> #define KVM_S390_VIRTIO_SET_STATUS 2 >> +#define KVM_S390_VIRTIO_CCW_NOTIFY 3 >> >> #define KERN_IMAGE_START 0x010000UL >> #define KERN_PARM_AREA 0x010480UL >> @@ -63,6 +66,7 @@ >> >> static VirtIOS390Bus *s390_bus; >> static S390CPU **ipi_states; >> +VirtioCcwBus *ccw_bus; >> >> S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) >> { >> @@ -76,15 +80,21 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) >> int s390_virtio_hypercall(CPUS390XState *env, uint64_t mem, uint64_t hypercall) >> { >> int r = 0, i; >> + int cssid, ssid, schid, m; >> + SubchDev *sch; >> >> dprintf("KVM hypercall: %ld\n", hypercall); >> switch (hypercall) { >> case KVM_S390_VIRTIO_NOTIFY: >> if (mem > ram_size) { >> - VirtIOS390Device *dev = s390_virtio_bus_find_vring(s390_bus, >> - mem, &i); >> - if (dev) { >> - virtio_queue_notify(dev->vdev, i); >> + if (s390_bus) { >> + VirtIOS390Device *dev = s390_virtio_bus_find_vring(s390_bus, >> + mem, &i); >> + if (dev) { >> + virtio_queue_notify(dev->vdev, i); >> + } else { >> + r = -EINVAL; >> + } > > We really want to factor out the DIAG handling code similar to how spapr handles its hypercalls. That way the legacy s390-virtio machine can register a VIRTIO_NOTIFY hypercall that works for it here, while the s390-virtio-ccw machine doesn't. > Agreed, but this has nothing to do with virtio-ccw and should be part of a follow-up cleanup. no? Christian From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43619) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiObN-0002dB-B6 for qemu-devel@nongnu.org; Tue, 11 Dec 2012 07:06:26 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TiObI-00012b-Tz for qemu-devel@nongnu.org; Tue, 11 Dec 2012 07:06:21 -0500 Received: from e06smtp16.uk.ibm.com ([195.75.94.112]:50665) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TiObI-00012E-LT for qemu-devel@nongnu.org; Tue, 11 Dec 2012 07:06:16 -0500 Received: from /spool/local by e06smtp16.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 11 Dec 2012 12:05:58 -0000 Received: from d06av05.portsmouth.uk.ibm.com (d06av05.portsmouth.uk.ibm.com [9.149.37.229]) by b06cxnps4074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id qBBC639j53281012 for ; Tue, 11 Dec 2012 12:06:03 GMT Received: from d06av05.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av05.portsmouth.uk.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id qBBC6BWR023668 for ; Tue, 11 Dec 2012 05:06:11 -0700 Message-ID: <50C721B2.9030200@de.ibm.com> Date: Tue, 11 Dec 2012 13:06:10 +0100 From: Christian Borntraeger MIME-Version: 1.0 References: <1354884626-15060-1-git-send-email-cornelia.huck@de.ibm.com> <1354884626-15060-9-git-send-email-cornelia.huck@de.ibm.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 8/8] s390: Add new channel I/O based virtio transport. List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf Cc: linux-s390 , Anthony Liguori , KVM , Gleb Natapov , Carsten Otte , Sebastian Ott , Marcelo Tosatti , Heiko Carstens , qemu-devel , Martin Schwidefsky , Cornelia Huck On 11/12/12 11:53, Alexander Graf wrote: > > On 07.12.2012, at 13:50, Cornelia Huck wrote: > >> Add a new virtio transport that uses channel commands to perform >> virtio operations. >> >> Add a new machine type s390-ccw that uses this virtio-ccw transport >> and make it the default machine for s390. >> >> Signed-off-by: Cornelia Huck >> --- >> hw/s390-virtio.c | 149 ++++++-- >> hw/s390x/Makefile.objs | 1 + >> hw/s390x/virtio-ccw.c | 909 +++++++++++++++++++++++++++++++++++++++++++++++++ >> hw/s390x/virtio-ccw.h | 81 +++++ >> trace-events | 4 + >> 5 files changed, 1124 insertions(+), 20 deletions(-) >> create mode 100644 hw/s390x/virtio-ccw.c >> create mode 100644 hw/s390x/virtio-ccw.h >> >> diff --git a/hw/s390-virtio.c b/hw/s390-virtio.c >> index 9e1afb2..f29ff74 100644 >> --- a/hw/s390-virtio.c >> +++ b/hw/s390-virtio.c >> @@ -33,6 +33,8 @@ >> >> #include "hw/s390-virtio-bus.h" >> #include "hw/s390x/sclp.h" >> +#include "hw/s390x/css.h" >> +#include "hw/s390x/virtio-ccw.h" >> >> //#define DEBUG_S390 >> >> @@ -47,6 +49,7 @@ >> #define KVM_S390_VIRTIO_NOTIFY 0 >> #define KVM_S390_VIRTIO_RESET 1 >> #define KVM_S390_VIRTIO_SET_STATUS 2 >> +#define KVM_S390_VIRTIO_CCW_NOTIFY 3 >> >> #define KERN_IMAGE_START 0x010000UL >> #define KERN_PARM_AREA 0x010480UL >> @@ -63,6 +66,7 @@ >> >> static VirtIOS390Bus *s390_bus; >> static S390CPU **ipi_states; >> +VirtioCcwBus *ccw_bus; >> >> S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) >> { >> @@ -76,15 +80,21 @@ S390CPU *s390_cpu_addr2state(uint16_t cpu_addr) >> int s390_virtio_hypercall(CPUS390XState *env, uint64_t mem, uint64_t hypercall) >> { >> int r = 0, i; >> + int cssid, ssid, schid, m; >> + SubchDev *sch; >> >> dprintf("KVM hypercall: %ld\n", hypercall); >> switch (hypercall) { >> case KVM_S390_VIRTIO_NOTIFY: >> if (mem > ram_size) { >> - VirtIOS390Device *dev = s390_virtio_bus_find_vring(s390_bus, >> - mem, &i); >> - if (dev) { >> - virtio_queue_notify(dev->vdev, i); >> + if (s390_bus) { >> + VirtIOS390Device *dev = s390_virtio_bus_find_vring(s390_bus, >> + mem, &i); >> + if (dev) { >> + virtio_queue_notify(dev->vdev, i); >> + } else { >> + r = -EINVAL; >> + } > > We really want to factor out the DIAG handling code similar to how spapr handles its hypercalls. That way the legacy s390-virtio machine can register a VIRTIO_NOTIFY hypercall that works for it here, while the s390-virtio-ccw machine doesn't. > Agreed, but this has nothing to do with virtio-ccw and should be part of a follow-up cleanup. no? Christian