Message ID | 20250311182631.3224812-2-saikrishnag@marvell.com (mailing list archive) |
---|---|
State | Changes Requested |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | octeontx2-af: fix build warnings flagged | expand |
> if (mbox->mbox.hwbase) > - iounmap(mbox->mbox.hwbase); > + iounmap((void __iomem *)mbox->mbox.hwbase); This looks wrong. If you are unmapping it, you must of mapped it somewhere. And that mapping would of returned an __iomem value. So mbox.hwbase should be an __iomem value and you would not need this cast. > for (qidx = 0; qidx < pf->qset.cq_cnt; qidx++) { > - ptr = otx2_get_regaddr(pf, NIX_LF_CQ_OP_INT); > + ptr = (__force u64 *)otx2_get_regaddr(pf, NIX_LF_CQ_OP_INT); > val = otx2_atomic64_add((qidx << 44), ptr); This also looks questionable. You should be removing casts, not adding them. otx2_get_regaddr() returns an __iomem. So maybe otx2_atomic64_add() is actually broken here? Andrew --- pw-bot: cr
diff --git a/drivers/net/ethernet/marvell/octeontx2/af/common.h b/drivers/net/ethernet/marvell/octeontx2/af/common.h index 406c59100a35..8a08bebf08c2 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/common.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/common.h @@ -39,7 +39,7 @@ struct qmem { void *base; dma_addr_t iova; int alloc_sz; - u16 entry_sz; + u32 entry_sz; u8 align; u32 qsize; }; diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index e1dde93e8af8..6c23d64e81f8 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -595,8 +595,7 @@ static int otx2_pfvf_mbox_init(struct otx2_nic *pf, int numvfs) base = pci_resource_start(pf->pdev, PCI_MBOX_BAR_NUM) + MBOX_SIZE; else - base = readq((void __iomem *)((u64)pf->reg_base + - RVU_PF_VF_BAR4_ADDR)); + base = readq(pf->reg_base + RVU_PF_VF_BAR4_ADDR); hwbase = ioremap_wc(base, MBOX_SIZE * pf->total_vfs); if (!hwbase) { @@ -645,7 +644,7 @@ static void otx2_pfvf_mbox_destroy(struct otx2_nic *pf) } if (mbox->mbox.hwbase) - iounmap(mbox->mbox.hwbase); + iounmap((void __iomem *)mbox->mbox.hwbase); otx2_mbox_destroy(&mbox->mbox); } @@ -1309,7 +1308,7 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data) /* CQ */ for (qidx = 0; qidx < pf->qset.cq_cnt; qidx++) { - ptr = otx2_get_regaddr(pf, NIX_LF_CQ_OP_INT); + ptr = (__force u64 *)otx2_get_regaddr(pf, NIX_LF_CQ_OP_INT); val = otx2_atomic64_add((qidx << 44), ptr); otx2_write64(pf, NIX_LF_CQ_OP_INT, (qidx << 44) | @@ -1348,7 +1347,7 @@ static irqreturn_t otx2_q_intr_handler(int irq, void *data) * these are fatal errors. */ - ptr = otx2_get_regaddr(pf, NIX_LF_SQ_OP_INT); + ptr = (__force u64 *)otx2_get_regaddr(pf, NIX_LF_SQ_OP_INT); val = otx2_atomic64_add((qidx << 44), ptr); otx2_write64(pf, NIX_LF_SQ_OP_INT, (qidx << 44) | (val & NIX_SQINT_BITS));
Sparse flagged a number of inconsistent usage of __iomem annotations. This patch fixes some of the issues reported by kernel test robot. These warning messages are address this by proper __iomem annotations. Warning messages flagged by Sparse: drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:611:24: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected void [noderef] __iomem *hwbase @@ got void * @@ drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:611:24: sparse: expected void [noderef] __iomem *hwbase drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:611:24: sparse: got void * drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:620:56: sparse: sparse: cast removes address space '__iomem' of expression drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:671:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] __iomem *addr @@ got void *hwbase @@ drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:671:35: sparse: expected void volatile [noderef] __iomem *addr drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:671:35: sparse: got void *hwbase drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:1344:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned long long [usertype] *ptr @@ got void [noderef] __iomem * @@ drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:1344:21: sparse: expected unsigned long long [usertype] *ptr drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:1344:21: sparse: got void [noderef] __iomem * drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:1383:21: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected unsigned long long [usertype] *ptr @@ got void [noderef] __iomem * @@ drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:1383:21: sparse: expected unsigned long long [usertype] *ptr drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c:1383:21: sparse: got void [noderef] __iomem * drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c: note: in included file (through drivers/net/ethernet/marvell/octeontx2/af/mbox.h, drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h): Flagged by Sparse on x86_64: drivers/net/ethernet/marvell/octeontx2/af/common.h:61:26: sparse: sparse: cast truncates bits from constant value (10000 becomes 0) To address this increased the size of entry_sz in qmem_alloc(), otherwise the value will be truncated to 0. Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202410221614.07o9QVjo-lkp@intel.com/ Signed-off-by: Sai Krishna <saikrishnag@marvell.com> --- drivers/net/ethernet/marvell/octeontx2/af/common.h | 2 +- drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-)