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 -- 2.1.4