lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Tue, 28 Jun 2022 16:01:27 +0800
From:   kernel test robot <lkp@...el.com>
To:     Hector Martin <marcan@...can.st>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [asahilinux:t8112/bringup 8/12] drivers/iommu/apple-dart.c:345:62:
 error: passing argument 1 of 'atomic64_read' from incompatible pointer type

tree:   https://github.com/AsahiLinux/linux t8112/bringup
head:   18558a69178b03776aaea0f2aca1d6299f07f8b9
commit: a47ec020cc1bdbed3fc343ebeb29b90cb69f1362 [8/12] iommu: dart: Support >64 stream IDs
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220628/202206281521.IMM4ifZr-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/AsahiLinux/linux/commit/a47ec020cc1bdbed3fc343ebeb29b90cb69f1362
        git remote add asahilinux https://github.com/AsahiLinux/linux
        git fetch --no-tags asahilinux t8112/bringup
        git checkout a47ec020cc1bdbed3fc343ebeb29b90cb69f1362
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@...el.com>

All errors (new ones prefixed by >>):

   drivers/iommu/apple-dart.c: In function 'apple_dart_domain_flush_tlb':
>> drivers/iommu/apple-dart.c:345:62: error: passing argument 1 of 'atomic64_read' from incompatible pointer type [-Werror=incompatible-pointer-types]
     345 |                         stream_map.sidmap[j] = atomic64_read(&domain_stream_map->sidmap[j]);
         |                                                              ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                              |
         |                                                              atomic_long_t * {aka atomic_t *}
   In file included from include/linux/atomic.h:82,
                    from drivers/iommu/apple-dart.c:14:
   include/linux/atomic/atomic-instrumented.h:644:33: note: expected 'const atomic64_t *' but argument is of type 'atomic_long_t *' {aka 'atomic_t *'}
     644 | atomic64_read(const atomic64_t *v)
         |               ~~~~~~~~~~~~~~~~~~^
   drivers/iommu/apple-dart.c: In function 'apple_dart_finalize_domain':
>> drivers/iommu/apple-dart.c:441:38: error: passing argument 1 of 'atomic64_set' from incompatible pointer type [-Werror=incompatible-pointer-types]
     441 |                         atomic64_set(&dart_domain->stream_maps[i].sidmap[j],
         |                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                      |
         |                                      atomic_long_t * {aka atomic_t *}
   In file included from include/linux/atomic.h:82,
                    from drivers/iommu/apple-dart.c:14:
   include/linux/atomic/atomic-instrumented.h:658:26: note: expected 'atomic64_t *' but argument is of type 'atomic_long_t *' {aka 'atomic_t *'}
     658 | atomic64_set(atomic64_t *v, s64 i)
         |              ~~~~~~~~~~~~^
   drivers/iommu/apple-dart.c: In function 'apple_dart_mod_streams':
>> drivers/iommu/apple-dart.c:490:45: error: passing argument 2 of 'atomic64_or' from incompatible pointer type [-Werror=incompatible-pointer-types]
     490 |                                             &domain_maps[i].sidmap[j]);
         |                                             ^~~~~~~~~~~~~~~~~~~~~~~~~
         |                                             |
         |                                             atomic_long_t * {aka atomic_t *}
   In file included from include/linux/atomic.h:82,
                    from drivers/iommu/apple-dart.c:14:
   include/linux/atomic/atomic-instrumented.h:1015:32: note: expected 'atomic64_t *' but argument is of type 'atomic_long_t *' {aka 'atomic_t *'}
    1015 | atomic64_or(s64 i, atomic64_t *v)
         |                    ~~~~~~~~~~~~^
>> drivers/iommu/apple-dart.c:493:46: error: passing argument 2 of 'atomic64_and' from incompatible pointer type [-Werror=incompatible-pointer-types]
     493 |                                              &domain_maps[i].sidmap[j]);
         |                                              ^~~~~~~~~~~~~~~~~~~~~~~~~
         |                                              |
         |                                              atomic_long_t * {aka atomic_t *}
   In file included from include/linux/atomic.h:82,
                    from drivers/iommu/apple-dart.c:14:
   include/linux/atomic/atomic-instrumented.h:941:33: note: expected 'atomic64_t *' but argument is of type 'atomic_long_t *' {aka 'atomic_t *'}
     941 | atomic64_and(s64 i, atomic64_t *v)
         |                     ~~~~~~~~~~~~^
   cc1: some warnings being treated as errors


vim +/atomic64_read +345 drivers/iommu/apple-dart.c

   334	
   335	static void apple_dart_domain_flush_tlb(struct apple_dart_domain *domain)
   336	{
   337		int i, j;
   338		struct apple_dart_atomic_stream_map *domain_stream_map;
   339		struct apple_dart_stream_map stream_map;
   340	
   341		for_each_stream_map(i, domain, domain_stream_map) {
   342			stream_map.dart = domain_stream_map->dart;
   343	
   344			for (j = 0; j < BITS_TO_LONGS(stream_map.dart->num_streams); j++)
 > 345				stream_map.sidmap[j] = atomic64_read(&domain_stream_map->sidmap[j]);
   346	
   347			apple_dart_hw_invalidate_tlb(&stream_map);
   348		}
   349	}
   350	
   351	static void apple_dart_flush_iotlb_all(struct iommu_domain *domain)
   352	{
   353		apple_dart_domain_flush_tlb(to_dart_domain(domain));
   354	}
   355	
   356	static void apple_dart_iotlb_sync(struct iommu_domain *domain,
   357					  struct iommu_iotlb_gather *gather)
   358	{
   359		apple_dart_domain_flush_tlb(to_dart_domain(domain));
   360	}
   361	
   362	static void apple_dart_iotlb_sync_map(struct iommu_domain *domain,
   363					      unsigned long iova, size_t size)
   364	{
   365		apple_dart_domain_flush_tlb(to_dart_domain(domain));
   366	}
   367	
   368	static phys_addr_t apple_dart_iova_to_phys(struct iommu_domain *domain,
   369						   dma_addr_t iova)
   370	{
   371		struct apple_dart_domain *dart_domain = to_dart_domain(domain);
   372		struct io_pgtable_ops *ops = dart_domain->pgtbl_ops;
   373	
   374		if (!ops)
   375			return 0;
   376	
   377		return ops->iova_to_phys(ops, iova);
   378	}
   379	
   380	static int apple_dart_map_pages(struct iommu_domain *domain, unsigned long iova,
   381					phys_addr_t paddr, size_t pgsize,
   382					size_t pgcount, int prot, gfp_t gfp,
   383					size_t *mapped)
   384	{
   385		struct apple_dart_domain *dart_domain = to_dart_domain(domain);
   386		struct io_pgtable_ops *ops = dart_domain->pgtbl_ops;
   387	
   388		if (!ops)
   389			return -ENODEV;
   390	
   391		return ops->map_pages(ops, iova, paddr, pgsize, pgcount, prot, gfp,
   392				      mapped);
   393	}
   394	
   395	static size_t apple_dart_unmap_pages(struct iommu_domain *domain,
   396					     unsigned long iova, size_t pgsize,
   397					     size_t pgcount,
   398					     struct iommu_iotlb_gather *gather)
   399	{
   400		struct apple_dart_domain *dart_domain = to_dart_domain(domain);
   401		struct io_pgtable_ops *ops = dart_domain->pgtbl_ops;
   402	
   403		return ops->unmap_pages(ops, iova, pgsize, pgcount, gather);
   404	}
   405	
   406	static void
   407	apple_dart_setup_translation(struct apple_dart_domain *domain,
   408				     struct apple_dart_stream_map *stream_map)
   409	{
   410		int i;
   411		struct io_pgtable_cfg *pgtbl_cfg =
   412			&io_pgtable_ops_to_pgtable(domain->pgtbl_ops)->cfg;
   413	
   414		for (i = 0; i < pgtbl_cfg->apple_dart_cfg.n_ttbrs; ++i)
   415			apple_dart_hw_set_ttbr(stream_map, i,
   416					       pgtbl_cfg->apple_dart_cfg.ttbr[i]);
   417		for (; i < DART_MAX_TTBR; ++i)
   418			apple_dart_hw_clear_ttbr(stream_map, i);
   419	
   420		apple_dart_hw_enable_translation(stream_map);
   421		apple_dart_hw_invalidate_tlb(stream_map);
   422	}
   423	
   424	static int apple_dart_finalize_domain(struct iommu_domain *domain,
   425					      struct apple_dart_master_cfg *cfg)
   426	{
   427		struct apple_dart_domain *dart_domain = to_dart_domain(domain);
   428		struct apple_dart *dart = cfg->stream_maps[0].dart;
   429		struct io_pgtable_cfg pgtbl_cfg;
   430		int ret = 0;
   431		int i, j;
   432	
   433		mutex_lock(&dart_domain->init_lock);
   434	
   435		if (dart_domain->finalized)
   436			goto done;
   437	
   438		for (i = 0; i < MAX_DARTS_PER_DEVICE; ++i) {
   439			dart_domain->stream_maps[i].dart = cfg->stream_maps[i].dart;
   440			for (j = 0; j < BITS_TO_LONGS(dart->num_streams); j++)
 > 441				atomic64_set(&dart_domain->stream_maps[i].sidmap[j],
   442					     cfg->stream_maps[i].sidmap[j]);
   443		}
   444	
   445		pgtbl_cfg = (struct io_pgtable_cfg){
   446			.pgsize_bitmap = dart->pgsize,
   447			.ias = 32,
   448			.oas = dart->hw->oas,
   449			.coherent_walk = 1,
   450			.iommu_dev = dart->dev,
   451		};
   452	
   453		dart_domain->pgtbl_ops =
   454			alloc_io_pgtable_ops(dart->hw->fmt, &pgtbl_cfg, domain);
   455		if (!dart_domain->pgtbl_ops) {
   456			ret = -ENOMEM;
   457			goto done;
   458		}
   459	
   460		domain->pgsize_bitmap = pgtbl_cfg.pgsize_bitmap;
   461		domain->geometry.aperture_start = 0;
   462		domain->geometry.aperture_end = DMA_BIT_MASK(32);
   463		domain->geometry.force_aperture = true;
   464	
   465		dart_domain->finalized = true;
   466	
   467	done:
   468		mutex_unlock(&dart_domain->init_lock);
   469		return ret;
   470	}
   471	
   472	static int
   473	apple_dart_mod_streams(struct apple_dart_atomic_stream_map *domain_maps,
   474			       struct apple_dart_stream_map *master_maps,
   475			       bool add_streams)
   476	{
   477		int i, j;
   478	
   479		for (i = 0; i < MAX_DARTS_PER_DEVICE; ++i) {
   480			if (domain_maps[i].dart != master_maps[i].dart)
   481				return -EINVAL;
   482		}
   483	
   484		for (i = 0; i < MAX_DARTS_PER_DEVICE; ++i) {
   485			if (!domain_maps[i].dart)
   486				break;
   487			for (j = 0; j < BITS_TO_LONGS(domain_maps[i].dart->num_streams); j++) {
   488				if (add_streams)
   489					atomic64_or(master_maps[i].sidmap[j],
 > 490						    &domain_maps[i].sidmap[j]);
   491				else
   492					atomic64_and(~master_maps[i].sidmap[j],
 > 493						     &domain_maps[i].sidmap[j]);
   494			}
   495		}
   496	
   497		return 0;
   498	}
   499	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ