From: "Jianjun Wang (王建军)" <Jianjun.Wang@mediatek.com>
To: "manivannan.sadhasivam@linaro.org" <manivannan.sadhasivam@linaro.org>
Cc: "linux-mediatek@lists.infradead.org"
<linux-mediatek@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"robh@kernel.org" <robh@kernel.org>,
"kw@linux.com" <kw@linux.com>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"matthias.bgg@gmail.com" <matthias.bgg@gmail.com>,
"bhelgaas@google.com" <bhelgaas@google.com>,
"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@collabora.com>,
Ryder Lee <Ryder.Lee@mediatek.com>
Subject: Re: [PATCH] PCI: mediatek: Remove the usage of virt_to_phys
Date: Thu, 23 Jan 2025 08:11:19 +0000 [thread overview]
Message-ID: <9e629b1779c2cb9c6fa34347ac16f9b4e2241430.camel@mediatek.com> (raw)
In-Reply-To: <20250115173156.a73ntoyyn3xy52ze@thinkpad>
On Wed, 2025-01-15 at 23:01 +0530, Manivannan Sadhasivam wrote:
> External email : Please do not click links or open attachments until
> you have verified the sender or the content.
>
>
> On Tue, Jan 07, 2025 at 01:20:58PM +0800, Jianjun Wang wrote:
> > Remove the usage of virt_to_phys, as it will cause sparse warnings
> > when
> > building on some platforms.
> >
>
> Strange. What are those warnings and platforms?
There are some warning messages when building tests with different
configs on different platforms (e.g., allmodconfig.arm,
allmodconfig.i386, allmodconfig.mips, etc.):
pcie-mediatek.c:399:40: sparse: warning: incorrect type in argument 1
(different address spaces)
pcie-mediatek.c:399:40: sparse: expected void const volatile *x
pcie-mediatek.c:399:40: sparse: got void [noderef] __iomem *
pcie-mediatek.c:515:44: sparse: warning: incorrect type in argument 1
(different address spaces)
pcie-mediatek.c:515:44: sparse: expected void const volatile *x
pcie-mediatek.c:515:44: sparse: got void [noderef] __iomem *
Thanks.
>
> - Mani
>
> > Signed-off-by: Jianjun Wang <jianjun.wang@mediatek.com>
> > ---
> > drivers/pci/controller/pcie-mediatek.c | 19 ++++++++++++-------
> > 1 file changed, 12 insertions(+), 7 deletions(-)
> >
> > diff --git a/drivers/pci/controller/pcie-mediatek.c
> > b/drivers/pci/controller/pcie-mediatek.c
> > index 3bcfc4e58ba2..dc1e5fd6c7aa 100644
> > --- a/drivers/pci/controller/pcie-mediatek.c
> > +++ b/drivers/pci/controller/pcie-mediatek.c
> > @@ -178,6 +178,7 @@ struct mtk_pcie_soc {
> > * @phy: pointer to PHY control block
> > * @slot: port slot
> > * @irq: GIC irq
> > + * @msg_addr: MSI message address
> > * @irq_domain: legacy INTx IRQ domain
> > * @inner_domain: inner IRQ domain
> > * @msi_domain: MSI IRQ domain
> > @@ -198,6 +199,7 @@ struct mtk_pcie_port {
> > struct phy *phy;
> > u32 slot;
> > int irq;
> > + phys_addr_t msg_addr;
> > struct irq_domain *irq_domain;
> > struct irq_domain *inner_domain;
> > struct irq_domain *msi_domain;
> > @@ -393,12 +395,10 @@ static struct pci_ops mtk_pcie_ops_v2 = {
> > static void mtk_compose_msi_msg(struct irq_data *data, struct
> > msi_msg *msg)
> > {
> > struct mtk_pcie_port *port =
> > irq_data_get_irq_chip_data(data);
> > - phys_addr_t addr;
> >
> > /* MT2712/MT7622 only support 32-bit MSI addresses */
> > - addr = virt_to_phys(port->base + PCIE_MSI_VECTOR);
> > msg->address_hi = 0;
> > - msg->address_lo = lower_32_bits(addr);
> > + msg->address_lo = lower_32_bits(port->msg_addr);
> >
> > msg->data = data->hwirq;
> >
> > @@ -510,10 +510,8 @@ static int
> > mtk_pcie_allocate_msi_domains(struct mtk_pcie_port *port)
> > static void mtk_pcie_enable_msi(struct mtk_pcie_port *port)
> > {
> > u32 val;
> > - phys_addr_t msg_addr;
> >
> > - msg_addr = virt_to_phys(port->base + PCIE_MSI_VECTOR);
> > - val = lower_32_bits(msg_addr);
> > + val = lower_32_bits(port->msg_addr);
> > writel(val, port->base + PCIE_IMSI_ADDR);
> >
> > val = readl(port->base + PCIE_INT_MASK);
> > @@ -913,6 +911,7 @@ static int mtk_pcie_parse_port(struct mtk_pcie
> > *pcie,
> > struct mtk_pcie_port *port;
> > struct device *dev = pcie->dev;
> > struct platform_device *pdev = to_platform_device(dev);
> > + struct resource *regs;
> > char name[10];
> > int err;
> >
> > @@ -921,12 +920,18 @@ static int mtk_pcie_parse_port(struct
> > mtk_pcie *pcie,
> > return -ENOMEM;
> >
> > snprintf(name, sizeof(name), "port%d", slot);
> > - port->base = devm_platform_ioremap_resource_byname(pdev,
> > name);
> > + regs = platform_get_resource_byname(pdev, IORESOURCE_MEM,
> > name);
> > + if (!regs)
> > + return -EINVAL;
> > +
> > + port->base = devm_ioremap_resource(dev, regs);
> > if (IS_ERR(port->base)) {
> > dev_err(dev, "failed to map port%d base\n", slot);
> > return PTR_ERR(port->base);
> > }
> >
> > + port->msg_addr = regs->start + PCIE_MSI_VECTOR;
> > +
> > snprintf(name, sizeof(name), "sys_ck%d", slot);
> > port->sys_ck = devm_clk_get(dev, name);
> > if (IS_ERR(port->sys_ck)) {
> > --
> > 2.46.0
> >
>
> --
> மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2025-01-23 8:11 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-07 5:20 [PATCH] PCI: mediatek: Remove the usage of virt_to_phys Jianjun Wang
2025-01-15 17:31 ` Manivannan Sadhasivam
2025-01-23 8:11 ` Jianjun Wang (王建军) [this message]
2025-01-28 0:41 ` Bjorn Helgaas
2025-02-01 16:24 ` manivannan.sadhasivam
2025-02-01 17:07 ` Bjorn Helgaas
2025-02-03 17:50 ` manivannan.sadhasivam
2025-02-03 18:52 ` Bjorn Helgaas
2025-02-06 17:13 ` manivannan.sadhasivam
2025-02-01 16:24 ` manivannan.sadhasivam
2025-04-19 8:36 ` Manivannan Sadhasivam
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=9e629b1779c2cb9c6fa34347ac16f9b4e2241430.camel@mediatek.com \
--to=jianjun.wang@mediatek.com \
--cc=Ryder.Lee@mediatek.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=bhelgaas@google.com \
--cc=kw@linux.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=matthias.bgg@gmail.com \
--cc=robh@kernel.org \
/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