mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-03 01:36:52 +09:00
Merge tag 'iommu-fixes-v5.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu fixes from Joerg Roedel: - Three AMD IOMMU patches to fix a boot crash on AMD Stoney systems and every other AMD IOMMU system booted with 'amd_iommu=off'. This is a v5.11 regression. - A Fix for the Tegra IOMMU driver to make sure it detects all IOMMUs * tag 'iommu-fixes-v5.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu/tegra-smmu: Make tegra_smmu_probe_device() to handle all IOMMU phandles iommu/amd: Keep track of amd_iommu_irq_remap state iommu/amd: Don't call early_amd_iommu_init() when AMD IOMMU is disabled iommu/amd: Move Stoney Ridge check to detect_ivrs()
This commit is contained in:
@@ -2714,7 +2714,6 @@ static int __init early_amd_iommu_init(void)
|
||||
struct acpi_table_header *ivrs_base;
|
||||
int i, remap_cache_sz, ret;
|
||||
acpi_status status;
|
||||
u32 pci_id;
|
||||
|
||||
if (!amd_iommu_detected)
|
||||
return -ENODEV;
|
||||
@@ -2804,16 +2803,6 @@ static int __init early_amd_iommu_init(void)
|
||||
if (ret)
|
||||
goto out;
|
||||
|
||||
/* Disable IOMMU if there's Stoney Ridge graphics */
|
||||
for (i = 0; i < 32; i++) {
|
||||
pci_id = read_pci_config(0, i, 0, 0);
|
||||
if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) {
|
||||
pr_info("Disable IOMMU on Stoney Ridge\n");
|
||||
amd_iommu_disabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Disable any previously enabled IOMMUs */
|
||||
if (!is_kdump_kernel() || amd_iommu_disabled)
|
||||
disable_iommus();
|
||||
@@ -2880,6 +2869,7 @@ static bool detect_ivrs(void)
|
||||
{
|
||||
struct acpi_table_header *ivrs_base;
|
||||
acpi_status status;
|
||||
int i;
|
||||
|
||||
status = acpi_get_table("IVRS", 0, &ivrs_base);
|
||||
if (status == AE_NOT_FOUND)
|
||||
@@ -2892,6 +2882,17 @@ static bool detect_ivrs(void)
|
||||
|
||||
acpi_put_table(ivrs_base);
|
||||
|
||||
/* Don't use IOMMU if there is Stoney Ridge graphics */
|
||||
for (i = 0; i < 32; i++) {
|
||||
u32 pci_id;
|
||||
|
||||
pci_id = read_pci_config(0, i, 0, 0);
|
||||
if ((pci_id & 0xffff) == 0x1002 && (pci_id >> 16) == 0x98e4) {
|
||||
pr_info("Disable IOMMU on Stoney Ridge\n");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/* Make sure ACS will be enabled during PCI probe */
|
||||
pci_request_acs();
|
||||
|
||||
@@ -2918,12 +2919,12 @@ static int __init state_next(void)
|
||||
}
|
||||
break;
|
||||
case IOMMU_IVRS_DETECTED:
|
||||
ret = early_amd_iommu_init();
|
||||
init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED;
|
||||
if (init_state == IOMMU_ACPI_FINISHED && amd_iommu_disabled) {
|
||||
pr_info("AMD IOMMU disabled\n");
|
||||
if (amd_iommu_disabled) {
|
||||
init_state = IOMMU_CMDLINE_DISABLED;
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
ret = early_amd_iommu_init();
|
||||
init_state = ret ? IOMMU_INIT_ERROR : IOMMU_ACPI_FINISHED;
|
||||
}
|
||||
break;
|
||||
case IOMMU_ACPI_FINISHED:
|
||||
@@ -3001,8 +3002,11 @@ int __init amd_iommu_prepare(void)
|
||||
amd_iommu_irq_remap = true;
|
||||
|
||||
ret = iommu_go_to_state(IOMMU_ACPI_FINISHED);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
amd_iommu_irq_remap = false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
return amd_iommu_irq_remap ? 0 : -ENODEV;
|
||||
}
|
||||
|
||||
|
||||
@@ -849,12 +849,11 @@ static struct iommu_device *tegra_smmu_probe_device(struct device *dev)
|
||||
smmu = tegra_smmu_find(args.np);
|
||||
if (smmu) {
|
||||
err = tegra_smmu_configure(smmu, dev, &args);
|
||||
of_node_put(args.np);
|
||||
|
||||
if (err < 0)
|
||||
if (err < 0) {
|
||||
of_node_put(args.np);
|
||||
return ERR_PTR(err);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
of_node_put(args.np);
|
||||
|
||||
Reference in New Issue
Block a user