From: Geert Uytterhoeven <geert@linux-m68k.org>
To: Sean Anderson <sean.anderson@seco.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, Camelia Groza <camelia.groza@nxp.com>,
Madalin Bucur <madalin.bucur@nxp.com>,
open list <linux-kernel@vger.kernel.org>,
linux-arm-kernel@lists.infradead.org,
linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH net-next v5 05/14] net: fman: Map the base address once
Date: Mon, 17 Oct 2022 17:49:01 +0200 [thread overview]
Message-ID: <CAMuHMdW-E4ykVdCugCyJt7_uKZZHyc=jStiL7DOiq2RZr6GTvQ@mail.gmail.com> (raw)
In-Reply-To: <086a6f02-4495-510e-9fc5-64f95e7d55f6@seco.com>
Hi Sean,
On Mon, Oct 17, 2022 at 5:34 PM Sean Anderson <sean.anderson@seco.com> wrote:
> On 10/17/22 11:15 AM, Geert Uytterhoeven wrote:
> > On Sat, Sep 3, 2022 at 12:00 AM Sean Anderson <sean.anderson@seco.com> wrote:
> >> We don't need to remap the base address from the resource twice (once in
> >> mac_probe() and again in set_fman_mac_params()). We still need the
> >> resource to get the end address, but we can use a single function call
> >> to get both at once.
> >>
> >> While we're at it, use platform_get_mem_or_io and devm_request_resource
> >> to map the resource. I think this is the more "correct" way to do things
> >> here, since we use the pdev resource, instead of creating a new one.
> >> It's still a bit tricky, since we need to ensure that the resource is a
> >> child of the fman region when it gets requested.
> >>
> >> Signed-off-by: Sean Anderson <sean.anderson@seco.com>
> >> Acked-by: Camelia Groza <camelia.groza@nxp.com>
> >
> > Thanks for your patch, which is now commit 262f2b782e255b79
> > ("net: fman: Map the base address once") in v6.1-rc1.
> >
> >> --- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c
> >> +++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sysfs.c
> >> @@ -18,7 +18,7 @@ static ssize_t dpaa_eth_show_addr(struct device *dev,
> >>
> >> if (mac_dev)
> >> return sprintf(buf, "%llx",
> >> - (unsigned long long)mac_dev->res->start);
> >> + (unsigned long long)mac_dev->vaddr);
> >
> > On 32-bit:
> >
> > warning: cast from pointer to integer of different size
> > [-Wpointer-to-int-cast]
> >
> > Obviously you should cast to "uintptr_t" or "unsigned long" instead,
> > and change the "%llx" to "%p" or "%lx"...
>
> Isn't there a %px for this purpose?
Yes there is. But if it makes sense to use that depends on the
still to be answered questions at the bottom...
> > However, taking a closer look:
> > 1. The old code exposed a physical address to user space, the new
> > code exposes the mapped virtual address.
> > Is that change intentional?
>
> No, this is not intentional. So to make this backwards-compatible, I
> suppose I need a virt_to_phys?
I think virt_to_phys() will work only on real memory, not on MMIO,
so you may need to reintroduce the resource again.
> > 2. Virtual addresses are useless in user space.
> > Moreover, addresses printed by "%p" are obfuscated, as this is
> > considered a security issue. Likewise for working around this by
> > casting to an integer.
>
> Yes, you're right that this probably shouldn't be exposed to userspace.
>
> > What's the real purpose of dpaa_eth_show_addr()?
>
> I have no idea. This is a question for Madalin.
>
> > Perhaps it should be removed?
>
> That would be reasonable IMO.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-10-17 15:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-02 21:57 [PATCH net-next v5 00/14] net: dpaa: Cleanups in preparation for phylink conversion (part 2) Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 01/14] net: fman: Move initialization to mac-specific files Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 02/14] net: fman: Mark mac methods static Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 03/14] net: fman: Inline several functions into initialization Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 04/14] net: fman: Remove internal_phy_node from params Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 05/14] net: fman: Map the base address once Sean Anderson
2022-10-17 15:15 ` Geert Uytterhoeven
2022-10-17 15:34 ` Sean Anderson
2022-10-17 15:49 ` Geert Uytterhoeven [this message]
2022-09-02 21:57 ` [PATCH net-next v5 06/14] net: fman: Pass params directly to mac init Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 07/14] net: fman: Use mac_dev for some params Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 08/14] net: fman: Specify type of mac_dev for exception_cb Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 09/14] net: fman: Clean up error handling Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 10/14] net: fman: Change return type of disable to void Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 11/14] net: dpaa: Use mac_dev variable in dpaa_netdev_init Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 12/14] soc: fsl: qbman: Add helper for sanity checking cgr ops Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 13/14] soc: fsl: qbman: Add CGR update function Sean Anderson
2022-09-02 21:57 ` [PATCH net-next v5 14/14] net: dpaa: Adjust queue depth on rate change Sean Anderson
2022-09-05 13:40 ` [PATCH net-next v5 00/14] net: dpaa: Cleanups in preparation for phylink conversion (part 2) patchwork-bot+netdevbpf
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='CAMuHMdW-E4ykVdCugCyJt7_uKZZHyc=jStiL7DOiq2RZr6GTvQ@mail.gmail.com' \
--to=geert@linux-m68k.org \
--cc=camelia.groza@nxp.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=madalin.bucur@nxp.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sean.anderson@seco.com \
/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).