qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [V4 0/4] AMD IO MMU
@ 2016-01-18 15:25 David Kiarie
  2016-01-18 15:25 ` [Qemu-devel] [V4 1/4] hw/i386: Introduce " David Kiarie
                   ` (3 more replies)
  0 siblings, 4 replies; 23+ messages in thread
From: David Kiarie @ 2016-01-18 15:25 UTC (permalink / raw)
  To: qemu-devel
  Cc: mst, crosthwaitepeter, valentine.sinitsyn, jan.kiszka, marcel,
	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

^ permalink raw reply	[flat|nested] 23+ messages in thread
* [Qemu-devel] [V4 0/4] AMD IOMMU
@ 2016-02-17 19:09 David Kiarie
  2016-02-17 19:09 ` [Qemu-devel] [V4 2/4] hw/core: Add AMD IO MMU to machine properties David Kiarie
  0 siblings, 1 reply; 23+ messages in thread
From: David Kiarie @ 2016-02-17 19:09 UTC (permalink / raw)
  To: qemu-devel
  Cc: mst, crosthwaitepeter, valentine.sinitsyn, jan.kiszka, marcel,
	David Kiarie

Hello there,

This is v5 of AMD IOMMU patches that fixes the issues mentioned in v4 except I fail to see the endian-ness issues Michael mentioned.

I also stripped PIIX AMD IOMMU support since I added an MSI interrupt. One of the patches has a conflict with current master but it this is mergable I could quickly send a clean patch.

Thanks!

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             |   28 +-
 hw/i386/Makefile.objs         |    1 +
 hw/i386/acpi-build.c          |   98 ++-
 hw/i386/amd_iommu.c           | 1430 +++++++++++++++++++++++++++++++++++++++++
 hw/i386/amd_iommu.h           |  395 ++++++++++++
 hw/pci-host/piix.c            |    1 +
 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 +-
 13 files changed, 2011 insertions(+), 27 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] 23+ messages in thread

end of thread, other threads:[~2016-02-21  8:24 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-18 15:25 [Qemu-devel] [V4 0/4] AMD IO MMU David Kiarie
2016-01-18 15:25 ` [Qemu-devel] [V4 1/4] hw/i386: Introduce " David Kiarie
2016-02-04 15:03   ` Michael S. Tsirkin
2016-02-14 18:02     ` David kiarie
2016-02-15  3:41     ` David kiarie
2016-02-15  3:54       ` David kiarie
2016-02-15 15:46     ` Marcel Apfelbaum
2016-02-15 15:55       ` jack bean
2016-01-18 15:25 ` [Qemu-devel] [V4 2/4] hw/core: Add AMD IO MMU to machine properties David Kiarie
2016-01-18 16:21   ` Marcel Apfelbaum
2016-01-18 16:48     ` David Kiarie
2016-01-18 17:27       ` Marcel Apfelbaum
2016-01-18 17:57         ` David Kiarie
2016-02-14 13:06     ` Marcel Apfelbaum
2016-01-18 15:25 ` [Qemu-devel] [V4 3/4] hw/i386: ACPI table for AMD IO MMU David Kiarie
2016-02-14 12:54   ` Marcel Apfelbaum
2016-02-14 13:07     ` Michael S. Tsirkin
2016-02-14 18:11       ` David kiarie
2016-01-18 15:25 ` [Qemu-devel] [V4 4/4] hw/pci-host: Emulate " David Kiarie
2016-02-14 13:02   ` Marcel Apfelbaum
2016-02-14 18:06     ` David kiarie
  -- strict thread matches above, loose matches on Subject: below --
2016-02-17 19:09 [Qemu-devel] [V4 0/4] AMD IOMMU David Kiarie
2016-02-17 19:09 ` [Qemu-devel] [V4 2/4] hw/core: Add AMD IO MMU to machine properties David Kiarie
2016-02-21  8:23   ` Jan Kiszka

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).