Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c1cbebee authored by Joerg Roedel's avatar Joerg Roedel Committed by Ingo Molnar
Browse files

x86, AMD IOMMU: don't try to init IOMMU if early detect code did not detect one



This patch adds a check if the early detect code has found AMD IOMMU hardware
descriptions and does not try to initialize hardware if the check failed.

Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
Cc: iommu@lists.linux-foundation.org
Cc: bhavna.sarathy@amd.com
Cc: robert.richter@amd.com
Cc: Joerg Roedel <joerg.roedel@amd.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 8b14518f
Loading
Loading
Loading
Loading
+6 −0
Original line number Original line Diff line number Diff line
@@ -101,6 +101,8 @@ struct ivmd_header {
	u64 range_length;
	u64 range_length;
} __attribute__((packed));
} __attribute__((packed));


static int __initdata amd_iommu_detected;

u16 amd_iommu_last_bdf;
u16 amd_iommu_last_bdf;
struct list_head amd_iommu_unity_map;
struct list_head amd_iommu_unity_map;
unsigned amd_iommu_aperture_order = 26;
unsigned amd_iommu_aperture_order = 26;
@@ -689,6 +691,9 @@ int __init amd_iommu_init(void)
		return 0;
		return 0;
	}
	}


	if (!amd_iommu_detected)
		return -ENODEV;

	/*
	/*
	 * First parse ACPI tables to find the largest Bus/Dev/Func
	 * First parse ACPI tables to find the largest Bus/Dev/Func
	 * we need to handle. Upon this information the shared data
	 * we need to handle. Upon this information the shared data
@@ -831,6 +836,7 @@ void __init amd_iommu_detect(void)


	if (acpi_table_parse("IVRS", early_amd_iommu_detect) == 0) {
	if (acpi_table_parse("IVRS", early_amd_iommu_detect) == 0) {
		iommu_detected = 1;
		iommu_detected = 1;
		amd_iommu_detected = 1;
#ifdef CONFIG_GART_IOMMU
#ifdef CONFIG_GART_IOMMU
		gart_iommu_aperture_disabled = 1;
		gart_iommu_aperture_disabled = 1;
		gart_iommu_aperture = 0;
		gart_iommu_aperture = 0;