From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202412 header.b=H0QoqVvC; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 4BA795A0276 for ; Fri, 20 Dec 2024 02:13:39 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1734657205; bh=tAsrT+tVk1iXq35EifsMKE30BK31hlKtAMzu9iPXVlo=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=H0QoqVvCHTU4YY0Z2z1/C8XatfZEVIYV+ofNz4J1TNDRLxOXlXZhCnJZkzwLxu7ZZ rEMaCdqtzf6B5BwBtFIyspEz+g5FInETDYbPxW2X9r64Q7lCvvGaSHozRkZ3//GoNY tSvU1GxOqdwW0/mK+MnqOaXkiAFCLqWH3c+m3pEwUFv7FU3BPATddCI4TGR64PrBpJ 9aO6n5hYSglhlGircJUB8oV2tUmyLFYsEsfnmnVtjKyBuOx5PJ4Xd9V0QFG0qnQzRF mtPCFrQSoRdgAtncshd+6e9qtfZ09Tsn52KL59e6B355cKUEGGnonQnekrsV6Odojj aolHCyqPNunjA== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YDqDP48Q7z4wxm; Fri, 20 Dec 2024 12:13:25 +1100 (AEDT) Date: Fri, 20 Dec 2024 11:24:17 +1100 From: David Gibson To: Laurent Vivier Subject: Re: [PATCH 1/9] virtio: Use const pointer for vu_dev Message-ID: References: <20241219111400.2352110-1-lvivier@redhat.com> <20241219111400.2352110-2-lvivier@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="4uMX7rpugrkpE/wK" Content-Disposition: inline In-Reply-To: <20241219111400.2352110-2-lvivier@redhat.com> Message-ID-Hash: KODVZ3TMNDMWBI7W3LQXZER75WQ5HDB4 X-Message-ID-Hash: KODVZ3TMNDMWBI7W3LQXZER75WQ5HDB4 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --4uMX7rpugrkpE/wK Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Dec 19, 2024 at 12:13:52PM +0100, Laurent Vivier wrote: > We don't modify the structure in some virtio functions. >=20 > Signed-off-by: Laurent Vivier > Reviewed-by: David Gibson Fwiw, I think this could be merged immediately regardless of the rest of the series. > --- > virtio.c | 14 +++++++++----- > virtio.h | 2 +- > vu_common.c | 2 +- > vu_common.h | 2 +- > 4 files changed, 12 insertions(+), 8 deletions(-) >=20 > diff --git a/virtio.c b/virtio.c > index a76de5e00222..625bac385f0c 100644 > --- a/virtio.c > +++ b/virtio.c > @@ -92,7 +92,8 @@ > * > * Return: virtual address in our address space of the guest physical ad= dress > */ > -static void *vu_gpa_to_va(struct vu_dev *dev, uint64_t *plen, uint64_t g= uest_addr) > +static void *vu_gpa_to_va(const struct vu_dev *dev, uint64_t *plen, > + uint64_t guest_addr) > { > unsigned int i; > =20 > @@ -210,7 +211,8 @@ static void virtqueue_get_head(const struct vu_virtq = *vq, > * > * Return: -1 if there is an error, 0 otherwise > */ > -static int virtqueue_read_indirect_desc(struct vu_dev *dev, struct vring= _desc *desc, > +static int virtqueue_read_indirect_desc(const struct vu_dev *dev, > + struct vring_desc *desc, > uint64_t addr, size_t len) > { > uint64_t read_len; > @@ -390,7 +392,7 @@ static inline void vring_set_avail_event(const struct= vu_virtq *vq, > * > * Return: false on error, true otherwise > */ > -static bool virtqueue_map_desc(struct vu_dev *dev, > +static bool virtqueue_map_desc(const struct vu_dev *dev, > unsigned int *p_num_sg, struct iovec *iov, > unsigned int max_num_sg, > uint64_t pa, size_t sz) > @@ -426,7 +428,8 @@ static bool virtqueue_map_desc(struct vu_dev *dev, > * > * Return: -1 if there is an error, 0 otherwise > */ > -static int vu_queue_map_desc(struct vu_dev *dev, struct vu_virtq *vq, un= signed int idx, > +static int vu_queue_map_desc(const struct vu_dev *dev, > + struct vu_virtq *vq, unsigned int idx, > struct vu_virtq_element *elem) > { > const struct vring_desc *desc =3D vq->vring.desc; > @@ -504,7 +507,8 @@ static int vu_queue_map_desc(struct vu_dev *dev, stru= ct vu_virtq *vq, unsigned i > * > * Return: -1 if there is an error, 0 otherwise > */ > -int vu_queue_pop(struct vu_dev *dev, struct vu_virtq *vq, struct vu_virt= q_element *elem) > +int vu_queue_pop(const struct vu_dev *dev, struct vu_virtq *vq, > + struct vu_virtq_element *elem) > { > unsigned int head; > int ret; > diff --git a/virtio.h b/virtio.h > index 6410d60f9b3f..0af259df7dac 100644 > --- a/virtio.h > +++ b/virtio.h > @@ -170,7 +170,7 @@ static inline bool vu_has_protocol_feature(const stru= ct vu_dev *vdev, > =20 > bool vu_queue_empty(struct vu_virtq *vq); > void vu_queue_notify(const struct vu_dev *dev, struct vu_virtq *vq); > -int vu_queue_pop(struct vu_dev *dev, struct vu_virtq *vq, > +int vu_queue_pop(const struct vu_dev *dev, struct vu_virtq *vq, > struct vu_virtq_element *elem); > void vu_queue_detach_element(struct vu_virtq *vq); > void vu_queue_unpop(struct vu_virtq *vq); > diff --git a/vu_common.c b/vu_common.c > index 299b5a32e244..6d365bea5fe2 100644 > --- a/vu_common.c > +++ b/vu_common.c > @@ -73,7 +73,7 @@ void vu_init_elem(struct vu_virtq_element *elem, struct= iovec *iov, int elem_cnt > * > * Return: number of elements used to contain the frame > */ > -int vu_collect(struct vu_dev *vdev, struct vu_virtq *vq, > +int vu_collect(const struct vu_dev *vdev, struct vu_virtq *vq, > struct vu_virtq_element *elem, int max_elem, > size_t size, size_t *frame_size) > { > diff --git a/vu_common.h b/vu_common.h > index 901d97216c67..bd70faf3e226 100644 > --- a/vu_common.h > +++ b/vu_common.h > @@ -46,7 +46,7 @@ static inline void vu_set_element(struct vu_virtq_eleme= nt *elem, > =20 > void vu_init_elem(struct vu_virtq_element *elem, struct iovec *iov, > int elem_cnt); > -int vu_collect(struct vu_dev *vdev, struct vu_virtq *vq, > +int vu_collect(const struct vu_dev *vdev, struct vu_virtq *vq, > struct vu_virtq_element *elem, int max_elem, size_t size, > size_t *frame_size); > void vu_set_vnethdr(const struct vu_dev *vdev, --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --4uMX7rpugrkpE/wK Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmdkuTAACgkQzQJF27ox 2Gc9zhAAmKD0J3d+gr0lrAAxejRxjXEYXVoMFo9TH0NDZWjOIkWHcF2Oi9Cu4+aH HV0TWPD+RXY4UIkR8quBHQwHP79VBXH/DDMVapWUfW6pkDaqu+ZdXgivqBoPMPp+ x2MZdNNOGOx6KNpXFRt/yJsjrt5KtjkJ/Os3wcFY5vuWtsAx+XRZinP+kBiYU6+b iVAagzPRIw1hRmm+LBstV6ikO3ag2cJaVSuKROwZUJkhd6m6bsBrvsVcLB9SmPps CkXWP+1/RPJdn825HRAd6TPffoK6VHc0V3FNiJd08MHuvtJnM+XSyfY2c4uBqJha S54+v4OoDDrHtJwKMAf/LOFYy0JMhnOrJjVv1W+AutUIo6wh9pUV4mSp/bAmG3eF 4Oq0P6dPqb8UghrXuxqgPQFuNtltFSzExR8F1ELwzgC4LkM0ZhqMsXHEz7TdcOUw Bb5gyEtZ5GvyqFsZSG7CrRVH1pGrscDv8SAVaeDGv+Z0csinfawf51q0rq0EbdtZ IAKdvMUj9Ba1PRNiN+NfTDD/aDFGjhM6UhWFNDML7GTXA5nuO6njm4ZqNbAakHo6 QMDhiJb98mwTkilEir0jn3HtTNWtiUhwpZrh9sLP3I1Grl0vgPS7CoBIm7YMIX2M kwV++aI4BGESUP8rVwSKPOSNuu8Q1nTYTpGGAJBZycfO87XZim0= =/RgD -----END PGP SIGNATURE----- --4uMX7rpugrkpE/wK--