David Woodhouse
2016-Apr-27 15:15 UTC
[PATCH V2 RFC] fixup! virtio: convert to use DMA api
On Wed, 2016-04-27 at 18:05 +0300, Michael S. Tsirkin wrote:> > I really don't get it. > > There's exactly one device that works now and needs the work-around and > so that we need to support, and that is virtio. It happens to have > exactly the same issue on all platforms.False. We have other devices which are currently *not* translated by the emulated IOMMU and which aren't going to be in the short term either. We also have other devices (emulated hardware NICs) to which precisely the same "we don't need protection" arguments apply, and which we *could* expose to the guest without an IOMMU translation if we really wanted to. It makes as much sense as exposing virtio without an IOMMU, going forward.> Why would we want to work hard to build platform-specific > solutions to a problem that can be solved in 5 lines of > generic code?Because it's a dirty hack in the *wrong* place. -- dwmw2 -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5691 bytes Desc: not available URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20160427/a2174d1e/attachment.bin>
Michael S. Tsirkin
2016-Apr-27 18:17 UTC
[PATCH V2 RFC] fixup! virtio: convert to use DMA api
On Wed, Apr 27, 2016 at 04:15:35PM +0100, David Woodhouse wrote:> On Wed, 2016-04-27 at 18:05 +0300, Michael S. Tsirkin wrote: > > > > I really don't get it. > > > > There's exactly one device that works now and needs the work-around and > > so that we need to support, and that is virtio. It happens to have > > exactly the same issue on all platforms. > > False. We have other devices which are currently *not* translated by > the emulated IOMMU and which aren't going to be in the short term > either. > > We also have other devices (emulated hardware NICs) to which precisely > the same "we don't need protection" arguments apply, and which we > *could* expose to the guest without an IOMMU translation if we really > wanted to. It makes as much sense as exposing virtio without an IOMMU, > going forward.The reasons for virtio are mostly dealing legacy. We don't need protection is a separate issue that I'd rather drop for now.> > Why would we want to work hard to build platform-specific > > solutions to a problem that can be solved in 5 lines of > > generic code? > > Because it's a dirty hack in the *wrong* place.No one came up with a better one so far :(> -- > dwmw2
David Woodhouse
2016-Apr-27 19:16 UTC
[PATCH V2 RFC] fixup! virtio: convert to use DMA api
On Wed, 2016-04-27 at 21:17 +0300, Michael S. Tsirkin wrote:> > > Because it's a dirty hack in the *wrong* place. > > No one came up with a better one so far :(Seriously? Take a look at drivers/iommu/intel-iommu.c. It has quirks for all kinds of shitty devices that have to be put in passthrough mode or otherwise excluded. We don't actually *need* it for the Intel IOMMU; all we need is for QEMU to stop lying in its DMAR tables. We *do* want the same kind of quirks in the relevant POWER and ARM IOMMU code in the kernel. Do that (hell, a simple quirk for all virtio devices will suffice, but NOT in the virtio driver) at the same moment you fix the virtio devices to use the DMA API. Job done. Some time *later* we can work on *refining* that quirk, and a way for QEMU to tell the guest (via something generic like fwcfg, maybe) that some devices are and aren't translated. Actually, I'm about to look at moving dma_ops into struct device and cleaning up the way we detect which IOMMU is attached, at device instantiation time. Perhaps I can shove the virtio-exception quirk in there while I'm at it... -- dwmw2 -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/x-pkcs7-signature Size: 5691 bytes Desc: not available URL: <http://lists.linuxfoundation.org/pipermail/virtualization/attachments/20160427/aaf4ffac/attachment.bin>
Maybe Matching Threads
- [PATCH V2 RFC] fixup! virtio: convert to use DMA api
- [PATCH V2 RFC] fixup! virtio: convert to use DMA api
- [PATCH V2 RFC] fixup! virtio: convert to use DMA api
- [PATCH V2 RFC] fixup! virtio: convert to use DMA api
- [PATCH V2 RFC] fixup! virtio: convert to use DMA api