From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50595) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLBh4-0001cC-82 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 10:26:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLBh0-0003v4-27 for qemu-devel@nongnu.org; Mon, 18 Jan 2016 10:26:10 -0500 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]:33726) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLBgz-0003u2-Rr for qemu-devel@nongnu.org; Mon, 18 Jan 2016 10:26:05 -0500 Received: by mail-wm0-x244.google.com with SMTP id u188so17217127wmu.0 for ; Mon, 18 Jan 2016 07:26:05 -0800 (PST) From: David Kiarie Date: Mon, 18 Jan 2016 18:25:41 +0300 Message-Id: <1453130745-25793-1-git-send-email-davidkiarie4@gmail.com> Subject: [Qemu-devel] [V4 0/4] AMD IO MMU List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: mst@redhat.com, crosthwaitepeter@gmail.com, valentine.sinitsyn@gmail.com, jan.kiszka@web.de, marcel@redhat.com, David Kiarie David Kiarie (4): hw/i386: Introduce AMD IO MMU hw/core: Add AMD IO MMU to machine properties hw/i386: ACPI table for AMD IO MMU hw/pci-host: Emulate AMD IO MMU hw/core/machine.c | 17 +- hw/i386/Makefile.objs | 1 + hw/i386/acpi-build.c | 70 ++ hw/i386/amd_iommu.c | 1409 +++++++++++++++++++++++++++++++++++++++++ hw/i386/amd_iommu.h | 399 ++++++++++++ hw/pci-host/piix.c | 11 + hw/pci-host/q35.c | 14 +- include/hw/acpi/acpi-defs.h | 55 ++ include/hw/boards.h | 3 +- include/hw/i386/intel_iommu.h | 1 + include/hw/pci/pci.h | 2 + qemu-options.hx | 6 +- util/qemu-config.c | 4 +- vl.c | 8 + 14 files changed, 1984 insertions(+), 16 deletions(-) create mode 100644 hw/i386/amd_iommu.c create mode 100644 hw/i386/amd_iommu.h Hi all, V4 of IO MMU patches. Changes since V3 -Fixed Marcel's comments -byte swapping in ACPI code fixed As for IO MMU MMIO region: This is the code that sets up the IO MMU base address in coreboot. It seems to be reading something from the BUS config region which as per the comment should have a value written by BIOS. case CB_AmdSetMidPostConfig: nbConfigPtr->pNbConfig->IoApicBaseAddress = IO_APIC_ADDR; #ifndef IOMMU_SUPPORT_DISABLE //TODO enable iommu /* SBIOS must alloc 16K memory for IOMMU MMIO */ UINT32 MmcfgBarAddress; //using default IOmmuBaseAddress LibNbPciRead(nbConfigPtr->NbPciAddress.AddressValue | 0x1C, AccessWidth32, &MmcfgBarAddress, nbConfigPtr); MmcfgBarAddress &= ~0xf; if (MmcfgBarAddress != 0) { nbConfigPtr->IommuBaseAddress = MmcfgBarAddress; } nbConfigPtr->IommuBaseAddress = 0; //disable iommu #endif I have a feeling that this is getting overly and unnecessary complex - AMD have their own BIOS which they, only know what it does and we have ours( which of course, we know how it behaves). If we choose a static address and assign that to IO MMU mmio we could hypothetically have two problems. -SeaBIOS allocating BAR from the same region. -Someone selecting the region for other devices such as HPET. The first problem can be solved as we know from what addresses seaBIOS allocats BARs while as for the second they should know better. I have therefore selected an unused IO region just next IOAPIC and HPET region and mapped 16K for IO MMU mmio. David. -- 2.1.4