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 <cornelia.huck@xxxxxxxxxx> >> --- >> 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 -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html