All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	pbonzini@redhat.com, peterx@redhat.com, cornelia.huck@de.ibm.com,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Amit Shah <amit.shah@redhat.com>,
	qemu-block@nongnu.org, Jason Wang <jasowang@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Wei Liu <wei.liu2@citrix.com>,
	virtualization@lists.linux-foundation.org, kvm@vger.kernel.org
Subject: Re: [PATCH RFC] fixup! virtio: convert to use DMA api
Date: Mon, 18 Apr 2016 18:30:41 +0300	[thread overview]
Message-ID: <20160418182320-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1460992923.3765.8.camel@infradead.org>

On Mon, Apr 18, 2016 at 11:22:03AM -0400, David Woodhouse wrote:
> On Mon, 2016-04-18 at 17:23 +0300, Michael S. Tsirkin wrote:
> > 
> > This patch doesn't change DMAR tables, it creates a way for virtio
> > device to tell guest "I obey what DMAR tables tell you, you can stop
> > doing hacks".
> > 
> > And as PPC guys seem adamant that platform tools there are no good for
> > that purpose, there's another bit that says "ignore what platform tells
> > you, I'm not a real device - I'm part of hypervisor and I bypass the
> > IOMMU".
> 
> ...
> 
> +/* Request IOMMU passthrough (if available)
> + * Without VIRTIO_F_IOMMU_PLATFORM: bypass the IOMMU even if enabled.
> + * With VIRTIO_F_IOMMU_PLATFORM: suggest disabling IOMMU.
> + */
> +#define VIRTIO_F_IOMMU_PASSTHROUGH     33
> +
> +/* Do not bypass the IOMMU (if configured) */
> +#define VIRTIO_F_IOMMU_PLATFORM                34
> 
> OK... let's see if I can reconcile those descriptions coherently.
> 
> Setting (only) VIRTIO_F_IOMMU_PASSTHROUGH indicates to the guest that
> its own operating system's IOMMU code is expected to be broken, and
> that the virtio driver should eschew the DMA API?

No - it tells guest that e.g. the ACPI tables (or whatever the
equivalent is) do not match reality with respect to this device
since IOMMU is ignored by hypervisor.
Hypervisor has no idea what does guest IOMMU code do - hopefully
it is not actually broken.

> And that the guest OS
> cannot further assign the affected device to any of *its* nested
> guests? Not that the broken IOMMU code in said guest OS will know the
> latter, of course.
> 
> With VIRTIO_F_IOMMU_PLATFORM set, VIRTIO_F_IOMMU_PASSTHROUGH is just a
> *hint*, suggesting that the guest OS should *request* a passthrough
> mapping from the IOMMU?

Right. But it'll work correctly if you don't.

> Via a driver←→IOMMU API which doesn't yet exist
> in Linux, since we only have 'iommu=pt' on the command line for that?
> 
> And having *neither* of those bits sets is the status quo, which means
> that your OS code might well be broken and need you to eschew the DMA
> API, but maybe not.


The status quo is that that the IOMMU might well be bypassed
and then you need to program physical addresses into the device,
but maybe not. If DMA API does not give you physical addresses, you
need to bypass it, but hypervisor does not know or care.


> 
> -- 
> dwmw2
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Wei Liu <wei.liu2@citrix.com>, Andy Lutomirski <luto@kernel.org>,
	qemu-block@nongnu.org,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	qemu-devel@nongnu.org, peterx@redhat.com,
	linux-kernel@vger.kernel.org, Amit Shah <amit.shah@redhat.com>,
	Stefan Hajnoczi <stefanha@redhat.com>,
	kvm@vger.kernel.org, pbonzini@redhat.com,
	virtualization@lists.linux-foundation.org
Subject: Re: [PATCH RFC] fixup! virtio: convert to use DMA api
Date: Mon, 18 Apr 2016 18:30:41 +0300	[thread overview]
Message-ID: <20160418182320-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1460992923.3765.8.camel@infradead.org>

On Mon, Apr 18, 2016 at 11:22:03AM -0400, David Woodhouse wrote:
> On Mon, 2016-04-18 at 17:23 +0300, Michael S. Tsirkin wrote:
> > 
> > This patch doesn't change DMAR tables, it creates a way for virtio
> > device to tell guest "I obey what DMAR tables tell you, you can stop
> > doing hacks".
> > 
> > And as PPC guys seem adamant that platform tools there are no good for
> > that purpose, there's another bit that says "ignore what platform tells
> > you, I'm not a real device - I'm part of hypervisor and I bypass the
> > IOMMU".
> 
> ...
> 
> +/* Request IOMMU passthrough (if available)
> + * Without VIRTIO_F_IOMMU_PLATFORM: bypass the IOMMU even if enabled.
> + * With VIRTIO_F_IOMMU_PLATFORM: suggest disabling IOMMU.
> + */
> +#define VIRTIO_F_IOMMU_PASSTHROUGH     33
> +
> +/* Do not bypass the IOMMU (if configured) */
> +#define VIRTIO_F_IOMMU_PLATFORM                34
> 
> OK... let's see if I can reconcile those descriptions coherently.
> 
> Setting (only) VIRTIO_F_IOMMU_PASSTHROUGH indicates to the guest that
> its own operating system's IOMMU code is expected to be broken, and
> that the virtio driver should eschew the DMA API?

No - it tells guest that e.g. the ACPI tables (or whatever the
equivalent is) do not match reality with respect to this device
since IOMMU is ignored by hypervisor.
Hypervisor has no idea what does guest IOMMU code do - hopefully
it is not actually broken.

> And that the guest OS
> cannot further assign the affected device to any of *its* nested
> guests? Not that the broken IOMMU code in said guest OS will know the
> latter, of course.
> 
> With VIRTIO_F_IOMMU_PLATFORM set, VIRTIO_F_IOMMU_PASSTHROUGH is just a
> *hint*, suggesting that the guest OS should *request* a passthrough
> mapping from the IOMMU?

Right. But it'll work correctly if you don't.

> Via a driver←→IOMMU API which doesn't yet exist
> in Linux, since we only have 'iommu=pt' on the command line for that?
> 
> And having *neither* of those bits sets is the status quo, which means
> that your OS code might well be broken and need you to eschew the DMA
> API, but maybe not.


The status quo is that that the IOMMU might well be bypassed
and then you need to program physical addresses into the device,
but maybe not. If DMA API does not give you physical addresses, you
need to bypass it, but hypervisor does not know or care.


> 
> -- 
> dwmw2
> 
> 


_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: qemu-devel@nongnu.org, linux-kernel@vger.kernel.org,
	pbonzini@redhat.com, peterx@redhat.com, cornelia.huck@de.ibm.com,
	Stefan Hajnoczi <stefanha@redhat.com>,
	Kevin Wolf <kwolf@redhat.com>, Amit Shah <amit.shah@redhat.com>,
	qemu-block@nongnu.org, Jason Wang <jasowang@redhat.com>,
	Alex Williamson <alex.williamson@redhat.com>,
	Andy Lutomirski <luto@kernel.org>,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Wei Liu <wei.liu2@citrix.com>,
	virtualization@lists.linux-foundation.org, kvm@vger.kernel.org
Subject: Re: [Qemu-devel] [PATCH RFC] fixup! virtio: convert to use DMA api
Date: Mon, 18 Apr 2016 18:30:41 +0300	[thread overview]
Message-ID: <20160418182320-mutt-send-email-mst@redhat.com> (raw)
In-Reply-To: <1460992923.3765.8.camel@infradead.org>

On Mon, Apr 18, 2016 at 11:22:03AM -0400, David Woodhouse wrote:
> On Mon, 2016-04-18 at 17:23 +0300, Michael S. Tsirkin wrote:
> > 
> > This patch doesn't change DMAR tables, it creates a way for virtio
> > device to tell guest "I obey what DMAR tables tell you, you can stop
> > doing hacks".
> > 
> > And as PPC guys seem adamant that platform tools there are no good for
> > that purpose, there's another bit that says "ignore what platform tells
> > you, I'm not a real device - I'm part of hypervisor and I bypass the
> > IOMMU".
> 
> ...
> 
> +/* Request IOMMU passthrough (if available)
> + * Without VIRTIO_F_IOMMU_PLATFORM: bypass the IOMMU even if enabled.
> + * With VIRTIO_F_IOMMU_PLATFORM: suggest disabling IOMMU.
> + */
> +#define VIRTIO_F_IOMMU_PASSTHROUGH     33
> +
> +/* Do not bypass the IOMMU (if configured) */
> +#define VIRTIO_F_IOMMU_PLATFORM                34
> 
> OK... let's see if I can reconcile those descriptions coherently.
> 
> Setting (only) VIRTIO_F_IOMMU_PASSTHROUGH indicates to the guest that
> its own operating system's IOMMU code is expected to be broken, and
> that the virtio driver should eschew the DMA API?

No - it tells guest that e.g. the ACPI tables (or whatever the
equivalent is) do not match reality with respect to this device
since IOMMU is ignored by hypervisor.
Hypervisor has no idea what does guest IOMMU code do - hopefully
it is not actually broken.

> And that the guest OS
> cannot further assign the affected device to any of *its* nested
> guests? Not that the broken IOMMU code in said guest OS will know the
> latter, of course.
> 
> With VIRTIO_F_IOMMU_PLATFORM set, VIRTIO_F_IOMMU_PASSTHROUGH is just a
> *hint*, suggesting that the guest OS should *request* a passthrough
> mapping from the IOMMU?

Right. But it'll work correctly if you don't.

> Via a driver←→IOMMU API which doesn't yet exist
> in Linux, since we only have 'iommu=pt' on the command line for that?
> 
> And having *neither* of those bits sets is the status quo, which means
> that your OS code might well be broken and need you to eschew the DMA
> API, but maybe not.


The status quo is that that the IOMMU might well be bypassed
and then you need to program physical addresses into the device,
but maybe not. If DMA API does not give you physical addresses, you
need to bypass it, but hypervisor does not know or care.


> 
> -- 
> dwmw2
> 
> 

  reply	other threads:[~2016-04-18 15:30 UTC|newest]

Thread overview: 97+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-18 11:47 [PATCH RFC] fixup! virtio: convert to use DMA api Michael S. Tsirkin
2016-04-18 11:47 ` [Qemu-devel] " Michael S. Tsirkin
2016-04-18 11:58 ` David Woodhouse
2016-04-18 11:58   ` [Qemu-devel] " David Woodhouse
2016-04-18 13:12   ` Michael S. Tsirkin
2016-04-18 13:12   ` Michael S. Tsirkin
2016-04-18 13:12     ` [Qemu-devel] " Michael S. Tsirkin
2016-04-18 14:03     ` David Woodhouse
2016-04-18 14:03     ` David Woodhouse
2016-04-18 14:03       ` [Qemu-devel] " David Woodhouse
2016-04-18 14:23       ` Michael S. Tsirkin
2016-04-18 14:23         ` [Qemu-devel] " Michael S. Tsirkin
2016-04-18 14:23         ` Michael S. Tsirkin
2016-04-18 15:22         ` David Woodhouse
2016-04-18 15:22           ` [Qemu-devel] " David Woodhouse
2016-04-18 15:22           ` David Woodhouse
2016-04-18 15:30           ` Michael S. Tsirkin [this message]
2016-04-18 15:30             ` [Qemu-devel] " Michael S. Tsirkin
2016-04-18 15:30             ` Michael S. Tsirkin
2016-04-18 15:51             ` David Woodhouse
2016-04-18 15:51               ` [Qemu-devel] " David Woodhouse
2016-04-18 15:51               ` David Woodhouse
2016-04-18 16:27               ` Michael S. Tsirkin
2016-04-18 16:27                 ` [Qemu-devel] " Michael S. Tsirkin
2016-04-18 16:27                 ` Michael S. Tsirkin
2016-04-18 18:29                 ` David Woodhouse
2016-04-18 18:29                   ` [Qemu-devel] " David Woodhouse
2016-04-18 18:29                   ` David Woodhouse
2016-04-18 19:24                   ` Andy Lutomirski
2016-04-18 19:24                     ` [Qemu-devel] " Andy Lutomirski
2016-04-18 19:24                     ` Andy Lutomirski
2016-04-19 10:27                     ` Michael S. Tsirkin
2016-04-19 10:27                       ` [Qemu-devel] " Michael S. Tsirkin
2016-04-19 10:27                       ` Michael S. Tsirkin
2016-04-19 16:02                       ` Andy Lutomirski
2016-04-19 16:02                         ` [Qemu-devel] " Andy Lutomirski
2016-04-19 16:02                         ` Andy Lutomirski
2016-04-19 16:09                         ` Michael S. Tsirkin
2016-04-19 16:09                           ` [Qemu-devel] " Michael S. Tsirkin
2016-04-19 16:09                           ` Michael S. Tsirkin
2016-04-19 16:12                           ` Andy Lutomirski
2016-04-19 16:12                             ` [Qemu-devel] " Andy Lutomirski
2016-04-19 16:12                             ` Andy Lutomirski
2016-04-19 16:20                             ` Michael S. Tsirkin
2016-04-19 16:20                               ` [Qemu-devel] " Michael S. Tsirkin
2016-04-19 16:20                               ` Michael S. Tsirkin
2016-04-19 16:26                               ` David Woodhouse
2016-04-19 16:26                                 ` [Qemu-devel] " David Woodhouse
2016-04-19 16:26                                 ` David Woodhouse
2016-04-19 17:49                                 ` Michael S. Tsirkin
2016-04-19 17:49                                   ` [Qemu-devel] " Michael S. Tsirkin
2016-04-19 17:49                                   ` Michael S. Tsirkin
2016-04-19 18:01                                   ` Andy Lutomirski
2016-04-19 18:01                                   ` Andy Lutomirski
2016-04-19 18:01                                     ` [Qemu-devel] " Andy Lutomirski
2016-04-19 18:01                                     ` Andy Lutomirski
2016-04-19 20:16                                     ` Michael S. Tsirkin
2016-04-19 20:16                                       ` [Qemu-devel] " Michael S. Tsirkin
2016-04-19 20:16                                       ` Michael S. Tsirkin
2016-04-19 20:27                                       ` Andy Lutomirski
2016-04-19 20:27                                       ` Andy Lutomirski
2016-04-19 20:27                                         ` [Qemu-devel] " Andy Lutomirski
2016-04-19 20:27                                         ` Andy Lutomirski
2016-04-19 20:54                                         ` Michael S. Tsirkin
2016-04-19 20:54                                           ` [Qemu-devel] " Michael S. Tsirkin
2016-04-19 20:54                                           ` Michael S. Tsirkin
2016-04-19 21:07                                           ` Andy Lutomirski
2016-04-19 21:07                                           ` Andy Lutomirski
2016-04-19 21:07                                             ` [Qemu-devel] " Andy Lutomirski
2016-04-19 21:07                                             ` Andy Lutomirski
2016-04-20 13:14                                             ` Michael S. Tsirkin
2016-04-20 13:14                                               ` [Qemu-devel] " Michael S. Tsirkin
2016-04-20 13:14                                               ` Michael S. Tsirkin
2016-04-20 15:43                                               ` Andy Lutomirski
2016-04-20 15:43                                               ` Andy Lutomirski
2016-04-20 15:43                                                 ` [Qemu-devel] " Andy Lutomirski
2016-04-20 15:43                                                 ` Andy Lutomirski
2016-04-19 20:54                                         ` Michael S. Tsirkin
2016-04-19 20:16                                     ` Michael S. Tsirkin
2016-04-19 17:49                                 ` Michael S. Tsirkin
2016-04-19 16:09                         ` Michael S. Tsirkin
2016-04-19 16:02                       ` Andy Lutomirski
2016-04-19  9:13                   ` Michael S. Tsirkin
2016-04-19  9:13                     ` [Qemu-devel] " Michael S. Tsirkin
2016-04-19  9:13                     ` Michael S. Tsirkin
2016-04-19 14:44                     ` Alex Williamson
2016-04-19 14:44                       ` [Qemu-devel] " Alex Williamson
2016-04-19 14:44                       ` Alex Williamson
2016-04-19 16:00                     ` Andy Lutomirski
2016-04-19 16:00                       ` [Qemu-devel] " Andy Lutomirski
2016-04-19 16:00                       ` Andy Lutomirski
2016-04-19 16:04                       ` Michael S. Tsirkin
2016-04-19 16:04                       ` Michael S. Tsirkin
2016-04-19 16:04                         ` [Qemu-devel] " Michael S. Tsirkin
2016-04-19 16:00                     ` Andy Lutomirski
2016-04-18 11:58 ` David Woodhouse
2016-04-18 11:47 Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160418182320-mutt-send-email-mst@redhat.com \
    --to=mst@redhat.com \
    --cc=alex.williamson@redhat.com \
    --cc=amit.shah@redhat.com \
    --cc=borntraeger@de.ibm.com \
    --cc=cornelia.huck@de.ibm.com \
    --cc=dwmw2@infradead.org \
    --cc=jasowang@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=kwolf@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=peterx@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wei.liu2@citrix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.