diff options
| -rw-r--r-- | drivers/iommu/amd_iommu.c | 4 | ||||
| -rw-r--r-- | drivers/iommu/arm-smmu.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/exynos-iommu.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/fsl_pamu_domain.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/intel-iommu.c | 4 | ||||
| -rw-r--r-- | drivers/iommu/iommu.c | 19 | ||||
| -rw-r--r-- | drivers/iommu/ipmmu-vmsa.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/msm_iommu.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/omap-iommu.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/shmobile-iommu.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/tegra-gart.c | 2 | ||||
| -rw-r--r-- | drivers/iommu/tegra-smmu.c | 2 | ||||
| -rw-r--r-- | include/linux/device.h | 2 | ||||
| -rw-r--r-- | include/linux/iommu.h | 4 |
14 files changed, 30 insertions, 21 deletions
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index c8f87a6c9b90..18405314168b 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c | |||
| @@ -80,7 +80,7 @@ LIST_HEAD(hpet_map); | |||
| 80 | */ | 80 | */ |
| 81 | static struct protection_domain *pt_domain; | 81 | static struct protection_domain *pt_domain; |
| 82 | 82 | ||
| 83 | static struct iommu_ops amd_iommu_ops; | 83 | static const struct iommu_ops amd_iommu_ops; |
| 84 | 84 | ||
| 85 | static ATOMIC_NOTIFIER_HEAD(ppr_notifier); | 85 | static ATOMIC_NOTIFIER_HEAD(ppr_notifier); |
| 86 | int amd_iommu_max_glx_val = -1; | 86 | int amd_iommu_max_glx_val = -1; |
| @@ -3395,7 +3395,7 @@ static int amd_iommu_domain_has_cap(struct iommu_domain *domain, | |||
| 3395 | return 0; | 3395 | return 0; |
| 3396 | } | 3396 | } |
| 3397 | 3397 | ||
| 3398 | static struct iommu_ops amd_iommu_ops = { | 3398 | static const struct iommu_ops amd_iommu_ops = { |
| 3399 | .domain_init = amd_iommu_domain_init, | 3399 | .domain_init = amd_iommu_domain_init, |
| 3400 | .domain_destroy = amd_iommu_domain_destroy, | 3400 | .domain_destroy = amd_iommu_domain_destroy, |
| 3401 | .attach_dev = amd_iommu_attach_device, | 3401 | .attach_dev = amd_iommu_attach_device, |
diff --git a/drivers/iommu/arm-smmu.c b/drivers/iommu/arm-smmu.c index 1599354e974d..67727294e6b5 100644 --- a/drivers/iommu/arm-smmu.c +++ b/drivers/iommu/arm-smmu.c | |||
| @@ -1609,7 +1609,7 @@ static void arm_smmu_remove_device(struct device *dev) | |||
| 1609 | iommu_group_remove_device(dev); | 1609 | iommu_group_remove_device(dev); |
| 1610 | } | 1610 | } |
| 1611 | 1611 | ||
| 1612 | static struct iommu_ops arm_smmu_ops = { | 1612 | static const struct iommu_ops arm_smmu_ops = { |
| 1613 | .domain_init = arm_smmu_domain_init, | 1613 | .domain_init = arm_smmu_domain_init, |
| 1614 | .domain_destroy = arm_smmu_domain_destroy, | 1614 | .domain_destroy = arm_smmu_domain_destroy, |
| 1615 | .attach_dev = arm_smmu_attach_dev, | 1615 | .attach_dev = arm_smmu_attach_dev, |
diff --git a/drivers/iommu/exynos-iommu.c b/drivers/iommu/exynos-iommu.c index 99054d2c040d..d037e87a1fe5 100644 --- a/drivers/iommu/exynos-iommu.c +++ b/drivers/iommu/exynos-iommu.c | |||
| @@ -1170,7 +1170,7 @@ static void exynos_iommu_remove_device(struct device *dev) | |||
| 1170 | iommu_group_remove_device(dev); | 1170 | iommu_group_remove_device(dev); |
| 1171 | } | 1171 | } |
| 1172 | 1172 | ||
| 1173 | static struct iommu_ops exynos_iommu_ops = { | 1173 | static const struct iommu_ops exynos_iommu_ops = { |
| 1174 | .domain_init = exynos_iommu_domain_init, | 1174 | .domain_init = exynos_iommu_domain_init, |
| 1175 | .domain_destroy = exynos_iommu_domain_destroy, | 1175 | .domain_destroy = exynos_iommu_domain_destroy, |
| 1176 | .attach_dev = exynos_iommu_attach_device, | 1176 | .attach_dev = exynos_iommu_attach_device, |
diff --git a/drivers/iommu/fsl_pamu_domain.c b/drivers/iommu/fsl_pamu_domain.c index d02d668c6ab1..fd5e9146aee6 100644 --- a/drivers/iommu/fsl_pamu_domain.c +++ b/drivers/iommu/fsl_pamu_domain.c | |||
| @@ -1076,7 +1076,7 @@ static u32 fsl_pamu_get_windows(struct iommu_domain *domain) | |||
| 1076 | return dma_domain->win_cnt; | 1076 | return dma_domain->win_cnt; |
| 1077 | } | 1077 | } |
| 1078 | 1078 | ||
| 1079 | static struct iommu_ops fsl_pamu_ops = { | 1079 | static const struct iommu_ops fsl_pamu_ops = { |
| 1080 | .domain_init = fsl_pamu_domain_init, | 1080 | .domain_init = fsl_pamu_domain_init, |
| 1081 | .domain_destroy = fsl_pamu_domain_destroy, | 1081 | .domain_destroy = fsl_pamu_domain_destroy, |
| 1082 | .attach_dev = fsl_pamu_attach_device, | 1082 | .attach_dev = fsl_pamu_attach_device, |
diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index f9e5f84ee952..41d9a2dcab2e 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c | |||
| @@ -450,7 +450,7 @@ EXPORT_SYMBOL_GPL(intel_iommu_gfx_mapped); | |||
| 450 | static DEFINE_SPINLOCK(device_domain_lock); | 450 | static DEFINE_SPINLOCK(device_domain_lock); |
| 451 | static LIST_HEAD(device_domain_list); | 451 | static LIST_HEAD(device_domain_list); |
| 452 | 452 | ||
| 453 | static struct iommu_ops intel_iommu_ops; | 453 | static const struct iommu_ops intel_iommu_ops; |
| 454 | 454 | ||
| 455 | static int __init intel_iommu_setup(char *str) | 455 | static int __init intel_iommu_setup(char *str) |
| 456 | { | 456 | { |
| @@ -4453,7 +4453,7 @@ static void intel_iommu_remove_device(struct device *dev) | |||
| 4453 | iommu_device_unlink(iommu->iommu_dev, dev); | 4453 | iommu_device_unlink(iommu->iommu_dev, dev); |
| 4454 | } | 4454 | } |
| 4455 | 4455 | ||
| 4456 | static struct iommu_ops intel_iommu_ops = { | 4456 | static const struct iommu_ops intel_iommu_ops = { |
| 4457 | .domain_init = intel_iommu_domain_init, | 4457 | .domain_init = intel_iommu_domain_init, |
| 4458 | .domain_destroy = intel_iommu_domain_destroy, | 4458 | .domain_destroy = intel_iommu_domain_destroy, |
| 4459 | .attach_dev = intel_iommu_attach_device, | 4459 | .attach_dev = intel_iommu_attach_device, |
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index d061c8677a81..169836020208 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c | |||
| @@ -36,6 +36,10 @@ static struct kset *iommu_group_kset; | |||
| 36 | static struct ida iommu_group_ida; | 36 | static struct ida iommu_group_ida; |
| 37 | static struct mutex iommu_group_mutex; | 37 | static struct mutex iommu_group_mutex; |
| 38 | 38 | ||
| 39 | struct iommu_callback_data { | ||
| 40 | const struct iommu_ops *ops; | ||
| 41 | }; | ||
| 42 | |||
| 39 | struct iommu_group { | 43 | struct iommu_group { |
| 40 | struct kobject kobj; | 44 | struct kobject kobj; |
| 41 | struct kobject *devices_kobj; | 45 | struct kobject *devices_kobj; |
| @@ -698,7 +702,8 @@ struct iommu_group *iommu_group_get_for_dev(struct device *dev) | |||
| 698 | 702 | ||
| 699 | static int add_iommu_group(struct device *dev, void *data) | 703 | static int add_iommu_group(struct device *dev, void *data) |
| 700 | { | 704 | { |
| 701 | struct iommu_ops *ops = data; | 705 | struct iommu_callback_data *cb = data; |
| 706 | const struct iommu_ops *ops = cb->ops; | ||
| 702 | 707 | ||
| 703 | if (!ops->add_device) | 708 | if (!ops->add_device) |
| 704 | return -ENODEV; | 709 | return -ENODEV; |
| @@ -714,7 +719,7 @@ static int iommu_bus_notifier(struct notifier_block *nb, | |||
| 714 | unsigned long action, void *data) | 719 | unsigned long action, void *data) |
| 715 | { | 720 | { |
| 716 | struct device *dev = data; | 721 | struct device *dev = data; |
| 717 | struct iommu_ops *ops = dev->bus->iommu_ops; | 722 | const struct iommu_ops *ops = dev->bus->iommu_ops; |
| 718 | struct iommu_group *group; | 723 | struct iommu_group *group; |
| 719 | unsigned long group_action = 0; | 724 | unsigned long group_action = 0; |
| 720 | 725 | ||
| @@ -767,10 +772,14 @@ static struct notifier_block iommu_bus_nb = { | |||
| 767 | .notifier_call = iommu_bus_notifier, | 772 | .notifier_call = iommu_bus_notifier, |
| 768 | }; | 773 | }; |
| 769 | 774 | ||
| 770 | static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops) | 775 | static void iommu_bus_init(struct bus_type *bus, const struct iommu_ops *ops) |
| 771 | { | 776 | { |
| 777 | struct iommu_callback_data cb = { | ||
| 778 | .ops = ops, | ||
| 779 | }; | ||
| 780 | |||
| 772 | bus_register_notifier(bus, &iommu_bus_nb); | 781 | bus_register_notifier(bus, &iommu_bus_nb); |
| 773 | bus_for_each_dev(bus, NULL, ops, add_iommu_group); | 782 | bus_for_each_dev(bus, NULL, &cb, add_iommu_group); |
| 774 | } | 783 | } |
| 775 | 784 | ||
| 776 | /** | 785 | /** |
| @@ -786,7 +795,7 @@ static void iommu_bus_init(struct bus_type *bus, struct iommu_ops *ops) | |||
| 786 | * is set up. With this function the iommu-driver can set the iommu-ops | 795 | * is set up. With this function the iommu-driver can set the iommu-ops |
| 787 | * afterwards. | 796 | * afterwards. |
| 788 | */ | 797 | */ |
| 789 | int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops) | 798 | int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops) |
| 790 | { | 799 | { |
| 791 | if (bus->iommu_ops != NULL) | 800 | if (bus->iommu_ops != NULL) |
| 792 | return -EBUSY; | 801 | return -EBUSY; |
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 53cde086e83b..7dab5cbcc775 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c | |||
| @@ -1120,7 +1120,7 @@ static void ipmmu_remove_device(struct device *dev) | |||
| 1120 | dev->archdata.iommu = NULL; | 1120 | dev->archdata.iommu = NULL; |
| 1121 | } | 1121 | } |
| 1122 | 1122 | ||
| 1123 | static struct iommu_ops ipmmu_ops = { | 1123 | static const struct iommu_ops ipmmu_ops = { |
| 1124 | .domain_init = ipmmu_domain_init, | 1124 | .domain_init = ipmmu_domain_init, |
| 1125 | .domain_destroy = ipmmu_domain_destroy, | 1125 | .domain_destroy = ipmmu_domain_destroy, |
| 1126 | .attach_dev = ipmmu_attach_device, | 1126 | .attach_dev = ipmmu_attach_device, |
diff --git a/drivers/iommu/msm_iommu.c b/drivers/iommu/msm_iommu.c index f5ff657f49fa..49f41d6e02f1 100644 --- a/drivers/iommu/msm_iommu.c +++ b/drivers/iommu/msm_iommu.c | |||
| @@ -674,7 +674,7 @@ fail: | |||
| 674 | return 0; | 674 | return 0; |
| 675 | } | 675 | } |
| 676 | 676 | ||
| 677 | static struct iommu_ops msm_iommu_ops = { | 677 | static const struct iommu_ops msm_iommu_ops = { |
| 678 | .domain_init = msm_iommu_domain_init, | 678 | .domain_init = msm_iommu_domain_init, |
| 679 | .domain_destroy = msm_iommu_domain_destroy, | 679 | .domain_destroy = msm_iommu_domain_destroy, |
| 680 | .attach_dev = msm_iommu_attach_dev, | 680 | .attach_dev = msm_iommu_attach_dev, |
diff --git a/drivers/iommu/omap-iommu.c b/drivers/iommu/omap-iommu.c index 895af06a667f..031b2476bcc4 100644 --- a/drivers/iommu/omap-iommu.c +++ b/drivers/iommu/omap-iommu.c | |||
| @@ -1291,7 +1291,7 @@ static void omap_iommu_remove_device(struct device *dev) | |||
| 1291 | kfree(arch_data); | 1291 | kfree(arch_data); |
| 1292 | } | 1292 | } |
| 1293 | 1293 | ||
| 1294 | static struct iommu_ops omap_iommu_ops = { | 1294 | static const struct iommu_ops omap_iommu_ops = { |
| 1295 | .domain_init = omap_iommu_domain_init, | 1295 | .domain_init = omap_iommu_domain_init, |
| 1296 | .domain_destroy = omap_iommu_domain_destroy, | 1296 | .domain_destroy = omap_iommu_domain_destroy, |
| 1297 | .attach_dev = omap_iommu_attach_dev, | 1297 | .attach_dev = omap_iommu_attach_dev, |
diff --git a/drivers/iommu/shmobile-iommu.c b/drivers/iommu/shmobile-iommu.c index 464acda0bbc4..1333e6fb3405 100644 --- a/drivers/iommu/shmobile-iommu.c +++ b/drivers/iommu/shmobile-iommu.c | |||
| @@ -354,7 +354,7 @@ static int shmobile_iommu_add_device(struct device *dev) | |||
| 354 | return 0; | 354 | return 0; |
| 355 | } | 355 | } |
| 356 | 356 | ||
| 357 | static struct iommu_ops shmobile_iommu_ops = { | 357 | static const struct iommu_ops shmobile_iommu_ops = { |
| 358 | .domain_init = shmobile_iommu_domain_init, | 358 | .domain_init = shmobile_iommu_domain_init, |
| 359 | .domain_destroy = shmobile_iommu_domain_destroy, | 359 | .domain_destroy = shmobile_iommu_domain_destroy, |
| 360 | .attach_dev = shmobile_iommu_attach_device, | 360 | .attach_dev = shmobile_iommu_attach_device, |
diff --git a/drivers/iommu/tegra-gart.c b/drivers/iommu/tegra-gart.c index dba1a9fd5070..b10a8ecede8e 100644 --- a/drivers/iommu/tegra-gart.c +++ b/drivers/iommu/tegra-gart.c | |||
| @@ -309,7 +309,7 @@ static int gart_iommu_domain_has_cap(struct iommu_domain *domain, | |||
| 309 | return 0; | 309 | return 0; |
| 310 | } | 310 | } |
| 311 | 311 | ||
| 312 | static struct iommu_ops gart_iommu_ops = { | 312 | static const struct iommu_ops gart_iommu_ops = { |
| 313 | .domain_init = gart_iommu_domain_init, | 313 | .domain_init = gart_iommu_domain_init, |
| 314 | .domain_destroy = gart_iommu_domain_destroy, | 314 | .domain_destroy = gart_iommu_domain_destroy, |
| 315 | .attach_dev = gart_iommu_attach_dev, | 315 | .attach_dev = gart_iommu_attach_dev, |
diff --git a/drivers/iommu/tegra-smmu.c b/drivers/iommu/tegra-smmu.c index 605b5b46a903..792da5ea6d12 100644 --- a/drivers/iommu/tegra-smmu.c +++ b/drivers/iommu/tegra-smmu.c | |||
| @@ -947,7 +947,7 @@ static void smmu_iommu_domain_destroy(struct iommu_domain *domain) | |||
| 947 | dev_dbg(smmu->dev, "smmu_as@%p\n", as); | 947 | dev_dbg(smmu->dev, "smmu_as@%p\n", as); |
| 948 | } | 948 | } |
| 949 | 949 | ||
| 950 | static struct iommu_ops smmu_iommu_ops = { | 950 | static const struct iommu_ops smmu_iommu_ops = { |
| 951 | .domain_init = smmu_iommu_domain_init, | 951 | .domain_init = smmu_iommu_domain_init, |
| 952 | .domain_destroy = smmu_iommu_domain_destroy, | 952 | .domain_destroy = smmu_iommu_domain_destroy, |
| 953 | .attach_dev = smmu_iommu_attach_dev, | 953 | .attach_dev = smmu_iommu_attach_dev, |
diff --git a/include/linux/device.h b/include/linux/device.h index af424acd393d..75f5bcb8930b 100644 --- a/include/linux/device.h +++ b/include/linux/device.h | |||
| @@ -124,7 +124,7 @@ struct bus_type { | |||
| 124 | 124 | ||
| 125 | const struct dev_pm_ops *pm; | 125 | const struct dev_pm_ops *pm; |
| 126 | 126 | ||
| 127 | struct iommu_ops *iommu_ops; | 127 | const struct iommu_ops *iommu_ops; |
| 128 | 128 | ||
| 129 | struct subsys_private *p; | 129 | struct subsys_private *p; |
| 130 | struct lock_class_key lock_key; | 130 | struct lock_class_key lock_key; |
diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 7fd16e3d1f25..c7097d7f024c 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h | |||
| @@ -50,7 +50,7 @@ struct iommu_domain_geometry { | |||
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | struct iommu_domain { | 52 | struct iommu_domain { |
| 53 | struct iommu_ops *ops; | 53 | const struct iommu_ops *ops; |
| 54 | void *priv; | 54 | void *priv; |
| 55 | iommu_fault_handler_t handler; | 55 | iommu_fault_handler_t handler; |
| 56 | void *handler_token; | 56 | void *handler_token; |
| @@ -140,7 +140,7 @@ struct iommu_ops { | |||
| 140 | #define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */ | 140 | #define IOMMU_GROUP_NOTIFY_UNBIND_DRIVER 5 /* Pre Driver unbind */ |
| 141 | #define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */ | 141 | #define IOMMU_GROUP_NOTIFY_UNBOUND_DRIVER 6 /* Post Driver unbind */ |
| 142 | 142 | ||
| 143 | extern int bus_set_iommu(struct bus_type *bus, struct iommu_ops *ops); | 143 | extern int bus_set_iommu(struct bus_type *bus, const struct iommu_ops *ops); |
| 144 | extern bool iommu_present(struct bus_type *bus); | 144 | extern bool iommu_present(struct bus_type *bus); |
| 145 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); | 145 | extern struct iommu_domain *iommu_domain_alloc(struct bus_type *bus); |
| 146 | extern struct iommu_group *iommu_group_get_by_id(int id); | 146 | extern struct iommu_group *iommu_group_get_by_id(int id); |
