Skip to content

RFC AMD IOMMU

David Kiarie qemu-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest4 patches 17 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4hw/core: Prepare for introducing AMD IOMMUhw/core/machine.c include/hw/boards.h+27 -00 replies
2/4hw/i386: Introduce AMD IOMMUhw/i386/Makefile.objs hw/i386/amd_iommu.c hw/i386/amd_iommu.h+1292 -017 replies
3/4hw/i386: Introduce IVRS for AMD IOMMUhw/i386/acpi-build.c include/hw/acpi/acpi-defs.h+140 -00 replies
4/4hw/pci-host: Add AMD IOMMU emulation to q35 and PIIXhw/pci-host/piix.c hw/pci-host/q35.c+22 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [Qemu-devel] [RFC 0/4] AMD IOMMU

This series implements basic AMD IOMMU emulation to Qemu

AMD IOMMU emulation.
-This series emulates AMD IOMMU on qemu. It implements the following features
-Translation - 4K pages
-Event logging - particulary fault logging.

-AMD IOMMU, being a convectional PCI device doesn't rely on any other technology from AMD and hence you can test this patch on l2 guest emulated on an Intel PC. -These patches have been tested using the 'ac97' sound device with QEMU_AUDIO_DRV=alsa and proven to work.

Testing - pretty basic stuff...
On host
#kvm_amd is loaded with nested support by default by anyways :)
-$modprobe -r kvm_amd
$modprobe kvm_amd nested=1

$command to start guest with 'iommu=1' kernel arguments

On the guest

    $dmesg | AMD-Vi

        AMD-Vi: Enabling IOMMU at 0000:00:00.2 cap 0x40
        AMD-Vi: Lazy IO/TLB flushing enabled

    $modprobe kvm_amd

    $modprobe pci_stub

    $lspci -n 
    01:00.0 0200: 8086:10b9 (rev 06)

    $echo "8086 10b9" > /sys/bus/pci/drivers/pci-stub/new_id
    $echo 0000:01:00.0 > /sys/bus/pci/devices/0000:01:00.0/driver/unbind
    $echo 0000:01:00.0 > /sys/bus/pci/drivers/pci-stub/bind

    Assign the device

    $/usr/local/bin/qemu-system-x86_64 -m 512 -boot c -net none -hda /root/ia32e_rhel5u1.img -device pci-assign,host=01:00.0 

I guess that's all there is to say. Please test!

asla.

David (4):
hw/core: Prepare for introducing AMD IOMMU hw/i386: Introduce AMD IOMMU
hw/i386: Introduce IVRS for AMD IOMMU hw/pci-host: Add AMD IOMMU emulation to q35 and PIIX

 hw/core/machine.c           |  25 ++
 hw/i386/Makefile.objs       |   1 +
 hw/i386/acpi-build.c        |  85 ++++
 hw/i386/amd_iommu.c         | 993 ++++++++++++++++++++++++++++++++++++++++++++
 hw/i386/amd_iommu.h         | 298 +++++++++++++
 hw/pci-host/piix.c          |  11 +
 hw/pci-host/q35.c           |  11 +
 include/hw/acpi/acpi-defs.h |  55 +++
 include/hw/boards.h         |   2 +
 9 files changed, 1481 insertions(+)
 create mode 100644 hw/i386/amd_iommu.c
 create mode 100644 hw/i386/amd_iommu.h
Signature · 1 line
2.1.4