All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] docs: Add '-device intel-iommu' entry
@ 2021-06-11 18:55 Peter Xu
  2021-07-06 21:06 ` Peter Xu
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Peter Xu @ 2021-06-11 18:55 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S . Tsirkin, Jason Wang, peterx, Alex Williamson,
	Jing Zhao, Lei Yang, Chao Yang

The parameters of intel-iommu device are non-trivial to understand.  Add an
entry for it so that people can reference to it when using.

There're actually a few more options there, but I hide them explicitly because
they shouldn't be used by normal QEMU users.

Cc: Chao Yang <chayang@redhat.com>
Cc: Lei Yang <leiyang@redhat.com>
Cc: Jing Zhao <jinzhao@redhat.com>
Cc: Jason Wang <jasowang@redhat.com>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 qemu-options.hx | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/qemu-options.hx b/qemu-options.hx
index 14258784b3a..4bb04243907 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -926,6 +926,38 @@ SRST
 
 ``-device pci-ipmi-bt,bmc=id``
     Like the KCS interface, but defines a BT interface on the PCI bus.
+
+``-device intel-iommu[,option=...]``
+    This is only supported by ``-machine q35``, which will enable Intel VT-d
+    emulation within the guest.  It supports below options:
+
+    ``intremap=on|off`` (default: auto)
+        This enables interrupt remapping feature in the guest.  It's required
+        to enable complete x2apic.  Currently it only supports kvm
+        kernel-irqchip modes ``off`` or ``split``.  Full kernel-irqchip is not
+        yet supported.
+
+    ``caching-mode=on|off`` (default: off)
+        This enables caching mode for the VT-d emulated device.  When
+        caching-mode is enabled, each guest DMA buffer mapping will generate an
+        IOTLB invalidation from the guest IOMMU driver to the vIOMMU device in
+        a synchronous way.  It is required for ``-device vfio-pci`` to work
+        with the VT-d device, because host assigned devices requires to setup
+        the DMA mapping on the host before guest DMA starts.
+
+    ``device-iotlb=on|off`` (default: off)
+        This enables device-iotlb capability for the emulated VT-d device.  So
+        far virtio/vhost should be the only real user for this parameter,
+        paired with ats=on configured for the device.
+
+    ``aw-bits=39|48`` (default: 39)
+        This decides the address width of IOVA address space.  The address
+        space has 39 bits width for 3-level IOMMU page tables, and 48 bits for
+        4-level IOMMU page tables.
+
+    Please also refer to the wiki page for general scenarios of VT-d
+    emulation in QEMU: https://wiki.qemu.org/Features/VT-d.
+
 ERST
 
 DEF("name", HAS_ARG, QEMU_OPTION_name,
-- 
2.31.1



^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH] docs: Add '-device intel-iommu' entry
  2021-06-11 18:55 [PATCH] docs: Add '-device intel-iommu' entry Peter Xu
@ 2021-07-06 21:06 ` Peter Xu
  2021-07-07  3:35 ` Jason Wang
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Peter Xu @ 2021-07-06 21:06 UTC (permalink / raw)
  To: qemu-devel
  Cc: Michael S . Tsirkin, Jason Wang, Alex Williamson, Jing Zhao,
	Lei Yang, Chao Yang

On Fri, Jun 11, 2021 at 02:55:00PM -0400, Peter Xu wrote:
> The parameters of intel-iommu device are non-trivial to understand.  Add an
> entry for it so that people can reference to it when using.
> 
> There're actually a few more options there, but I hide them explicitly because
> they shouldn't be used by normal QEMU users.
> 
> Cc: Chao Yang <chayang@redhat.com>
> Cc: Lei Yang <leiyang@redhat.com>
> Cc: Jing Zhao <jinzhao@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  qemu-options.hx | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)

Ping..

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] docs: Add '-device intel-iommu' entry
  2021-06-11 18:55 [PATCH] docs: Add '-device intel-iommu' entry Peter Xu
  2021-07-06 21:06 ` Peter Xu
@ 2021-07-07  3:35 ` Jason Wang
  2021-07-07 15:27   ` Peter Xu
  2021-07-07  9:29 ` Eric Auger
  2021-07-07 10:36 ` Liu, Yi L
  3 siblings, 1 reply; 8+ messages in thread
From: Jason Wang @ 2021-07-07  3:35 UTC (permalink / raw)
  To: Peter Xu, qemu-devel
  Cc: Jing Zhao, Lei Yang, Alex Williamson, Chao Yang, Michael S . Tsirkin


在 2021/6/12 上午2:55, Peter Xu 写道:
> The parameters of intel-iommu device are non-trivial to understand.  Add an
> entry for it so that people can reference to it when using.
>
> There're actually a few more options there, but I hide them explicitly because
> they shouldn't be used by normal QEMU users.
>
> Cc: Chao Yang <chayang@redhat.com>
> Cc: Lei Yang <leiyang@redhat.com>
> Cc: Jing Zhao <jinzhao@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>   qemu-options.hx | 32 ++++++++++++++++++++++++++++++++
>   1 file changed, 32 insertions(+)
>
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 14258784b3a..4bb04243907 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -926,6 +926,38 @@ SRST
>   
>   ``-device pci-ipmi-bt,bmc=id``
>       Like the KCS interface, but defines a BT interface on the PCI bus.
> +
> +``-device intel-iommu[,option=...]``
> +    This is only supported by ``-machine q35``, which will enable Intel VT-d
> +    emulation within the guest.  It supports below options:
> +
> +    ``intremap=on|off`` (default: auto)
> +        This enables interrupt remapping feature in the guest.


I think we don't need "in the guest" here.

Other than this:

Reviewed-by: Jason Wang <jasowang@redhat.com>

Thanks


>   It's required
> +        to enable complete x2apic.  Currently it only supports kvm
> +        kernel-irqchip modes ``off`` or ``split``.  Full kernel-irqchip is not
> +        yet supported.
> +
> +    ``caching-mode=on|off`` (default: off)
> +        This enables caching mode for the VT-d emulated device.  When
> +        caching-mode is enabled, each guest DMA buffer mapping will generate an
> +        IOTLB invalidation from the guest IOMMU driver to the vIOMMU device in
> +        a synchronous way.  It is required for ``-device vfio-pci`` to work
> +        with the VT-d device, because host assigned devices requires to setup
> +        the DMA mapping on the host before guest DMA starts.
> +
> +    ``device-iotlb=on|off`` (default: off)
> +        This enables device-iotlb capability for the emulated VT-d device.  So
> +        far virtio/vhost should be the only real user for this parameter,
> +        paired with ats=on configured for the device.
> +
> +    ``aw-bits=39|48`` (default: 39)
> +        This decides the address width of IOVA address space.  The address
> +        space has 39 bits width for 3-level IOMMU page tables, and 48 bits for
> +        4-level IOMMU page tables.
> +
> +    Please also refer to the wiki page for general scenarios of VT-d
> +    emulation in QEMU: https://wiki.qemu.org/Features/VT-d.
> +
>   ERST
>   
>   DEF("name", HAS_ARG, QEMU_OPTION_name,



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] docs: Add '-device intel-iommu' entry
  2021-06-11 18:55 [PATCH] docs: Add '-device intel-iommu' entry Peter Xu
  2021-07-06 21:06 ` Peter Xu
  2021-07-07  3:35 ` Jason Wang
@ 2021-07-07  9:29 ` Eric Auger
  2021-07-07 15:35   ` Peter Xu
  2021-07-07 10:36 ` Liu, Yi L
  3 siblings, 1 reply; 8+ messages in thread
From: Eric Auger @ 2021-07-07  9:29 UTC (permalink / raw)
  To: Peter Xu, qemu-devel
  Cc: Michael S . Tsirkin, Jason Wang, Alex Williamson, Lei Yang,
	Jing Zhao, Chao Yang

Hi Peter,

On 6/11/21 8:55 PM, Peter Xu wrote:
> The parameters of intel-iommu device are non-trivial to understand.  Add an
> entry for it so that people can reference to it when using.
> 
> There're actually a few more options there, but I hide them explicitly because
> they shouldn't be used by normal QEMU users.
> 
> Cc: Chao Yang <chayang@redhat.com>
> Cc: Lei Yang <leiyang@redhat.com>
> Cc: Jing Zhao <jinzhao@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  qemu-options.hx | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 14258784b3a..4bb04243907 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -926,6 +926,38 @@ SRST
>  
>  ``-device pci-ipmi-bt,bmc=id``
>      Like the KCS interface, but defines a BT interface on the PCI bus.
> +
> +``-device intel-iommu[,option=...]``
> +    This is only supported by ``-machine q35``, which will enable Intel VT-d
> +    emulation within the guest.  It supports below options:
> +
> +    ``intremap=on|off`` (default: auto)
> +        This enables interrupt remapping feature in the guest.  It's required
> +        to enable complete x2apic.  Currently it only supports kvm
> +        kernel-irqchip modes ``off`` or ``split``.  Full kernel-irqchip is not
> +        yet supported.
maybe explain how the default is chosen (based on kernel-irqhcip mode?)
> +
> +    ``caching-mode=on|off`` (default: off)
> +        This enables caching mode for the VT-d emulated device.  When
> +        caching-mode is enabled, each guest DMA buffer mapping will generate an
> +        IOTLB invalidation from the guest IOMMU driver to the vIOMMU device in
> +        a synchronous way.  It is required for ``-device vfio-pci`` to work
> +        with the VT-d device, because host assigned devices requires to setup
> +        the DMA mapping on the host before guest DMA starts.
> +
> +    ``device-iotlb=on|off`` (default: off)
> +        This enables device-iotlb capability for the emulated VT-d device.  So
> +        far virtio/vhost should be the only real user for this parameter,
I thought if was needed for vhost. What is the usage for virtio?
> +        paired with ats=on configured for the device.
What is not obvious to me is whether there is a kind of diagnosis
whether device-iotlb and caching mode settings are consistent with
vfio/vhost usage. Does qemu exit if there is inconsistency?
> +
> +    ``aw-bits=39|48`` (default: 39)
> +        This decides the address width of IOVA address space.  The address
> +        space has 39 bits width for 3-level IOMMU page tables, and 48 bits for
> +        4-level IOMMU page tables.
> +
> +    Please also refer to the wiki page for general scenarios of VT-d
> +    emulation in QEMU: https://wiki.qemu.org/Features/VT-d.
> +
>  ERST
>  
>  DEF("name", HAS_ARG, QEMU_OPTION_name,
>
Besides, it is quite useful.

Thanks

Eric



^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] docs: Add '-device intel-iommu' entry
  2021-06-11 18:55 [PATCH] docs: Add '-device intel-iommu' entry Peter Xu
                   ` (2 preceding siblings ...)
  2021-07-07  9:29 ` Eric Auger
@ 2021-07-07 10:36 ` Liu, Yi L
  3 siblings, 0 replies; 8+ messages in thread
From: Liu, Yi L @ 2021-07-07 10:36 UTC (permalink / raw)
  To: Peter Xu, qemu-devel
  Cc: Michael S . Tsirkin, Jason Wang, Alex Williamson, Lei Yang,
	Jing Zhao, Chao Yang

> From: Peter Xu < peterx@redhat.com >
> Sent: Saturday, June 12, 2021 2:55 AM
> 
> The parameters of intel-iommu device are non-trivial to understand.  Add
> an
> entry for it so that people can reference to it when using.
> 
> There're actually a few more options there, but I hide them explicitly
> because
> they shouldn't be used by normal QEMU users.

yes, it's a good start.

Looks good to me.
Reviewed-by: Liu Yi L <yi.l.liu@intel.com>

Regards,
Yi Liu

> 
> Cc: Chao Yang <chayang@redhat.com>
> Cc: Lei Yang <leiyang@redhat.com>
> Cc: Jing Zhao <jinzhao@redhat.com>
> Cc: Jason Wang <jasowang@redhat.com>
> Cc: Michael S. Tsirkin <mst@redhat.com>
> Cc: Alex Williamson <alex.williamson@redhat.com>
> Signed-off-by: Peter Xu <peterx@redhat.com>
> ---
>  qemu-options.hx | 32 ++++++++++++++++++++++++++++++++
>  1 file changed, 32 insertions(+)
> 
> diff --git a/qemu-options.hx b/qemu-options.hx
> index 14258784b3a..4bb04243907 100644
> --- a/qemu-options.hx
> +++ b/qemu-options.hx
> @@ -926,6 +926,38 @@ SRST
> 
>  ``-device pci-ipmi-bt,bmc=id``
>      Like the KCS interface, but defines a BT interface on the PCI bus.
> +
> +``-device intel-iommu[,option=...]``
> +    This is only supported by ``-machine q35``, which will enable Intel VT-d
> +    emulation within the guest.  It supports below options:
> +
> +    ``intremap=on|off`` (default: auto)
> +        This enables interrupt remapping feature in the guest.  It's required
> +        to enable complete x2apic.  Currently it only supports kvm
> +        kernel-irqchip modes ``off`` or ``split``.  Full kernel-irqchip is not
> +        yet supported.
> +
> +    ``caching-mode=on|off`` (default: off)
> +        This enables caching mode for the VT-d emulated device.  When
> +        caching-mode is enabled, each guest DMA buffer mapping will
> generate an
> +        IOTLB invalidation from the guest IOMMU driver to the vIOMMU
> device in
> +        a synchronous way.  It is required for ``-device vfio-pci`` to work
> +        with the VT-d device, because host assigned devices requires to setup
> +        the DMA mapping on the host before guest DMA starts.
> +
> +    ``device-iotlb=on|off`` (default: off)
> +        This enables device-iotlb capability for the emulated VT-d device.  So
> +        far virtio/vhost should be the only real user for this parameter,
> +        paired with ats=on configured for the device.
> +
> +    ``aw-bits=39|48`` (default: 39)
> +        This decides the address width of IOVA address space.  The address
> +        space has 39 bits width for 3-level IOMMU page tables, and 48 bits for
> +        4-level IOMMU page tables.
> +
> +    Please also refer to the wiki page for general scenarios of VT-d
> +    emulation in QEMU: https://wiki.qemu.org/Features/VT-d.
> +
>  ERST
> 
>  DEF("name", HAS_ARG, QEMU_OPTION_name,
> --
> 2.31.1
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] docs: Add '-device intel-iommu' entry
  2021-07-07  3:35 ` Jason Wang
@ 2021-07-07 15:27   ` Peter Xu
  0 siblings, 0 replies; 8+ messages in thread
From: Peter Xu @ 2021-07-07 15:27 UTC (permalink / raw)
  To: Jason Wang
  Cc: Michael S . Tsirkin, qemu-devel, Alex Williamson, Jing Zhao,
	Lei Yang, Chao Yang

On Wed, Jul 07, 2021 at 11:35:43AM +0800, Jason Wang wrote:
> 
> 在 2021/6/12 上午2:55, Peter Xu 写道:
> > The parameters of intel-iommu device are non-trivial to understand.  Add an
> > entry for it so that people can reference to it when using.
> > 
> > There're actually a few more options there, but I hide them explicitly because
> > they shouldn't be used by normal QEMU users.
> > 
> > Cc: Chao Yang <chayang@redhat.com>
> > Cc: Lei Yang <leiyang@redhat.com>
> > Cc: Jing Zhao <jinzhao@redhat.com>
> > Cc: Jason Wang <jasowang@redhat.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: Alex Williamson <alex.williamson@redhat.com>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >   qemu-options.hx | 32 ++++++++++++++++++++++++++++++++
> >   1 file changed, 32 insertions(+)
> > 
> > diff --git a/qemu-options.hx b/qemu-options.hx
> > index 14258784b3a..4bb04243907 100644
> > --- a/qemu-options.hx
> > +++ b/qemu-options.hx
> > @@ -926,6 +926,38 @@ SRST
> >   ``-device pci-ipmi-bt,bmc=id``
> >       Like the KCS interface, but defines a BT interface on the PCI bus.
> > +
> > +``-device intel-iommu[,option=...]``
> > +    This is only supported by ``-machine q35``, which will enable Intel VT-d
> > +    emulation within the guest.  It supports below options:
> > +
> > +    ``intremap=on|off`` (default: auto)
> > +        This enables interrupt remapping feature in the guest.
> 
> 
> I think we don't need "in the guest" here.

Sure.

> 
> Other than this:
> 
> Reviewed-by: Jason Wang <jasowang@redhat.com>

Thanks,

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] docs: Add '-device intel-iommu' entry
  2021-07-07  9:29 ` Eric Auger
@ 2021-07-07 15:35   ` Peter Xu
  2021-07-08  8:59     ` Eric Auger
  0 siblings, 1 reply; 8+ messages in thread
From: Peter Xu @ 2021-07-07 15:35 UTC (permalink / raw)
  To: Eric Auger
  Cc: Michael S . Tsirkin, Jason Wang, qemu-devel, Alex Williamson,
	Jing Zhao, Lei Yang, Chao Yang

On Wed, Jul 07, 2021 at 11:29:47AM +0200, Eric Auger wrote:
> Hi Peter,

Hi, Eric,

> 
> On 6/11/21 8:55 PM, Peter Xu wrote:
> > The parameters of intel-iommu device are non-trivial to understand.  Add an
> > entry for it so that people can reference to it when using.
> > 
> > There're actually a few more options there, but I hide them explicitly because
> > they shouldn't be used by normal QEMU users.
> > 
> > Cc: Chao Yang <chayang@redhat.com>
> > Cc: Lei Yang <leiyang@redhat.com>
> > Cc: Jing Zhao <jinzhao@redhat.com>
> > Cc: Jason Wang <jasowang@redhat.com>
> > Cc: Michael S. Tsirkin <mst@redhat.com>
> > Cc: Alex Williamson <alex.williamson@redhat.com>
> > Signed-off-by: Peter Xu <peterx@redhat.com>
> > ---
> >  qemu-options.hx | 32 ++++++++++++++++++++++++++++++++
> >  1 file changed, 32 insertions(+)
> > 
> > diff --git a/qemu-options.hx b/qemu-options.hx
> > index 14258784b3a..4bb04243907 100644
> > --- a/qemu-options.hx
> > +++ b/qemu-options.hx
> > @@ -926,6 +926,38 @@ SRST
> >  
> >  ``-device pci-ipmi-bt,bmc=id``
> >      Like the KCS interface, but defines a BT interface on the PCI bus.
> > +
> > +``-device intel-iommu[,option=...]``
> > +    This is only supported by ``-machine q35``, which will enable Intel VT-d
> > +    emulation within the guest.  It supports below options:
> > +
> > +    ``intremap=on|off`` (default: auto)
> > +        This enables interrupt remapping feature in the guest.  It's required
> > +        to enable complete x2apic.  Currently it only supports kvm
> > +        kernel-irqchip modes ``off`` or ``split``.  Full kernel-irqchip is not
> > +        yet supported.
> maybe explain how the default is chosen (based on kernel-irqhcip mode?)

Will do.

> > +
> > +    ``caching-mode=on|off`` (default: off)
> > +        This enables caching mode for the VT-d emulated device.  When
> > +        caching-mode is enabled, each guest DMA buffer mapping will generate an
> > +        IOTLB invalidation from the guest IOMMU driver to the vIOMMU device in
> > +        a synchronous way.  It is required for ``-device vfio-pci`` to work
> > +        with the VT-d device, because host assigned devices requires to setup
> > +        the DMA mapping on the host before guest DMA starts.
> > +
> > +    ``device-iotlb=on|off`` (default: off)
> > +        This enables device-iotlb capability for the emulated VT-d device.  So
> > +        far virtio/vhost should be the only real user for this parameter,
> I thought if was needed for vhost. What is the usage for virtio?

I used "virtio/vhost" because vhost is only one type of virtio backend, so
normally they should be used in pair.  Also, the "ats=on" parameter should be
an option to virtio frontend rather than vhost, hence I mentioned both.

> > +        paired with ats=on configured for the device.
> What is not obvious to me is whether there is a kind of diagnosis
> whether device-iotlb and caching mode settings are consistent with
> vfio/vhost usage. Does qemu exit if there is inconsistency?

Caching mode check is done in vtd_machine_done_notify_one().

I think there's no such check for vhost, however iirc vhost should work
with/without ats=on; I did't check deeper.

> > +
> > +    ``aw-bits=39|48`` (default: 39)
> > +        This decides the address width of IOVA address space.  The address
> > +        space has 39 bits width for 3-level IOMMU page tables, and 48 bits for
> > +        4-level IOMMU page tables.
> > +
> > +    Please also refer to the wiki page for general scenarios of VT-d
> > +    emulation in QEMU: https://wiki.qemu.org/Features/VT-d.
> > +
> >  ERST
> >  
> >  DEF("name", HAS_ARG, QEMU_OPTION_name,
> >
> Besides, it is quite useful.

Thanks for taking a look!

-- 
Peter Xu



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] docs: Add '-device intel-iommu' entry
  2021-07-07 15:35   ` Peter Xu
@ 2021-07-08  8:59     ` Eric Auger
  0 siblings, 0 replies; 8+ messages in thread
From: Eric Auger @ 2021-07-08  8:59 UTC (permalink / raw)
  To: Peter Xu
  Cc: Michael S . Tsirkin, Jason Wang, qemu-devel, Alex Williamson,
	Jing Zhao, Lei Yang, Chao Yang

Hi Peter,
On 7/7/21 5:35 PM, Peter Xu wrote:
> On Wed, Jul 07, 2021 at 11:29:47AM +0200, Eric Auger wrote:
>> Hi Peter,
> 
> Hi, Eric,
> 
>>
>> On 6/11/21 8:55 PM, Peter Xu wrote:
>>> The parameters of intel-iommu device are non-trivial to understand.  Add an
>>> entry for it so that people can reference to it when using.
>>>
>>> There're actually a few more options there, but I hide them explicitly because
>>> they shouldn't be used by normal QEMU users.
>>>
>>> Cc: Chao Yang <chayang@redhat.com>
>>> Cc: Lei Yang <leiyang@redhat.com>
>>> Cc: Jing Zhao <jinzhao@redhat.com>
>>> Cc: Jason Wang <jasowang@redhat.com>
>>> Cc: Michael S. Tsirkin <mst@redhat.com>
>>> Cc: Alex Williamson <alex.williamson@redhat.com>
>>> Signed-off-by: Peter Xu <peterx@redhat.com>
>>> ---
>>>  qemu-options.hx | 32 ++++++++++++++++++++++++++++++++
>>>  1 file changed, 32 insertions(+)
>>>
>>> diff --git a/qemu-options.hx b/qemu-options.hx
>>> index 14258784b3a..4bb04243907 100644
>>> --- a/qemu-options.hx
>>> +++ b/qemu-options.hx
>>> @@ -926,6 +926,38 @@ SRST
>>>  
>>>  ``-device pci-ipmi-bt,bmc=id``
>>>      Like the KCS interface, but defines a BT interface on the PCI bus.
>>> +
>>> +``-device intel-iommu[,option=...]``
>>> +    This is only supported by ``-machine q35``, which will enable Intel VT-d
>>> +    emulation within the guest.  It supports below options:
>>> +
>>> +    ``intremap=on|off`` (default: auto)
>>> +        This enables interrupt remapping feature in the guest.  It's required
>>> +        to enable complete x2apic.  Currently it only supports kvm
>>> +        kernel-irqchip modes ``off`` or ``split``.  Full kernel-irqchip is not
>>> +        yet supported.
>> maybe explain how the default is chosen (based on kernel-irqhcip mode?)
> 
> Will do.
> 
>>> +
>>> +    ``caching-mode=on|off`` (default: off)
>>> +        This enables caching mode for the VT-d emulated device.  When
>>> +        caching-mode is enabled, each guest DMA buffer mapping will generate an
>>> +        IOTLB invalidation from the guest IOMMU driver to the vIOMMU device in
>>> +        a synchronous way.  It is required for ``-device vfio-pci`` to work
>>> +        with the VT-d device, because host assigned devices requires to setup
>>> +        the DMA mapping on the host before guest DMA starts.
>>> +
>>> +    ``device-iotlb=on|off`` (default: off)
>>> +        This enables device-iotlb capability for the emulated VT-d device.  So
>>> +        far virtio/vhost should be the only real user for this parameter,
>> I thought if was needed for vhost. What is the usage for virtio?
> 
> I used "virtio/vhost" because vhost is only one type of virtio backend, so
> normally they should be used in pair.  Also, the "ats=on" parameter should be
> an option to virtio frontend rather than vhost, hence I mentioned both.

OK makes sense.
> 
>>> +        paired with ats=on configured for the device.
>> What is not obvious to me is whether there is a kind of diagnosis
>> whether device-iotlb and caching mode settings are consistent with
>> vfio/vhost usage. Does qemu exit if there is inconsistency?
> 
> Caching mode check is done in vtd_machine_done_notify_one().
> 
> I think there's no such check for vhost, however iirc vhost should work
> with/without ats=on; I did't check deeper.
OK
> 
>>> +
>>> +    ``aw-bits=39|48`` (default: 39)
>>> +        This decides the address width of IOVA address space.  The address
>>> +        space has 39 bits width for 3-level IOMMU page tables, and 48 bits for
>>> +        4-level IOMMU page tables.
>>> +
>>> +    Please also refer to the wiki page for general scenarios of VT-d
>>> +    emulation in QEMU: https://wiki.qemu.org/Features/VT-d.
>>> +
>>>  ERST
>>>  
>>>  DEF("name", HAS_ARG, QEMU_OPTION_name,
>>>
>> Besides, it is quite useful.
> 
> Thanks for taking a look!
> 
Besides,

Reviewed-by: Eric Auger <eric.auger@redhat.com>


Eric



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2021-07-08  9:03 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-11 18:55 [PATCH] docs: Add '-device intel-iommu' entry Peter Xu
2021-07-06 21:06 ` Peter Xu
2021-07-07  3:35 ` Jason Wang
2021-07-07 15:27   ` Peter Xu
2021-07-07  9:29 ` Eric Auger
2021-07-07 15:35   ` Peter Xu
2021-07-08  8:59     ` Eric Auger
2021-07-07 10:36 ` Liu, Yi L

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.