On Thu, 26 Oct 2023, David Woodhouse wrote: > On Wed, 2023-10-25 at 14:24 -0700, Vikram Garhwal wrote: > > Hi, > > This patch series add support for grant mappings as a pseudo RAM region for > > Xen. > > > > Enabling grant mappings patches(first 6) are written by Juergen in 2021. > > > > QEMU Virtio device provides an emulated backends for Virtio frontned devices > > in Xen. > > Please set "iommu_platform=on" option when invoking QEMU. As this will set > > VIRTIO_F_ACCESS_PLATFORM feature which will be used by virtio frontend in > > Xen > > to know whether backend supports grants or not. > > I don't really understand what's going on here. The subject of the > cover letter certainly doesn't help me, because we *already* support > grant mappings under Xen, don't we? > > I found > https://static.linaro.org/connect/lvc21/presentations/lvc21-314.pdf but > I think it's a bit out of date; the decision about how to handle grant > mappings for virtio devices is still 'TBD'.
See this presentation: https://www.youtube.com/watch?v=boRQ8UHc760 The patch series is for the guest (e.g. Linux) to use grants to share memory with virtio devices. The plumbing was already done in Linux a couple of years ago, but QEMU support for it is still missing. > Can you talk me through the process of what happens when a guest wants > to a virtio device to initiate 'DMA' to one of its pages? I assume it > starts by creating a grant mapping, and then taking the gntref and... > then what? First the guest gets a grant reference for the page, then it uses it as "dma address" to pass to the virtio device. The top bit (1ULL << 63) is used to signal that the address in question is a grant address. See in Linux: drivers/xen/grant-dma-ops.c grant_to_dma, dma_to_grant, xen_grant_dma_alloc, etc. > I don't see any changes to the virtio devices themselves in this > series; are we doing something that will make it work by magic? If so, > it might be useful to explain that magic... Yes something like that :-) https://marc.info/?l=xen-devel&m=165419780304962&w=2 Vikram, I think it would be a good idea to submit a separate patch to xen.git to add a document under docs/ to capture this.