From: Frank Li <Frank.Li@nxp.com>
To: imx@lists.linux.dev, "Jon Mason" <jdmason@kudzu.us>,
"Dave Jiang" <dave.jiang@intel.com>,
"Allen Hubbe" <allenbh@gmail.com>,
"Kishon Vijay Abraham I" <kishon@ti.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
ntb@lists.linux.dev (open list:NTB DRIVER CORE),
linux-pci@vger.kernel.org (open list:PCI ENDPOINT SUBSYSTEM),
linux-kernel@vger.kernel.org (open list)
Subject: [PATCH v13 6/6] PCI: endpoint: pci-epf-vntb: fix sparse build warning
Date: Fri, 7 Oct 2022 15:13:26 -0400 [thread overview]
Message-ID: <20221007191326.193079-8-Frank.Li@nxp.com> (raw)
In-Reply-To: <20221007191326.193079-1-Frank.Li@nxp.com>
From: Frank Li <frank.li@nxp.com>
Using epf_db[i] instead of readl() because epf_db is located in local
memory and allocated by dma_alloc_coherent().
Sparse build warning when there are not __iomem at readl().
Added __iomem force type convert in vntb_epf_peer_spad_read\write()
and vntb_epf_spad_read\write(). This require strong order at read and
write.
Signed-off-by: Frank Li <frank.li@nxp.com>
---
drivers/pci/endpoint/functions/pci-epf-vntb.c | 27 +++++++++----------
1 file changed, 13 insertions(+), 14 deletions(-)
diff --git a/drivers/pci/endpoint/functions/pci-epf-vntb.c b/drivers/pci/endpoint/functions/pci-epf-vntb.c
index 54616281da9e..9f1ec6788e51 100644
--- a/drivers/pci/endpoint/functions/pci-epf-vntb.c
+++ b/drivers/pci/endpoint/functions/pci-epf-vntb.c
@@ -136,7 +136,7 @@ struct epf_ntb {
struct epf_ntb_ctrl *reg;
- void __iomem *epf_db;
+ u32 *epf_db;
phys_addr_t vpci_mw_phy[MAX_MW];
void __iomem *vpci_mw_addr[MAX_MW];
@@ -257,12 +257,9 @@ static void epf_ntb_cmd_handler(struct work_struct *work)
ntb = container_of(work, struct epf_ntb, cmd_handler.work);
for (i = 1; i < ntb->db_count; i++) {
- if (readl(ntb->epf_db + i * sizeof(u32))) {
- if (readl(ntb->epf_db + i * sizeof(u32)))
- ntb->db |= 1 << (i - 1);
-
+ if (ntb->epf_db[i]) {
ntb_db_event(&ntb->ntb, i);
- writel(0, ntb->epf_db + i * sizeof(u32));
+ ntb->epf_db[i] = 0;
}
}
@@ -529,13 +526,15 @@ static int epf_ntb_configure_interrupt(struct epf_ntb *ntb)
static int epf_ntb_db_bar_init(struct epf_ntb *ntb)
{
const struct pci_epc_features *epc_features;
- u32 align;
struct device *dev = &ntb->epf->dev;
- int ret;
struct pci_epf_bar *epf_bar;
- void __iomem *mw_addr;
enum pci_barno barno;
- size_t size = sizeof(u32) * ntb->db_count;
+ void *mw_addr;
+ size_t size;
+ u32 align;
+ int ret;
+
+ size = sizeof(u32) * ntb->db_count;
epc_features = pci_epc_get_features(ntb->epf->epc,
ntb->epf->func_no,
@@ -1123,7 +1122,7 @@ static u32 vntb_epf_spad_read(struct ntb_dev *ndev, int idx)
struct epf_ntb *ntb = ntb_ndev(ndev);
int off = ntb->reg->spad_offset, ct = ntb->reg->spad_count * sizeof(u32);
u32 val;
- void __iomem *base = ntb->reg;
+ void __iomem *base = (void __iomem *)ntb->reg;
val = readl(base + off + ct + idx * sizeof(u32));
return val;
@@ -1134,7 +1133,7 @@ static int vntb_epf_spad_write(struct ntb_dev *ndev, int idx, u32 val)
struct epf_ntb *ntb = ntb_ndev(ndev);
struct epf_ntb_ctrl *ctrl = ntb->reg;
int off = ctrl->spad_offset, ct = ctrl->spad_count * sizeof(u32);
- void __iomem *base = ntb->reg;
+ void __iomem *base = (void __iomem *)ntb->reg;
writel(val, base + off + ct + idx * sizeof(u32));
return 0;
@@ -1145,7 +1144,7 @@ static u32 vntb_epf_peer_spad_read(struct ntb_dev *ndev, int pidx, int idx)
struct epf_ntb *ntb = ntb_ndev(ndev);
struct epf_ntb_ctrl *ctrl = ntb->reg;
int off = ctrl->spad_offset;
- void __iomem *base = ntb->reg;
+ void __iomem *base = (void __iomem *)ntb->reg;
u32 val;
val = readl(base + off + idx * sizeof(u32));
@@ -1157,7 +1156,7 @@ static int vntb_epf_peer_spad_write(struct ntb_dev *ndev, int pidx, int idx, u32
struct epf_ntb *ntb = ntb_ndev(ndev);
struct epf_ntb_ctrl *ctrl = ntb->reg;
int off = ctrl->spad_offset;
- void __iomem *base = ntb->reg;
+ void __iomem *base = (void __iomem *)ntb->reg;
writel(val, base + off + idx * sizeof(u32));
return 0;
--
2.34.1
next prev parent reply other threads:[~2022-10-07 19:14 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-07 19:13 [PATCH v12 5/6] PCI: endpoint: pci-epf-vntb: Clean up Frank Li
2022-10-07 19:13 ` [PATCH v13 1/6] PCI: endpoint: pci-epf-vntb: Clean up kernel_doc warning Frank Li
2022-10-17 20:06 ` Frank Li
2022-10-19 16:25 ` Bjorn Helgaas
2022-10-19 16:28 ` [EXT] " Frank Li
2022-10-07 19:13 ` [PATCH v13 2/6] PCI: endpoint: pci-epf-vntb: Fix indentation of the struct epf_ntb_ctrl Frank Li
2022-10-07 19:13 ` [PATCH v13 3/6] PCI: endpoint: pci-epf-vntb: fix call pci_epc_mem_free_addr at err path Frank Li
2022-10-07 19:13 ` [PATCH v13 4/6] PCI: endpoint: pci-epf-vntb: remove unused field epf_db_phy Frank Li
2022-10-07 19:13 ` [PATCH v13 5/6] PCI: endpoint: pci-epf-vntb: replace hardcode 4 with sizeof(u32) Frank Li
2022-10-07 19:13 ` Frank Li [this message]
2022-10-27 10:42 ` [PATCH v13 6/6] PCI: endpoint: pci-epf-vntb: fix sparse build warning Lorenzo Pieralisi
2022-10-27 14:27 ` [EXT] " Frank Li
2022-10-07 19:17 ` [EXT] [PATCH v12 5/6] PCI: endpoint: pci-epf-vntb: Clean up Frank Li
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=20221007191326.193079-8-Frank.Li@nxp.com \
--to=frank.li@nxp.com \
--cc=allenbh@gmail.com \
--cc=bhelgaas@google.com \
--cc=dave.jiang@intel.com \
--cc=imx@lists.linux.dev \
--cc=jdmason@kudzu.us \
--cc=kishon@ti.com \
--cc=kw@linux.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=ntb@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).