Skip to content

Commit

Permalink
iommu/amd: Introduce early_amd_iommu_init routine
Browse files Browse the repository at this point in the history
Split out the code to parse the ACPI table and setup
relevant data structures into a new function.

Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
  • Loading branch information
Joerg Roedel committed Jul 17, 2012
1 parent 4d121c3 commit 643511b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
1 change: 0 additions & 1 deletion drivers/iommu/amd_iommu.c
Original file line number Diff line number Diff line change
Expand Up @@ -384,7 +384,6 @@ DECLARE_STATS_COUNTER(invalidate_iotlb);
DECLARE_STATS_COUNTER(invalidate_iotlb_all);
DECLARE_STATS_COUNTER(pri_requests);


static struct dentry *stats_dir;
static struct dentry *de_fflush;

Expand Down
38 changes: 23 additions & 15 deletions drivers/iommu/amd_iommu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -1491,17 +1491,14 @@ static void __init free_on_init_error(void)
* After everything is set up the IOMMUs are enabled and the necessary
* hotplug and suspend notifiers are registered.
*/
int __init amd_iommu_init_hardware(void)
static int __init early_amd_iommu_init(void)
{
struct acpi_table_header *ivrs_base;
acpi_size ivrs_size;
acpi_status status;
int i, ret = 0;

if (no_iommu || (iommu_detected && !gart_iommu_aperture))
return -ENODEV;

if (amd_iommu_disabled || !amd_iommu_detected)
if (!amd_iommu_detected)
return -ENODEV;

if (amd_iommu_dev_table != NULL) {
Expand Down Expand Up @@ -1588,16 +1585,6 @@ int __init amd_iommu_init_hardware(void)
if (ret)
goto free;

ret = amd_iommu_init_pci();
if (ret)
goto free;

enable_iommus();

amd_iommu_init_notifier();

register_syscore_ops(&amd_iommu_syscore_ops);

out:
/* Don't leak any ACPI memory */
early_acpi_os_unmap_memory((char __iomem *)ivrs_base, ivrs_size);
Expand All @@ -1611,6 +1598,27 @@ int __init amd_iommu_init_hardware(void)
goto out;
}

int __init amd_iommu_init_hardware(void)
{
int ret = 0;

ret = early_amd_iommu_init();
if (ret)
return ret;

ret = amd_iommu_init_pci();
if (ret)
return ret;

enable_iommus();

amd_iommu_init_notifier();

register_syscore_ops(&amd_iommu_syscore_ops);

return ret;
}

static int amd_iommu_enable_interrupts(void)
{
struct amd_iommu *iommu;
Expand Down

0 comments on commit 643511b

Please sign in to comment.