Message ID | 1341488454.18786.15.camel@lappy (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 07/05/2012 07:40 PM, Sasha Levin wrote: > On Thu, 2012-07-05 at 18:29 +0800, Jason Wang wrote: >> Instead of storing the queue index in virtio infos, this patch moves them to >> vring_virtqueue and introduces helpers to set and get the value. This would >> simplify the management and tracing. >> >> Signed-off-by: Jason Wang<jasowang@redhat.com> > This patch actually fails to compile: > > drivers/virtio/virtio_mmio.c: In function ‘vm_notify’: > drivers/virtio/virtio_mmio.c:229:13: error: ‘struct virtio_mmio_vq_info’ has no member named ‘queue_index’ > drivers/virtio/virtio_mmio.c: In function ‘vm_del_vq’: > drivers/virtio/virtio_mmio.c:278:13: error: ‘struct virtio_mmio_vq_info’ has no member named ‘queue_index’ > make[2]: *** [drivers/virtio/virtio_mmio.o] Error 1 > > It probably misses the following hunks: > > diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c > index f5432b6..12b6180 100644 > --- a/drivers/virtio/virtio_mmio.c > +++ b/drivers/virtio/virtio_mmio.c > @@ -222,11 +222,10 @@ static void vm_reset(struct virtio_device *vdev) > static void vm_notify(struct virtqueue *vq) > { > struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); > - struct virtio_mmio_vq_info *info = vq->priv; > > /* We write the queue's selector into the notification register to > * signal the other end */ > - writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY); > + writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY); > } > > /* Notify all virtqueues on an interrupt. */ > @@ -275,7 +274,7 @@ static void vm_del_vq(struct virtqueue *vq) > vring_del_virtqueue(vq); > > /* Select and deactivate the queue */ > - writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); > + writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); > writel(0, vm_dev->base + VIRTIO_MMIO_QUEUE_PFN); > > size = PAGE_ALIGN(vring_size(info->num, VIRTIO_MMIO_VRING_ALIGN)); > Oops, I miss the virtio mmio part, thanks for pointing this. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Il 05/07/2012 13:40, Sasha Levin ha scritto: > @@ -275,7 +274,7 @@ static void vm_del_vq(struct virtqueue *vq) > vring_del_virtqueue(vq); > > /* Select and deactivate the queue */ > - writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); > + writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); > writel(0, vm_dev->base + VIRTIO_MMIO_QUEUE_PFN); > This accesses vq after vring_del_virtqueue has freed it. Paolo -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
On 07/26/2012 04:20 PM, Paolo Bonzini wrote: > Il 05/07/2012 13:40, Sasha Levin ha scritto: >> @@ -275,7 +274,7 @@ static void vm_del_vq(struct virtqueue *vq) >> vring_del_virtqueue(vq); >> >> /* Select and deactivate the queue */ >> - writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); >> + writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); >> writel(0, vm_dev->base + VIRTIO_MMIO_QUEUE_PFN); >> > This accesses vq after vring_del_virtqueue has freed it. > > Paolo > > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Yes, so need a temporary variable before vring_del_virtqueue(). Thanks. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/drivers/virtio/virtio_mmio.c b/drivers/virtio/virtio_mmio.c index f5432b6..12b6180 100644 --- a/drivers/virtio/virtio_mmio.c +++ b/drivers/virtio/virtio_mmio.c @@ -222,11 +222,10 @@ static void vm_reset(struct virtio_device *vdev) static void vm_notify(struct virtqueue *vq) { struct virtio_mmio_device *vm_dev = to_virtio_mmio_device(vq->vdev); - struct virtio_mmio_vq_info *info = vq->priv; /* We write the queue's selector into the notification register to * signal the other end */ - writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY); + writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_NOTIFY); } /* Notify all virtqueues on an interrupt. */ @@ -275,7 +274,7 @@ static void vm_del_vq(struct virtqueue *vq) vring_del_virtqueue(vq); /* Select and deactivate the queue */ - writel(info->queue_index, vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); + writel(virtqueue_get_queue_index(vq), vm_dev->base + VIRTIO_MMIO_QUEUE_SEL); writel(0, vm_dev->base + VIRTIO_MMIO_QUEUE_PFN); size = PAGE_ALIGN(vring_size(info->num, VIRTIO_MMIO_VRING_ALIGN));