From mboxrd@z Thu Jan 1 00:00:00 1970 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 6A1C2229B12 for ; Thu, 15 Jan 2026 08:41:02 +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=1768466464; cv=none; b=JclFBUsvVShl4e5cMPHGjolOiooeiSX3x9i3CrWS+URlsaIpVU2V/1n4TLQZzvKSjrIzhJRggN/xosZrVaVlq9Xu4gQTASFCbnq0Lzd8tfKuC7zqznd3i9+AlIKAIDj9OIv6R2In0St4PJM8+MlGTgkwQVMu/lh7V+1ocjAMYvs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768466464; c=relaxed/simple; bh=+wzBuN4KidO8MO6orQXf7y66N/RZ6NStFOIpjiDyUyY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=L1JveC7xjAf65k+bIVMpQfTslHYcnWX3h1RXG/6ArWE6OPXYKfsR2hlPt7VbfSrQlsDLkxU2HJd8Az9YCTEo69t4uokoR5gw4YDfmNGcsKnbPWxSyyhCxJkT1KCSiQ7GcWHtaF9PGOtR/pbaYTMNYqtZM9hb39NpaLt9woAUQ14= 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=fIy7JqX2; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=HXrI5xJt; 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="fIy7JqX2"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="HXrI5xJt" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1768466461; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CGq0ojxFgIbcUhxRFKzME0p+XYpvzFHdQrjvntUvkPI=; b=fIy7JqX2naiQnapGT4r5GKP7k/VcCIeHgZMGOSCnMIF3cel3hDmy98tMHPlvngnJFCpTMA OcPiD1xQZUWSKW/+Uiqq33v01/BDX0N5rJGExhTcbb2OHGovgzxMwwrRGfeWdJvxUM+UEX FTf5HKzp1YXAtY9U2evfiYTEzniwJkA= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-599-4ux3zx4sN22Gh6ik7vBQHg-1; Thu, 15 Jan 2026 03:40:59 -0500 X-MC-Unique: 4ux3zx4sN22Gh6ik7vBQHg-1 X-Mimecast-MFC-AGG-ID: 4ux3zx4sN22Gh6ik7vBQHg_1768466459 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-47d3ffa98fcso3821625e9.3 for ; Thu, 15 Jan 2026 00:40:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1768466458; x=1769071258; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=CGq0ojxFgIbcUhxRFKzME0p+XYpvzFHdQrjvntUvkPI=; b=HXrI5xJtm85SgQb5dSHk4QzHjq0MuoTvyLOrQOvcDQWWKTf7C4qS1vDpg/f/P1hfhb uoMhIWu64BQzLcWWyRWh3eFEJ4Oj/0m3qUGY4zRh9lokrLGB8gN2Ci0hy/INFGmZ6bx7 SEh3z4FC0xBJ7GvJ4GKc7COPhcxkyZyWz9G20R8oMixpA7YmljOIuMlJtwndokgxV+5j h1gZWwHbMUrktLIiDaBpm4b9+klilfh3JPhTUTc4LirUX4r+HPg32uMUi7+SWk3X++qj kLKole2aR9GGoLraS6+BdHCFbgwNwHKDCE1WJXkpcQzxeRrVQ9Lyy43M3Jv/cVr/Li8d i5bg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768466458; x=1769071258; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CGq0ojxFgIbcUhxRFKzME0p+XYpvzFHdQrjvntUvkPI=; b=KY8U5OFu8ZKMD48CRd4cKa7EY3BcgawPKVPR8itXnXRywIjZgoFZpyXgDcxOfcbTaf brYenJtHu3NrKZl9JDLUs1mZcCOfABUedAMRDYo4gSjlBsNzWZeP4BXq4qVqsG5F0msZ O/HKxivFMCFAvD702z8Yo4nZX7uBXVnssXyo+pMKNoB/TOmTHRUpttASOVNo3AnWKq1M kAW+A7xwBqVQQsaE/rrkB3XiW6cFu7f+LF25OkrYjnx7a49A6xgY5+vX2WHJ8qOU9lNG YFTHaLvb3ijei/0I37eBQrGKpTu9nm0jEHmD7OcST/sv4e9K6YSZSpkPgiOGJb8oEoG8 ifhw== X-Forwarded-Encrypted: i=1; AJvYcCUqaK7LbPA9D4D4Jw64/hH6QosOxqOua6xJUHC1g5XNNGapQ0+gSl2gKdwtuQBjVIJFY77pprr5RahTYtw=@vger.kernel.org X-Gm-Message-State: AOJu0Yynxydk/ck60fddItk7zehRFXP5zp1ejI3ggrMTP3wapjsPdQUY M1p0BvxjJKD5CCDCQC3dSRfFfauEbu9BUBfMOERicof1tnAATh/lWrLCqMKZVQ2yX83lttTb4PK W9RuwBgC2OpwPoh9O37Nbgv7KuPKm0ATqnlhxErz54MM9gFz6jbzvCFzunPGh3K2Uzw== X-Gm-Gg: AY/fxX50XUqogyUFblBN3nA8WiitIuvNhoBMiBjMKEOShjencGavtx59jMteNdjNhGt fn6e6lfs5dndzgoMepOS4Ax184POI1tdAfMnej3T/gKFupmrYbrJwi6BcXnfNqIrXWmbdXU8nDM D1P4IaRrajFb7JC8TXFDUjehMFPjSKqMqNFg0tR2IfE7LYuekFhcBRL8NPrwtePB4C8YFJ8+pwi dnRmVg2wavo+5wXgEZLVrCIOtKXuqdjtd8ppeZmt1uV+pdMf9ez1k2QOwrNoIPHP3cJuA90tZgV ZrhirnpInZE29d1rGjpLffLnV6ccKxjWEQ8jds172p3j6w2eDY++8JCN4zOC2a3TJrvYlt1Dt23 DTRmraWBHdDztZBk0FIcszOE1XyTBng== X-Received: by 2002:a05:600c:c4a1:b0:45d:dc85:c009 with SMTP id 5b1f17b1804b1-47ee3342eabmr59984415e9.10.1768466458543; Thu, 15 Jan 2026 00:40:58 -0800 (PST) X-Received: by 2002:a05:600c:c4a1:b0:45d:dc85:c009 with SMTP id 5b1f17b1804b1-47ee3342eabmr59984115e9.10.1768466458063; Thu, 15 Jan 2026 00:40:58 -0800 (PST) Received: from redhat.com (IGLD-80-230-35-22.inter.net.il. [80.230.35.22]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-47f42907141sm34468375e9.9.2026.01.15.00.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Jan 2026 00:40:57 -0800 (PST) Date: Thu, 15 Jan 2026 03:40:54 -0500 From: "Michael S. Tsirkin" To: Eugenio =?iso-8859-1?Q?P=E9rez?= Cc: Maxime Coquelin , Xuan Zhuo , virtualization@lists.linux.dev, jasowang@redhat.com, Stefano Garzarella , Yongji Xie , linux-kernel@vger.kernel.org, Cindy Lu , Laurent Vivier Subject: Re: [PATCH v12 13/13] Documentation: Add documentation for VDUSE Address Space IDs Message-ID: <20260115033239-mutt-send-email-mst@kernel.org> References: <20260114184839.926884-1-eperezma@redhat.com> <20260114184839.926884-14-eperezma@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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260114184839.926884-14-eperezma@redhat.com> On Wed, Jan 14, 2026 at 07:48:39PM +0100, Eugenio Pérez wrote: > Address Space IDs allows the VDUSE framework to support devices able to > expose different virtqueues to different part of the drivers. For > example, to let QEMU handle the net device control virtqueue, so QEMU > always knows the state of the device like mac address or number of > queues enabled, while leaving the dataplane passtrhough to the guest passthrough > intact. This enables live migration. > > Expands the VDUSE documentation to explain how to use the new ioctls or > the new struct members of old ioctls. > > Signed-off-by: Eugenio Pérez > --- > v12: New in V12. Requested by Jason. > --- > Documentation/userspace-api/vduse.rst | 49 +++++++++++++++++++++++++++ > 1 file changed, 49 insertions(+) > > diff --git a/Documentation/userspace-api/vduse.rst b/Documentation/userspace-api/vduse.rst > index bdb880e01132..66110d918815 100644 > --- a/Documentation/userspace-api/vduse.rst > +++ b/Documentation/userspace-api/vduse.rst > @@ -230,4 +230,53 @@ able to start the dataplane processing as follows: > 5. Inject an interrupt for specific virtqueue with the VDUSE_INJECT_VQ_IRQ ioctl > after the used ring is filled. > > +Enabling ASID (API version 1) > +------------------------------ > + > +VDUSE supports per-address-space identifiers (ASIDs) starting with API > +version 1. Setup it Set it up > with ioctl(VDUSE_SET_API_VERSION) on `/dev/vduse/control` and > +pass `VDUSE_API_VERSION_1` before creating a new VDUSE instance with > +ioctl(VDUSE_CREATE_DEV). > + > +Afterwards, you can use the member asid of ioctl(VDUSE_IOTLB_GET_INFO) to > +select the address space of the IOTLB you are queryng. querying > Similarly, you can use > +ioctl(VDUSE_IOTLB_GET_FD2) to obtain the file descriptor describing an IOVA > +region of an specific ASID. Example usage: a specific > + > +.. code-block:: c > + > + static void *iova_to_va(int dev_fd, uint32_t asid, uint64_t iova, > + uint64_t *len) > + { > + int fd; > + void *addr; > + size_t size; > + struct vduse_iotlb_entry_v2 entry = { 0 }; > + > + entry.v1.start = iova; > + entry.v1.last = iova; > + entry.asid = asid; > + > + fd = ioctl(dev_fd, VDUSE_IOTLB_GET_FD2, &entry); > + if (fd < 0) > + return NULL; > + > + size = entry.v1.last - entry.v1.start + 1; > + *len = entry.v1.last - iova + 1; > + addr = mmap(0, size, perm_to_prot(entry.v1.perm), MAP_SHARED, > + fd, entry.v1.offset); > + close(fd); > + if (addr == MAP_FAILED) > + return NULL; > + > + /* > + * Using some data structures such as linked list to store > + * the iotlb mapping. The munmap(2) should be called for the > + * cached mapping when the corresponding VDUSE_UPDATE_IOTLB > + * message is received or the device is reset. > + */ > + > + return addr + iova - entry.start; > + } > + > For more details on the uAPI, please see include/uapi/linux/vduse.h. > -- > 2.52.0