Loading drivers/iommu/arm-smmu.c +11 −33 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_device.h> #include <linux/pci.h> #include <linux/platform_device.h> #include <linux/slab.h> Loading Loading @@ -433,8 +434,6 @@ struct arm_smmu_device { u32 num_context_irqs; unsigned int *irqs; struct list_head list; u32 cavium_id_base; /* Specific to Cavium */ /* Specific to QCOM */ struct arm_smmu_impl_def_reg *impl_def_attach_registers; Loading Loading @@ -508,9 +507,6 @@ struct arm_smmu_domain { struct iommu_domain domain; }; static DEFINE_SPINLOCK(arm_smmu_devices_lock); static LIST_HEAD(arm_smmu_devices); struct arm_smmu_option_prop { u32 opt; const char *prop; Loading Loading @@ -618,6 +614,8 @@ static int __find_legacy_master_phandle(struct device *dev, void *data) return err == -ENOENT ? 0 : err; } static struct platform_driver arm_smmu_driver; static int arm_smmu_register_legacy_master(struct device *dev) { struct arm_smmu_device *smmu; Loading @@ -636,19 +634,16 @@ static int arm_smmu_register_legacy_master(struct device *dev) } it.node = np; spin_lock(&arm_smmu_devices_lock); list_for_each_entry(smmu, &arm_smmu_devices, list) { err = __find_legacy_master_phandle(smmu->dev, &data); if (err) break; } spin_unlock(&arm_smmu_devices_lock); err = driver_for_each_device(&arm_smmu_driver.driver, NULL, &data, __find_legacy_master_phandle); of_node_put(np); if (err == 0) return -ENODEV; if (err < 0) return err; smmu = dev_get_drvdata(data); if (it.cur_count > MAX_MASTER_STREAMIDS) { dev_err(smmu->dev, "reached maximum number (%d) of stream IDs for master device %s\n", Loading Loading @@ -3500,7 +3495,6 @@ MODULE_DEVICE_TABLE(of, arm_smmu_of_match); static int qsmmuv500_tbu_register(struct device *dev, void *data); static int arm_smmu_device_dt_probe(struct platform_device *pdev) { const struct of_device_id *of_id; const struct arm_smmu_match_data *data; struct resource *res; struct arm_smmu_device *smmu; Loading @@ -3517,8 +3511,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) idr_init(&smmu->asid_idr); mutex_init(&smmu->idr_mutex); of_id = of_match_node(arm_smmu_of_match, dev->of_node); data = of_id->data; data = of_device_get_match_data(dev); smmu->version = data->version; smmu->model = data->model; smmu->arch_ops = data->arch_ops; Loading Loading @@ -3604,15 +3597,11 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) } } INIT_LIST_HEAD(&smmu->list); spin_lock(&arm_smmu_devices_lock); list_add(&smmu->list, &arm_smmu_devices); spin_unlock(&arm_smmu_devices_lock); err = arm_smmu_arch_init(smmu); if (err) goto out_power_off; platform_set_drvdata(pdev, smmu); arm_smmu_device_reset(smmu); arm_smmu_power_off(smmu->pwr); Loading @@ -3629,18 +3618,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) static int arm_smmu_device_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct arm_smmu_device *curr, *smmu = NULL; spin_lock(&arm_smmu_devices_lock); list_for_each_entry(curr, &arm_smmu_devices, list) { if (curr->dev == dev) { smmu = curr; list_del(&smmu->list); break; } } spin_unlock(&arm_smmu_devices_lock); struct arm_smmu_device *smmu = platform_get_drvdata(pdev); if (!smmu) return -ENODEV; Loading @@ -3649,7 +3627,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev) return -EINVAL; if (!bitmap_empty(smmu->context_map, ARM_SMMU_MAX_CBS)) dev_err(dev, "removing device with active domains!\n"); dev_err(&pdev->dev, "removing device with active domains!\n"); idr_destroy(&smmu->asid_idr); Loading Loading
drivers/iommu/arm-smmu.c +11 −33 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ #include <linux/module.h> #include <linux/of.h> #include <linux/of_address.h> #include <linux/of_device.h> #include <linux/pci.h> #include <linux/platform_device.h> #include <linux/slab.h> Loading Loading @@ -433,8 +434,6 @@ struct arm_smmu_device { u32 num_context_irqs; unsigned int *irqs; struct list_head list; u32 cavium_id_base; /* Specific to Cavium */ /* Specific to QCOM */ struct arm_smmu_impl_def_reg *impl_def_attach_registers; Loading Loading @@ -508,9 +507,6 @@ struct arm_smmu_domain { struct iommu_domain domain; }; static DEFINE_SPINLOCK(arm_smmu_devices_lock); static LIST_HEAD(arm_smmu_devices); struct arm_smmu_option_prop { u32 opt; const char *prop; Loading Loading @@ -618,6 +614,8 @@ static int __find_legacy_master_phandle(struct device *dev, void *data) return err == -ENOENT ? 0 : err; } static struct platform_driver arm_smmu_driver; static int arm_smmu_register_legacy_master(struct device *dev) { struct arm_smmu_device *smmu; Loading @@ -636,19 +634,16 @@ static int arm_smmu_register_legacy_master(struct device *dev) } it.node = np; spin_lock(&arm_smmu_devices_lock); list_for_each_entry(smmu, &arm_smmu_devices, list) { err = __find_legacy_master_phandle(smmu->dev, &data); if (err) break; } spin_unlock(&arm_smmu_devices_lock); err = driver_for_each_device(&arm_smmu_driver.driver, NULL, &data, __find_legacy_master_phandle); of_node_put(np); if (err == 0) return -ENODEV; if (err < 0) return err; smmu = dev_get_drvdata(data); if (it.cur_count > MAX_MASTER_STREAMIDS) { dev_err(smmu->dev, "reached maximum number (%d) of stream IDs for master device %s\n", Loading Loading @@ -3500,7 +3495,6 @@ MODULE_DEVICE_TABLE(of, arm_smmu_of_match); static int qsmmuv500_tbu_register(struct device *dev, void *data); static int arm_smmu_device_dt_probe(struct platform_device *pdev) { const struct of_device_id *of_id; const struct arm_smmu_match_data *data; struct resource *res; struct arm_smmu_device *smmu; Loading @@ -3517,8 +3511,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) idr_init(&smmu->asid_idr); mutex_init(&smmu->idr_mutex); of_id = of_match_node(arm_smmu_of_match, dev->of_node); data = of_id->data; data = of_device_get_match_data(dev); smmu->version = data->version; smmu->model = data->model; smmu->arch_ops = data->arch_ops; Loading Loading @@ -3604,15 +3597,11 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) } } INIT_LIST_HEAD(&smmu->list); spin_lock(&arm_smmu_devices_lock); list_add(&smmu->list, &arm_smmu_devices); spin_unlock(&arm_smmu_devices_lock); err = arm_smmu_arch_init(smmu); if (err) goto out_power_off; platform_set_drvdata(pdev, smmu); arm_smmu_device_reset(smmu); arm_smmu_power_off(smmu->pwr); Loading @@ -3629,18 +3618,7 @@ static int arm_smmu_device_dt_probe(struct platform_device *pdev) static int arm_smmu_device_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct arm_smmu_device *curr, *smmu = NULL; spin_lock(&arm_smmu_devices_lock); list_for_each_entry(curr, &arm_smmu_devices, list) { if (curr->dev == dev) { smmu = curr; list_del(&smmu->list); break; } } spin_unlock(&arm_smmu_devices_lock); struct arm_smmu_device *smmu = platform_get_drvdata(pdev); if (!smmu) return -ENODEV; Loading @@ -3649,7 +3627,7 @@ static int arm_smmu_device_remove(struct platform_device *pdev) return -EINVAL; if (!bitmap_empty(smmu->context_map, ARM_SMMU_MAX_CBS)) dev_err(dev, "removing device with active domains!\n"); dev_err(&pdev->dev, "removing device with active domains!\n"); idr_destroy(&smmu->asid_idr); Loading