diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2008-07-10 14:16:40 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-12 02:44:50 -0400 |
commit | ad3ad3f6a2caebf56869b83b69e23eb9fa5e0ab6 (patch) | |
tree | 7bc99dde6a6313eb43783086a33f6eebc1da1907 /drivers/pci/intr_remapping.c | |
parent | 2d6b5f85bb4ca919d8ab0f30311309b53fb93bc3 (diff) |
x64, x2apic/intr-remap: parse ioapic scope under vt-d structures
Parse the vt-d device scope structures to find the mapping between IO-APICs
and the interrupt remapping hardware units.
This will be used later for enabling Interrupt-remapping for IOAPIC devices.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: akpm@linux-foundation.org
Cc: arjan@linux.intel.com
Cc: andi@firstfloor.org
Cc: ebiederm@xmission.com
Cc: jbarnes@virtuousgeek.org
Cc: steiner@sgi.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'drivers/pci/intr_remapping.c')
-rw-r--r-- | drivers/pci/intr_remapping.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c new file mode 100644 index 000000000000..a80b87921c68 --- /dev/null +++ b/drivers/pci/intr_remapping.c | |||
@@ -0,0 +1,70 @@ | |||
1 | #include <linux/dmar.h> | ||
2 | #include <asm/io_apic.h> | ||
3 | #include "intel-iommu.h" | ||
4 | #include "intr_remapping.h" | ||
5 | |||
6 | static struct ioapic_scope ir_ioapic[MAX_IO_APICS]; | ||
7 | static int ir_ioapic_num; | ||
8 | |||
9 | static int ir_parse_ioapic_scope(struct acpi_dmar_header *header, | ||
10 | struct intel_iommu *iommu) | ||
11 | { | ||
12 | struct acpi_dmar_hardware_unit *drhd; | ||
13 | struct acpi_dmar_device_scope *scope; | ||
14 | void *start, *end; | ||
15 | |||
16 | drhd = (struct acpi_dmar_hardware_unit *)header; | ||
17 | |||
18 | start = (void *)(drhd + 1); | ||
19 | end = ((void *)drhd) + header->length; | ||
20 | |||
21 | while (start < end) { | ||
22 | scope = start; | ||
23 | if (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_IOAPIC) { | ||
24 | if (ir_ioapic_num == MAX_IO_APICS) { | ||
25 | printk(KERN_WARNING "Exceeded Max IO APICS\n"); | ||
26 | return -1; | ||
27 | } | ||
28 | |||
29 | printk(KERN_INFO "IOAPIC id %d under DRHD base" | ||
30 | " 0x%Lx\n", scope->enumeration_id, | ||
31 | drhd->address); | ||
32 | |||
33 | ir_ioapic[ir_ioapic_num].iommu = iommu; | ||
34 | ir_ioapic[ir_ioapic_num].id = scope->enumeration_id; | ||
35 | ir_ioapic_num++; | ||
36 | } | ||
37 | start += scope->length; | ||
38 | } | ||
39 | |||
40 | return 0; | ||
41 | } | ||
42 | |||
43 | /* | ||
44 | * Finds the assocaition between IOAPIC's and its Interrupt-remapping | ||
45 | * hardware unit. | ||
46 | */ | ||
47 | int __init parse_ioapics_under_ir(void) | ||
48 | { | ||
49 | struct dmar_drhd_unit *drhd; | ||
50 | int ir_supported = 0; | ||
51 | |||
52 | for_each_drhd_unit(drhd) { | ||
53 | struct intel_iommu *iommu = drhd->iommu; | ||
54 | |||
55 | if (ecap_ir_support(iommu->ecap)) { | ||
56 | if (ir_parse_ioapic_scope(drhd->hdr, iommu)) | ||
57 | return -1; | ||
58 | |||
59 | ir_supported = 1; | ||
60 | } | ||
61 | } | ||
62 | |||
63 | if (ir_supported && ir_ioapic_num != nr_ioapics) { | ||
64 | printk(KERN_WARNING | ||
65 | "Not all IO-APIC's listed under remapping hardware\n"); | ||
66 | return -1; | ||
67 | } | ||
68 | |||
69 | return ir_supported; | ||
70 | } | ||