drivers/net/ethernet/marvell/octeontx2/af/rvu.c:1964:46: sparse: sparse: cast removes address space '__iomem' of expression

From: kernel test robot
Date: Mon Feb 21 2022 - 18:31:53 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 038101e6b2cd5c55f888f85db42ea2ad3aecb4b6
commit: 98c5611163603d3d8012b1bf64ab48fd932cf734 octeontx2-af: cn10k: Add mbox support for CN10K platform
date: 1 year ago
config: arm64-allmodconfig (https://download.01.org/0day-ci/archive/20220222/202202220710.SPJ8ha4K-lkp@xxxxxxxxx/config)
compiler: aarch64-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=98c5611163603d3d8012b1bf64ab48fd932cf734
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 98c5611163603d3d8012b1bf64ab48fd932cf734
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=arm64 SHELL=/bin/bash drivers/gpu/drm/tegra/ drivers/gpu/host1x/ drivers/hid/ drivers/irqchip/ drivers/net/ethernet/marvell/octeontx2/af/ drivers/net/ethernet/ti/ drivers/remoteproc/ drivers/scsi/hisi_sas/ security/integrity/ima/

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/net/ethernet/marvell/octeontx2/af/rvu.c:780:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct rvu_fwdata *fwdata @@ got void [noderef] __iomem * @@
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:780:21: sparse: expected struct rvu_fwdata *fwdata
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:780:21: sparse: got void [noderef] __iomem *
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:786:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got struct rvu_fwdata *fwdata @@
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:786:28: sparse: expected void volatile [noderef] __iomem *addr
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:786:28: sparse: got struct rvu_fwdata *fwdata
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:799:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got struct rvu_fwdata *fwdata @@
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:799:28: sparse: expected void volatile [noderef] __iomem *addr
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:799:28: sparse: got struct rvu_fwdata *fwdata
>> drivers/net/ethernet/marvell/octeontx2/af/rvu.c:1964:46: sparse: sparse: cast removes address space '__iomem' of expression
drivers/net/ethernet/marvell/octeontx2/af/rvu.c:1984:38: sparse: sparse: cast removes address space '__iomem' of expression

vim +/__iomem +1964 drivers/net/ethernet/marvell/octeontx2/af/rvu.c

1941
1942 static int rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr,
1943 int num, int type)
1944 {
1945 struct rvu_hwinfo *hw = rvu->hw;
1946 int region;
1947 u64 bar4;
1948
1949 /* For cn10k platform VF mailbox regions of a PF follows after the
1950 * PF <-> AF mailbox region. Whereas for Octeontx2 it is read from
1951 * RVU_PF_VF_BAR4_ADDR register.
1952 */
1953 if (type == TYPE_AFVF) {
1954 for (region = 0; region < num; region++) {
1955 if (hw->cap.per_pf_mbox_regs) {
1956 bar4 = rvu_read64(rvu, BLKADDR_RVUM,
1957 RVU_AF_PFX_BAR4_ADDR(0)) +
1958 MBOX_SIZE;
1959 bar4 += region * MBOX_SIZE;
1960 } else {
1961 bar4 = rvupf_read64(rvu, RVU_PF_VF_BAR4_ADDR);
1962 bar4 += region * MBOX_SIZE;
1963 }
> 1964 mbox_addr[region] = (void *)ioremap_wc(bar4, MBOX_SIZE);
1965 if (!mbox_addr[region])
1966 goto error;
1967 }
1968 return 0;
1969 }
1970
1971 /* For cn10k platform AF <-> PF mailbox region of a PF is read from per
1972 * PF registers. Whereas for Octeontx2 it is read from
1973 * RVU_AF_PF_BAR4_ADDR register.
1974 */
1975 for (region = 0; region < num; region++) {
1976 if (hw->cap.per_pf_mbox_regs) {
1977 bar4 = rvu_read64(rvu, BLKADDR_RVUM,
1978 RVU_AF_PFX_BAR4_ADDR(region));
1979 } else {
1980 bar4 = rvu_read64(rvu, BLKADDR_RVUM,
1981 RVU_AF_PF_BAR4_ADDR);
1982 bar4 += region * MBOX_SIZE;
1983 }
1984 mbox_addr[region] = (void *)ioremap_wc(bar4, MBOX_SIZE);
1985 if (!mbox_addr[region])
1986 goto error;
1987 }
1988 return 0;
1989
1990 error:
1991 while (region--)
1992 iounmap((void __iomem *)mbox_addr[region]);
1993 return -ENOMEM;
1994 }
1995

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx