All of lore.kernel.org
 help / color / mirror / Atom feed
* [krzk-github:wip/eliza-integration-display-on-early-hwe 22479/22523] drivers/iommu/of_iommu.c:204:13: warning: 'of_iommu_derive_resv_regions' defined but not used
@ 2026-10-14  2:15 kernel test robot
  0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2026-10-14  2:15 UTC (permalink / raw)
  To: Vikash Garodia; +Cc: oe-kbuild-all, Abel Vesa, Vishnu Reddy

tree:   https://github.com/krzk/linux wip/eliza-integration-display-on-early-hwe
head:   bc8619ef46818e58ca3d967ab1c52ad66162306a
commit: 65e5b1819ef65430d58df9451428404f2ae889b1 [22479/22523] FROMLIST: iommu: of_iommu: Add support for "iommu-ranges" on a device node
config: sparc-randconfig-r2306-20261014 (https://download.01.org/0day-ci/archive/20261014/202610140431.Oibtitx2-lkp@intel.com/config)
compiler: sparc64-linux-gcc (GCC) 16.1.0
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20261014/202610140431.Oibtitx2-lkp@intel.com/reproduce)

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/202610140431.Oibtitx2-lkp@intel.com/

All warnings (new ones prefixed by >>):

>> drivers/iommu/of_iommu.c:204:13: warning: 'of_iommu_derive_resv_regions' defined but not used [-Wunused-function]
     204 | static void of_iommu_derive_resv_regions(struct device *dev, struct list_head *list)
         |             ^~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +/of_iommu_derive_resv_regions +204 drivers/iommu/of_iommu.c

   192	
   193	/**
   194	 * of_iommu_derive_resv_regions - derive reserved regions which
   195	 *                                are outside of iommu-ranges
   196	 * @dev: device for which to get reserved regions
   197	 * @list: reserved region list
   198	 *
   199	 * A device can describe its own usable IOVA ranges directly on its node
   200	 * via "iommu-ranges". Everything not under those ranges is derived
   201	 * as a reserved region so the IOMMU allocator won't use it. Entries may
   202	 * appear in any order in the property.
   203	 */
 > 204	static void of_iommu_derive_resv_regions(struct device *dev, struct list_head *list)
   205	{
   206		struct of_iommu_range {
   207			struct list_head node;
   208			phys_addr_t start;
   209			phys_addr_t end;
   210		} *pos, *new, *next_range;
   211		int size, prot = IOMMU_READ | IOMMU_WRITE;
   212		struct iommu_resv_region *region;
   213		const __be32 *maps, *end;
   214		struct list_head *prev;
   215		phys_addr_t next = 0;
   216		LIST_HEAD(ranges);
   217	
   218		maps = of_get_property(dev->of_node, "iommu-ranges", &size);
   219		if (!maps)
   220			return;
   221	
   222		end = maps + size / sizeof(__be32);
   223	
   224		while (maps < end) {
   225			phys_addr_t iova, iova_end;
   226			size_t length;
   227	
   228			maps = of_translate_dma_region(dev->of_node, maps, &iova, &length);
   229			if (!maps) {
   230				dev_err(dev, "%pOF: failed to parse iommu-ranges\n",
   231					dev->of_node);
   232				break;
   233			}
   234	
   235			if (!length)
   236				continue;
   237	
   238			iova_end = iova + length - 1;
   239	
   240			if (iova_end < iova) {
   241				dev_err(dev, "%pOF: iommu-ranges overflows address space\n",
   242					dev->of_node);
   243				continue;
   244			}
   245	
   246			prev = &ranges;
   247			list_for_each_entry(pos, &ranges, node) {
   248				if (pos->start > iova)
   249					break;
   250				prev = &pos->node;
   251			}
   252	
   253			new = kmalloc_obj(*new);
   254			if (!new)
   255				continue;
   256	
   257			new->start = iova;
   258			new->end = iova_end;
   259			list_add(&new->node, prev);
   260		}
   261	
   262		if (list_empty(&ranges))
   263			return;
   264	
   265		if (of_dma_is_coherent(dev->of_node))
   266			prot |= IOMMU_CACHE;
   267	
   268		list_for_each_entry_safe(pos, next_range, &ranges, node) {
   269			if (pos->start > next) {
   270				region = iommu_alloc_resv_region(next, pos->start - next, prot,
   271								 IOMMU_RESV_RESERVED, GFP_KERNEL);
   272				if (region)
   273					list_add_tail(&region->list, list);
   274			}
   275	
   276			if (pos->end == PHYS_ADDR_MAX)
   277				goto exit;
   278	
   279			if (pos->end >= next)
   280				next = pos->end + 1;
   281	
   282			list_del(&pos->node);
   283			kfree(pos);
   284		}
   285	
   286		region = iommu_alloc_resv_region(next, PHYS_ADDR_MAX - next + 1,
   287						 prot, IOMMU_RESV_RESERVED, GFP_KERNEL);
   288		if (region)
   289			list_add_tail(&region->list, list);
   290	
   291	exit:
   292		list_for_each_entry_safe(pos, next_range, &ranges, node) {
   293			list_del(&pos->node);
   294			kfree(pos);
   295		}
   296	}
   297	

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2026-10-14  2:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-14  2:15 [krzk-github:wip/eliza-integration-display-on-early-hwe 22479/22523] drivers/iommu/of_iommu.c:204:13: warning: 'of_iommu_derive_resv_regions' defined but not used kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.