From: Bjorn Helgaas <helgaas@kernel.org>
To: "manivannan.sadhasivam@linaro.org" <manivannan.sadhasivam@linaro.org>
Cc: "Jianjun Wang (王建军)" <Jianjun.Wang@mediatek.com>,
"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: Sat, 1 Feb 2025 11:07:40 -0600 [thread overview]
Message-ID: <20250201170740.GA731664@bhelgaas> (raw)
In-Reply-To: <20250201162416.azp4slqqeabo2xyl@thinkpad>
On Sat, Feb 01, 2025 at 09:54:16PM +0530, manivannan.sadhasivam@linaro.org wrote:
> On Mon, Jan 27, 2025 at 06:41:50PM -0600, Bjorn Helgaas wrote:
> > On Thu, Jan 23, 2025 at 08:11:19AM +0000, Jianjun Wang (王建军) wrote:
> > > On Wed, 2025-01-15 at 23:01 +0530, Manivannan Sadhasivam wrote:
> > > > 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.
> > > > > 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;
> >
> > I think this still assumes that a CPU physical address
> > (regs->start) is the same as the PCI bus address used for MSI, so
> > this doesn't seem like the right solution to me.
> >
> > Apparently they happen to be the same on this platform because (I
> > assume) MSIs actually do work, but it's not a good pattern for
> > drivers to copy. I think what we really need is a dma_addr_t, and
> > I think there are one or two PCI controller drivers that do that.
>
> I don't see why we would need 'dma_addr_t' here. The MSI address is
> a static physical address on this platform and that is not a DMA
> address. Other drivers can *only* copy this pattern if they also
> have the physical address allocated for MSI.
Isn't an MSI on PCI just a DMA write to a certain address? My
assumption is that if you put an analyzer on that link, an MSI from a
device would be structurally indistinguishable from a DMA write from
the device. The MSI uses a different address, but doesn't it use the
same size and kind of address, at least from the PCIe protocol
perspective?
Bjorn
next prev parent reply other threads:[~2025-02-01 17:09 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 (王建军)
2025-01-28 0:41 ` Bjorn Helgaas
2025-02-01 16:24 ` manivannan.sadhasivam
2025-02-01 17:07 ` Bjorn Helgaas [this message]
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=20250201170740.GA731664@bhelgaas \
--to=helgaas@kernel.org \
--cc=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