qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v12 00/13] VIRTIO-IOMMU device
@ 2020-01-09 14:43 Eric Auger
  2020-01-09 14:43 ` [PATCH v12 01/13] migration: Support QLIST migration Eric Auger
                   ` (13 more replies)
  0 siblings, 14 replies; 39+ messages in thread
From: Eric Auger @ 2020-01-09 14:43 UTC (permalink / raw)
  To: eric.auger.pro, eric.auger, qemu-devel, qemu-arm, peter.maydell,
	jean-philippe, dgilbert, quintela, mst, peterx
  Cc: kevin.tian, bharatb.linux, tnowicki

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.

This feature targets 5.0.

For non DT integration, guest kernel dependencies are not resolved
yet. Historically, an approach based on the ACPI IORT was used.
However this is not considered as the best approach anymore.
Alternative approaches are under discussion in [2] but they are
still in RFC state. So considering the time needed to get this
stabilized and the spec updated, I hope the DT integration for ARM
can be merged first.

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

Best Regards

Eric

This series can be found at:
https://github.com/eauger/qemu/tree/v4.2-virtio-iommu-v12
This branch also supports ACPI/IORT integration for both ARM
and x86.

References:
[1] kernel branch to be used for guest for testing on ARM or
    x86 with ACPI/IORT integration:
    https://github.com/eauger/linux/tree/v5.4-rc8-virtio-iommu-iort
    for testing the DT boot on ARM, upstream kernel can be used.
[2] [RFC 00/13] virtio-iommu on non-devicetree platforms
[3] VFIO/VHOST integration is not part of this series. Please follow
    [PATCH RFC v5 0/5] virtio-iommu: VFIO integration respins

Testing:
- tested with guest using virtio-net-pci
  (,vhost=off,iommu_platform,disable-modern=off,disable-legacy=on)
  and virtio-blk-pci
- migration on ARM and x86
- on x86 PC machine AHCI unmapped transactions are observed at early
  boot stage. This does not prevent the guest from booting and behaving
  properly. Warnings look like:
qemu-system-x86_64: virtio_iommu_translate sid=250 is not known!!
qemu-system-x86_64: no buffer available in event queue to report event
qemu-system-x86_64: AHCI: Failed to start FIS receive engine: bad FIS
receive buffer address
This is due to the fact that by default the virtio-iommu device blocks
unmapped transations. This is likely to change in the future.

History:

v11 -> v12:
- took into account Peter and Jean's comments
  - use guest features
  - restore as_by_bus_num and when attaching devices, check they are
    actually protected by the IOMMU. Updated the tests accordingly.
  - fix the mapping ref counting and make sure mappings are properly
    cleaned.
  - Use CamelCase for data types
  - simplify postload callback as suggested by Peter
  - add R-bs
- fix mingw compilation issue
- add IOMMU migration priority
- qlist migration load simplified following Juan's suggestion

v10 -> v11:
- introduce virtio_iommu_handle_req macro
- migration support
- introduce DEFINE_PROP_INTERVAL and pass reserved regions
  through an array of those
- domain gtree simplification

v9 -> v10:
- rebase on 4.1.0-rc2, compliance with 0.12 spec
- removed ACPI part
- cleanup (see individual change logs)
- moved to a PATCH series

v8 -> v9:
- virtio-iommu-pci device needs to be instantiated from the command
  line (RID is not imposed anymore).
- tail structure properly initialized

v7 -> v8:
- virtio-iommu-pci added
- virt instantiation modified
- DT and ACPI modified to exclude the iommu RID from the mapping
- VIRTIO_IOMMU_F_BYPASS, VIRTIO_F_VERSION_1 features exposed

v6 -> v7:
- rebase on qemu 3.0.0-rc3
- minor update against v0.7
- fix issue with EP not on pci.0 and ACPI probing
- change the instantiation method

v5 -> v6:
- minor update against v0.6 spec
- fix g_hash_table_lookup in virtio_iommu_find_add_as
- replace some error_reports by qemu_log_mask(LOG_GUEST_ERROR, ...)

v4 -> v5:
- event queue and fault reporting
- we now return the IOAPIC MSI region if the virtio-iommu is instantiated
  in a PC machine.
- we bypass transactions on MSI HW region and fault on reserved ones.
- We support ACPI boot with mach-virt (based on IORT proposal)
- We moved to the new driver naming conventions
- simplified mach-virt instantiation
- worked around the disappearing of pci_find_primary_bus
- in virtio_iommu_translate, check the dev->as is not NULL
- initialize as->device_list in virtio_iommu_get_as
- initialize bufstate.error to false in virtio_iommu_probe

v3 -> v4:
- probe request support although no reserved region is returned at
  the moment
- unmap semantics less strict, as specified in v0.4
- device registration, attach/detach revisited
- split into smaller patches to ease review
- propose a way to inform the IOMMU mr about the page_size_mask
  of underlying HW IOMMU, if any
- remove warning associated with the translation of the MSI doorbell

v2 -> v3:
- rebase on top of 2.10-rc0 and especially
  [PATCH qemu v9 0/2] memory/iommu: QOM'fy IOMMU MemoryRegion
- add mutex init
- fix as->mappings deletion using g_tree_ref/unref
- when a dev is attached whereas it is already attached to
  another address space, first detach it
- fix some error values
- page_sizes = TARGET_PAGE_MASK;
- I haven't changed the unmap() semantics yet, waiting for the
  next virtio-iommu spec revision.

v1 -> v2:
- fix redefinition of viommu_as typedef


Eric Auger (13):
  migration: Support QLIST migration
  virtio-iommu: Add skeleton
  virtio-iommu: Decode the command payload
  virtio-iommu: Add the iommu regions
  virtio-iommu: Endpoint and domains structs and helpers
  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
  tests: Add virtio-iommu test

 hw/arm/virt.c                    |  54 +-
 hw/virtio/Kconfig                |   5 +
 hw/virtio/Makefile.objs          |   2 +
 hw/virtio/trace-events           |  20 +
 hw/virtio/virtio-iommu-pci.c     |  88 +++
 hw/virtio/virtio-iommu.c         | 902 +++++++++++++++++++++++++++++++
 include/hw/arm/virt.h            |   2 +
 include/hw/pci/pci.h             |   1 +
 include/hw/virtio/virtio-iommu.h |  64 +++
 include/migration/vmstate.h      |  21 +
 include/qemu/queue.h             |  32 ++
 migration/trace-events           |   5 +
 migration/vmstate-types.c        |  74 +++
 qdev-monitor.c                   |   1 +
 tests/Makefile.include           |   2 +
 tests/libqos/virtio-iommu.c      | 177 ++++++
 tests/libqos/virtio-iommu.h      |  45 ++
 tests/test-vmstate.c             | 170 ++++++
 tests/virtio-iommu-test.c        | 308 +++++++++++
 19 files changed, 1965 insertions(+), 8 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
 create mode 100644 tests/libqos/virtio-iommu.c
 create mode 100644 tests/libqos/virtio-iommu.h
 create mode 100644 tests/virtio-iommu-test.c

-- 
2.20.1



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

end of thread, other threads:[~2020-02-10 16:45 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-09 14:43 [PATCH v12 00/13] VIRTIO-IOMMU device Eric Auger
2020-01-09 14:43 ` [PATCH v12 01/13] migration: Support QLIST migration Eric Auger
2020-01-09 14:43 ` [PATCH v12 02/13] virtio-iommu: Add skeleton Eric Auger
2020-01-13 19:53   ` Peter Xu
2020-01-09 14:43 ` [PATCH v12 03/13] virtio-iommu: Decode the command payload Eric Auger
2020-01-09 14:43 ` [PATCH v12 04/13] virtio-iommu: Add the iommu regions Eric Auger
2020-01-13 19:53   ` Peter Xu
2020-01-14  8:37     ` Auger Eric
2020-01-14 18:49       ` Peter Xu
2020-01-13 20:06   ` Peter Xu
2020-01-14  8:48     ` Auger Eric
2020-01-09 14:43 ` [PATCH v12 05/13] virtio-iommu: Endpoint and domains structs and helpers Eric Auger
2020-01-13 20:23   ` Peter Xu
2020-01-14  8:51     ` Auger Eric
2020-01-14 18:07       ` Peter Xu
2020-01-15 13:00         ` Auger Eric
2020-01-15 14:59           ` Peter Xu
2020-01-15 16:55             ` Auger Eric
2020-01-15 13:15         ` Auger Eric
2020-01-09 14:43 ` [PATCH v12 06/13] virtio-iommu: Implement attach/detach command Eric Auger
2020-01-09 14:43 ` [PATCH v12 07/13] virtio-iommu: Implement map/unmap Eric Auger
2020-01-14 18:55   ` Peter Xu
2020-01-09 14:43 ` [PATCH v12 08/13] virtio-iommu: Implement translate Eric Auger
2020-01-09 14:43 ` [PATCH v12 09/13] virtio-iommu: Implement fault reporting Eric Auger
2020-01-14 19:04   ` Peter Xu
2020-01-15 13:12     ` Auger Eric
2020-01-15 15:04       ` Peter Xu
2020-01-15 16:36         ` Auger Eric
2020-01-09 14:43 ` [PATCH v12 10/13] virtio-iommu-pci: Add virtio iommu pci support Eric Auger
2020-01-09 14:43 ` [PATCH v12 11/13] hw/arm/virt: Add the virtio-iommu device tree mappings Eric Auger
2020-01-09 14:43 ` [PATCH v12 12/13] virtio-iommu: Support migration Eric Auger
2020-01-14 19:07   ` Peter Xu
2020-02-10 12:33   ` Juan Quintela
2020-02-10 13:09     ` Auger Eric
2020-02-10 13:36       ` Auger Eric
2020-02-10 16:44         ` Juan Quintela
2020-01-09 14:43 ` [PATCH v12 13/13] tests: Add virtio-iommu test Eric Auger
2020-01-09 15:12 ` [PATCH v12 00/13] VIRTIO-IOMMU device no-reply
2020-01-09 16:07   ` Auger Eric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).