From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH] PPC: Correct the tophys/tovirt macros
Date: Thu, 4 Oct 2012 11:08:41 -0600 [thread overview]
Message-ID: <20121004170841.GA2994@obsidianresearch.com> (raw)
In-Reply-To: <1349349544.4260.24.camel@pasglop>
On Thu, Oct 04, 2012 at 09:19:04PM +1000, Benjamin Herrenschmidt wrote:
> On Sun, 2012-09-30 at 17:28 -0600, Jason Gunthorpe wrote:
> > asm/page.h discusses the calculation for v2p and p2v, it should be:
> > va = pa + KERNELBASE - PHYSICAL_START
> > which is the same as:
> > va = pa + LOAD_OFFSET
> >
> > tophys/tovirt were using PAGE_OFFSET, which as page.h says, is almost
> > always the same thing.
> >
> > Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
>
> It's a bit gross tho in that KERNEL_BASE, PHYSICAL_START and LOAD_OFFSET
> are about where the kernel is linked/running, and while the value ends
> up happening to also be the p->v offset (and indeed not by accident), it
> makes the code less clear and more confusing.
Yes, I found the three names confusing.. However LOAD_OFFSET is the
name that include/asm-generic/vmlinux.lds.h and many arch's use for
P2V translation in the linker script, so at least there is some
precedent.
> I don't have the bandwidth to revisit all that, but I really think that
> whole are area where PAGE_OFFSET doesn't map 0 needs revisiting.
Something like that is also outside my scope.. This patch does fix a
bug I hit when CONFIG_PHYSICAL_START is used, are there problems with
it in other cases?
FWIW, this is part of a larger work that makes CONFIG_PHYSICAL_START
work on PPC404, which is not yet clean enough to post:
https://github.com/jgunthorpe/linux/commit/90df2d247c9db5d39c32dbbada0815f15d7b3be7
Regards,
Jason
prev parent reply other threads:[~2012-10-04 17:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-30 23:28 [PATCH] PPC: Correct the tophys/tovirt macros Jason Gunthorpe
2012-10-04 11:19 ` Benjamin Herrenschmidt
2012-10-04 17:08 ` Jason Gunthorpe [this message]
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=20121004170841.GA2994@obsidianresearch.com \
--to=jgunthorpe@obsidianresearch.com \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@lists.ozlabs.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;
as well as URLs for NNTP newsgroup(s).