Michael S. Tsirkin
2018-Apr-05 18:34 UTC
[RFC] virtio: Use DMA MAP API for devices without an IOMMU
On Fri, Apr 06, 2018 at 01:09:43AM +1000, Benjamin Herrenschmidt wrote:> On Thu, 2018-04-05 at 17:54 +0300, Michael S. Tsirkin wrote: > > On Thu, Apr 05, 2018 at 08:09:30PM +0530, Anshuman Khandual wrote: > > > On 04/05/2018 04:26 PM, Anshuman Khandual wrote: > > > > There are certian platforms which would like to use SWIOTLB based DMA API > > > > for bouncing purpose without actually requiring an IOMMU back end. But the > > > > virtio core does not allow such mechanism. Right now DMA MAP API is only > > > > selected for devices which have an IOMMU and then the QEMU/host back end > > > > will process all incoming SG buffer addresses as IOVA instead of simple > > > > GPA which is the case for simple bounce buffers after being processed with > > > > SWIOTLB API. To enable this usage, it introduces an architecture specific > > > > function which will just make virtio core front end select DMA operations > > > > structure. > > > > > > > > Signed-off-by: Anshuman Khandual <khandual at linux.vnet.ibm.com> > > > > > > + "Michael S. Tsirkin" <mst at redhat.com> > > > > I'm confused by this. > > > > static bool vring_use_dma_api(struct virtio_device *vdev) > > { > > if (!virtio_has_iommu_quirk(vdev)) > > return true; > > > > > > Why doesn't setting VIRTIO_F_IOMMU_PLATFORM on the > > hypervisor side sufficient? > > In this specific case, because that would make qemu expect an iommu, > and there isn't one.I think that you can set iommu_platform in qemu without an iommu.> Anshuman, you need to provide more background here. I don't have time > right now it's late, but explain about the fact that this is for a > specific type of secure VM which has only a limited pool of (insecure) > memory that can be shared with qemu, so all IOs need to bounce via that > pool, which can be achieved by using swiotlb. > > Note: this isn't urgent, we can discuss alternative approaches, this is > just to start the conversation. > > Cheers, > Ben.
Benjamin Herrenschmidt
2018-Apr-05 21:18 UTC
[RFC] virtio: Use DMA MAP API for devices without an IOMMU
On Thu, 2018-04-05 at 21:34 +0300, Michael S. Tsirkin wrote:> > In this specific case, because that would make qemu expect an iommu, > > and there isn't one. > > > I think that you can set iommu_platform in qemu without an iommu.No I mean the platform has one but it's not desirable for it to be used due to the performance hit. Cheers, Ben.> > > Anshuman, you need to provide more background here. I don't have time > > right now it's late, but explain about the fact that this is for a > > specific type of secure VM which has only a limited pool of (insecure) > > memory that can be shared with qemu, so all IOs need to bounce via that > > pool, which can be achieved by using swiotlb. > > > > Note: this isn't urgent, we can discuss alternative approaches, this is > > just to start the conversation. > > > > Cheers, > > Ben.
Anshuman Khandual
2018-Apr-06 02:53 UTC
[RFC] virtio: Use DMA MAP API for devices without an IOMMU
On 04/06/2018 02:48 AM, Benjamin Herrenschmidt wrote:> On Thu, 2018-04-05 at 21:34 +0300, Michael S. Tsirkin wrote: >>> In this specific case, because that would make qemu expect an iommu, >>> and there isn't one. >> >> >> I think that you can set iommu_platform in qemu without an iommu. > > No I mean the platform has one but it's not desirable for it to be used > due to the performance hit.Also the only requirement is to bounce the I/O buffers through SWIOTLB implemented as DMA API which the virtio core understands. There is no need for an IOMMU to be involved for the device representation in this case IMHO.
Seemingly Similar Threads
- [RFC] virtio: Use DMA MAP API for devices without an IOMMU
- [RFC] virtio: Use DMA MAP API for devices without an IOMMU
- [RFC] virtio: Use DMA MAP API for devices without an IOMMU
- [RFC] virtio: Use DMA MAP API for devices without an IOMMU
- [RFC] virtio: Use DMA MAP API for devices without an IOMMU