diff options
author | Keshavamurthy, Anil S <anil.s.keshavamurthy@intel.com> | 2007-10-21 19:41:41 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-22 11:13:18 -0400 |
commit | 10e5247f40f3bf7508a0ed2848c9cae37bddf4bc (patch) | |
tree | adca606f00ebcbdbdc5c474f012105d7e59152f6 /include/linux | |
parent | 89910cccb8fec0c1140d33a743e72a712efd4f05 (diff) |
Intel IOMMU: DMAR detection and parsing logic
This patch supports the upcomming Intel IOMMU hardware a.k.a. Intel(R)
Virtualization Technology for Directed I/O Architecture and the hardware spec
for the same can be found here
http://www.intel.com/technology/virtualization/index.htm
FAQ! (questions from akpm, answers from ak)
> So... what's all this code for?
>
> I assume that the intent here is to speed things up under Xen, etc?
Yes in some cases, but not this code. That would be the Xen version of this
code that could potentially assign whole devices to guests. I expect this to
be only useful in some special cases though because most hardware is not
virtualizable and you typically want an own instance for each guest.
Ok at some point KVM might implement this too; i likely would use this code
for this.
> Do we
> have any benchmark results to help us to decide whether a merge would be
> justified?
The main advantage for doing it in the normal kernel is not performance, but
more safety. Broken devices won't be able to corrupt memory by doing random
DMA.
Unfortunately that doesn't work for graphics yet, for that need user space
interfaces for the X server are needed.
There are some potential performance benefits too:
- When you have a device that cannot address the complete address range an
IOMMU can remap its memory instead of bounce buffering. Remapping is likely
cheaper than copying.
- The IOMMU can merge sg lists into a single virtual block. This could
potentially speed up SG IO when the device is slow walking SG lists. [I
long ago benchmarked 5% on some block benchmark with an old MPT Fusion; but
it probably depends a lot on the HBA]
And you get better driver debugging because unexpected memory accesses from
the devices will cause a trappable event.
>
> Does it slow anything down?
It adds more overhead to each IO so yes.
This patch:
Add support for early detection and parsing of DMAR's (DMA Remapping) reported
to OS via ACPI tables.
DMA remapping(DMAR) devices support enables independent address translations
for Direct Memory Access(DMA) from Devices. These DMA remapping devices are
reported via ACPI tables and includes pci device scope covered by these DMA
remapping device.
For detailed info on the specification of "Intel(R) Virtualization Technology
for Directed I/O Architecture" please see
http://www.intel.com/technology/virtualization/index.htm
Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
Cc: Andi Kleen <ak@suse.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Muli Ben-Yehuda <muli@il.ibm.com>
Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Ashok Raj <ashok.raj@intel.com>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Christoph Lameter <clameter@sgi.com>
Cc: Greg KH <greg@kroah.com>
Cc: Len Brown <lenb@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/dmar.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/include/linux/dmar.h b/include/linux/dmar.h new file mode 100644 index 000000000000..8d3e0e38ca4d --- /dev/null +++ b/include/linux/dmar.h | |||
@@ -0,0 +1,52 @@ | |||
1 | /* | ||
2 | * Copyright (c) 2006, Intel Corporation. | ||
3 | * | ||
4 | * This program is free software; you can redistribute it and/or modify it | ||
5 | * under the terms and conditions of the GNU General Public License, | ||
6 | * version 2, as published by the Free Software Foundation. | ||
7 | * | ||
8 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
9 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
10 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for | ||
11 | * more details. | ||
12 | * | ||
13 | * You should have received a copy of the GNU General Public License along with | ||
14 | * this program; if not, write to the Free Software Foundation, Inc., 59 Temple | ||
15 | * Place - Suite 330, Boston, MA 02111-1307 USA. | ||
16 | * | ||
17 | * Copyright (C) Ashok Raj <ashok.raj@intel.com> | ||
18 | * Copyright (C) Shaohua Li <shaohua.li@intel.com> | ||
19 | */ | ||
20 | |||
21 | #ifndef __DMAR_H__ | ||
22 | #define __DMAR_H__ | ||
23 | |||
24 | #include <linux/acpi.h> | ||
25 | #include <linux/types.h> | ||
26 | |||
27 | |||
28 | extern int dmar_table_init(void); | ||
29 | extern int early_dmar_detect(void); | ||
30 | |||
31 | extern struct list_head dmar_drhd_units; | ||
32 | extern struct list_head dmar_rmrr_units; | ||
33 | |||
34 | struct dmar_drhd_unit { | ||
35 | struct list_head list; /* list of drhd units */ | ||
36 | u64 reg_base_addr; /* register base address*/ | ||
37 | struct pci_dev **devices; /* target device array */ | ||
38 | int devices_cnt; /* target device count */ | ||
39 | u8 ignored:1; /* ignore drhd */ | ||
40 | u8 include_all:1; | ||
41 | struct intel_iommu *iommu; | ||
42 | }; | ||
43 | |||
44 | struct dmar_rmrr_unit { | ||
45 | struct list_head list; /* list of rmrr units */ | ||
46 | u64 base_address; /* reserved base address*/ | ||
47 | u64 end_address; /* reserved end address */ | ||
48 | struct pci_dev **devices; /* target devices */ | ||
49 | int devices_cnt; /* target device count */ | ||
50 | }; | ||
51 | |||
52 | #endif /* __DMAR_H__ */ | ||