drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1884:21: sparse: sparse: incorrect type in argument 1 (different address spaces)
From: kernel test robot
Date: Thu Jun 18 2020 - 15:15:56 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 1b5044021070efa3259f3e9548dc35d1eb6aa844
commit: 57430471e2fa60a412e220fa3014567e792aaa6f drm/amdgpu: Add support for USBC PD FW download
date: 4 months ago
config: riscv-randconfig-s032-20200618 (attached as .config)
compiler: riscv64-linux-gcc (GCC) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-rc1-10-gc17b1b06-dirty
git checkout 57430471e2fa60a412e220fa3014567e792aaa6f
# save the attached .config to linux build tree
make W=1 C=1 ARCH=riscv CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:160:9: sparse: sparse: incompatible types in conditional expression (different base types):
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:160:9: sparse: void
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:160:9: sparse: int
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:525:5: sparse: sparse: symbol 'psp_ta_invoke' was not declared. Should it be static?
>> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1884:21: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] <asn:2> *addr @@ got void *[assigned] cpu_addr @@
>> drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1884:21: sparse: expected void volatile [noderef] <asn:2> *addr
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1884:21: sparse: got void *[assigned] cpu_addr
drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c:1887:9: sparse: sparse: undefined identifier 'clflush_cache_range'
vim +1884 drivers/gpu/drm/amd/amdgpu/amdgpu_psp.c
1857
1858 static ssize_t psp_usbc_pd_fw_sysfs_write(struct device *dev,
1859 struct device_attribute *attr,
1860 const char *buf,
1861 size_t count)
1862 {
1863 struct drm_device *ddev = dev_get_drvdata(dev);
1864 struct amdgpu_device *adev = ddev->dev_private;
1865 void *cpu_addr;
1866 dma_addr_t dma_addr;
1867 int ret;
1868 char fw_name[100];
1869 const struct firmware *usbc_pd_fw;
1870
1871
1872 snprintf(fw_name, sizeof(fw_name), "amdgpu/%s", buf);
1873 ret = request_firmware(&usbc_pd_fw, fw_name, adev->dev);
1874 if (ret)
1875 goto fail;
1876
1877 /* We need contiguous physical mem to place the FW for psp to access */
1878 cpu_addr = dma_alloc_coherent(adev->dev, usbc_pd_fw->size, &dma_addr, GFP_KERNEL);
1879
1880 ret = dma_mapping_error(adev->dev, dma_addr);
1881 if (ret)
1882 goto rel_buf;
1883
> 1884 memcpy_toio(cpu_addr, usbc_pd_fw->data, usbc_pd_fw->size);
1885
1886 /*TODO Remove once PSP starts snooping CPU cache */
1887 clflush_cache_range(cpu_addr, (usbc_pd_fw->size & ~(L1_CACHE_BYTES - 1)));
1888
1889 mutex_lock(&adev->psp.mutex);
1890 ret = psp_load_usbc_pd_fw(&adev->psp, dma_addr);
1891 mutex_unlock(&adev->psp.mutex);
1892
1893 rel_buf:
1894 dma_free_coherent(adev->dev, usbc_pd_fw->size, cpu_addr, dma_addr);
1895 release_firmware(usbc_pd_fw);
1896
1897 fail:
1898 if (ret) {
1899 DRM_ERROR("Failed to load USBC PD FW, err = %d", ret);
1900 return ret;
1901 }
1902
1903 return count;
1904 }
1905
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip