diff options
Diffstat (limited to 'drivers/pci')
-rw-r--r-- | drivers/pci/dmar.c | 7 | ||||
-rw-r--r-- | drivers/pci/intel-iommu.c | 17 | ||||
-rw-r--r-- | drivers/pci/intr_remapping.c | 14 | ||||
-rw-r--r-- | drivers/pci/pci-driver.c | 16 | ||||
-rw-r--r-- | drivers/pci/quirks.c | 4 |
5 files changed, 36 insertions, 22 deletions
diff --git a/drivers/pci/dmar.c b/drivers/pci/dmar.c index 7b287cb38b7a..ab99783dccec 100644 --- a/drivers/pci/dmar.c +++ b/drivers/pci/dmar.c | |||
@@ -33,6 +33,7 @@ | |||
33 | #include <linux/timer.h> | 33 | #include <linux/timer.h> |
34 | #include <linux/irq.h> | 34 | #include <linux/irq.h> |
35 | #include <linux/interrupt.h> | 35 | #include <linux/interrupt.h> |
36 | #include <linux/tboot.h> | ||
36 | 37 | ||
37 | #undef PREFIX | 38 | #undef PREFIX |
38 | #define PREFIX "DMAR:" | 39 | #define PREFIX "DMAR:" |
@@ -413,6 +414,12 @@ parse_dmar_table(void) | |||
413 | */ | 414 | */ |
414 | dmar_table_detect(); | 415 | dmar_table_detect(); |
415 | 416 | ||
417 | /* | ||
418 | * ACPI tables may not be DMA protected by tboot, so use DMAR copy | ||
419 | * SINIT saved in SinitMleData in TXT heap (which is DMA protected) | ||
420 | */ | ||
421 | dmar_tbl = tboot_get_dmar_table(dmar_tbl); | ||
422 | |||
416 | dmar = (struct acpi_table_dmar *)dmar_tbl; | 423 | dmar = (struct acpi_table_dmar *)dmar_tbl; |
417 | if (!dmar) | 424 | if (!dmar) |
418 | return -ENODEV; | 425 | return -ENODEV; |
diff --git a/drivers/pci/intel-iommu.c b/drivers/pci/intel-iommu.c index 2314ad7ee5fe..562221e11917 100644 --- a/drivers/pci/intel-iommu.c +++ b/drivers/pci/intel-iommu.c | |||
@@ -37,6 +37,7 @@ | |||
37 | #include <linux/iommu.h> | 37 | #include <linux/iommu.h> |
38 | #include <linux/intel-iommu.h> | 38 | #include <linux/intel-iommu.h> |
39 | #include <linux/sysdev.h> | 39 | #include <linux/sysdev.h> |
40 | #include <linux/tboot.h> | ||
40 | #include <asm/cacheflush.h> | 41 | #include <asm/cacheflush.h> |
41 | #include <asm/iommu.h> | 42 | #include <asm/iommu.h> |
42 | #include "pci.h" | 43 | #include "pci.h" |
@@ -3183,12 +3184,22 @@ static int __init init_iommu_sysfs(void) | |||
3183 | int __init intel_iommu_init(void) | 3184 | int __init intel_iommu_init(void) |
3184 | { | 3185 | { |
3185 | int ret = 0; | 3186 | int ret = 0; |
3187 | int force_on = 0; | ||
3186 | 3188 | ||
3187 | if (dmar_table_init()) | 3189 | /* VT-d is required for a TXT/tboot launch, so enforce that */ |
3190 | force_on = tboot_force_iommu(); | ||
3191 | |||
3192 | if (dmar_table_init()) { | ||
3193 | if (force_on) | ||
3194 | panic("tboot: Failed to initialize DMAR table\n"); | ||
3188 | return -ENODEV; | 3195 | return -ENODEV; |
3196 | } | ||
3189 | 3197 | ||
3190 | if (dmar_dev_scope_init()) | 3198 | if (dmar_dev_scope_init()) { |
3199 | if (force_on) | ||
3200 | panic("tboot: Failed to initialize DMAR device scope\n"); | ||
3191 | return -ENODEV; | 3201 | return -ENODEV; |
3202 | } | ||
3192 | 3203 | ||
3193 | /* | 3204 | /* |
3194 | * Check the need for DMA-remapping initialization now. | 3205 | * Check the need for DMA-remapping initialization now. |
@@ -3204,6 +3215,8 @@ int __init intel_iommu_init(void) | |||
3204 | 3215 | ||
3205 | ret = init_dmars(); | 3216 | ret = init_dmars(); |
3206 | if (ret) { | 3217 | if (ret) { |
3218 | if (force_on) | ||
3219 | panic("tboot: Failed to initialize DMARs\n"); | ||
3207 | printk(KERN_ERR "IOMMU: dmar init failed\n"); | 3220 | printk(KERN_ERR "IOMMU: dmar init failed\n"); |
3208 | put_iova_domain(&reserved_iova_list); | 3221 | put_iova_domain(&reserved_iova_list); |
3209 | iommu_exit_mempool(); | 3222 | iommu_exit_mempool(); |
diff --git a/drivers/pci/intr_remapping.c b/drivers/pci/intr_remapping.c index 4f5b8712931f..44803644ca05 100644 --- a/drivers/pci/intr_remapping.c +++ b/drivers/pci/intr_remapping.c | |||
@@ -55,15 +55,12 @@ static struct irq_2_iommu *irq_2_iommu(unsigned int irq) | |||
55 | return desc->irq_2_iommu; | 55 | return desc->irq_2_iommu; |
56 | } | 56 | } |
57 | 57 | ||
58 | static struct irq_2_iommu *irq_2_iommu_alloc_node(unsigned int irq, int node) | 58 | static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq) |
59 | { | 59 | { |
60 | struct irq_desc *desc; | 60 | struct irq_desc *desc; |
61 | struct irq_2_iommu *irq_iommu; | 61 | struct irq_2_iommu *irq_iommu; |
62 | 62 | ||
63 | /* | 63 | desc = irq_to_desc(irq); |
64 | * alloc irq desc if not allocated already. | ||
65 | */ | ||
66 | desc = irq_to_desc_alloc_node(irq, node); | ||
67 | if (!desc) { | 64 | if (!desc) { |
68 | printk(KERN_INFO "can not get irq_desc for %d\n", irq); | 65 | printk(KERN_INFO "can not get irq_desc for %d\n", irq); |
69 | return NULL; | 66 | return NULL; |
@@ -72,16 +69,11 @@ static struct irq_2_iommu *irq_2_iommu_alloc_node(unsigned int irq, int node) | |||
72 | irq_iommu = desc->irq_2_iommu; | 69 | irq_iommu = desc->irq_2_iommu; |
73 | 70 | ||
74 | if (!irq_iommu) | 71 | if (!irq_iommu) |
75 | desc->irq_2_iommu = get_one_free_irq_2_iommu(node); | 72 | desc->irq_2_iommu = get_one_free_irq_2_iommu(irq_node(irq)); |
76 | 73 | ||
77 | return desc->irq_2_iommu; | 74 | return desc->irq_2_iommu; |
78 | } | 75 | } |
79 | 76 | ||
80 | static struct irq_2_iommu *irq_2_iommu_alloc(unsigned int irq) | ||
81 | { | ||
82 | return irq_2_iommu_alloc_node(irq, cpu_to_node(boot_cpu_id)); | ||
83 | } | ||
84 | |||
85 | #else /* !CONFIG_SPARSE_IRQ */ | 77 | #else /* !CONFIG_SPARSE_IRQ */ |
86 | 78 | ||
87 | static struct irq_2_iommu irq_2_iommuX[NR_IRQS]; | 79 | static struct irq_2_iommu irq_2_iommuX[NR_IRQS]; |
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index ffc15e97d11c..e5d47be3c6d7 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -600,7 +600,7 @@ static void pci_pm_complete(struct device *dev) | |||
600 | static int pci_pm_suspend(struct device *dev) | 600 | static int pci_pm_suspend(struct device *dev) |
601 | { | 601 | { |
602 | struct pci_dev *pci_dev = to_pci_dev(dev); | 602 | struct pci_dev *pci_dev = to_pci_dev(dev); |
603 | struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 603 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
604 | 604 | ||
605 | if (pci_has_legacy_pm_support(pci_dev)) | 605 | if (pci_has_legacy_pm_support(pci_dev)) |
606 | return pci_legacy_suspend(dev, PMSG_SUSPEND); | 606 | return pci_legacy_suspend(dev, PMSG_SUSPEND); |
@@ -636,7 +636,7 @@ static int pci_pm_suspend(struct device *dev) | |||
636 | static int pci_pm_suspend_noirq(struct device *dev) | 636 | static int pci_pm_suspend_noirq(struct device *dev) |
637 | { | 637 | { |
638 | struct pci_dev *pci_dev = to_pci_dev(dev); | 638 | struct pci_dev *pci_dev = to_pci_dev(dev); |
639 | struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 639 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
640 | 640 | ||
641 | if (pci_has_legacy_pm_support(pci_dev)) | 641 | if (pci_has_legacy_pm_support(pci_dev)) |
642 | return pci_legacy_suspend_late(dev, PMSG_SUSPEND); | 642 | return pci_legacy_suspend_late(dev, PMSG_SUSPEND); |
@@ -695,7 +695,7 @@ static int pci_pm_resume_noirq(struct device *dev) | |||
695 | static int pci_pm_resume(struct device *dev) | 695 | static int pci_pm_resume(struct device *dev) |
696 | { | 696 | { |
697 | struct pci_dev *pci_dev = to_pci_dev(dev); | 697 | struct pci_dev *pci_dev = to_pci_dev(dev); |
698 | struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 698 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
699 | int error = 0; | 699 | int error = 0; |
700 | 700 | ||
701 | /* | 701 | /* |
@@ -734,7 +734,7 @@ static int pci_pm_resume(struct device *dev) | |||
734 | static int pci_pm_freeze(struct device *dev) | 734 | static int pci_pm_freeze(struct device *dev) |
735 | { | 735 | { |
736 | struct pci_dev *pci_dev = to_pci_dev(dev); | 736 | struct pci_dev *pci_dev = to_pci_dev(dev); |
737 | struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 737 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
738 | 738 | ||
739 | if (pci_has_legacy_pm_support(pci_dev)) | 739 | if (pci_has_legacy_pm_support(pci_dev)) |
740 | return pci_legacy_suspend(dev, PMSG_FREEZE); | 740 | return pci_legacy_suspend(dev, PMSG_FREEZE); |
@@ -801,7 +801,7 @@ static int pci_pm_thaw_noirq(struct device *dev) | |||
801 | static int pci_pm_thaw(struct device *dev) | 801 | static int pci_pm_thaw(struct device *dev) |
802 | { | 802 | { |
803 | struct pci_dev *pci_dev = to_pci_dev(dev); | 803 | struct pci_dev *pci_dev = to_pci_dev(dev); |
804 | struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 804 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
805 | int error = 0; | 805 | int error = 0; |
806 | 806 | ||
807 | if (pci_has_legacy_pm_support(pci_dev)) | 807 | if (pci_has_legacy_pm_support(pci_dev)) |
@@ -822,7 +822,7 @@ static int pci_pm_thaw(struct device *dev) | |||
822 | static int pci_pm_poweroff(struct device *dev) | 822 | static int pci_pm_poweroff(struct device *dev) |
823 | { | 823 | { |
824 | struct pci_dev *pci_dev = to_pci_dev(dev); | 824 | struct pci_dev *pci_dev = to_pci_dev(dev); |
825 | struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 825 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
826 | 826 | ||
827 | if (pci_has_legacy_pm_support(pci_dev)) | 827 | if (pci_has_legacy_pm_support(pci_dev)) |
828 | return pci_legacy_suspend(dev, PMSG_HIBERNATE); | 828 | return pci_legacy_suspend(dev, PMSG_HIBERNATE); |
@@ -893,7 +893,7 @@ static int pci_pm_restore_noirq(struct device *dev) | |||
893 | static int pci_pm_restore(struct device *dev) | 893 | static int pci_pm_restore(struct device *dev) |
894 | { | 894 | { |
895 | struct pci_dev *pci_dev = to_pci_dev(dev); | 895 | struct pci_dev *pci_dev = to_pci_dev(dev); |
896 | struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; | 896 | const struct dev_pm_ops *pm = dev->driver ? dev->driver->pm : NULL; |
897 | int error = 0; | 897 | int error = 0; |
898 | 898 | ||
899 | /* | 899 | /* |
@@ -931,7 +931,7 @@ static int pci_pm_restore(struct device *dev) | |||
931 | 931 | ||
932 | #endif /* !CONFIG_HIBERNATION */ | 932 | #endif /* !CONFIG_HIBERNATION */ |
933 | 933 | ||
934 | struct dev_pm_ops pci_dev_pm_ops = { | 934 | const struct dev_pm_ops pci_dev_pm_ops = { |
935 | .prepare = pci_pm_prepare, | 935 | .prepare = pci_pm_prepare, |
936 | .complete = pci_pm_complete, | 936 | .complete = pci_pm_complete, |
937 | .suspend = pci_pm_suspend, | 937 | .suspend = pci_pm_suspend, |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 3b693942ebde..6099facecd79 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -990,7 +990,7 @@ DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454NX, | |||
990 | 990 | ||
991 | static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev) | 991 | static void __devinit quirk_amd_ide_mode(struct pci_dev *pdev) |
992 | { | 992 | { |
993 | /* set sb600/sb700/sb800 sata to ahci mode */ | 993 | /* set SBX00 SATA in IDE mode to AHCI mode */ |
994 | u8 tmp; | 994 | u8 tmp; |
995 | 995 | ||
996 | pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp); | 996 | pci_read_config_byte(pdev, PCI_CLASS_DEVICE, &tmp); |
@@ -1009,6 +1009,8 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk | |||
1009 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode); | 1009 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SATA, quirk_amd_ide_mode); |
1010 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); | 1010 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); |
1011 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); | 1011 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP700_SATA, quirk_amd_ide_mode); |
1012 | DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SB900_SATA_IDE, quirk_amd_ide_mode); | ||
1013 | DECLARE_PCI_FIXUP_RESUME_EARLY(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_SB900_SATA_IDE, quirk_amd_ide_mode); | ||
1012 | 1014 | ||
1013 | /* | 1015 | /* |
1014 | * Serverworks CSB5 IDE does not fully support native mode | 1016 | * Serverworks CSB5 IDE does not fully support native mode |