Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 112639
b: refs/heads/master
c: ad3ad3f
h: refs/heads/master
i:
  112637: aff88c6
  112635: 85a501f
  112631: 71f4b2e
  112623: 786d700
  112607: b19ac93
  112575: 390ad35
  112511: 237c049
  112383: 4eb0d39
  112127: 4241a0d
  111615: 7c62613
  110591: 6c83fc6
v: v3
  • Loading branch information
Suresh Siddha authored and Ingo Molnar committed Jul 12, 2008
1 parent 565bc37 commit 6447e5a
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 2d6b5f85bb4ca919d8ab0f30311309b53fb93bc3
refs/heads/master: ad3ad3f6a2caebf56869b83b69e23eb9fa5e0ab6
2 changes: 2 additions & 0 deletions trunk/drivers/pci/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ obj-$(CONFIG_HT_IRQ) += htirq.o
# Build Intel IOMMU support
obj-$(CONFIG_DMAR) += dmar.o iova.o intel-iommu.o

obj-$(CONFIG_INTR_REMAP) += dmar.o intr_remapping.o

#
# Some architectures use the generic PCI setup functions
#
Expand Down
3 changes: 3 additions & 0 deletions trunk/drivers/pci/dmar.c
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,9 @@ int __init dmar_table_init(void)
printk(KERN_INFO PREFIX "No RMRR found\n");
#endif

#ifdef CONFIG_INTR_REMAP
parse_ioapics_under_ir();
#endif
return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions trunk/drivers/pci/intel-iommu.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ static inline void dmar_writeq(void __iomem *addr, u64 val)
#define ecap_max_iotlb_offset(e) \
(ecap_iotlb_offset(e) + ecap_niotlb_iunits(e) * 16)
#define ecap_coherent(e) ((e) & 0x1)
#define ecap_eim_support(e) ((e >> 4) & 0x1)
#define ecap_ir_support(e) ((e >> 3) & 0x1)


/* IOTLB_REG */
Expand Down
70 changes: 70 additions & 0 deletions trunk/drivers/pci/intr_remapping.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include <linux/dmar.h>
#include <asm/io_apic.h>
#include "intel-iommu.h"
#include "intr_remapping.h"

static struct ioapic_scope ir_ioapic[MAX_IO_APICS];
static int ir_ioapic_num;

static int ir_parse_ioapic_scope(struct acpi_dmar_header *header,
struct intel_iommu *iommu)
{
struct acpi_dmar_hardware_unit *drhd;
struct acpi_dmar_device_scope *scope;
void *start, *end;

drhd = (struct acpi_dmar_hardware_unit *)header;

start = (void *)(drhd + 1);
end = ((void *)drhd) + header->length;

while (start < end) {
scope = start;
if (scope->entry_type == ACPI_DMAR_SCOPE_TYPE_IOAPIC) {
if (ir_ioapic_num == MAX_IO_APICS) {
printk(KERN_WARNING "Exceeded Max IO APICS\n");
return -1;
}

printk(KERN_INFO "IOAPIC id %d under DRHD base"
" 0x%Lx\n", scope->enumeration_id,
drhd->address);

ir_ioapic[ir_ioapic_num].iommu = iommu;
ir_ioapic[ir_ioapic_num].id = scope->enumeration_id;
ir_ioapic_num++;
}
start += scope->length;
}

return 0;
}

/*
* Finds the assocaition between IOAPIC's and its Interrupt-remapping
* hardware unit.
*/
int __init parse_ioapics_under_ir(void)
{
struct dmar_drhd_unit *drhd;
int ir_supported = 0;

for_each_drhd_unit(drhd) {
struct intel_iommu *iommu = drhd->iommu;

if (ecap_ir_support(iommu->ecap)) {
if (ir_parse_ioapic_scope(drhd->hdr, iommu))
return -1;

ir_supported = 1;
}
}

if (ir_supported && ir_ioapic_num != nr_ioapics) {
printk(KERN_WARNING
"Not all IO-APIC's listed under remapping hardware\n");
return -1;
}

return ir_supported;
}
6 changes: 6 additions & 0 deletions trunk/drivers/pci/intr_remapping.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#include "intel-iommu.h"

struct ioapic_scope {
struct intel_iommu *iommu;
unsigned int id;
};
1 change: 1 addition & 0 deletions trunk/include/linux/dmar.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ extern int intel_iommu_init(void);
extern int dmar_table_init(void);
extern int early_dmar_detect(void);
extern int dmar_dev_scope_init(void);
extern int parse_ioapics_under_ir(void);

extern struct list_head dmar_drhd_units;
extern struct list_head dmar_rmrr_units;
Expand Down

0 comments on commit 6447e5a

Please sign in to comment.