All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [V15 0/4] AMD IOMMU
@ 2016-08-02  8:39 David Kiarie
  2016-08-02  8:39 ` [Qemu-devel] [V15 1/4] hw/pci: Prepare for " David Kiarie
                   ` (3 more replies)
  0 siblings, 4 replies; 25+ messages in thread
From: David Kiarie @ 2016-08-02  8:39 UTC (permalink / raw)
  To: qemu-devel
  Cc: peterx, rkrcmar, jan.kiszka, valentine.sinitsyn, ehabkost, mst,
	David Kiarie

Hi all,

This patchset adds basic AMD IOMMU emulation support to Qemu. This version happens to have been delayed since I expected to send it together with IR code but it seems that may take even longer so I'm sending this first.

Changes since v13
   -Added an error to make AMD IOMMU incompatible with device assignment.[Alex]
   -Converted AMD IOMMU into a composite PCI and System Bus device. This helps with:
      -We can now inherit from X86 IOMMU base class(which is implemented as a System Bus device).
      -We can now reserve MMIO region for IOMMU without a BAR register and without a hack.

Changes since v12

   -Coding style fixes [Jan, Michael]
   -Error logging fix to avoid using a macro[Jan]
   -moved some PCI macros to PCI header[Jan]
   -Use a lookup table for MMIO register names when tracing[Jan]

Changes since V11
   -AMD IOMMU is not started with -device amd-iommu (with a dependency on Marcel's patches).
   -IOMMU commands are represented using bitfields which is less error prone and more readable[Peter]
   -Changed from debug fprintfs to tracing[Jan]

Changes since V10
 
   -Support for huge pages including some obscure AMD IOMMU feature that allows default page size override[Jan].
   -Fixed an issue with generation of interrupts. We noted that AMD IOMMU has BusMaster- and is therefore not able to generate interrupts like any other PCI device. We have resulted in writing directly to system address but this could be fixed by some patches which have not been merged yet.

Changes since v9

   -amd_iommu prefixes have been renamed to a shorter 'amdvi' both in the macros
    and in the functions/code. The register macros have not been moved to the 
    implementation file since almost the macros there are basically macros and I 
    reckoned renaming them should suffice.
   -taken care of byte order in the use of 'dma_memory_read'[Michael]
   -Taken care of invalid DTE entries to ensure no DMA unless a device is configured to allow it.
   -An issue with the emulate IOMMU defaulting to AMD_IOMMU has been fixed[Marcel]
   
You can test[1] this patches by starting with parameters 
    qemu-system-x86_64 -M -device amd-iommu -m 2G -enable-kvm -smp 4 -cpu host -hda file.img -soundhw ac97 
emulating whatever devices you want.

Not passing any command line parameters to linux should be enough to test this patches since the devices are basically
passes-through but to the 'host' (l1 guest). You can still go ahead pass command line parameter 'iommu=pt iommu=1'
and try to pass a device to L2 guest. This can also done without passing any iommu related parameters to the kernel. 

David Kiarie (4):
  hw/pci: Prepare for AMD IOMMU
  hw/i386/trace-events: Add AMD IOMMU trace events
  hw/i386: Introduce AMD IOMMU
  hw/i386: AMD IOMMU IVRS table

 hw/acpi/aml-build.c         |    2 +-
 hw/i386/Makefile.objs       |    1 +
 hw/i386/acpi-build.c        |   76 ++-
 hw/i386/amd_iommu.c         | 1397 +++++++++++++++++++++++++++++++++++++++++++
 hw/i386/amd_iommu.h         |  390 ++++++++++++
 hw/i386/trace-events        |   36 ++
 hw/i386/x86-iommu.c         |   19 +
 include/hw/acpi/aml-build.h |    1 +
 include/hw/i386/x86-iommu.h |   11 +
 include/hw/pci/pci.h        |    5 +-
 10 files changed, 1929 insertions(+), 9 deletions(-)
 create mode 100644 hw/i386/amd_iommu.c
 create mode 100644 hw/i386/amd_iommu.h

-- 
2.1.4

^ permalink raw reply	[flat|nested] 25+ messages in thread
* [Qemu-devel] [V15 0/4] AMD IOMMU
@ 2016-08-09 20:27 David Kiarie
  2016-08-09 20:27 ` [Qemu-devel] [V15 1/4] hw/pci: Prepare for " David Kiarie
  0 siblings, 1 reply; 25+ messages in thread
From: David Kiarie @ 2016-08-09 20:27 UTC (permalink / raw)
  To: qemu-devel
  Cc: peterx, jan.kiszka, rkrcmar, valentine.sinitsyn, ehabkost, mst,
	David Kiarie

Hi all,

This patchset adds basic AMD IOMMU emulation support to Qemu. 

Change since v14
   -MMIO register reading/write bug fix [Peter]
   -Endian-ness issue fix[Peter]
   -Bitfields layouts in IOMMU commands fix[Peter]
   -IVRS changed IVHD device entry from type 3 to 1 to save a few bytes
   -coding style issues, comment grammer and other miscellaneous fixes.

Changes since v13
   -Added an error to make AMD IOMMU incompatible with device assignment.[Alex]
   -Converted AMD IOMMU into a composite PCI and System Bus device. This helps with:
      -We can now inherit from X86 IOMMU base class(which is implemented as a System Bus device).
      -We can now reserve MMIO region for IOMMU without a BAR register and without a hack.

Changes since v12

   -Coding style fixes [Jan, Michael]
   -Error logging fix to avoid using a macro[Jan]
   -moved some PCI macros to PCI header[Jan]
   -Use a lookup table for MMIO register names when tracing[Jan]

Changes since V11
   -AMD IOMMU is not started with -device amd-iommu (with a dependency on Marcel's patches).
   -IOMMU commands are represented using bitfields which is less error prone and more readable[Peter]
   -Changed from debug fprintfs to tracing[Jan]

Changes since V10
 
   -Support for huge pages including some obscure AMD IOMMU feature that allows default page size override[Jan].
   -Fixed an issue with generation of interrupts. We noted that AMD IOMMU has BusMaster- and is therefore not able to generate interrupts like any other PCI device. We have resulted in writing directly to system address but this could be fixed by some patches which have not been merged yet.

Changes since v9

   -amd_iommu prefixes have been renamed to a shorter 'amdvi' both in the macros
    and in the functions/code. The register macros have not been moved to the 
    implementation file since almost the macros there are basically macros and I 
    reckoned renaming them should suffice.
   -taken care of byte order in the use of 'dma_memory_read'[Michael]
   -Taken care of invalid DTE entries to ensure no DMA unless a device is configured to allow it.
   -An issue with the emulate IOMMU defaulting to AMD_IOMMU has been fixed[Marcel]
   
You can test[1] this patches by starting with parameters 
    qemu-system-x86_64 -M -device amd-iommu -m 2G -enable-kvm -smp 4 -cpu host -hda file.img -soundhw ac97 
emulating whatever devices you want.

Not passing any command line parameters to linux should be enough to test this patches since the devices are basically
passes-through but to the 'host' (l1 guest). You can still go ahead pass command line parameter 'iommu=pt iommu=1'
and try to pass a device to L2 guest. This can also done without passing any iommu related parameters to the kernel. 

David Kiarie (4):
  hw/pci: Prepare for AMD IOMMU
  hw/i386/trace-events: Add AMD IOMMU trace events
  hw/i386: Introduce AMD IOMMU
  hw/i386: AMD IOMMU IVRS table

 hw/acpi/aml-build.c         |    2 +-
 hw/i386/Makefile.objs       |    1 +
 hw/i386/acpi-build.c        |   76 ++-
 hw/i386/amd_iommu.c         | 1401 +++++++++++++++++++++++++++++++++++++++++++
 hw/i386/amd_iommu.h         |  390 ++++++++++++
 hw/i386/intel_iommu.c       |    1 +
 hw/i386/trace-events        |   36 ++
 hw/i386/x86-iommu.c         |    6 +
 include/hw/acpi/aml-build.h |    1 +
 include/hw/i386/x86-iommu.h |   12 +
 include/hw/pci/pci.h        |    4 +-
 11 files changed, 1919 insertions(+), 11 deletions(-)
 create mode 100644 hw/i386/amd_iommu.c
 create mode 100644 hw/i386/amd_iommu.h

-- 
2.1.4

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

end of thread, other threads:[~2016-08-12 19:42 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-02  8:39 [Qemu-devel] [V15 0/4] AMD IOMMU David Kiarie
2016-08-02  8:39 ` [Qemu-devel] [V15 1/4] hw/pci: Prepare for " David Kiarie
2016-08-08  9:01   ` Peter Xu
2016-08-08  9:25     ` David Kiarie
2016-08-02  8:39 ` [Qemu-devel] [V15 2/4] hw/i386/trace-events: Add AMD IOMMU trace events David Kiarie
2016-08-02  8:39 ` [Qemu-devel] [V15 3/4] hw/i386: Introduce AMD IOMMU David Kiarie
2016-08-09  5:44   ` Peter Xu
2016-08-09 12:07     ` David Kiarie
2016-08-09 12:21       ` Peter Xu
2016-08-09 12:52     ` David Kiarie
2016-08-09 13:01       ` Valentine Sinitsyn
2016-08-09 13:17         ` David Kiarie
2016-08-10  2:08       ` Peter Xu
2016-08-10  6:30         ` David Kiarie
2016-08-09 17:46     ` David Kiarie
2016-08-10  1:49       ` Peter Xu
2016-08-11  8:23   ` Valentine Sinitsyn
2016-08-11  8:32     ` David Kiarie
2016-08-11  8:35       ` Valentine Sinitsyn
2016-08-12 19:10   ` Valentine Sinitsyn
2016-08-12 19:40     ` David Kiarie
2016-08-12 19:41       ` Valentine Sinitsyn
2016-08-02  8:39 ` [Qemu-devel] [V15 4/4] hw/i386: AMD IOMMU IVRS table David Kiarie
2016-08-02 13:32   ` Igor Mammedov
2016-08-09 20:27 [Qemu-devel] [V15 0/4] AMD IOMMU David Kiarie
2016-08-09 20:27 ` [Qemu-devel] [V15 1/4] hw/pci: Prepare for " David Kiarie

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.