[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [RFCv4,01/35] plat/virtio: Introduce several helpers for virtio ring


  • To: Razvan Virtan <virtanrazvan@xxxxxxxxx>
  • From: Justin He <Justin.He@xxxxxxx>
  • Date: Tue, 11 May 2021 09:28:48 +0000
  • Accept-language: en-US, zh-CN
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=CbfZMcG8/pvHtR2oFgH048+i505TkvclgWoJZBeo0FY=; b=R0xDGpW76y4Khps4HRZSgGpmpiRHnz/WL4RNtfjCw3A/NmmURKylnjrAzImtzGmdd9JjLLZKYEgHWQ15pB/zmDJ+ypz8/gAx4ISVPcPfK0WMrX+2W4ca1w45r+RVQn48BdravMNCTeT+VD0RPiJtGYiu1Q5XjqKMA8J+mDS7+YfF46IiBqzJIWNUXjNmvqCGi8qNlxMNINRFcED9l7XMISb8YImJpMylauN0UeetWfYiwZ0v0Klvn7nU/8MEG19VAwgBlXcNp0GvGJvz2IB0qlw2zA+SwgjgINxJHkhFmak+kKygHnLEBhFK4Pdm6U5vAiV8tUaVb3hK6W3RWOPKQg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jVpwww1n2F1E+I02fV1v1/2EtskZJvWKiLxhhokXuQ5IgJVCO6GAs3ayt1eYDOQOhxuJHfbwYaMzl0NNXF2RoJD6J73cSHcrovR+o7GoXiQNzYVVjE3utr93/PESOO3K/NX29YBPv09eQwHtaowoRJmX8yDzXSQotOtwoKPxJhQmxwGmH7kbXxxHX0eURoldJN3lI9QjOctd/7USiBOXNFqQ+xyqjKUGD1eabO/JERmPqL3fdU390u3p5REDQ3g6HvBeGGrvl9nP3PmsLFLV7M/yl8H7tJYWUTEQl82sAey3DHekKErnx+eujxSxxQYvrD3kKAorRpwDi1fPbJxC0w==
  • Authentication-results-original: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com;
  • Cc: "minios-devel@xxxxxxxxxxxxx" <minios-devel@xxxxxxxxxxxxx>
  • Delivery-date: Tue, 11 May 2021 09:30:07 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: gmail.com; dkim=none (message not signed) header.d=none;gmail.com; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXGbwCrdWcrRWCQUKZ8YVCogevuqreUlxQ
  • Thread-topic: [RFCv4,01/35] plat/virtio: Introduce several helpers for virtio ring

Hi Razvan

> -----Original Message-----
> From: Minios-devel <minios-devel-bounces@xxxxxxxxxxxxxxxxxxxx> On Behalf Of
> Razvan Virtan
> Sent: Tuesday, March 16, 2021 12:55 AM
> To: Justin He <Justin.He@xxxxxxx>
> Cc: minios-devel@xxxxxxxxxxxxx
> Subject: Re: [RFCv4,01/35] plat/virtio: Introduce several helpers for
> virtio ring
>
> This patch looks good to me, I have only 2 inline sugestions for
> "virito_ring.c".
>
> diff --git a/plat/drivers/virtio/virtio_ring.c
> b/plat/drivers/virtio/virtio_ring.c
> index 0a5c3f3..bda7549 100644
> --- a/plat/drivers/virtio/virtio_ring.c
> +++ b/plat/drivers/virtio/virtio_ring.c
> @@ -262,6 +262,38 @@  __phys_addr virtqueue_physaddr(struct virtqueue *vq)
>       return ukplat_virt_to_phys(vrq->vring_mem);
>  }
>
> +__phys_addr virtqueue_get_avail_addr(struct virtqueue *vq)
> +{
> +     struct virtqueue_vring *vrq = NULL;
> +
> +     UK_ASSERT(vq);
> +
> +     vrq = to_virtqueue_vring(vq);
> Maybe `return ukplat_virt_to_phys((void *) vrq->vring.avail);` would be
> more straightforward?
> +     return virtqueue_physaddr(vq) +
> +             ((char *)vrq->vring.avail - (char *)vrq->vring.desc);
> +}
> +
> +__phys_addr virtqueue_get_used_addr(struct virtqueue *vq)
> +{
> +     struct virtqueue_vring *vrq = NULL;
> +
> +     UK_ASSERT(vq);
> +
> +     vrq = to_virtqueue_vring(vq);
> Maybe `return ukplat_virt_to_phys((void *) vrq->vring.used);` would be more
> straightforward?

I don't quite understand you suggestion here. Seems they are not equal.
ukplat_virt_to_phys((void *) vrq->vring.used) != virtqueue_physaddr(vq) + 
((char *)vrq->vring.used - (char *)vrq->vring.desc)


--
Cheers,
Justin (Jia He)


> +     return virtqueue_physaddr(vq) +
> +             ((char *)vrq->vring.used - (char *)vrq->vring.desc);
> +}
> +
> +unsigned int virtqueue_vring_get_num(struct virtqueue *vq)
> +{
> +     struct virtqueue_vring *vrq = NULL;
> +
> +     UK_ASSERT(vq);
> +
> +     vrq = to_virtqueue_vring(vq);
> +     return vrq->vring.num;
> +}
> +
>
> Reviewed-by: Razvan Virtan <virtanrazvan@xxxxxxxxx>

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.



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.