All of lore.kernel.org
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Nicolin Chen <nicolinc@nvidia.com>
Cc: oe-kbuild-all@lists.linux.dev, Jason Gunthorpe <jgg@ziepe.ca>,
	Eric Auger <eric.auger@redhat.com>
Subject: [jgunthorpe:smmuv3_nesting 11/17] drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:141:21: sparse: sparse: incorrect type in assignment (different base types)
Date: Sun, 20 Oct 2024 04:34:57 +0800	[thread overview]
Message-ID: <202410200404.OJrmhHAF-lkp@intel.com> (raw)

tree:   https://github.com/jgunthorpe/linux smmuv3_nesting
head:   fa1528253d221071f2c743b194d5aebad4b55a93
commit: a29d6e74459ce8ff8a2c370e09cdd85d2ee89480 [11/17] iommu/arm-smmu-v3: Add arm_smmu_cache_invalidate_user
config: arm64-randconfig-r123-20241019 (https://download.01.org/0day-ci/archive/20241020/202410200404.OJrmhHAF-lkp@intel.com/config)
compiler: aarch64-linux-gcc (GCC) 14.1.0
reproduce: (https://download.01.org/0day-ci/archive/20241020/202410200404.OJrmhHAF-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/202410200404.OJrmhHAF-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:141:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 @@     got unsigned long long [usertype] @@
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:141:21: sparse:     expected restricted __le64
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:141:21: sparse:     got unsigned long long [usertype]
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:142:21: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 @@     got unsigned long long [usertype] @@
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:142:21: sparse:     expected restricted __le64
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:142:21: sparse:     got unsigned long long [usertype]
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:144:25: sparse: sparse: restricted __le64 degrades to integer
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:147:29: sparse: sparse: incorrect type in assignment (different base types) @@     expected restricted __le64 @@     got unsigned long long @@
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:147:29: sparse:     expected restricted __le64
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:147:29: sparse:     got unsigned long long
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:155:29: sparse: sparse: invalid assignment: &=
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:155:29: sparse:    left side has type restricted __le64
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:155:29: sparse:    right side has type unsigned long long
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:156:29: sparse: sparse: invalid assignment: |=
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:156:29: sparse:    left side has type restricted __le64
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:156:29: sparse:    right side has type unsigned long long
>> drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:202:51: sparse: sparse: incorrect type in argument 3 (different base types) @@     expected unsigned long long [usertype] *cmds @@     got restricted __le64 * @@
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:202:51: sparse:     expected unsigned long long [usertype] *cmds
   drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:202:51: sparse:     got restricted __le64 *

vim +141 drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c

   127	
   128	/*
   129	 * Convert, in place, the raw invalidation command into an internal format that
   130	 * can be passed to arm_smmu_cmdq_issue_cmdlist(). Internally commands are
   131	 * stored in CPU endian.
   132	 *
   133	 * Enforce the VMID on the command.
   134	 */
   135	static int
   136	arm_smmu_convert_user_cmd(struct arm_smmu_nested_domain *nested_domain,
   137				  struct iommu_hwpt_arm_smmuv3_invalidate *cmd)
   138	{
   139		u16 vmid = nested_domain->s2_parent->s2_cfg.vmid;
   140	
 > 141		cmd->cmd[0] = le64_to_cpu(cmd->cmd[0]);
   142		cmd->cmd[1] = le64_to_cpu(cmd->cmd[1]);
   143	
 > 144		switch (cmd->cmd[0] & CMDQ_0_OP) {
   145		case CMDQ_OP_TLBI_NSNH_ALL:
   146			/* Convert to NH_ALL */
 > 147			cmd->cmd[0] = CMDQ_OP_TLBI_NH_ALL |
   148				      FIELD_PREP(CMDQ_TLBI_0_VMID, vmid);
   149			cmd->cmd[1] = 0;
   150			break;
   151		case CMDQ_OP_TLBI_NH_VA:
   152		case CMDQ_OP_TLBI_NH_VAA:
   153		case CMDQ_OP_TLBI_NH_ALL:
   154		case CMDQ_OP_TLBI_NH_ASID:
 > 155			cmd->cmd[0] &= ~CMDQ_TLBI_0_VMID;
   156			cmd->cmd[0] |= FIELD_PREP(CMDQ_TLBI_0_VMID, vmid);
   157			break;
   158		default:
   159			return -EIO;
   160		}
   161		return 0;
   162	}
   163	
   164	static int arm_smmu_cache_invalidate_user(struct iommu_domain *domain,
   165						  struct iommu_user_data_array *array)
   166	{
   167		struct arm_smmu_nested_domain *nested_domain =
   168			to_smmu_nested_domain(domain);
   169		struct arm_smmu_device *smmu = nested_domain->s2_parent->smmu;
   170		struct iommu_hwpt_arm_smmuv3_invalidate *last_batch;
   171		struct iommu_hwpt_arm_smmuv3_invalidate *cmds;
   172		struct iommu_hwpt_arm_smmuv3_invalidate *cur;
   173		struct iommu_hwpt_arm_smmuv3_invalidate *end;
   174		int ret;
   175	
   176		cmds = kcalloc(array->entry_num, sizeof(*cmds), GFP_KERNEL);
   177		if (!cmds)
   178			return -ENOMEM;
   179		cur = cmds;
   180		end = cmds + array->entry_num;
   181	
   182		static_assert(sizeof(*cmds) == 2 * sizeof(u64));
   183		ret = iommu_copy_struct_from_full_user_array(
   184			cmds, sizeof(*cmds), array,
   185			IOMMU_HWPT_INVALIDATE_DATA_ARM_SMMUV3);
   186		if (ret)
   187			goto out;
   188	
   189		last_batch = cmds;
   190		while (cur != end) {
   191			ret = arm_smmu_convert_user_cmd(nested_domain, cur);
   192			if (ret)
   193				goto out;
   194	
   195			/* FIXME work in blocks of CMDQ_BATCH_ENTRIES and copy each block? */
   196			cur++;
   197			if (cur != end && (cur - last_batch) != CMDQ_BATCH_ENTRIES - 1)
   198				continue;
   199	
   200			/* FIXME always uses the main cmdq rather than trying to group by type */
   201			ret = arm_smmu_cmdq_issue_cmdlist(smmu, &smmu->cmdq,
 > 202							  last_batch->cmd,
   203							  cur - last_batch, true);
   204			if (ret) {
   205				cur--;
   206				goto out;
   207			}
   208			last_batch = cur;
   209		}
   210	out:
   211		array->entry_num = cur - cmds;
   212		kfree(cmds);
   213		return ret;
   214	}
   215	

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

             reply	other threads:[~2024-10-19 20:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-19 20:34 kernel test robot [this message]
2024-10-19 22:05 ` [jgunthorpe:smmuv3_nesting 11/17] drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3-iommufd.c:141:21: sparse: sparse: incorrect type in assignment (different base types) Nicolin Chen
2024-10-21 12:41   ` Jason Gunthorpe
2024-10-21 21:02     ` Nicolin Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202410200404.OJrmhHAF-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=eric.auger@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=nicolinc@nvidia.com \
    --cc=oe-kbuild-all@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.