diff options
author | Joerg Roedel <joerg.roedel@amd.com> | 2010-09-23 09:15:19 -0400 |
---|---|---|
committer | Joerg Roedel <joerg.roedel@amd.com> | 2010-09-23 10:26:03 -0400 |
commit | 4c894f47bb49284008073d351c0ddaac8860864e (patch) | |
tree | 4f14600bbc3a7b9c22dfb667edebba736e7e3ca9 /arch/x86/kernel | |
parent | e9bf51971157e367aabfc111a8219db010f69cd4 (diff) |
x86/amd-iommu: Work around S3 BIOS bug
This patch adds a workaround for an IOMMU BIOS problem to
the AMD IOMMU driver. The result of the bug is that the
IOMMU does not execute commands anymore when the system
comes out of the S3 state resulting in system failure. The
bug in the BIOS is that is does not restore certain hardware
specific registers correctly. This workaround reads out the
contents of these registers at boot time and restores them
on resume from S3. The workaround is limited to the specific
IOMMU chipset where this problem occurs.
Cc: stable@kernel.org
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
Diffstat (limited to 'arch/x86/kernel')
-rw-r--r-- | arch/x86/kernel/amd_iommu_init.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/arch/x86/kernel/amd_iommu_init.c b/arch/x86/kernel/amd_iommu_init.c index 85e9817ead43..5a170cbbbed8 100644 --- a/arch/x86/kernel/amd_iommu_init.c +++ b/arch/x86/kernel/amd_iommu_init.c | |||
@@ -632,6 +632,13 @@ static void __init init_iommu_from_pci(struct amd_iommu *iommu) | |||
632 | iommu->last_device = calc_devid(MMIO_GET_BUS(range), | 632 | iommu->last_device = calc_devid(MMIO_GET_BUS(range), |
633 | MMIO_GET_LD(range)); | 633 | MMIO_GET_LD(range)); |
634 | iommu->evt_msi_num = MMIO_MSI_NUM(misc); | 634 | iommu->evt_msi_num = MMIO_MSI_NUM(misc); |
635 | |||
636 | if (is_rd890_iommu(iommu->dev)) { | ||
637 | pci_read_config_dword(iommu->dev, 0xf0, &iommu->cache_cfg[0]); | ||
638 | pci_read_config_dword(iommu->dev, 0xf4, &iommu->cache_cfg[1]); | ||
639 | pci_read_config_dword(iommu->dev, 0xf8, &iommu->cache_cfg[2]); | ||
640 | pci_read_config_dword(iommu->dev, 0xfc, &iommu->cache_cfg[3]); | ||
641 | } | ||
635 | } | 642 | } |
636 | 643 | ||
637 | /* | 644 | /* |
@@ -1120,6 +1127,16 @@ static void iommu_init_flags(struct amd_iommu *iommu) | |||
1120 | iommu_feature_enable(iommu, CONTROL_COHERENT_EN); | 1127 | iommu_feature_enable(iommu, CONTROL_COHERENT_EN); |
1121 | } | 1128 | } |
1122 | 1129 | ||
1130 | static void iommu_apply_quirks(struct amd_iommu *iommu) | ||
1131 | { | ||
1132 | if (is_rd890_iommu(iommu->dev)) { | ||
1133 | pci_write_config_dword(iommu->dev, 0xf0, iommu->cache_cfg[0]); | ||
1134 | pci_write_config_dword(iommu->dev, 0xf4, iommu->cache_cfg[1]); | ||
1135 | pci_write_config_dword(iommu->dev, 0xf8, iommu->cache_cfg[2]); | ||
1136 | pci_write_config_dword(iommu->dev, 0xfc, iommu->cache_cfg[3]); | ||
1137 | } | ||
1138 | } | ||
1139 | |||
1123 | /* | 1140 | /* |
1124 | * This function finally enables all IOMMUs found in the system after | 1141 | * This function finally enables all IOMMUs found in the system after |
1125 | * they have been initialized | 1142 | * they have been initialized |
@@ -1130,6 +1147,7 @@ static void enable_iommus(void) | |||
1130 | 1147 | ||
1131 | for_each_iommu(iommu) { | 1148 | for_each_iommu(iommu) { |
1132 | iommu_disable(iommu); | 1149 | iommu_disable(iommu); |
1150 | iommu_apply_quirks(iommu); | ||
1133 | iommu_init_flags(iommu); | 1151 | iommu_init_flags(iommu); |
1134 | iommu_set_device_table(iommu); | 1152 | iommu_set_device_table(iommu); |
1135 | iommu_enable_command_buffer(iommu); | 1153 | iommu_enable_command_buffer(iommu); |