Commit 169294a1 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Michael S. Tsirkin
Browse files

vringh: use bvec_kmap_local



Use the bvec_kmap_local helper rather than digging into the bvec
internals.

Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
Message-Id: <20250501142244.2888227-1-hch@lst.de>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Reviewed-by: default avatarChaitanya Kulkarni <kch@nvidia.com>
parent 8b3f9967
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -1290,11 +1290,10 @@ static inline int getu16_iotlb(const struct vringh *vrh,
		if (ret)
			return ret;
	} else {
		void *kaddr = kmap_local_page(ivec.iov.bvec[0].bv_page);
		void *from = kaddr + ivec.iov.bvec[0].bv_offset;
		__virtio16 *from = bvec_kmap_local(&ivec.iov.bvec[0]);

		tmp = READ_ONCE(*(__virtio16 *)from);
		kunmap_local(kaddr);
		tmp = READ_ONCE(*from);
		kunmap_local(from);
	}

	*val = vringh16_to_cpu(vrh, tmp);
@@ -1329,11 +1328,10 @@ static inline int putu16_iotlb(const struct vringh *vrh,
		if (ret)
			return ret;
	} else {
		void *kaddr = kmap_local_page(ivec.iov.bvec[0].bv_page);
		void *to = kaddr + ivec.iov.bvec[0].bv_offset;
		__virtio16 *to = bvec_kmap_local(&ivec.iov.bvec[0]);

		WRITE_ONCE(*(__virtio16 *)to, tmp);
		kunmap_local(kaddr);
		WRITE_ONCE(*to, tmp);
		kunmap_local(to);
	}

	return 0;