On Thu, 26 Feb 2015 15:04:39 +0800 Jason Wang <jasow...@redhat.com> wrote:
> Instead of depending on marco, using a bus specific limit. > > Cc: Alexander Graf <ag...@suse.de> > Cc: Cornelia Huck <cornelia.h...@de.ibm.com> > Cc: Christian Borntraeger <borntrae...@de.ibm.com> > Cc: Richard Henderson <r...@twiddle.net> > Signed-off-by: Jason Wang <jasow...@redhat.com> > --- > hw/s390x/s390-virtio-ccw.c | 7 +++++-- > hw/s390x/virtio-ccw.c | 13 +++++++------ > include/hw/virtio/virtio.h | 1 + > 3 files changed, 13 insertions(+), 8 deletions(-) > > diff --git a/hw/s390x/s390-virtio-ccw.c b/hw/s390x/s390-virtio-ccw.c > index 71bafe0..6aeb815 100644 > --- a/hw/s390x/s390-virtio-ccw.c > +++ b/hw/s390x/s390-virtio-ccw.c > @@ -43,6 +43,7 @@ void io_subsystem_reset(void) > > static int virtio_ccw_hcall_notify(const uint64_t *args) > { > + VirtIODevice *vdev; > uint64_t subch_id = args[0]; > uint64_t queue = args[1]; > SubchDev *sch; > @@ -55,10 +56,12 @@ static int virtio_ccw_hcall_notify(const uint64_t *args) > if (!sch || !css_subch_visible(sch)) { > return -EINVAL; > } > - if (queue >= VIRTIO_PCI_QUEUE_MAX) { > + > + vdev = virtio_ccw_get_vdev(sch); > + if (queue >= virtio_get_queue_max(vdev)) { But we already know we have a virtio_ccw device, right? So why not just check against VIRTIO_CCW_QUEUE_MAX? > return -EINVAL; > } > - virtio_queue_notify(virtio_ccw_get_vdev(sch), queue); > + virtio_queue_notify(vdev, queue); > return 0; > > } (...) > diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h > index 9fe0d92..04ad532 100644 > --- a/include/hw/virtio/virtio.h > +++ b/include/hw/virtio/virtio.h > @@ -93,6 +93,7 @@ typedef struct VirtQueueElement > } VirtQueueElement; > > #define VIRTIO_PCI_QUEUE_MAX 64 > +#define VIRTIO_CCW_QUEUE_MAX 64 Does generic code need to know about the ccw limit? > > #define VIRTIO_NO_VECTOR 0xffff >