diff options
author | Joerg Roedel <joro@8bytes.org> | 2013-04-09 10:53:58 -0400 |
---|---|---|
committer | Joerg Roedel <joro@8bytes.org> | 2013-04-19 14:48:43 -0400 |
commit | 31cff67f6b00456cac8890e8fd97694cadc754b8 (patch) | |
tree | 08c174e51eda29bde33307bedd498d9323321261 /drivers/iommu | |
parent | d3da2200d0d6096e7c7f9a951cd23bc391403326 (diff) |
iommu/amd: Extend IVRS special device data structure
This patch extends the devid_map data structure to allow
ioapic and hpet entries in ivrs to be overridden on the
kernel command line.
Reviewed-by: Shuah Khan <shuahkhan@gmail.com>
Signed-off-by: Joerg Roedel <joro@8bytes.org>
Diffstat (limited to 'drivers/iommu')
-rw-r--r-- | drivers/iommu/amd_iommu_init.c | 30 | ||||
-rw-r--r-- | drivers/iommu/amd_iommu_types.h | 1 |
2 files changed, 21 insertions, 10 deletions
diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index ea94ee644989..3a210f0c1b3f 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c | |||
@@ -703,25 +703,35 @@ static void __init set_dev_entry_from_acpi(struct amd_iommu *iommu, | |||
703 | set_iommu_for_device(iommu, devid); | 703 | set_iommu_for_device(iommu, devid); |
704 | } | 704 | } |
705 | 705 | ||
706 | static int __init add_special_device(u8 type, u8 id, u16 devid) | 706 | static int __init add_special_device(u8 type, u8 id, u16 devid, bool cmd_line) |
707 | { | 707 | { |
708 | struct devid_map *entry; | 708 | struct devid_map *entry; |
709 | struct list_head *list; | 709 | struct list_head *list; |
710 | 710 | ||
711 | if (type != IVHD_SPECIAL_IOAPIC && type != IVHD_SPECIAL_HPET) | 711 | if (type == IVHD_SPECIAL_IOAPIC) |
712 | list = &ioapic_map; | ||
713 | else if (type == IVHD_SPECIAL_HPET) | ||
714 | list = &hpet_map; | ||
715 | else | ||
712 | return -EINVAL; | 716 | return -EINVAL; |
713 | 717 | ||
718 | list_for_each_entry(entry, list, list) { | ||
719 | if (!(entry->id == id && entry->cmd_line)) | ||
720 | continue; | ||
721 | |||
722 | pr_info("AMD-Vi: Command-line override present for %s id %d - ignoring\n", | ||
723 | type == IVHD_SPECIAL_IOAPIC ? "IOAPIC" : "HPET", id); | ||
724 | |||
725 | return 0; | ||
726 | } | ||
727 | |||
714 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 728 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
715 | if (!entry) | 729 | if (!entry) |
716 | return -ENOMEM; | 730 | return -ENOMEM; |
717 | 731 | ||
718 | entry->id = id; | 732 | entry->id = id; |
719 | entry->devid = devid; | 733 | entry->devid = devid; |
720 | 734 | entry->cmd_line = cmd_line; | |
721 | if (type == IVHD_SPECIAL_IOAPIC) | ||
722 | list = &ioapic_map; | ||
723 | else | ||
724 | list = &hpet_map; | ||
725 | 735 | ||
726 | list_add_tail(&entry->list, list); | 736 | list_add_tail(&entry->list, list); |
727 | 737 | ||
@@ -929,7 +939,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
929 | PCI_FUNC(devid)); | 939 | PCI_FUNC(devid)); |
930 | 940 | ||
931 | set_dev_entry_from_acpi(iommu, devid, e->flags, 0); | 941 | set_dev_entry_from_acpi(iommu, devid, e->flags, 0); |
932 | ret = add_special_device(type, handle, devid); | 942 | ret = add_special_device(type, handle, devid, false); |
933 | if (ret) | 943 | if (ret) |
934 | return ret; | 944 | return ret; |
935 | break; | 945 | break; |
diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index 083f98c0488b..b81153fb9e60 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h | |||
@@ -592,6 +592,7 @@ struct devid_map { | |||
592 | struct list_head list; | 592 | struct list_head list; |
593 | u8 id; | 593 | u8 id; |
594 | u16 devid; | 594 | u16 devid; |
595 | bool cmd_line; | ||
595 | }; | 596 | }; |
596 | 597 | ||
597 | /* Map HPET and IOAPIC ids to the devid used by the IOMMU */ | 598 | /* Map HPET and IOAPIC ids to the devid used by the IOMMU */ |