{"id":2198135,"url":"http://patchwork.ozlabs.org/api/1.0/covers/2198135/?format=json","project":{"id":14,"url":"http://patchwork.ozlabs.org/api/1.0/projects/14/?format=json","name":"QEMU Development","link_name":"qemu-devel","list_id":"qemu-devel.nongnu.org","list_email":"qemu-devel@nongnu.org","web_url":"","scm_url":"","webscm_url":""},"msgid":"<20260219130334.787858-1-aesteve@redhat.com>","date":"2026-02-19T13:03:27","name":"[v13,0/7] vhost-user: Add SHMEM_MAP/UNMAP requests","submitter":{"id":85915,"url":"http://patchwork.ozlabs.org/api/1.0/people/85915/?format=json","name":"Albert Esteve","email":"aesteve@redhat.com"},"series":[{"id":492672,"url":"http://patchwork.ozlabs.org/api/1.0/series/492672/?format=json","date":"2026-02-19T13:03:27","name":"vhost-user: Add SHMEM_MAP/UNMAP requests","version":13,"mbox":"http://patchwork.ozlabs.org/series/492672/mbox/"}],"headers":{"Return-Path":"<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>","X-Original-To":"incoming@patchwork.ozlabs.org","Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=cqwUlWme;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)"],"Received":["from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fGtr352m9z1xvg\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 20 Feb 2026 00:04:19 +1100 (AEDT)","from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1vt3hC-0007X9-Pt; Thu, 19 Feb 2026 08:03:54 -0500","from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <aesteve@redhat.com>)\n id 1vt3hA-0007WV-HU\n for qemu-devel@nongnu.org; Thu, 19 Feb 2026 08:03:52 -0500","from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <aesteve@redhat.com>)\n id 1vt3h8-0006GN-MP\n for qemu-devel@nongnu.org; Thu, 19 Feb 2026 08:03:52 -0500","from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-121-QmxcmrIdNO6OljSux_ipZw-1; Thu,\n 19 Feb 2026 08:03:45 -0500","from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 16AE01956088; Thu, 19 Feb 2026 13:03:43 +0000 (UTC)","from fedora.redhat.com (unknown [10.44.33.19])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 7609D1955F01; Thu, 19 Feb 2026 13:03:36 +0000 (UTC)"],"DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1771506229;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=GfnV/zKgRVgL1zzhb9CqiAMAu8czKO3LqF4YsD9cyIE=;\n b=cqwUlWmewmo4lWGTUXZKdEyrSXOXlhoDm/H1M3dZtZXrm7GighzZbbSCbtRI6QPzJKEFdf\n YgTNAoJwoCQQ5DQ9eVWNeOKePTKw8I8UjgNe2NqDxXEIQPwtRssdf3A/4DNJFBRawr0fSN\n 08rwbqLS547QhZhzgwnEBfFkSfUWufg=","X-MC-Unique":"QmxcmrIdNO6OljSux_ipZw-1","X-Mimecast-MFC-AGG-ID":"QmxcmrIdNO6OljSux_ipZw_1771506224","From":"Albert Esteve <aesteve@redhat.com>","To":"qemu-devel@nongnu.org","Cc":"Peter Xu <peterx@redhat.com>,\n Pierrick Bouvier <pierrick.bouvier@linaro.org>, mst@redhat.com,\n dbassey@redhat.com,\n =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= <philmd@linaro.org>, =?utf-8?q?Alex?=\n\t=?utf-8?q?_Benn=C3=A9e?= <alex.bennee@linaro.org>,\n Paolo Bonzini <pbonzini@redhat.com>, Fabiano Rosas <farosas@suse.de>,\n stefanha@redhat.com, manos.pitsidianakis@linaro.org,\n Stefano Garzarella <sgarzare@redhat.com>, jasowang@redhat.com,\n Laurent Vivier <lvivier@redhat.com>, slp@redhat.com, hi@alyssa.is,\n stevensd@chromium.org","Subject":"[PATCH v13 0/7] vhost-user: Add SHMEM_MAP/UNMAP requests","Date":"Thu, 19 Feb 2026 14:03:27 +0100","Message-ID":"<20260219130334.787858-1-aesteve@redhat.com>","Content-Type":"text/plain; charset=\"utf-8\"","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit","X-Scanned-By":"MIMEDefang 3.0 on 10.30.177.12","Received-SPF":"pass client-ip=170.10.129.124; envelope-from=aesteve@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com","X-Spam_score_int":"-20","X-Spam_score":"-2.1","X-Spam_bar":"--","X-Spam_report":"(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.045,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no","X-Spam_action":"no action","X-BeenThere":"qemu-devel@nongnu.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"qemu development <qemu-devel.nongnu.org>","List-Unsubscribe":"<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>","List-Archive":"<https://lists.nongnu.org/archive/html/qemu-devel>","List-Post":"<mailto:qemu-devel@nongnu.org>","List-Help":"<mailto:qemu-devel-request@nongnu.org?subject=help>","List-Subscribe":"<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>","Errors-To":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org","Sender":"qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org"},"content":"Hi all,\n\nv12-v13\n- SMEM_UNMAP spec update to explicitly state the use of\n  VHOST_USER_PROTOCOL_F_REPLY_ACK for replies\n- Removed confusing remark for 0-sized regions in\n  GET_SHMEM_CONFIG\nv11->v12\n- Refined VIRTIO Shared Memory Region configuration mem size\n  spec description\n- Removed unused name in vhost-user-base's vub_device_realize to\n  avoid build error\n- Initialize shmem in vhost_user_backend_handle_shmem_unmap\n  to avoid compiler being confused\n- Added stub for memory_region_init_ram_from_fd in memory.h\n  for windows builds\n- Use memory_region_size for shmem_region handlers instead\n  of accessing size member directly in shmem mrs\nv10->v11\n- Rebase to grab commit fde5930cc37175cfcd0f03a089e26f4458a52311\n  and explicitly unset reply_ack on the SHMEM_MAP/UNMAP msg.\n- Mention mapping cleanup on device reset in the spec.\nv9->v10\n- Fix transaction_commit invoked without transaction_begin\n  on vhost_user_backend_handle_shmem_map() early errors\n- Removed fd tracking on VirtioSharedMemoryMapping, it\n  is handled by the RAMBlock\n- Reject invalid BAR configurations when VIRTIO Shared Memory\n  Regions are in use by vhost-user-test-device\n\nThis patch series implements dynamic fd-backed memory mapping support\nfor vhost-user backends, enabling backends to dynamically request memory\nmappings and unmappings during runtime through the new\nVHOST_USER_BACKEND_SHMEM_MAP/UNMAP protocol messages.\n\nThis feature benefits various VIRTIO devices that require dynamic shared\nmemory management, including virtiofs (for DAX mappings), virtio-gpu\n(for resource sharing), and the recently standardized virtio-media.\n\nThe implementation introduces a QOM-based architecture for managing\nshared memory lifecycle:\n\n- VirtioSharedMemoryMapping: an intermediate object that manages\n  individual memory mappings by acting as generic container for regions\n  declared in any vhost-user device type\n- Dynamic Mapping: backends can request mappings via SHMEM_MAP messages,\n  with the frontend creating MemoryRegions from the provided file\n  descriptors and adding them as subregions\n\nWhen a SHMEM_MAP request is received, the frontend:\n1. Creates VirtioSharedMemoryMapping to manage the mapping lifecycle\n2. Maps the provided fd with memory_region_init_ram_from_fd()\n3. Creates a MemoryRegion backed by the mapped memory\n4. Adds it as a subregion of the appropiate VIRTIO Shared Memory Region\n\nThe QOM reference counting ensures automatic cleanup when mappings are\nremoved or the device is destroyed.\n\nThis patch also includes:\n- VHOST_USER_GET_SHMEM_CONFIG: a new frontend request allowing generic\n  vhost-user devices to query shared memory configuration from backends\n  at device initialization, enabling the generic vhost-user-device\n  frontend to work with any backend regardless of specific shared memory\n  requirements.\n\nThe implementation has been tested with rust-vmm based backends.\n\nAlbert Esteve (7):\n  vhost-user: Add VirtIO Shared Memory map request\n  vhost_user.rst: Align VhostUserMsg excerpt members\n  vhost_user.rst: Add SHMEM_MAP/_UNMAP to spec\n  vhost_user: Add frontend get_shmem_config command\n  vhost_user.rst: Add GET_SHMEM_CONFIG message\n  qmp: add shmem feature map\n  vhost-user-device: Add shared memory BAR\n\n docs/interop/vhost-user.rst               | 104 +++++++++\n hw/virtio/vhost-user-base.c               |  46 +++-\n hw/virtio/vhost-user-test-device-pci.c    |  38 ++-\n hw/virtio/vhost-user.c                    | 269 ++++++++++++++++++++++\n hw/virtio/virtio-qmp.c                    |   3 +\n hw/virtio/virtio.c                        | 201 ++++++++++++++++\n include/hw/virtio/vhost-backend.h         |  10 +\n include/hw/virtio/vhost-user.h            |   1 +\n include/hw/virtio/virtio.h                | 137 +++++++++++\n include/system/memory.h                   |  13 ++\n subprojects/libvhost-user/libvhost-user.c |  70 ++++++\n subprojects/libvhost-user/libvhost-user.h |  54 +++++\n 12 files changed, 941 insertions(+), 5 deletions(-)"}