Commit f5325094 authored by Joerg Roedel's avatar Joerg Roedel

x86/amd-iommu: Fix IOMMU-API initialization for iommu=pt

This patch moves the initialization of the iommu-api out of
the dma-ops initialization code. This ensures that the
iommu-api is initialized even with iommu=pt.

Cc: stable@kernel.org
Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
parent 2ca76279
...@@ -31,6 +31,7 @@ extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu); ...@@ -31,6 +31,7 @@ extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu);
extern int amd_iommu_init_devices(void); extern int amd_iommu_init_devices(void);
extern void amd_iommu_uninit_devices(void); extern void amd_iommu_uninit_devices(void);
extern void amd_iommu_init_notifier(void); extern void amd_iommu_init_notifier(void);
extern void amd_iommu_init_api(void);
#ifndef CONFIG_AMD_IOMMU_STATS #ifndef CONFIG_AMD_IOMMU_STATS
static inline void amd_iommu_stats_init(void) { } static inline void amd_iommu_stats_init(void) { }
......
...@@ -2221,6 +2221,12 @@ static struct dma_map_ops amd_iommu_dma_ops = { ...@@ -2221,6 +2221,12 @@ static struct dma_map_ops amd_iommu_dma_ops = {
/* /*
* The function which clues the AMD IOMMU driver into dma_ops. * The function which clues the AMD IOMMU driver into dma_ops.
*/ */
void __init amd_iommu_init_api(void)
{
register_iommu(&amd_iommu_ops);
}
int __init amd_iommu_init_dma_ops(void) int __init amd_iommu_init_dma_ops(void)
{ {
struct amd_iommu *iommu; struct amd_iommu *iommu;
...@@ -2256,8 +2262,6 @@ int __init amd_iommu_init_dma_ops(void) ...@@ -2256,8 +2262,6 @@ int __init amd_iommu_init_dma_ops(void)
/* Make the driver finally visible to the drivers */ /* Make the driver finally visible to the drivers */
dma_ops = &amd_iommu_dma_ops; dma_ops = &amd_iommu_dma_ops;
register_iommu(&amd_iommu_ops);
amd_iommu_stats_init(); amd_iommu_stats_init();
return 0; return 0;
......
...@@ -1292,9 +1292,12 @@ static int __init amd_iommu_init(void) ...@@ -1292,9 +1292,12 @@ static int __init amd_iommu_init(void)
ret = amd_iommu_init_passthrough(); ret = amd_iommu_init_passthrough();
else else
ret = amd_iommu_init_dma_ops(); ret = amd_iommu_init_dma_ops();
if (ret) if (ret)
goto free; goto free;
amd_iommu_init_api();
amd_iommu_init_notifier(); amd_iommu_init_notifier();
enable_iommus(); enable_iommus();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment