From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52474) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZU11j-0003Jk-Cg for qemu-devel@nongnu.org; Mon, 24 Aug 2015 19:19:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZU11f-0006qQ-94 for qemu-devel@nongnu.org; Mon, 24 Aug 2015 19:19:43 -0400 Received: from mail-wi0-x22c.google.com ([2a00:1450:400c:c05::22c]:34733) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZU11f-0006oG-1U for qemu-devel@nongnu.org; Mon, 24 Aug 2015 19:19:39 -0400 Received: by widdq5 with SMTP id dq5so64034122wid.1 for ; Mon, 24 Aug 2015 16:19:38 -0700 (PDT) From: David Kiarie Date: Tue, 25 Aug 2015 02:19:25 +0300 Message-Id: <1440458369-7384-1-git-send-email-davidkiarie4@gmail.com> Subject: [Qemu-devel] [RFC 0/4] AMD IOMMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: valentine.sinitsyn@gmail.com, jan.kiszka@web.de, David Kiarie , mst@redhat.com 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