提交 8638c491 编写于 作者: J Joerg Roedel

x86/amd-iommu: Fix PCI hotplug with passthrough mode

The device change notifier is initialized in the dma_ops
initialization path. But this path is never executed for
iommu=pt. Move the notifier initialization to IOMMU hardware
init code to fix this.
Signed-off-by: NJoerg Roedel <joerg.roedel@amd.com>
上级 b7cc9554
...@@ -30,6 +30,7 @@ extern void amd_iommu_apply_erratum_63(u16 devid); ...@@ -30,6 +30,7 @@ extern void amd_iommu_apply_erratum_63(u16 devid);
extern void amd_iommu_reset_cmd_buffer(struct amd_iommu *iommu); 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);
#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) { }
......
...@@ -1624,6 +1624,11 @@ static struct notifier_block device_nb = { ...@@ -1624,6 +1624,11 @@ static struct notifier_block device_nb = {
.notifier_call = device_change_notifier, .notifier_call = device_change_notifier,
}; };
void amd_iommu_init_notifier(void)
{
bus_register_notifier(&pci_bus_type, &device_nb);
}
/***************************************************************************** /*****************************************************************************
* *
* The next functions belong to the dma_ops mapping/unmapping code. * The next functions belong to the dma_ops mapping/unmapping code.
...@@ -2250,8 +2255,6 @@ int __init amd_iommu_init_dma_ops(void) ...@@ -2250,8 +2255,6 @@ int __init amd_iommu_init_dma_ops(void)
register_iommu(&amd_iommu_ops); register_iommu(&amd_iommu_ops);
bus_register_notifier(&pci_bus_type, &device_nb);
amd_iommu_stats_init(); amd_iommu_stats_init();
return 0; return 0;
......
...@@ -1285,6 +1285,8 @@ static int __init amd_iommu_init(void) ...@@ -1285,6 +1285,8 @@ static int __init amd_iommu_init(void)
if (ret) if (ret)
goto free; goto free;
amd_iommu_init_notifier();
enable_iommus(); enable_iommus();
if (iommu_pass_through) if (iommu_pass_through)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册