All of lore.kernel.org
 help / color / mirror / Atom feed
* [android-common:android16-6.12-lts 1/1] arch/arm64/kvm/iommu.c:153:58: sparse: sparse: Using plain integer as NULL pointer
@ 2026-09-15  8:35 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-09-15  8:35 UTC (permalink / raw)
  To: cros-kernel-buildreports; +Cc: oe-kbuild-all

tree:   https://android.googlesource.com/kernel/common android16-6.12-lts
head:   57041e4a7e52342473871000827584f966d8cbd3
commit: 9dabecc2a2c31f11239b0853839bfc860de071e0 [1/1] ANDROID: KVM: arm64: iommu: Add memcache for guest pvIOMMU
config: arm64-randconfig-r123-20260910 (https://download.01.org/0day-ci/archive/20260915/202609151626.e4d1AZ0S-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project d3db069999553568848400c84cbf815c03f5470f)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260915/202609151626.e4d1AZ0S-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/202609151626.e4d1AZ0S-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> arch/arm64/kvm/iommu.c:153:58: sparse: sparse: Using plain integer as NULL pointer
   arch/arm64/kvm/iommu.c:162:50: sparse: sparse: Using plain integer as NULL pointer

vim +153 arch/arm64/kvm/iommu.c

    12	
  > 13	struct kvm_iommu_driver *iommu_driver;
    14	extern struct kvm_iommu_ops *kvm_nvhe_sym(kvm_iommu_ops);
    15	
    16	int kvm_iommu_register_driver(struct kvm_iommu_driver *kern_ops)
    17	{
    18		if (WARN_ON(!kern_ops))
    19			return -EINVAL;
    20	
    21		/*
    22		 * Paired with smp_load_acquire(&iommu_driver)
    23		 * Ensure memory stores happening during a driver
    24		 * init are observed before executing kvm iommu callbacks.
    25		 */
    26		return cmpxchg_release(&iommu_driver, NULL, kern_ops) ? -EBUSY : 0;
    27	}
    28	EXPORT_SYMBOL(kvm_iommu_register_driver);
    29	
    30	int kvm_iommu_init_hyp(struct kvm_iommu_ops *hyp_ops,
    31			       struct kvm_hyp_memcache *atomic_mc)
    32	{
    33		if (!hyp_ops)
    34			return -EINVAL;
    35	
    36		return kvm_call_hyp_nvhe(__pkvm_iommu_init, hyp_ops,
    37					 atomic_mc->head, atomic_mc->nr_pages);
    38	}
    39	EXPORT_SYMBOL(kvm_iommu_init_hyp);
    40	
    41	int kvm_iommu_init_driver(void)
    42	{
    43		if (!smp_load_acquire(&iommu_driver) || !iommu_driver->get_iommu_id_by_of) {
    44			kvm_err("pKVM enabled without an IOMMU driver, do not run confidential workloads in virtual machines\n");
    45			return 0;
    46		}
    47	
    48		kvm_hyp_iommu_domains = (void *)__get_free_pages(GFP_KERNEL | __GFP_ZERO,
    49					get_order(KVM_IOMMU_DOMAINS_ROOT_SIZE));
    50		if (!kvm_hyp_iommu_domains)
    51			return -ENOMEM;
    52	
    53		kvm_hyp_iommu_domains = kern_hyp_va(kvm_hyp_iommu_domains);
    54	
    55		return iommu_driver->init_driver();
    56	}
    57	EXPORT_SYMBOL(kvm_iommu_init_driver);
    58	
    59	void kvm_iommu_remove_driver(void)
    60	{
    61		if (smp_load_acquire(&iommu_driver))
    62			iommu_driver->remove_driver();
    63	}
    64	
    65	
    66	pkvm_handle_t kvm_get_iommu_id_by_of(struct device_node *np)
    67	{
    68		if (!iommu_driver)
    69			return 0;
    70	
    71		return iommu_driver->get_iommu_id_by_of(np);
    72	}
    73	
    74	static pkvm_handle_t kvm_get_iommu_id(struct device *dev)
    75	{
    76		return kvm_get_iommu_id_by_of(dev_of_node(dev));
    77	}
    78	
    79	int pkvm_iommu_suspend(struct device *dev)
    80	{
    81		int device_id = kvm_get_iommu_id(dev);
    82	
    83		return kvm_call_hyp_nvhe(__pkvm_host_hvc_pd, device_id, 0);
    84	}
    85	EXPORT_SYMBOL(pkvm_iommu_suspend);
    86	
    87	int pkvm_iommu_resume(struct device *dev)
    88	{
    89		int device_id = kvm_get_iommu_id(dev);
    90	
    91		return kvm_call_hyp_nvhe(__pkvm_host_hvc_pd, device_id, 1);
    92	}
    93	EXPORT_SYMBOL(pkvm_iommu_resume);
    94	
    95	int kvm_iommu_share_hyp_sg(struct kvm_iommu_sg *sg, unsigned int nents)
    96	{
    97		size_t nr_pages = PAGE_ALIGN(sizeof(*sg) * nents) >> PAGE_SHIFT;
    98		phys_addr_t sg_pfn = virt_to_phys(sg) >> PAGE_SHIFT;
    99		int i;
   100		int ret;
   101	
   102		for (i = 0 ; i < nr_pages ; ++i) {
   103			ret = kvm_call_hyp_nvhe(__pkvm_host_share_hyp, sg_pfn + i);
   104			if (ret)
   105				return ret;
   106		}
   107	
   108		return 0;
   109	}
   110	EXPORT_SYMBOL(kvm_iommu_share_hyp_sg);
   111	
   112	int kvm_iommu_unshare_hyp_sg(struct kvm_iommu_sg *sg, unsigned int nents)
   113	{
   114		size_t nr_pages = PAGE_ALIGN(sizeof(*sg) * nents) >> PAGE_SHIFT;
   115		phys_addr_t sg_pfn = virt_to_phys(sg) >> PAGE_SHIFT;
   116		int i;
   117		int ret;
   118	
   119		for (i = 0 ; i < nr_pages ; ++i) {
   120			ret = kvm_call_hyp_nvhe(__pkvm_host_unshare_hyp, sg_pfn + i);
   121			if (ret)
   122				return ret;
   123		}
   124	
   125		return 0;
   126	}
   127	EXPORT_SYMBOL(kvm_iommu_unshare_hyp_sg);
   128	
   129	int kvm_iommu_device_num_ids(struct device *dev)
   130	{
   131		if (iommu_driver->get_device_iommu_num_ids)
   132			return iommu_driver->get_device_iommu_num_ids(dev);
   133		return 0;
   134	}
   135	EXPORT_SYMBOL_GPL(kvm_iommu_device_num_ids);
   136	
   137	int kvm_iommu_device_id(struct device *dev, u32 idx,
   138				pkvm_handle_t *out_iommu, u32 *out_sid)
   139	{
   140		if (iommu_driver->get_device_iommu_id)
   141			return iommu_driver->get_device_iommu_id(dev, idx, out_iommu, out_sid);
   142		return -ENODEV;
   143	}
   144	EXPORT_SYMBOL_GPL(kvm_iommu_device_id);
   145	
   146	int kvm_iommu_guest_alloc_mc(struct kvm_hyp_memcache *mc, u32 pgsize, u32 nr_pages)
   147	{
   148		u8 order = get_order(pgsize);
   149	
   150		/* Driver might have dedicated allocator especially if it needs large pages. */
   151		if (iommu_driver && iommu_driver->guest_alloc && iommu_driver->guest_free)
   152			return __topup_hyp_memcache(mc, nr_pages, iommu_driver->guest_alloc,
 > 153						    kvm_host_pa, 0, order);
   154	
   155		return topup_hyp_memcache(mc, nr_pages, order);
   156	}
   157	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [android-common:android16-6.12-lts 1/1] arch/arm64/kvm/iommu.c:153:58: sparse: sparse: Using plain integer as NULL pointer
@ 2026-09-18  8:17 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2026-09-18  8:17 UTC (permalink / raw)
  To: cros-kernel-buildreports; +Cc: oe-kbuild-all

tree:   https://android.googlesource.com/kernel/common android16-6.12-lts
head:   57041e4a7e52342473871000827584f966d8cbd3
commit: 9dabecc2a2c31f11239b0853839bfc860de071e0 [1/1] ANDROID: KVM: arm64: iommu: Add memcache for guest pvIOMMU
config: arm64-randconfig-r123-20260910 (https://download.01.org/0day-ci/archive/20260918/202609181647.ibpzYHY2-lkp@intel.com/config)
compiler: clang version 24.0.0git (https://github.com/llvm/llvm-project d3db069999553568848400c84cbf815c03f5470f)
sparse: v0.6.5-rc1
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260918/202609181647.ibpzYHY2-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/202609181647.ibpzYHY2-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> arch/arm64/kvm/iommu.c:153:58: sparse: sparse: Using plain integer as NULL pointer
   arch/arm64/kvm/iommu.c:162:50: sparse: sparse: Using plain integer as NULL pointer

vim +153 arch/arm64/kvm/iommu.c

   145	
   146	int kvm_iommu_guest_alloc_mc(struct kvm_hyp_memcache *mc, u32 pgsize, u32 nr_pages)
   147	{
   148		u8 order = get_order(pgsize);
   149	
   150		/* Driver might have dedicated allocator especially if it needs large pages. */
   151		if (iommu_driver && iommu_driver->guest_alloc && iommu_driver->guest_free)
   152			return __topup_hyp_memcache(mc, nr_pages, iommu_driver->guest_alloc,
 > 153						    kvm_host_pa, 0, order);
   154	
   155		return topup_hyp_memcache(mc, nr_pages, order);
   156	}
   157	

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-18  8:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-15  8:35 [android-common:android16-6.12-lts 1/1] arch/arm64/kvm/iommu.c:153:58: sparse: sparse: Using plain integer as NULL pointer kernel test robot
  -- strict thread matches above, loose matches on Subject: below --
2026-09-18  8:17 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.