[linux-next:master 6958/10848] drivers/soc/hisilicon/kunpeng_hccs.c:183:9: sparse: sparse: incorrect type in argument 1 (different address spaces)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   47762f08697484cf0c2f2904b8c52375ed26c8cb
commit: 886bdf9c883bcc9bfb0a0bc0ed27680e68c8b6c2 [6958/10848] soc: hisilicon: Support HCCS driver on Kunpeng SoC
config: loongarch-randconfig-r083-20230818 (https://download.01.org/0day-ci/archive/20230818/202308181402.TTzMhV7E-lkp@xxxxxxxxx/config)
compiler: loongarch64-linux-gcc (GCC) 12.3.0
reproduce: (https://download.01.org/0day-ci/archive/20230818/202308181402.TTzMhV7E-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202308181402.TTzMhV7E-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
   drivers/soc/hisilicon/kunpeng_hccs.c:88:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *addr @@     got void *pcc_comm_addr @@
   drivers/soc/hisilicon/kunpeng_hccs.c:88:32: sparse:     expected void volatile [noderef] __iomem *addr
   drivers/soc/hisilicon/kunpeng_hccs.c:88:32: sparse:     got void *pcc_comm_addr
   drivers/soc/hisilicon/kunpeng_hccs.c:156:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got unsigned short * @@
   drivers/soc/hisilicon/kunpeng_hccs.c:156:15: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/soc/hisilicon/kunpeng_hccs.c:156:15: sparse:     got unsigned short *
   drivers/soc/hisilicon/kunpeng_hccs.c:156:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __iomem *addr @@     got unsigned short * @@
   drivers/soc/hisilicon/kunpeng_hccs.c:156:15: sparse:     expected void const volatile [noderef] __iomem *addr
   drivers/soc/hisilicon/kunpeng_hccs.c:156:15: sparse:     got unsigned short *
>> drivers/soc/hisilicon/kunpeng_hccs.c:183:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *to @@     got struct acpi_pcct_shared_memory *comm_base @@
   drivers/soc/hisilicon/kunpeng_hccs.c:183:9: sparse:     expected void volatile [noderef] __iomem *to
   drivers/soc/hisilicon/kunpeng_hccs.c:183:9: sparse:     got struct acpi_pcct_shared_memory *comm_base
>> drivers/soc/hisilicon/kunpeng_hccs.c:189:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void volatile [noderef] __iomem *to @@     got void *comm_space @@
   drivers/soc/hisilicon/kunpeng_hccs.c:189:9: sparse:     expected void volatile [noderef] __iomem *to
   drivers/soc/hisilicon/kunpeng_hccs.c:189:9: sparse:     got void *comm_space
>> drivers/soc/hisilicon/kunpeng_hccs.c:205:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@     expected void const volatile [noderef] __iomem *from @@     got void *comm_space @@
   drivers/soc/hisilicon/kunpeng_hccs.c:205:9: sparse:     expected void const volatile [noderef] __iomem *from
   drivers/soc/hisilicon/kunpeng_hccs.c:205:9: sparse:     got void *comm_space

vim +183 drivers/soc/hisilicon/kunpeng_hccs.c

    82	
    83	static void hccs_unregister_pcc_channel(struct hccs_dev *hdev)
    84	{
    85		struct hccs_mbox_client_info *cl_info = &hdev->cl_info;
    86	
    87		if (cl_info->pcc_comm_addr)
  > 88			iounmap(cl_info->pcc_comm_addr);
    89		pcc_mbox_free_channel(hdev->cl_info.pcc_chan);
    90	}
    91	
    92	static int hccs_register_pcc_channel(struct hccs_dev *hdev)
    93	{
    94		struct hccs_mbox_client_info *cl_info = &hdev->cl_info;
    95		struct mbox_client *cl = &cl_info->client;
    96		struct pcc_mbox_chan *pcc_chan;
    97		struct device *dev = hdev->dev;
    98		int rc;
    99	
   100		cl->dev = dev;
   101		cl->tx_block = false;
   102		cl->knows_txdone = true;
   103		cl->tx_done = hccs_chan_tx_done;
   104		pcc_chan = pcc_mbox_request_channel(cl, hdev->chan_id);
   105		if (IS_ERR(pcc_chan)) {
   106			dev_err(dev, "PPC channel request failed.\n");
   107			rc = -ENODEV;
   108			goto out;
   109		}
   110		cl_info->pcc_chan = pcc_chan;
   111		cl_info->mbox_chan = pcc_chan->mchan;
   112	
   113		/*
   114		 * pcc_chan->latency is just a nominal value. In reality the remote
   115		 * processor could be much slower to reply. So add an arbitrary amount
   116		 * of wait on top of nominal.
   117		 */
   118		cl_info->deadline_us =
   119				HCCS_PCC_CMD_WAIT_RETRIES_NUM * pcc_chan->latency;
   120		if (cl_info->mbox_chan->mbox->txdone_irq) {
   121			dev_err(dev, "PCC IRQ in PCCT is enabled.\n");
   122			rc = -EINVAL;
   123			goto err_mbx_channel_free;
   124		}
   125	
   126		if (pcc_chan->shmem_base_addr) {
   127			cl_info->pcc_comm_addr = (void __force *)ioremap(
   128				pcc_chan->shmem_base_addr, pcc_chan->shmem_size);
   129			if (!cl_info->pcc_comm_addr) {
   130				dev_err(dev, "Failed to ioremap PCC communication region for channel-%d.\n",
   131					hdev->chan_id);
   132				rc = -ENOMEM;
   133				goto err_mbx_channel_free;
   134			}
   135		}
   136	
   137		return 0;
   138	
   139	err_mbx_channel_free:
   140		pcc_mbox_free_channel(cl_info->pcc_chan);
   141	out:
   142		return rc;
   143	}
   144	
   145	static int hccs_check_chan_cmd_complete(struct hccs_dev *hdev)
   146	{
   147		struct hccs_mbox_client_info *cl_info = &hdev->cl_info;
   148		struct acpi_pcct_shared_memory *comm_base = cl_info->pcc_comm_addr;
   149		u16 status;
   150		int ret;
   151	
   152		/*
   153		 * Poll PCC status register every 3us(delay_us) for maximum of
   154		 * deadline_us(timeout_us) until PCC command complete bit is set(cond)
   155		 */
 > 156		ret = readw_poll_timeout(&comm_base->status, status,
   157					 status & HCCS_PCC_STATUS_CMD_COMPLETE,
   158					 HCCS_POLL_STATUS_TIME_INTERVAL_US,
   159					 cl_info->deadline_us);
   160		if (unlikely(ret))
   161			dev_err(hdev->dev, "poll PCC status failed, ret = %d.\n", ret);
   162	
   163		return ret;
   164	}
   165	
   166	static int hccs_pcc_cmd_send(struct hccs_dev *hdev, u8 cmd,
   167				     struct hccs_desc *desc)
   168	{
   169		struct hccs_mbox_client_info *cl_info = &hdev->cl_info;
   170		struct acpi_pcct_shared_memory *comm_base = cl_info->pcc_comm_addr;
   171		void *comm_space = (void *)(comm_base + 1);
   172		struct hccs_fw_inner_head *fw_inner_head;
   173		struct acpi_pcct_shared_memory tmp = {0};
   174		u16 comm_space_size;
   175		int ret;
   176	
   177		/* Write signature for this subspace */
   178		tmp.signature = HCCS_PCC_SIGNATURE_MASK | hdev->chan_id;
   179		/* Write to the shared command region */
   180		tmp.command = cmd;
   181		/* Clear cmd complete bit */
   182		tmp.status = 0;
 > 183		memcpy_toio(comm_base, (void *)&tmp,
   184				sizeof(struct acpi_pcct_shared_memory));
   185	
   186		/* Copy the message to the PCC comm space */
   187		comm_space_size = HCCS_PCC_SHARE_MEM_BYTES -
   188					sizeof(struct acpi_pcct_shared_memory);
 > 189		memcpy_toio(comm_space, (void *)desc, comm_space_size);
   190	
   191		/* Ring doorbell */
   192		ret = mbox_send_message(cl_info->mbox_chan, &cmd);
   193		if (ret < 0) {
   194			dev_err(hdev->dev, "Send PCC mbox message failed, ret = %d.\n",
   195				ret);
   196			goto end;
   197		}
   198	
   199		/* Wait for completion */
   200		ret = hccs_check_chan_cmd_complete(hdev);
   201		if (ret)
   202			goto end;
   203	
   204		/* Copy response data */
 > 205		memcpy_fromio((void *)desc, comm_space, comm_space_size);
   206		fw_inner_head = &desc->rsp.fw_inner_head;
   207		if (fw_inner_head->retStatus) {
   208			dev_err(hdev->dev, "Execute PCC command failed, error code = %u.\n",
   209				fw_inner_head->retStatus);
   210			ret = -EIO;
   211		}
   212	
   213	end:
   214		mbox_client_txdone(cl_info->mbox_chan, ret);
   215		return ret;
   216	}
   217	

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




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux