Message ID | 42722975eb1309a3e43f58099ff5b6c7bfb23d3d.1718994350.git.robin.murphy@arm.com |
---|---|
State | Superseded |
Headers | show |
Series | iommu: Remove iommu_fwspec ops | expand |
Hi Robin,
kernel test robot noticed the following build errors:
[auto build test ERROR on joro-iommu/next]
[also build test ERROR on rafael-pm/linux-next rafael-pm/bleeding-edge arm-perf/for-next/perf arm64/for-next/core linus/master v6.10-rc6 next-20240701]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Robin-Murphy/iommu-Resolve-fwspec-ops-automatically/20240625-210010
base: https://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu.git next
patch link: https://lore.kernel.org/r/42722975eb1309a3e43f58099ff5b6c7bfb23d3d.1718994350.git.robin.murphy%40arm.com
patch subject: [PATCH v2 4/4] iommu: Remove iommu_fwspec ops
config: arm-allmodconfig
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0
reproduce (this is a W=1 build):
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202407020415.KKnhPTUj-lkp@intel.com/
All errors (new ones prefixed by >>):
drivers/iommu/mtk_iommu_v1.c: In function 'mtk_iommu_v1_create_mapping':
>> drivers/iommu/mtk_iommu_v1.c:421:45: error: 'struct iommu_fwspec' has no member named 'ops'
421 | } else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_v1_ops) {
| ^~
vim +421 drivers/iommu/mtk_iommu_v1.c
84672f192671e64 Robin Murphy 2016-10-17 396
b17336c55d8928c Honghui Zhang 2016-06-08 397 /*
b17336c55d8928c Honghui Zhang 2016-06-08 398 * MTK generation one iommu HW only support one iommu domain, and all the client
b17336c55d8928c Honghui Zhang 2016-06-08 399 * sharing the same iova address space.
b17336c55d8928c Honghui Zhang 2016-06-08 400 */
b42a905b6aad40c Krzysztof Kozlowski 2024-02-16 401 static int mtk_iommu_v1_create_mapping(struct device *dev,
b42a905b6aad40c Krzysztof Kozlowski 2024-02-16 402 const struct of_phandle_args *args)
b17336c55d8928c Honghui Zhang 2016-06-08 403 {
a9bf2eec5a6fc01 Joerg Roedel 2018-11-29 404 struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev);
ad9b10e533f6fb3 Yong Wu 2022-05-03 405 struct mtk_iommu_v1_data *data;
b17336c55d8928c Honghui Zhang 2016-06-08 406 struct platform_device *m4updev;
b17336c55d8928c Honghui Zhang 2016-06-08 407 struct dma_iommu_mapping *mtk_mapping;
b17336c55d8928c Honghui Zhang 2016-06-08 408 int ret;
b17336c55d8928c Honghui Zhang 2016-06-08 409
b17336c55d8928c Honghui Zhang 2016-06-08 410 if (args->args_count != 1) {
b17336c55d8928c Honghui Zhang 2016-06-08 411 dev_err(dev, "invalid #iommu-cells(%d) property for IOMMU\n",
b17336c55d8928c Honghui Zhang 2016-06-08 412 args->args_count);
b17336c55d8928c Honghui Zhang 2016-06-08 413 return -EINVAL;
b17336c55d8928c Honghui Zhang 2016-06-08 414 }
b17336c55d8928c Honghui Zhang 2016-06-08 415
a9bf2eec5a6fc01 Joerg Roedel 2018-11-29 416 if (!fwspec) {
5fff542d1626fec Robin Murphy 2024-06-21 417 ret = iommu_fwspec_init(dev, of_fwnode_handle(args->np));
84672f192671e64 Robin Murphy 2016-10-17 418 if (ret)
84672f192671e64 Robin Murphy 2016-10-17 419 return ret;
a9bf2eec5a6fc01 Joerg Roedel 2018-11-29 420 fwspec = dev_iommu_fwspec_get(dev);
ad9b10e533f6fb3 Yong Wu 2022-05-03 @421 } else if (dev_iommu_fwspec_get(dev)->ops != &mtk_iommu_v1_ops) {
84672f192671e64 Robin Murphy 2016-10-17 422 return -EINVAL;
84672f192671e64 Robin Murphy 2016-10-17 423 }
84672f192671e64 Robin Murphy 2016-10-17 424
3524b5592cad638 Joerg Roedel 2020-03-26 425 if (!dev_iommu_priv_get(dev)) {
b17336c55d8928c Honghui Zhang 2016-06-08 426 /* Get the m4u device */
b17336c55d8928c Honghui Zhang 2016-06-08 427 m4updev = of_find_device_by_node(args->np);
b17336c55d8928c Honghui Zhang 2016-06-08 428 if (WARN_ON(!m4updev))
b17336c55d8928c Honghui Zhang 2016-06-08 429 return -EINVAL;
b17336c55d8928c Honghui Zhang 2016-06-08 430
3524b5592cad638 Joerg Roedel 2020-03-26 431 dev_iommu_priv_set(dev, platform_get_drvdata(m4updev));
b17336c55d8928c Honghui Zhang 2016-06-08 432 }
b17336c55d8928c Honghui Zhang 2016-06-08 433
84672f192671e64 Robin Murphy 2016-10-17 434 ret = iommu_fwspec_add_ids(dev, args->args, 1);
84672f192671e64 Robin Murphy 2016-10-17 435 if (ret)
84672f192671e64 Robin Murphy 2016-10-17 436 return ret;
b17336c55d8928c Honghui Zhang 2016-06-08 437
3524b5592cad638 Joerg Roedel 2020-03-26 438 data = dev_iommu_priv_get(dev);
589601720d9d036 Joerg Roedel 2020-06-25 439 mtk_mapping = data->mapping;
b17336c55d8928c Honghui Zhang 2016-06-08 440 if (!mtk_mapping) {
b17336c55d8928c Honghui Zhang 2016-06-08 441 /* MTK iommu support 4GB iova address space. */
b17336c55d8928c Honghui Zhang 2016-06-08 442 mtk_mapping = arm_iommu_create_mapping(&platform_bus_type,
b17336c55d8928c Honghui Zhang 2016-06-08 443 0, 1ULL << 32);
84672f192671e64 Robin Murphy 2016-10-17 444 if (IS_ERR(mtk_mapping))
84672f192671e64 Robin Murphy 2016-10-17 445 return PTR_ERR(mtk_mapping);
84672f192671e64 Robin Murphy 2016-10-17 446
589601720d9d036 Joerg Roedel 2020-06-25 447 data->mapping = mtk_mapping;
b17336c55d8928c Honghui Zhang 2016-06-08 448 }
b17336c55d8928c Honghui Zhang 2016-06-08 449
b17336c55d8928c Honghui Zhang 2016-06-08 450 return 0;
b17336c55d8928c Honghui Zhang 2016-06-08 451 }
b17336c55d8928c Honghui Zhang 2016-06-08 452
diff --git a/drivers/iommu/iommu-priv.h b/drivers/iommu/iommu-priv.h index 078cafcf49b4..a34efed2884b 100644 --- a/drivers/iommu/iommu-priv.h +++ b/drivers/iommu/iommu-priv.h @@ -19,6 +19,11 @@ static inline const struct iommu_ops *dev_iommu_ops(struct device *dev) const struct iommu_ops *iommu_ops_from_fwnode(const struct fwnode_handle *fwnode); +static inline const struct iommu_ops *iommu_fwspec_ops(struct iommu_fwspec *fwspec) +{ + return iommu_ops_from_fwnode(fwspec ? fwspec->iommu_fwnode : NULL); +} + int iommu_group_replace_domain(struct iommu_group *group, struct iommu_domain *new_domain); diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 7618c4285cf9..e15ae1dd494b 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -510,7 +510,6 @@ DEFINE_MUTEX(iommu_probe_device_lock); static int __iommu_probe_device(struct device *dev, struct list_head *group_list) { const struct iommu_ops *ops; - struct iommu_fwspec *fwspec; struct iommu_group *group; struct group_device *gdev; int ret; @@ -523,12 +522,7 @@ static int __iommu_probe_device(struct device *dev, struct list_head *group_list * be present, and that any of their registered instances has suitable * ops for probing, and thus cheekily co-opt the same mechanism. */ - fwspec = dev_iommu_fwspec_get(dev); - if (fwspec && fwspec->ops) - ops = fwspec->ops; - else - ops = iommu_ops_from_fwnode(NULL); - + ops = iommu_fwspec_ops(dev_iommu_fwspec_get(dev)); if (!ops) return -ENODEV; /* @@ -2831,7 +2825,7 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode) return -EPROBE_DEFER; if (fwspec) - return ops == fwspec->ops ? 0 : -EINVAL; + return ops == iommu_fwspec_ops(fwspec) ? 0 : -EINVAL; if (!dev_iommu_get(dev)) return -ENOMEM; @@ -2843,7 +2837,6 @@ int iommu_fwspec_init(struct device *dev, struct fwnode_handle *iommu_fwnode) fwnode_handle_get(iommu_fwnode); fwspec->iommu_fwnode = iommu_fwnode; - fwspec->ops = ops; dev_iommu_fwspec_set(dev, fwspec); return 0; } diff --git a/drivers/iommu/of_iommu.c b/drivers/iommu/of_iommu.c index c946521a5906..559c5db78edb 100644 --- a/drivers/iommu/of_iommu.c +++ b/drivers/iommu/of_iommu.c @@ -17,6 +17,8 @@ #include <linux/slab.h> #include <linux/fsl/mc.h> +#include "iommu-priv.h" + static int of_iommu_xlate(struct device *dev, struct of_phandle_args *iommu_spec) { @@ -32,7 +34,7 @@ static int of_iommu_xlate(struct device *dev, if (ret) return ret; - ops = dev_iommu_fwspec_get(dev)->ops; + ops = iommu_ops_from_fwnode(&iommu_spec->np->fwnode); if (!ops->of_xlate || !try_module_get(ops->owner)) return -ENODEV; diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 81893aad9ee4..11ae1750cb1d 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -968,7 +968,6 @@ extern struct iommu_group *generic_single_device_group(struct device *dev); /** * struct iommu_fwspec - per-device IOMMU instance data - * @ops: ops for this device's IOMMU * @iommu_fwnode: firmware handle for this device's IOMMU * @flags: IOMMU_FWSPEC_* flags * @num_ids: number of associated device IDs @@ -979,7 +978,6 @@ extern struct iommu_group *generic_single_device_group(struct device *dev); * consumers. */ struct iommu_fwspec { - const struct iommu_ops *ops; struct fwnode_handle *iommu_fwnode; u32 flags; unsigned int num_ids;
The ops in iommu_fwspec are only needed for the early configuration and probe process, and by now are easy enough to derive on-demand in those couple of places which need them, so remove the redundant stored copy. Signed-off-by: Robin Murphy <robin.murphy@arm.com> --- drivers/iommu/iommu-priv.h | 5 +++++ drivers/iommu/iommu.c | 11 ++--------- drivers/iommu/of_iommu.c | 4 +++- include/linux/iommu.h | 2 -- 4 files changed, 10 insertions(+), 12 deletions(-)