Loading arch/x86/include/asm/amd_iommu_proto.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,9 @@ extern void amd_iommu_flush_all_domains(void); extern void amd_iommu_flush_all_devices(void); extern void amd_iommu_flush_all_devices(void); extern void amd_iommu_apply_erratum_63(u16 devid); 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 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) { } Loading arch/x86/kernel/amd_iommu.c +42 −4 Original line number Original line Diff line number Diff line Loading @@ -166,6 +166,43 @@ static void iommu_uninit_device(struct device *dev) { { kfree(dev->archdata.iommu); kfree(dev->archdata.iommu); } } void __init amd_iommu_uninit_devices(void) { struct pci_dev *pdev = NULL; for_each_pci_dev(pdev) { if (!check_device(&pdev->dev)) continue; iommu_uninit_device(&pdev->dev); } } int __init amd_iommu_init_devices(void) { struct pci_dev *pdev = NULL; int ret = 0; for_each_pci_dev(pdev) { if (!check_device(&pdev->dev)) continue; ret = iommu_init_device(&pdev->dev); if (ret) goto out_free; } return 0; out_free: amd_iommu_uninit_devices(); return ret; } #ifdef CONFIG_AMD_IOMMU_STATS #ifdef CONFIG_AMD_IOMMU_STATS /* /* Loading Loading @@ -1587,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. Loading Loading @@ -2145,8 +2187,6 @@ static void prealloc_protection_domains(void) if (!check_device(&dev->dev)) if (!check_device(&dev->dev)) continue; continue; iommu_init_device(&dev->dev); /* Is there already any domain for it? */ /* Is there already any domain for it? */ if (domain_for_device(&dev->dev)) if (domain_for_device(&dev->dev)) continue; continue; Loading Loading @@ -2215,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; Loading arch/x86/kernel/amd_iommu_init.c +9 −0 Original line number Original line Diff line number Diff line Loading @@ -1274,6 +1274,10 @@ static int __init amd_iommu_init(void) if (ret) if (ret) goto free; goto free; ret = amd_iommu_init_devices(); if (ret) goto free; if (iommu_pass_through) if (iommu_pass_through) ret = amd_iommu_init_passthrough(); ret = amd_iommu_init_passthrough(); else else Loading @@ -1281,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) Loading @@ -1296,6 +1302,9 @@ static int __init amd_iommu_init(void) return ret; return ret; free: free: amd_iommu_uninit_devices(); free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, get_order(MAX_DOMAIN_ID/8)); get_order(MAX_DOMAIN_ID/8)); Loading Loading
arch/x86/include/asm/amd_iommu_proto.h +3 −1 Original line number Original line Diff line number Diff line Loading @@ -28,7 +28,9 @@ extern void amd_iommu_flush_all_domains(void); extern void amd_iommu_flush_all_devices(void); extern void amd_iommu_flush_all_devices(void); extern void amd_iommu_apply_erratum_63(u16 devid); 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 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) { } Loading
arch/x86/kernel/amd_iommu.c +42 −4 Original line number Original line Diff line number Diff line Loading @@ -166,6 +166,43 @@ static void iommu_uninit_device(struct device *dev) { { kfree(dev->archdata.iommu); kfree(dev->archdata.iommu); } } void __init amd_iommu_uninit_devices(void) { struct pci_dev *pdev = NULL; for_each_pci_dev(pdev) { if (!check_device(&pdev->dev)) continue; iommu_uninit_device(&pdev->dev); } } int __init amd_iommu_init_devices(void) { struct pci_dev *pdev = NULL; int ret = 0; for_each_pci_dev(pdev) { if (!check_device(&pdev->dev)) continue; ret = iommu_init_device(&pdev->dev); if (ret) goto out_free; } return 0; out_free: amd_iommu_uninit_devices(); return ret; } #ifdef CONFIG_AMD_IOMMU_STATS #ifdef CONFIG_AMD_IOMMU_STATS /* /* Loading Loading @@ -1587,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. Loading Loading @@ -2145,8 +2187,6 @@ static void prealloc_protection_domains(void) if (!check_device(&dev->dev)) if (!check_device(&dev->dev)) continue; continue; iommu_init_device(&dev->dev); /* Is there already any domain for it? */ /* Is there already any domain for it? */ if (domain_for_device(&dev->dev)) if (domain_for_device(&dev->dev)) continue; continue; Loading Loading @@ -2215,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; Loading
arch/x86/kernel/amd_iommu_init.c +9 −0 Original line number Original line Diff line number Diff line Loading @@ -1274,6 +1274,10 @@ static int __init amd_iommu_init(void) if (ret) if (ret) goto free; goto free; ret = amd_iommu_init_devices(); if (ret) goto free; if (iommu_pass_through) if (iommu_pass_through) ret = amd_iommu_init_passthrough(); ret = amd_iommu_init_passthrough(); else else Loading @@ -1281,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) Loading @@ -1296,6 +1302,9 @@ static int __init amd_iommu_init(void) return ret; return ret; free: free: amd_iommu_uninit_devices(); free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, free_pages((unsigned long)amd_iommu_pd_alloc_bitmap, get_order(MAX_DOMAIN_ID/8)); get_order(MAX_DOMAIN_ID/8)); Loading