From nobody Sat Oct 4 03:01:36 2025 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 5A3942E62D4 for ; Thu, 21 Aug 2025 06:47:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755758853; cv=none; b=dHUXcOME88UZUYFOEh+fnWQlqQVD8OYY4wChYft1fbptmH2YTOkPAfaJoBzHhI34u+HExUXpLMFFe9kb84p7m/QVuheVlYBig85NyFKBXnorArwWcBM25Z3+cY3xZdY2XupN4BXaLxCXBmY+jmeOROpsal2Q640gAXU8e7o6KlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755758853; c=relaxed/simple; bh=LN8i5nBTtv1gH+nZSHIGAt4dxlhvtYXx78DZXdqjxb8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H5/8Mr4Jj1mp0EQUWMmxIbcvlwEEyPNJ016Wb9+GCe58k9gSedSdhVwvMKOgSAmwu/Qox42BJXaJ1MmWQTtg8CaUe6JlBCvqrcmeJXw2Apsr3fR0yXz4SHqGe5YVYjPqr86nXwE5ytXiBbimD0MDGPeMLYU2FscBTfcjYstLkQs= 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=a/O7kdyN; arc=none smtp.client-ip=170.10.129.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="a/O7kdyN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1755758850; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GAlkpiaWJFov7oj6MyH5JCLTU4KbmM5X75mHxRhVtrU=; b=a/O7kdyNv7arFLi4y7vOlZPLrXOq6iObnYHUPKBTcjnGqL5ui9lboHazUKlj4y/8V2MdIv 3KX972mKWT/sGtBA1T9eREYsfVXdUWpO3TfdbGFCgDQRgB5Y0Pb+8eEc7QtKwHQ1UtylwK Lg+d3uZz59+gTnsGrXJZP2ehDpIVjNE= Received: from mx-prod-mc-08.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-695-LzyzpzAKP5ivMKLIWH5-9g-1; Thu, 21 Aug 2025 02:47:27 -0400 X-MC-Unique: LzyzpzAKP5ivMKLIWH5-9g-1 X-Mimecast-MFC-AGG-ID: LzyzpzAKP5ivMKLIWH5-9g_1755758845 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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 89C32180036E; Thu, 21 Aug 2025 06:47:24 +0000 (UTC) Received: from localhost.localdomain (unknown [10.72.112.130]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id EBB5819560B0; Thu, 21 Aug 2025 06:47:18 +0000 (UTC) From: Jason Wang To: mst@redhat.com, jasowang@redhat.com, xuanzhuo@linux.alibaba.com, eperezma@redhat.com Cc: virtualization@lists.linux.dev, linux-kernel@vger.kernel.org, hch@infradead.org, Christoph Hellwig Subject: [PATCH V6 5/9] virtio_ring: rename dma_handle to map_handle Date: Thu, 21 Aug 2025 14:46:37 +0800 Message-ID: <20250821064641.5025-6-jasowang@redhat.com> In-Reply-To: <20250821064641.5025-1-jasowang@redhat.com> References: <20250821064641.5025-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-Transfer-Encoding: quoted-printable X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 Content-Type: text/plain; charset="utf-8" Following patch will introduce virtio map opreations which means the address is not necessarily used for DMA. Let's rename the dma_handle to map_handle first. Reviewed-by: Christoph Hellwig Reviewed-by: Xuan Zhuo Signed-off-by: Jason Wang --- drivers/virtio/virtio_ring.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/virtio/virtio_ring.c b/drivers/virtio/virtio_ring.c index cda9bc2121bf..46515b017ccb 100644 --- a/drivers/virtio/virtio_ring.c +++ b/drivers/virtio/virtio_ring.c @@ -305,18 +305,18 @@ size_t virtio_max_dma_size(const struct virtio_device= *vdev) EXPORT_SYMBOL_GPL(virtio_max_dma_size); =20 static void *vring_alloc_queue(struct virtio_device *vdev, size_t size, - dma_addr_t *dma_handle, gfp_t flag, + dma_addr_t *map_handle, gfp_t flag, union virtio_map map) { if (vring_use_map_api(vdev)) { return dma_alloc_coherent(map.dma_dev, size, - dma_handle, flag); + map_handle, flag); } else { void *queue =3D alloc_pages_exact(PAGE_ALIGN(size), flag); =20 if (queue) { phys_addr_t phys_addr =3D virt_to_phys(queue); - *dma_handle =3D (dma_addr_t)phys_addr; + *map_handle =3D (dma_addr_t)phys_addr; =20 /* * Sanity check: make sure we dind't truncate @@ -329,7 +329,7 @@ static void *vring_alloc_queue(struct virtio_device *vd= ev, size_t size, * warning and abort if we end up with an * unrepresentable address. */ - if (WARN_ON_ONCE(*dma_handle !=3D phys_addr)) { + if (WARN_ON_ONCE(*map_handle !=3D phys_addr)) { free_pages_exact(queue, PAGE_ALIGN(size)); return NULL; } @@ -339,11 +339,11 @@ static void *vring_alloc_queue(struct virtio_device *= vdev, size_t size, } =20 static void vring_free_queue(struct virtio_device *vdev, size_t size, - void *queue, dma_addr_t dma_handle, + void *queue, dma_addr_t map_handle, union virtio_map map) { if (vring_use_map_api(vdev)) - dma_free_coherent(map.dma_dev, size, queue, dma_handle); + dma_free_coherent(map.dma_dev, size, queue, map_handle); else free_pages_exact(queue, PAGE_ALIGN(size)); } --=20 2.31.1