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.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 391D639792F for ; Mon, 10 Aug 2026 08:05:09 +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=1786349113; cv=none; b=hZnsMhU1uzoFioAEvCzpwgSoynMaosMYtch/x7JQzSA0fwuEJ8bTs8EiwY7oLPP5OC/efq0qQOvQRqHBpqICKoPRDZsD5oLG09Oywg0vQ0uzblf5rmYHH8PEGbkW35Ew1LL9BWzEcIvKxijnKzzglg0jnjNniTcEJaClEbXu6ek= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786349113; c=relaxed/simple; bh=+lkuVQnHgrhF7fjMdkJDE/fkoUTrWZAAHCdTOrn70ZQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=A6PLjGW1fmwdZw/ssjBfbSfN8xxe/Ltv3eTeXBfCrXzX/Bl+O/geWy+8KWfFu2CYzjI+Oc+Jz6g38SaTTmLi34JgVTpKQWQqPRHPIkzqwjZyeaN2NqujoETpFsic+m+ae+o2Ti8B7JiYkmnROx38fkO5OEylSh3b9c7Jj83/K6E= 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=KUFCxuE8; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b=pUhzANjy; 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="KUFCxuE8"; dkim=pass (2048-bit key) header.d=redhat.com header.i=@redhat.com header.b="pUhzANjy" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1786349109; 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: in-reply-to:in-reply-to:references:references; bh=/+a+0U5GgUWNz5gXhQg+X0ag29Jj0knQnRmccGbHPwc=; b=KUFCxuE8MQXk3y1J7nnyoF9ux8K+fTuHwTX8csuZBSMo5D0EvjiHzshCxqDUbkeAk1naAj JiIfLQxiUEGNEWJLDaI5KGL735P90jTn47683XkkXnaWdBz6syBgyefCPyBntdsFMSB2eR ea1kpV7uHC6H8XREOR8hmoxf6i7MdAA= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-384-JTFZiJWnMd-eUE5QgHvVug-1; Mon, 10 Aug 2026 04:05:02 -0400 X-MC-Unique: JTFZiJWnMd-eUE5QgHvVug-1 X-Mimecast-MFC-AGG-ID: JTFZiJWnMd-eUE5QgHvVug_1786349102 Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-47fe23b5acdso1535478f8f.0 for ; Mon, 10 Aug 2026 01:05:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=google; t=1786349101; x=1786953901; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=/+a+0U5GgUWNz5gXhQg+X0ag29Jj0knQnRmccGbHPwc=; b=pUhzANjy0WIZNYvNWcTLS5xtZ59irPzJVi+JUXcDPgBa+uXkuWvDrTwU5Ve4gIIIik j4rr/dPqogEdtEdgvVwcHJsTLKu/Ohr48YVVeMB3w/Q757BdEzRETPGpycI1FtD9o6aN Xu7rm9vrYti0mSvf3Jeifo2bTvPVn+QXIEfurJjMpcucS8PjJ5F8mAj9+hcisf7+3/tr N0d3xqUu17lgxxyNRhbyCIcex2MZQJiFkw4w6XJZRFG0JE18LHEtSqcvZoBbgpKu4diF 1FXgZQU/OYkbB3UHpZvKYewYFTjFlS8Zci3BGpa3IPjCBDfLXAGmlkKgCQ5aMPcP+Tfu 3zag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1786349101; x=1786953901; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=/+a+0U5GgUWNz5gXhQg+X0ag29Jj0knQnRmccGbHPwc=; b=rj6Zy0fCUcmV+saEdUD8QQbSRy2kDWctt4VYUgOGZ4YcsEsqIK0KIlEUXL3ipyd+fC H+8LAsY/fGwjgYpTPCQlrqpMcSI3jIgNWuiWRf58XdSV9TyLiFbBgH+lSQZBeLFbVh6o sU+ptY4Rkmi6k4HbS+QKFU/hG6pEw6buN/Eu9amlMCSGIU8gMNyBuHQVYMLZdEUo+7NV vcxAPmo27nvVbcGyV8KefaZmhnt2Qi5I90An2Fw2P1OCsz2FiZgXaU4gtZCrYNWjbEaN kV5r7tQCiuQBvVYzV0IRS74Xa8vfXDk4//rv1EDWL2klpzVpOoHfesbtEpyzAhtfgMKi 7BUQ== X-Forwarded-Encrypted: i=1; AHgh+Rq31/+5QhHqcykEyuoiC+ksbZwEJlEMfzz4Dmi3rZXUHciFSg7lhk7i7MLQI6BCZs/Qu+pSWXMSC8nZCt8=@vger.kernel.org X-Gm-Message-State: AOJu0Yytn1sQWDACaAUnnBkra1d0xMPRJofToVqBpUTMOuo4QDGN/ry9 jCXDWFn6nqPosTM5WSb/ppAVnK6hG0ZZwopZs9x90nr4up2Mk1/QYAF3kker+RwuG+teEyuV6s/ ADJL0vR4R2Z9eM7r30MNmsdTw0YOG4kYo7EeH3QJ//KPWq2MKBO6R9yd9ZNe92aWDKA== X-Gm-Gg: AR+sD136JyNUcqpIv5CRo4HgGjoRl4wjbnbNyQYg32aTU1HlFZvs0taW7dOIIlyGSxr CjJb+ipcicboxZ5swo58vcZwnl4cr+Ibge9xdBolNSIQJ7UXIerpiLunMmPtcgJb99e7qL3GksS MnsOeofvlP8A87N7PQdCAGYuAPBPvDP6Q8RHc17PNm3HybuaVw4xJhStahTnGZlRS6h/roqpGTZ Tp2qRaciO1rSqUUYG0bczG68+5ixaO4z7ebe1+TpMZsxhEANms8z107z4e1HHaoZOTmnn0uNdHP x/67cnlkbfQn2emz/GIesBT7CSeIJuG0AOTJxwmST5AjG7rXQRH/j8SJb2RYsJWPuCyJd2aLRUW KydtRhwhg/RZcsP4Cx/sPyQ== X-Received: by 2002:a05:6000:430a:b0:47f:71a6:970e with SMTP id ffacd0b85a97d-47ffd203e5emr38268915f8f.2.1786349101195; Mon, 10 Aug 2026 01:05:01 -0700 (PDT) X-Received: by 2002:a05:6000:430a:b0:47f:71a6:970e with SMTP id ffacd0b85a97d-47ffd203e5emr38268788f8f.2.1786349100617; Mon, 10 Aug 2026 01:05:00 -0700 (PDT) Received: from redhat.com (IGLD-80-230-39-98.inter.net.il. [80.230.39.98]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-480021e8b09sm35811136f8f.23.2026.08.10.01.04.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Aug 2026 01:05:00 -0700 (PDT) Date: Mon, 10 Aug 2026 04:04:55 -0400 From: "Michael S. Tsirkin" To: "Graf (AWS), Alexander" Cc: Jason Wang , Alex Williamson , David Airlie , Dmitry Osipenko , "dri-devel@lists.freedesktop.org" , Eugenio =?iso-8859-1?Q?P=E9rez?= , Feng Liu , Gerd Hoffmann , Halil Pasic , Jens Axboe , Jiri Pirko , Jonathan Corbet , "linux-block@vger.kernel.org" , "linux-doc@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "nh-open-source@amazon.com" , "nvdimm@lists.linux.dev" , Pankaj Gupta , Paolo Bonzini , Parav Pandit , Shuah Khan , Stefan Hajnoczi , "virtualization@lists.linux.dev" , Xuan Zhuo , Yishai Hadas Subject: Re: [RFC PATCH 00/12] virtio: support devices that own their virtqueue memory Message-ID: <20260810035246-mutt-send-email-mst@kernel.org> References: <20260809182010.32931-1-graf@amazon.com> <20260810021450-mutt-send-email-mst@kernel.org> 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=us-ascii Content-Disposition: inline In-Reply-To: On Mon, Aug 10, 2026 at 07:39:02AM +0000, Graf (AWS), Alexander wrote: > Hey Michael, > > Thanks a bunch for having a detailed and quick look! > > On 10.08.26 08:23, Michael S. Tsirkin wrote: > > On Sun, Aug 09, 2026 at 06:19:58PM +0000, Alexander Graf wrote: > >> Virtio drivers use guest memory to back virtqueues and their buffers. > >> That means a VMM needs to be able to map guest memory. That is ok in the > >> normal virt case. It gets icky with confidential computing (where we use > >> swiotlb as workaround) and it defeats the purpose of isolated vhost-user > >> backing devices, because they end up with full RAM access to the guest. > >> > >> So instead, I'm proposing an extension to virtio which allows it to give > >> each virtio device its own dedicated memory region to communicate with the > >> host, called DMB (Device Memory Buffer). A trusted hypervisor can force > >> DMB to be present, which then enables safer, more isolated and resilient > >> communication between guest and host. > >> > >> With DMB, the device provides a shared memory region that both parties > >> agree is the full memory map both have access to. All memory offsets > >> that previously would have been into guest RAM, are then offsets into > >> this shared memory buffer region. One nice property of this is that it > >> is a generic mechanism in the virtio transport layer, so higher level > >> drivers work unmodified. > >> > >> I was exploring to use swiotlb instead to create individual pools. But > >> that approach has multiple downsides: > >> > >> 1. Swiotlb is an OS primitive which is not available in all Operating > >> Systems. DMB however lives in the virtio transport layer, which means we > >> can add support for it in any OS independent of generic layers. This > >> helps with Windows support. > > > > How does it help, if you are going to put a pool in > > the driver, put a pool in the driver. Maybe with virtio mem to > > simplify allocation. > > > I'm not sure I understand the suggestion :) > I'm not sure what the problem is for windows :) But if you want a chunk of contiguos memory that windows does not poke at without a driver, virtio mem is that :) > > > >> 2. We munge DMA space together. DMB provides a separate DMA space per > >> virtio device. This means we can for example implement a device in > >> vhost-user and give the implementing process only visibility to the DMB > >> region, not all of guest memory. That reduces the exposure the > >> vhost-user provider has, improving security. > >> > >> 3. Devices can opt-in. A hypervisor can choose to use standard virtio > >> semantics for self-implemented devices (e.g. NSM), while requiring DMB > >> for devices implemented by less trustworthy providers. The > >> non-trustworthy devices do not get any visibility into the trustworthy > >> ones, even with DMB in place for both. > > > > So I am not sure whether the implication is that it's purely a software > > construct. But if it is, can we extend virtio iommu to > > add a way to discover and enforce trust boundaries? > > And maybe translate offsets to BARs, if that is desired? > > > > It seems to be that the result would be that we don't need fiddly > > special casing in virtio ring specifically, and a lot of things like > > pre-mapped dma will begin to work. > > > On thing I'm trying to avoid is dynamicity. Anything that dynamically > changes visibility or needs state tracking is something that can go > wrong. By keeping everything self-contained within the guest, I can > reason about what is visible and what is not easily. Especially for > confidential computing, IMHO static wins over dynamic in general. > > Or did I misunderstand your suggestion? I get this part. But we can absolutely make it static. Let's start by replicating your functionality with virtio-iommu. So: -device is behind virtio-iommu -virtio-iommu tells guest "this device can only consume memory from that range," -and maybe: ...and translation is 1:1 with this offset if guest does not acknowledge it will just fail? this covers the proposal here simply by using a dedicated range per device, right? But look what we can easily add later: share a range between devices, now you can move data between them with zero copies. Isn't that better? > As to pure software construct: With CXL, you can implement the exact > same protocol on real hardware as well. All it takes is cache coherency > of the BAR (or whatever the transport uses) region. > > > > Alex Yes this is what I thought originally, that you intend to do it in hardware. But re-reading it, it begins to look like that's not really the case, it's only "theoretically possible"? -- MST