From: "Grant Likely" <grant.likely@secretlab.ca>
To: benh@kernel.crashing.org
Cc: linuxppc-dev@ozlabs.org, paulus@samba.org, miltonm@bga.com
Subject: Re: [RFC/PATCH 1/3] powerpc: add ioremap_bat() function for setting up BAT translated IO regions.
Date: Wed, 6 Aug 2008 17:11:08 -0600 [thread overview]
Message-ID: <fa686aa40808061611p616208bp2baf9a0d5e095870@mail.gmail.com> (raw)
In-Reply-To: <1218061585.24157.246.camel@pasglop>
On Wed, Aug 6, 2008 at 4:26 PM, Benjamin Herrenschmidt
<benh@kernel.crashing.org> wrote:
> On Wed, 2008-08-06 at 00:02 -0600, Grant Likely wrote:
>> From: Grant Likely <grant.likely@secretlab.ca>
>>
>> ioremap_bat() is useful for things like mapping SoC internally memory mapped
>> register and early text because it allows mappings to devices to be setup
>> early in the boot process where they are needed, and the mappings persist
>> after the MMU is configured.
>>
>> Without ioremap_bat(), setting up the MMU would cause the early text
>> mappings to get lost and mostly likely result in a kernel panic on the next
>> attempt at output.
>>
>> Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
>> ---
>
> First comment, make the name more generic. This facility could be
> implemented on processors without BATs using different techniques.
>
> Maybe ioremap_block() or ioremap_early() or something like that.
okay
>> diff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c
>> index 066e65c..7b25b57 100644
>> --- a/arch/powerpc/kernel/setup_32.c
>> +++ b/arch/powerpc/kernel/setup_32.c
>> @@ -113,6 +113,15 @@ notrace unsigned long __init early_init(unsigned long dt_ptr)
>> */
>> notrace void __init machine_init(unsigned long dt_ptr, unsigned long phys)
>> {
>> + /* Do the bare minimum to start allocting from the IO region so
>> + * that ioremap_bat() works */
>> +#ifdef CONFIG_HIGHMEM
>> + ioremap_base = PKMAP_BASE;
>> +#else
>> + ioremap_base = 0xfe000000UL; /* for now, could be 0xfffff000 */
>> +#endif /* CONFIG_HIGHMEM */
>> + ioremap_bot = ioremap_base;
>> +
>
> Can't these be statically initialized ? If not, then do a function call
> to mm/ please. Something like mm_init_early().
heh, I had just moved this code block without thinking about it. I'll
investigate and see what I can do.
>> + /* BAT mappings must be 128k aligned */
>> + if (addr != _ALIGN_DOWN(addr, 128 << 10))
>> + return NULL;
>
> Mustn't they be naturally aligned on their size ?
I'm not sure what you're asking. Are you asking about this particular
test, or are you asking why I don't also test the size?
I do this particular test to make absolute sure that the caller
absolutely understands the limitations of the block mapping. If they
call this with something that isn't 128k aligned, then I make it fail
immediately so the coder is forced to go and understand what they are
allowed to do. Basically, I'm reinforcing the fact that this is not
the same as ioremap().
I haven't decided yet if I should test size in the same way. Thoughts?
g.
--
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.
next prev parent reply other threads:[~2008-08-06 23:11 UTC|newest]
Thread overview: 45+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-06 6:02 [RFC/PATCH 0/3] Attempt at making 32bit BAT assignment more intelligent Grant Likely
2008-08-06 6:02 ` [RFC/PATCH 1/3] powerpc: add ioremap_bat() function for setting up BAT translated IO regions Grant Likely
2008-08-06 14:07 ` Kumar Gala
2008-08-06 21:54 ` Grant Likely
2008-08-06 22:11 ` Kumar Gala
2008-08-06 22:28 ` Benjamin Herrenschmidt
2008-08-06 22:55 ` Brad Boyer
2008-08-06 23:11 ` Grant Likely
2008-08-07 1:49 ` Kumar Gala
2008-08-07 22:13 ` Benjamin Herrenschmidt
2008-08-08 0:04 ` Kumar Gala
2008-08-12 19:50 ` Grant Likely
2008-08-06 22:31 ` Scott Wood
2008-08-06 23:02 ` Grant Likely
2008-08-07 1:52 ` Kumar Gala
2008-08-06 22:26 ` Benjamin Herrenschmidt
2008-08-06 23:11 ` Grant Likely [this message]
2008-08-07 16:45 ` Scott Wood
2008-08-07 18:21 ` Kumar Gala
2008-08-07 22:09 ` Benjamin Herrenschmidt
2008-08-06 6:02 ` [RFC/PATCH 2/3] of: add of_lookup_stdout() utility function Grant Likely
2008-08-06 6:14 ` Michael Ellerman
2008-08-06 6:34 ` Grant Likely
2008-08-06 7:42 ` Stephen Rothwell
2008-08-06 7:44 ` David Miller
2008-08-06 7:57 ` Stephen Rothwell
2008-08-06 6:32 ` David Miller
2008-08-06 6:35 ` Grant Likely
2008-08-06 7:19 ` David Miller
2008-08-07 22:37 ` Benjamin Herrenschmidt
2008-08-06 10:21 ` Paul Mackerras
2008-08-06 10:52 ` David Miller
2008-08-06 13:31 ` Grant Likely
2008-08-06 16:25 ` Segher Boessenkool
2008-08-06 17:09 ` Mitch Bradley
2008-08-07 0:40 ` David Gibson
2008-08-07 22:35 ` Benjamin Herrenschmidt
2008-08-06 16:46 ` Timur Tabi
2008-08-07 6:12 ` David Gibson
2008-08-07 17:28 ` Yoder Stuart
2008-08-07 18:11 ` Timur Tabi
2008-08-13 5:41 ` Grant Likely
2008-08-13 14:32 ` Timur Tabi
2008-08-07 22:36 ` Benjamin Herrenschmidt
2008-08-06 6:02 ` [RFC/PATCH 3/3] powerpc/52xx: add udbg and early debug support for PSC serial console Grant Likely
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=fa686aa40808061611p616208bp2baf9a0d5e095870@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=benh@kernel.crashing.org \
--cc=linuxppc-dev@ozlabs.org \
--cc=miltonm@bga.com \
--cc=paulus@samba.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).