[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH v3 09/14] plat/drivers: Enable/disable interrupts on virtio block queues
LGTM, Reviewed-by: Jia He <justin.he@xxxxxxx> > -----Original Message----- > From: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx> > Sent: Friday, March 6, 2020 4:30 AM > To: minios-devel@xxxxxxxxxxxxx > Cc: Justin He <Justin.He@xxxxxxx>; Roxana Nicolescu > <nicolescu.roxana1996@xxxxxxxxx> > Subject: [UNIKRAFT PATCH v3 09/14] plat/drivers: Enable/disable interrupts > on virtio block queues > > This patch introduces support for the user to enable/disable interrupts > on queues. > > Signed-off-by: Roxana Nicolescu <nicolescu.roxana1996@xxxxxxxxx> > --- > plat/drivers/virtio/virtio_blk.c | 49 ++++++++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > > diff --git a/plat/drivers/virtio/virtio_blk.c > b/plat/drivers/virtio/virtio_blk.c > index 46d3236f..cb732135 100644 > --- a/plat/drivers/virtio/virtio_blk.c > +++ b/plat/drivers/virtio/virtio_blk.c > @@ -35,6 +35,11 @@ > #define DRIVER_NAME"virtio-blk" > #define DEFAULT_SECTOR_SIZE512 > > +#defineVTBLK_INTR_EN(1 << 0) > +#defineVTBLK_INTR_EN_MASK(1) > +#defineVTBLK_INTR_USR_EN(1 << 1) > +#defineVTBLK_INTR_USR_EN_MASK(2) > + > #define to_virtioblkdev(bdev) \ > __containerof(bdev, struct virtio_blk_device, blkdev) > > @@ -86,6 +91,8 @@ struct uk_blkdev_queue { > uint16_t max_nb_desc; > /* The nr. of descriptor user configured */ > uint16_t nb_desc; > +/* The flag to interrupt on the queue */ > +uint8_t intr_enabled; > /* Reference to virtio_blk_device */ > struct virtio_blk_device *vbd; > /* The scatter list and its associated fragments */ > @@ -102,11 +109,51 @@ static int virtio_blkdev_recv_done(struct virtqueue > *vq, void *priv) > > queue = (struct uk_blkdev_queue *) priv; > > +/* Disable the interrupt for the ring */ > +virtqueue_intr_disable(vq); > +queue->intr_enabled &= ~(VTBLK_INTR_EN); > + > uk_blkdev_drv_queue_event(&queue->vbd->blkdev, queue- > >lqueue_id); > > return 1; > } > > +static int virtio_blkdev_queue_intr_enable(struct uk_blkdev *dev, > +struct uk_blkdev_queue *queue) > +{ > +int rc = 0; > + > +UK_ASSERT(dev); > + > +/* If the interrupt is enabled */ > +if (queue->intr_enabled & VTBLK_INTR_EN) > +return 0; > + > +/** > + * Enable the user configuration bit. This would cause the interrupt > to > + * be enabled automatically, if the interrupt could not be enabled > now > + * due to data in the queue. > + */ > +queue->intr_enabled = VTBLK_INTR_USR_EN; > +rc = virtqueue_intr_enable(queue->vq); > +if (!rc) > +queue->intr_enabled |= VTBLK_INTR_EN; > + > +return rc; > +} > + > +static int virtio_blkdev_queue_intr_disable(struct uk_blkdev *dev, > +struct uk_blkdev_queue *queue) > +{ > +UK_ASSERT(dev); > +UK_ASSERT(queue); > + > +virtqueue_intr_disable(queue->vq); > +queue->intr_enabled &= ~(VTBLK_INTR_USR_EN | VTBLK_INTR_EN); > + > +return 0; > +} > + > /** > * This function setup the vring infrastructure. > */ > @@ -459,6 +506,8 @@ static const struct uk_blkdev_ops virtio_blkdev_ops = > { > .dev_configure = virtio_blkdev_configure, > .queue_get_info = virtio_blkdev_queue_info_get, > .queue_setup = virtio_blkdev_queue_setup, > +.queue_intr_enable = virtio_blkdev_queue_intr_enable, > +.queue_intr_disable = virtio_blkdev_queue_intr_disable, > .queue_release = virtio_blkdev_queue_release, > .dev_unconfigure = virtio_blkdev_unconfigure, > }; > -- > 2.17.1 IMPORTANT NOTICE: The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you. _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |