From nobody Thu Oct 2 09:17:09 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AFA622D46A9 for ; Fri, 19 Sep 2025 07:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758267157; cv=none; b=oOZn+m1rla7B45xhfQfigIOJdby7HS16NgtUYEoA1VgVUXZG8Z3RTUX/MC/wkX/1PNxgWJ40svicjQrN240a01JagGFwSjByn4qKBzUKwriZW0YfPaZmUGDSEd6uJafAOJ6KAvHTn6YmjrUE2vkdQbWqvbX2qUajsfjD8OPTIXQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758267157; c=relaxed/simple; bh=YT3vrhS+PUCC+eZtNTyINuu6CeMWKNqHlIf2nyOKauw=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=b002VTe/uzCeBpN0tePgdTh2GwSS2LMjS4hXxWJIH8ggC9d5voj5W9toCltet/1LskWLkAnUG34H7w8hiukTuakC/3CqxCEnxJtdWVqFN3fTE+W7qVK+POQUV/Zp6+GjBj/ZJK1rm26kgxuzZZXARyf+XXg5Kb4ofwPneVdLRxA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=LrQ5WLMk; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="LrQ5WLMk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1758267154; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oQNJDdpKQN4RItYG+T6p4p6o0SV+o4+2aVHoBVZKfjc=; b=LrQ5WLMkd0s8oywqSrqSxfkNFZrm1mQLke3j+SgdHMcMbropRcbrnys8DkMqbUYUZPzBY+ lfbbPwe/dD5oytoa8L2QwLuSWP6rJ4exy8BTWV5pVE7a4wpiqV0eOshsvXei7PlZqdBhri N1ELGFpX2i3WDOK9bVcMWL4MvihUg/w= Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-86-remhx1rwO6iOy5zSVdwKVg-1; Fri, 19 Sep 2025 03:32:30 -0400 X-MC-Unique: remhx1rwO6iOy5zSVdwKVg-1 X-Mimecast-MFC-AGG-ID: remhx1rwO6iOy5zSVdwKVg_1758267149 Received: from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id B235F18004D4; Fri, 19 Sep 2025 07:32:29 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.45]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id AC8B51956048; Fri, 19 Sep 2025 07:32:26 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com, virtualization@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH V6 07/19] virtio: switch to use vring_virtqueue for virtqueue_add variants Date: Fri, 19 Sep 2025 15:31:42 +0800 Message-ID: <20250919073154.49278-8-jasowang@redhat.com> In-Reply-To: <20250919073154.49278-1-jasowang@redhat.com> References: <20250919073154.49278-1-jasowang@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Those variants are used internally so let's switch to use vring_virtqueue as parameter to be consistent with other internal virtqueue helpers. Acked-by: Eugenio P=C3=A9rez Reviewed-by: Xuan Zhuo Signed-off-by: Jason Wang --- drivers/virtio/virtio_ring.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index 93c36314b5e7..3625c7ed2fbb 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -816,11 +816,10 @@ static bool more_used_split(const struct vring_virtqu= eue *vq) return virtqueue_poll_split(vq, vq->last_used_idx); } =20 -static void *virtqueue_get_buf_ctx_split(struct virtqueue *_vq, +static void *virtqueue_get_buf_ctx_split(struct vring_virtqueue *vq, unsigned int *len, void **ctx) { - struct vring_virtqueue *vq =3D to_vvq(_vq); void *ret; unsigned int i; u16 last_used; @@ -842,9 +841,9 @@ static void *virtqueue_get_buf_ctx_split(struct virtque= ue *_vq, virtio_rmb(vq->weak_barriers); =20 last_used =3D (vq->last_used_idx & (vq->split.vring.num - 1)); - i =3D virtio32_to_cpu(_vq->vdev, + i =3D virtio32_to_cpu(vq->vq.vdev, vq->split.vring.used->ring[last_used].id); - *len =3D virtio32_to_cpu(_vq->vdev, + *len =3D virtio32_to_cpu(vq->vq.vdev, vq->split.vring.used->ring[last_used].len); =20 if (unlikely(i >=3D vq->split.vring.num)) { @@ -866,7 +865,7 @@ static void *virtqueue_get_buf_ctx_split(struct virtque= ue *_vq, if (!(vq->split.avail_flags_shadow & VRING_AVAIL_F_NO_INTERRUPT)) virtio_store_mb(vq->weak_barriers, &vring_used_event(&vq->split.vring), - cpu_to_virtio16(_vq->vdev, vq->last_used_idx)); + cpu_to_virtio16(vq->vq.vdev, vq->last_used_idx)); =20 LAST_ADD_TIME_INVALID(vq); =20 @@ -1720,11 +1719,10 @@ static bool more_used_packed(const struct vring_vir= tqueue *vq) return virtqueue_poll_packed(vq, READ_ONCE(vq->last_used_idx)); } =20 -static void *virtqueue_get_buf_ctx_packed(struct virtqueue *_vq, +static void *virtqueue_get_buf_ctx_packed(struct vring_virtqueue *vq, unsigned int *len, void **ctx) { - struct vring_virtqueue *vq =3D to_vvq(_vq); u16 last_used, id, last_used_idx; bool used_wrap_counter; void *ret; @@ -2524,8 +2522,8 @@ void *virtqueue_get_buf_ctx(struct virtqueue *_vq, un= signed int *len, { struct vring_virtqueue *vq =3D to_vvq(_vq); =20 - return vq->packed_ring ? virtqueue_get_buf_ctx_packed(_vq, len, ctx) : - virtqueue_get_buf_ctx_split(_vq, len, ctx); + return vq->packed_ring ? virtqueue_get_buf_ctx_packed(vq, len, ctx) : + virtqueue_get_buf_ctx_split(vq, len, ctx); } EXPORT_SYMBOL_GPL(virtqueue_get_buf_ctx); =20 --=20 2.31.1