diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2010-09-20 08:33:07 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2010-09-23 10:24:50 -0400 |
commit | e9bf51971157e367aabfc111a8219db010f69cd4 (patch) | |
tree | fa8fb0702fbd9f687e2d2ee19cef00e5d1861956 | |
parent | 49553c2ef88749dd502687f4eb9c258bb10a4f44 (diff) |
x86/amd-iommu: Set iommu configuration flags in enable-loop
This patch moves the setting of the configuration and
feature flags out out the acpi table parsing path and moves
it into the iommu-enable path. This is needed to reliably
fix resume-from-s3.
Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
-rw-r--r-- | arch/x86/include/asm/amd_iommu_types.h | 3 | ||||
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 49 |
2 files changed, 30 insertions, 22 deletions
diff --git a/arch/x86/include/asm/amd_iommu_types.h b/arch/x86/include/asm/amd_iommu_types.h index 7014e88bc779..ef2d5cd7d7e7 100644 --- a/arch/x86/include/asm/amd_iommu_types.h +++ b/arch/x86/include/asm/amd_iommu_types.h | |||
@@ -368,6 +368,9 @@ struct amd_iommu { | |||
368 | /* capabilities of that IOMMU read from ACPI */ | 368 | /* capabilities of that IOMMU read from ACPI */ |
369 | u32 cap; | 369 | u32 cap; |
370 | 370 | ||
371 | /* flags read from acpi table */ | ||
372 | u8 acpi_flags; | ||
373 | |||
371 | /* | 374 | /* |
372 | * Capability pointer. There could be more than one IOMMU per PCI | 375 | * Capability pointer. There could be more than one IOMMU per PCI |
373 | * device function if there are more than one AMD IOMMU capability | 376 | * device function if there are more than one AMD IOMMU capability |
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 3cc63e2b8dd4..85e9817ead43 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -649,29 +649,9 @@ static void __init init_iommu_from_acpi(struct amd_iommu *iommu, | |||
649 | struct ivhd_entry *e; | 649 | struct ivhd_entry *e; |
650 | 650 | ||
651 | /* | 651 | /* |
652 | * First set the recommended feature enable bits from ACPI | 652 | * First save the recommended feature enable bits from ACPI |
653 | * into the IOMMU control registers | ||
654 | */ | 653 | */ |
655 | h->flags & IVHD_FLAG_HT_TUN_EN_MASK ? | 654 | iommu->acpi_flags = h->flags; |
656 | iommu_feature_enable(iommu, CONTROL_HT_TUN_EN) : | ||
657 | iommu_feature_disable(iommu, CONTROL_HT_TUN_EN); | ||
658 | |||
659 | h->flags & IVHD_FLAG_PASSPW_EN_MASK ? | ||
660 | iommu_feature_enable(iommu, CONTROL_PASSPW_EN) : | ||
661 | iommu_feature_disable(iommu, CONTROL_PASSPW_EN); | ||
662 | |||
663 | h->flags & IVHD_FLAG_RESPASSPW_EN_MASK ? | ||
664 | iommu_feature_enable(iommu, CONTROL_RESPASSPW_EN) : | ||
665 | iommu_feature_disable(iommu, CONTROL_RESPASSPW_EN); | ||
666 | |||
667 | h->flags & IVHD_FLAG_ISOC_EN_MASK ? | ||
668 | iommu_feature_enable(iommu, CONTROL_ISOC_EN) : | ||
669 | iommu_feature_disable(iommu, CONTROL_ISOC_EN); | ||
670 | |||
671 | /* | ||
672 | * make IOMMU memory accesses cache coherent | ||
673 | */ | ||
674 | iommu_feature_enable(iommu, CONTROL_COHERENT_EN); | ||
675 | 655 | ||
676 | /* | 656 | /* |
677 | * Done. Now parse the device entries | 657 | * Done. Now parse the device entries |
@@ -1116,6 +1096,30 @@ static void init_device_table(void) | |||
1116 | } | 1096 | } |
1117 | } | 1097 | } |
1118 | 1098 | ||
1099 | static void iommu_init_flags(struct amd_iommu *iommu) | ||
1100 | { | ||
1101 | iommu->acpi_flags & IVHD_FLAG_HT_TUN_EN_MASK ? | ||
1102 | iommu_feature_enable(iommu, CONTROL_HT_TUN_EN) : | ||
1103 | iommu_feature_disable(iommu, CONTROL_HT_TUN_EN); | ||
1104 | |||
1105 | iommu->acpi_flags & IVHD_FLAG_PASSPW_EN_MASK ? | ||
1106 | iommu_feature_enable(iommu, CONTROL_PASSPW_EN) : | ||
1107 | iommu_feature_disable(iommu, CONTROL_PASSPW_EN); | ||
1108 | |||
1109 | iommu->acpi_flags & IVHD_FLAG_RESPASSPW_EN_MASK ? | ||
1110 | iommu_feature_enable(iommu, CONTROL_RESPASSPW_EN) : | ||
1111 | iommu_feature_disable(iommu, CONTROL_RESPASSPW_EN); | ||
1112 | |||
1113 | iommu->acpi_flags & IVHD_FLAG_ISOC_EN_MASK ? | ||
1114 | iommu_feature_enable(iommu, CONTROL_ISOC_EN) : | ||
1115 | iommu_feature_disable(iommu, CONTROL_ISOC_EN); | ||
1116 | |||
1117 | /* | ||
1118 | * make IOMMU memory accesses cache coherent | ||
1119 | */ | ||
1120 | iommu_feature_enable(iommu, CONTROL_COHERENT_EN); | ||
1121 | } | ||
1122 | |||
1119 | /* | 1123 | /* |
1120 | * This function finally enables all IOMMUs found in the system after | 1124 | * This function finally enables all IOMMUs found in the system after |
1121 | * they have been initialized | 1125 | * they have been initialized |
@@ -1126,6 +1130,7 @@ static void enable_iommus(void) | |||
1126 | 1130 | ||
1127 | for_each_iommu(iommu) { | 1131 | for_each_iommu(iommu) { |
1128 | iommu_disable(iommu); | 1132 | iommu_disable(iommu); |
1133 | iommu_init_flags(iommu); | ||
1129 | iommu_set_device_table(iommu); | 1134 | iommu_set_device_table(iommu); |
1130 | iommu_enable_command_buffer(iommu); | 1135 | iommu_enable_command_buffer(iommu); |
1131 | iommu_enable_event_buffer(iommu); | 1136 | iommu_enable_event_buffer(iommu); |