Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-05-09 Thread Paolo Bonzini
On 28/04/2016 17:37, Michael S. Tsirkin wrote: > > All the internally-emulated devices *can* be either translated or > > untranslated. That's just a matter of software. Surely, you currently > > *can't* have translated assigned devices (until someone implements the > > whole VT-d page table

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-28 Thread David Woodhouse
On Thu, 2016-04-28 at 18:37 +0300, Michael S. Tsirkin wrote: > OK, so for intel, it seems that it's enough to set > pdev->dev.archdata.iommu = DUMMY_DEVICE_DOMAIN_INFO; > for the device. Yes, currently. Although that's vile. In fact what we *want* to happen is for the intel-iommu code

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-28 Thread Michael S. Tsirkin
On Thu, Apr 28, 2016 at 04:11:54PM +0100, David Woodhouse wrote: > On Thu, 2016-04-28 at 17:34 +0300, Michael S. Tsirkin wrote: > > I see work-arounds for broken IOMMUs but not for > > individual devices. Could you point me to a more specific > > example? > > I think the closest example is

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-28 Thread David Woodhouse
On Thu, 2016-04-28 at 17:34 +0300, Michael S. Tsirkin wrote: > I see work-arounds for broken IOMMUs but not for > individual devices. Could you point me to a more specific > example? I think the closest example is probably quirk_ioat_snb_local_iommu(). If we see this particular device, we *know*

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-28 Thread Michael S. Tsirkin
On Wed, Apr 27, 2016 at 08:16:57PM +0100, David Woodhouse wrote: > 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

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread David Woodhouse
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

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread Andy Lutomirski
On Wed, Apr 27, 2016 at 7:54 AM, Michael S. Tsirkin wrote: > On Wed, Apr 27, 2016 at 07:43:07AM -0700, Andy Lutomirski wrote: >> On Wed, Apr 27, 2016 at 7:38 AM, Michael S. Tsirkin wrote: >> > On Wed, Apr 27, 2016 at 07:31:43AM -0700, Andy Lutomirski wrote: >>

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread Michael S. Tsirkin
On Wed, Apr 27, 2016 at 04:58:51PM +0200, Joerg Roedel wrote: > On Wed, Apr 27, 2016 at 05:54:57PM +0300, Michael S. Tsirkin wrote: > > Point is, QEMU is not the only virtio implementation out there. > > So we can't know no virtio implementations have an IOMMU as long as > > linux supports this

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread Michael S. Tsirkin
On Wed, Apr 27, 2016 at 04:56:32PM +0200, Joerg Roedel wrote: > On Wed, Apr 27, 2016 at 05:34:30PM +0300, Michael S. Tsirkin wrote: > > On Wed, Apr 27, 2016 at 04:23:32PM +0200, Joerg Roedel wrote: > > > QEMU can choose to bypass IOMMU for one device and not the other. > > IOMMU in QEMU isn't

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread Joerg Roedel
On Wed, Apr 27, 2016 at 05:54:57PM +0300, Michael S. Tsirkin wrote: > Point is, QEMU is not the only virtio implementation out there. > So we can't know no virtio implementations have an IOMMU as long as > linux supports this IOMMU. > virtio always used physical addresses since it was born and if

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread Joerg Roedel
On Wed, Apr 27, 2016 at 05:34:30PM +0300, Michael S. Tsirkin wrote: > On Wed, Apr 27, 2016 at 04:23:32PM +0200, Joerg Roedel wrote: > QEMU can choose to bypass IOMMU for one device and not the other. > IOMMU in QEMU isn't involved when it's bypassed. And it is QEMU's task to tell the OS, right?

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread Andy Lutomirski
On Wed, Apr 27, 2016 at 7:38 AM, Michael S. Tsirkin wrote: > On Wed, Apr 27, 2016 at 07:31:43AM -0700, Andy Lutomirski wrote: >> On Wed, Apr 27, 2016 at 7:23 AM, Joerg Roedel wrote: >> > On Wed, Apr 27, 2016 at 04:37:04PM +0300, Michael S. Tsirkin wrote: >> >>

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread Joerg Roedel
On Wed, Apr 27, 2016 at 04:37:04PM +0300, Michael S. Tsirkin wrote: > One correction: it's a feature of the device in the system. > There could be a mix of devices bypassing and not > bypassing the IOMMU. No, it really is not. A device can't chose to bypass the IOMMU. But the IOMMU can chose to

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread Michael S. Tsirkin
On Wed, Apr 27, 2016 at 01:18:21PM +0100, David Woodhouse wrote: > > > > On some systems, including Xen and any system with a physical device > > > that speaks virtio behind a physical IOMMU, we must use the DMA API > > > for virtio DMA to work at all. > > >  > > > Add a feature bit to detect

Re: [PATCH V2 RFC] fixup! virtio: convert to use DMA api

2016-04-27 Thread David Woodhouse
> > On some systems, including Xen and any system with a physical device > > that speaks virtio behind a physical IOMMU, we must use the DMA API > > for virtio DMA to work at all. > >  > > Add a feature bit to detect that: VIRTIO_F_IOMMU_PLATFORM. > >  > > If not there, we preserve historic