[PATCH v15 0/9] VIRTIO-IOMMU device

Eric Auger posted 9 patches 5 years, 9 months ago
Test docker-quick@centos7 passed
Test FreeBSD passed
Test docker-mingw@fedora passed
Test checkpatch passed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20200208120022.1920-1-eric.auger@redhat.com
Maintainers: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, "Michael S. Tsirkin" <mst@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Eduardo Habkost <ehabkost@redhat.com>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>
There is a newer version of this series
hw/arm/virt.c                    |  57 +-
hw/virtio/Kconfig                |   5 +
hw/virtio/Makefile.objs          |   2 +
hw/virtio/trace-events           |  20 +
hw/virtio/virtio-iommu-pci.c     | 103 ++++
hw/virtio/virtio-iommu.c         | 890 +++++++++++++++++++++++++++++++
include/hw/arm/virt.h            |   2 +
include/hw/pci/pci.h             |   1 +
include/hw/virtio/virtio-iommu.h |  61 +++
qdev-monitor.c                   |   1 +
10 files changed, 1135 insertions(+), 7 deletions(-)
create mode 100644 hw/virtio/virtio-iommu-pci.c
create mode 100644 hw/virtio/virtio-iommu.c
create mode 100644 include/hw/virtio/virtio-iommu.h
[PATCH v15 0/9] VIRTIO-IOMMU device
Posted by Eric Auger 5 years, 9 months ago
This series implements the QEMU virtio-iommu device.

This matches the v0.12 spec (voted) and the corresponding
virtio-iommu driver upstreamed in 5.3. All kernel dependencies
are resolved for DT integration. The virtio-iommu can be
instantiated in ARM virt using:

"-device virtio-iommu-pci".

Non DT mode is not yet supported as it has non resolved kernel
dependencies [1].

This feature targets 5.0.

Integration with vhost devices and vfio devices is not part
of this series. Please follow Bharat's respins [2].

Best Regards

Eric

This series can be found at:
https://github.com/eauger/qemu/tree/v4.2-virtio-iommu-v15

References:
[1] [RFC 00/13] virtio-iommu on non-devicetree platforms
[2] [PATCH RFC v5 0/5] virtio-iommu: VFIO integration

Testing:
- tested with guest using virtio-net-pci
  (,vhost=off,iommu_platform,disable-modern=off,disable-legacy=on)
  and virtio-blk-pci
- migration

History:

v14 -> v15:
- removed x-dt-binding and just kept check on hotplug_handler
- removed "tests: Add virtio-iommu test" as the check on
  hotplug_handler fails on PC machine
- destroy mappings in put_domain and remove
  g_tree_destroy(domain->mappings) in virtio_iommu_detach

v13 -> v14:
- added "virtio-iommu-pci: Introduce the x-dt-binding option"
- Removed the mappings gtree ref counting and simply delete
  the gtree when the last EP is detached from the domain
- call virtio_iommu_detach_endpoint_from_domain from
  virtio_iommu_put_endpoint

v12 -> v13:
- Take into account Peter's comments
- fix qtest error and accomodate for directory changes in
  test
- remove "[PATCH v12 01/13] migration: Support QLIST migration"
  which is now upstream
- fix iommu_find_iommu_pcibus()
- squash commits as requested by Peter
- remove spurious guest log

../..

Eric Auger (9):
  virtio-iommu: Add skeleton
  virtio-iommu: Decode the command payload
  virtio-iommu: Implement attach/detach command
  virtio-iommu: Implement map/unmap
  virtio-iommu: Implement translate
  virtio-iommu: Implement fault reporting
  virtio-iommu-pci: Add virtio iommu pci support
  hw/arm/virt: Add the virtio-iommu device tree mappings
  virtio-iommu: Support migration

 hw/arm/virt.c                    |  57 +-
 hw/virtio/Kconfig                |   5 +
 hw/virtio/Makefile.objs          |   2 +
 hw/virtio/trace-events           |  20 +
 hw/virtio/virtio-iommu-pci.c     | 103 ++++
 hw/virtio/virtio-iommu.c         | 890 +++++++++++++++++++++++++++++++
 include/hw/arm/virt.h            |   2 +
 include/hw/pci/pci.h             |   1 +
 include/hw/virtio/virtio-iommu.h |  61 +++
 qdev-monitor.c                   |   1 +
 10 files changed, 1135 insertions(+), 7 deletions(-)
 create mode 100644 hw/virtio/virtio-iommu-pci.c
 create mode 100644 hw/virtio/virtio-iommu.c
 create mode 100644 include/hw/virtio/virtio-iommu.h

-- 
2.20.1


Re: [PATCH v15 0/9] VIRTIO-IOMMU device
Posted by Michael S. Tsirkin 5 years, 9 months ago
On Sat, Feb 08, 2020 at 01:00:13PM +0100, Eric Auger wrote:
> This series implements the QEMU virtio-iommu device.
> 
> This matches the v0.12 spec (voted) and the corresponding
> virtio-iommu driver upstreamed in 5.3. All kernel dependencies
> are resolved for DT integration. The virtio-iommu can be
> instantiated in ARM virt using:
> 
> "-device virtio-iommu-pci".
> 
> Non DT mode is not yet supported as it has non resolved kernel
> dependencies [1].
> 
> This feature targets 5.0.
> 
> Integration with vhost devices and vfio devices is not part
> of this series. Please follow Bharat's respins [2].
> 
> Best Regards
> 
> Eric


Looks good.
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

I can see this merged through ARM tree, or through my tree with
Peters's ack for the ARM bits.


> This series can be found at:
> https://github.com/eauger/qemu/tree/v4.2-virtio-iommu-v15
> 
> References:
> [1] [RFC 00/13] virtio-iommu on non-devicetree platforms
> [2] [PATCH RFC v5 0/5] virtio-iommu: VFIO integration
> 
> Testing:
> - tested with guest using virtio-net-pci
>   (,vhost=off,iommu_platform,disable-modern=off,disable-legacy=on)
>   and virtio-blk-pci
> - migration
> 
> History:
> 
> v14 -> v15:
> - removed x-dt-binding and just kept check on hotplug_handler
> - removed "tests: Add virtio-iommu test" as the check on
>   hotplug_handler fails on PC machine
> - destroy mappings in put_domain and remove
>   g_tree_destroy(domain->mappings) in virtio_iommu_detach
> 
> v13 -> v14:
> - added "virtio-iommu-pci: Introduce the x-dt-binding option"
> - Removed the mappings gtree ref counting and simply delete
>   the gtree when the last EP is detached from the domain
> - call virtio_iommu_detach_endpoint_from_domain from
>   virtio_iommu_put_endpoint
> 
> v12 -> v13:
> - Take into account Peter's comments
> - fix qtest error and accomodate for directory changes in
>   test
> - remove "[PATCH v12 01/13] migration: Support QLIST migration"
>   which is now upstream
> - fix iommu_find_iommu_pcibus()
> - squash commits as requested by Peter
> - remove spurious guest log
> 
> ../..
> 
> Eric Auger (9):
>   virtio-iommu: Add skeleton
>   virtio-iommu: Decode the command payload
>   virtio-iommu: Implement attach/detach command
>   virtio-iommu: Implement map/unmap
>   virtio-iommu: Implement translate
>   virtio-iommu: Implement fault reporting
>   virtio-iommu-pci: Add virtio iommu pci support
>   hw/arm/virt: Add the virtio-iommu device tree mappings
>   virtio-iommu: Support migration
> 
>  hw/arm/virt.c                    |  57 +-
>  hw/virtio/Kconfig                |   5 +
>  hw/virtio/Makefile.objs          |   2 +
>  hw/virtio/trace-events           |  20 +
>  hw/virtio/virtio-iommu-pci.c     | 103 ++++
>  hw/virtio/virtio-iommu.c         | 890 +++++++++++++++++++++++++++++++
>  include/hw/arm/virt.h            |   2 +
>  include/hw/pci/pci.h             |   1 +
>  include/hw/virtio/virtio-iommu.h |  61 +++
>  qdev-monitor.c                   |   1 +
>  10 files changed, 1135 insertions(+), 7 deletions(-)
>  create mode 100644 hw/virtio/virtio-iommu-pci.c
>  create mode 100644 hw/virtio/virtio-iommu.c
>  create mode 100644 include/hw/virtio/virtio-iommu.h
> 
> -- 
> 2.20.1


Re: [PATCH v15 0/9] VIRTIO-IOMMU device
Posted by Peter Maydell 5 years, 9 months ago
On Tue, 11 Feb 2020 at 13:56, Michael S. Tsirkin <mst@redhat.com> wrote:
>
> On Sat, Feb 08, 2020 at 01:00:13PM +0100, Eric Auger wrote:
> > This series implements the QEMU virtio-iommu device.
> >
> > This matches the v0.12 spec (voted) and the corresponding
> > virtio-iommu driver upstreamed in 5.3. All kernel dependencies
> > are resolved for DT integration. The virtio-iommu can be
> > instantiated in ARM virt using:
> >
> > "-device virtio-iommu-pci".
> >
> > Non DT mode is not yet supported as it has non resolved kernel
> > dependencies [1].
> >
> > This feature targets 5.0.
> >
> > Integration with vhost devices and vfio devices is not part
> > of this series. Please follow Bharat's respins [2].
> >
> > Best Regards
> >
> > Eric
>
>
> Looks good.
> Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
>
> I can see this merged through ARM tree, or through my tree with
> Peters's ack for the ARM bits.

Either way would work for me. I left some review comments
on patch 8 which I think is the only arm-specific one.

Can you use the virtio-iommu on x86 ? Would you want to?

If I'm not misreading the MAINTAINERS file the new
files in hw/virtio aren't covered by any existing
entry there, so we should probably have a new one.

thanks
-- PMM

Re: [PATCH v15 0/9] VIRTIO-IOMMU device
Posted by Michael S. Tsirkin 5 years, 9 months ago
On Tue, Feb 11, 2020 at 03:02:28PM +0000, Peter Maydell wrote:
> On Tue, 11 Feb 2020 at 13:56, Michael S. Tsirkin <mst@redhat.com> wrote:
> >
> > On Sat, Feb 08, 2020 at 01:00:13PM +0100, Eric Auger wrote:
> > > This series implements the QEMU virtio-iommu device.
> > >
> > > This matches the v0.12 spec (voted) and the corresponding
> > > virtio-iommu driver upstreamed in 5.3. All kernel dependencies
> > > are resolved for DT integration. The virtio-iommu can be
> > > instantiated in ARM virt using:
> > >
> > > "-device virtio-iommu-pci".
> > >
> > > Non DT mode is not yet supported as it has non resolved kernel
> > > dependencies [1].
> > >
> > > This feature targets 5.0.
> > >
> > > Integration with vhost devices and vfio devices is not part
> > > of this series. Please follow Bharat's respins [2].
> > >
> > > Best Regards
> > >
> > > Eric
> >
> >
> > Looks good.
> > Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
> >
> > I can see this merged through ARM tree, or through my tree with
> > Peters's ack for the ARM bits.
> 
> Either way would work for me. I left some review comments
> on patch 8 which I think is the only arm-specific one.
> 
> Can you use the virtio-iommu on x86 ? Would you want to?

Potentially yes.

> If I'm not misreading the MAINTAINERS file the new
> files in hw/virtio aren't covered by any existing
> entry there, so we should probably have a new one.
> 
> thanks
> -- PMM