* port on exotic board.
@ 2004-12-21 8:53 moreau francis
2004-12-22 1:27 ` Jun Sun
0 siblings, 1 reply; 8+ messages in thread
From: moreau francis @ 2004-12-21 8:53 UTC (permalink / raw)
To: linux-mips
Hi,
Well, I'm still trying to port Linux on my "exotic"
board...
I hope you don't mind if I ask a couple of questions,
which may be stupid for you but usefull at my level.
If you think that linux-mips mailing list is not
intended for these kind of questions, tell me !
So here I am:
I've mapped kernel code and kernel data in different
memories in order to save precious SDRAM memory.
Code 0xC0000000 0x30000000 16Mo FLASH
Data 0xC1000000 0x20000000 8Mo SDRAM
When running the kernel at the very begining, I
encounter different issues:
In "tlb_init" function, cp0 WIRED register is set to
zero, therefore the call to "local_flush_tlb_all"
flush all TLB entries which were mapping my kernel
in the 3 first entries. Why is this necessary ?
In different part of the kernel it is assumed that the
kernel start at physical addr 0. For instance in
"init_bootmem" fonction, argument start is set to 0.
Or the way to calculate a page frame index in mem_map
array. Why this assumption ?
Why does "mem_map" need to store page frames for
kernel
code ? Are these pages going be used when the Linux is
running ?
I noticed CPHYSADDR macro. This macro only works if
PAGE_OFFSET is equal to 0x80000000. Why does this
macro exist ? Why not using __pa macro ?
Thanks for your answers.
Francis.
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: port on exotic board.
2004-12-21 8:53 port on exotic board moreau francis
@ 2004-12-22 1:27 ` Jun Sun
2004-12-22 2:07 ` Ilya A. Volynets-Evenbakh
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Jun Sun @ 2004-12-22 1:27 UTC (permalink / raw)
To: moreau francis; +Cc: linux-mips
Since nobody else is replying I am giving it a shot. Hope it helps.
On Tue, Dec 21, 2004 at 09:53:07AM +0100, moreau francis wrote:
> Hi,
>
> Well, I'm still trying to port Linux on my "exotic"
> board...
> I hope you don't mind if I ask a couple of questions,
> which may be stupid for you but usefull at my level.
> If you think that linux-mips mailing list is not
> intended for these kind of questions, tell me !
>
> So here I am:
>
> I've mapped kernel code and kernel data in different
> memories in order to save precious SDRAM memory.
>
> Code 0xC0000000 0x30000000 16Mo FLASH
> Data 0xC1000000 0x20000000 8Mo SDRAM
>
> When running the kernel at the very begining, I
> encounter different issues:
>
> In "tlb_init" function, cp0 WIRED register is set to
> zero, therefore the call to "local_flush_tlb_all"
> flush all TLB entries which were mapping my kernel
> in the 3 first entries. Why is this necessary ?
Setting WIRED to zero is just part of kernel start-up initialization.
In 2.4 it is done before board setup routine, which allows board
to setup certain wired mapping.
In 2.6 it is done after board setup routine. You are screwed. :) I think
this needs to be fixed. A couple of boards should be broken because of this.
> In different part of the kernel it is assumed that the
> kernel start at physical addr 0. For instance in
> "init_bootmem" fonction, argument start is set to 0.
> Or the way to calculate a page frame index in mem_map
> array. Why this assumption ?
>
Because all other boards have phys memory starting from 0? It
simplies code for sure.
> Why does "mem_map" need to store page frames for
> kernel
> code ?
mem_map holds kernel page table. Kernel code is mapped there because
we start from 0 and we need to use the free memory _after_ kernel code
segment. (I don't think it is very useful for MIPS though, since MIPS uses
a flat 512MB block mapping for kernel virtual address.)
> Are these pages going be used when the Linux is
> running ?
Not much in MIPS case I suppose.
> I noticed CPHYSADDR macro. This macro only works if
> PAGE_OFFSET is equal to 0x80000000. Why does this
> macro exist ? Why not using __pa macro ?
Don't know much about this one.
BTW, once there was a board whose memory starts from 0x90000000. It had
similar problems as yours, but I think it ran in the end. Try to search
the mailing list.
Jun
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: port on exotic board.
2004-12-22 1:27 ` Jun Sun
@ 2004-12-22 2:07 ` Ilya A. Volynets-Evenbakh
2004-12-22 10:00 ` moreau francis
2004-12-22 5:36 ` Manish Lachwani
2004-12-22 9:55 ` moreau francis
2 siblings, 1 reply; 8+ messages in thread
From: Ilya A. Volynets-Evenbakh @ 2004-12-22 2:07 UTC (permalink / raw)
To: moreau francis; +Cc: linux-mips
CPHYSADDR gives you physical address from an address that lies in
one of compatibility "unmapped" spaces. "compatibility" in this case refers
to 32bit MIPS view of memory space.
As such, CPHYSADDR macro generally should not be used.
Jun Sun wrote:
>>I noticed CPHYSADDR macro. This macro only works if
>>PAGE_OFFSET is equal to 0x80000000. Why does this
>>macro exist ? Why not using __pa macro ?
>>
>>
>
>Don't know much about this one.
>
>BTW, once there was a board whose memory starts from 0x90000000. It had
>similar problems as yours, but I think it ran in the end. Try to search
>the mailing list.
>
>Jun
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: port on exotic board.
2004-12-22 2:07 ` Ilya A. Volynets-Evenbakh
@ 2004-12-22 10:00 ` moreau francis
0 siblings, 0 replies; 8+ messages in thread
From: moreau francis @ 2004-12-22 10:00 UTC (permalink / raw)
To: Ilya A. Volynets-Evenbakh; +Cc: linux-mips
> CPHYSADDR gives you physical address from an address
> that lies in
> one of compatibility "unmapped" spaces.
> "compatibility" in this case refers
> to 32bit MIPS view of memory space.
>
> As such, CPHYSADDR macro generally should not be
> used.
Well I still don't understand, why it has been
created...
Why does it should replaced "__pa" in particular time
?
Thanks
Francis
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: port on exotic board.
2004-12-22 1:27 ` Jun Sun
2004-12-22 2:07 ` Ilya A. Volynets-Evenbakh
@ 2004-12-22 5:36 ` Manish Lachwani
2004-12-22 10:04 ` moreau francis
2004-12-22 9:55 ` moreau francis
2 siblings, 1 reply; 8+ messages in thread
From: Manish Lachwani @ 2004-12-22 5:36 UTC (permalink / raw)
To: Jun Sun, moreau francis; +Cc: linux-mips
Hello !
> > In "tlb_init" function, cp0 WIRED register is set
> to
> > zero, therefore the call to "local_flush_tlb_all"
> > flush all TLB entries which were mapping my kernel
> > in the 3 first entries. Why is this necessary ?
>
> Setting WIRED to zero is just part of kernel
> start-up initialization.
>
> In 2.4 it is done before board setup routine, which
> allows board
> to setup certain wired mapping.
>
> In 2.6 it is done after board setup routine. You
> are screwed. :) I think
> this needs to be fixed. A couple of boards should
> be broken because of this.
>
Well, you can again setup the wired tlb entries later.
For example, in case of Ocelot3 board (setup.c code),
the wired tlb entries are again created in the
time_init function.
void momenco_time_init(void)
{
setup_wired_tlb_entries();
....
And it is set for the first time in the board setup
function:
static int __init momenco_ocelot_3_setup(void)
{
unsigned int tmpword;
board_time_init = momenco_time_init;
_machine_restart = momenco_ocelot_restart;
_machine_halt = momenco_ocelot_halt;
_machine_power_off = momenco_ocelot_power_off;
/* Wired TLB entries */
setup_wired_tlb_entries();
....
Maybe you can do the same for this board as well
Thanks
Manish Lachwani
=====
http://www.koffee-break.com
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: port on exotic board.
2004-12-22 5:36 ` Manish Lachwani
@ 2004-12-22 10:04 ` moreau francis
0 siblings, 0 replies; 8+ messages in thread
From: moreau francis @ 2004-12-22 10:04 UTC (permalink / raw)
To: Manish Lachwani, Jun Sun; +Cc: linux-mips
> ....
>
> Maybe you can do the same for this board as well
>
I don't think so, because at the boot time, before
running the very first lines of linux code, the kernel
must be mapped through the TLB. Used TLB entries
should
never be modified, because linux uses them to run
itself, even at boot time !
Francis
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: port on exotic board.
2004-12-22 1:27 ` Jun Sun
2004-12-22 2:07 ` Ilya A. Volynets-Evenbakh
2004-12-22 5:36 ` Manish Lachwani
@ 2004-12-22 9:55 ` moreau francis
2004-12-22 10:35 ` Stanislaw Skowronek
2 siblings, 1 reply; 8+ messages in thread
From: moreau francis @ 2004-12-22 9:55 UTC (permalink / raw)
To: Jun Sun; +Cc: linux-mips
> Since nobody else is replying I am giving it a shot.
> Hope it helps.
yes it helps, thanks for replying !
> Setting WIRED to zero is just part of kernel
> start-up initialization.
> I think
> this needs to be fixed. A couple of boards should
> be broken because of this.
yes and anyway the default value for WIRED is zero
after a reset.
> > Why this assumption ?
> >
>
> Because all other boards have phys memory starting
> from 0? It simplies code for sure.
Well, a part of the kernel seems to support this
feature but not all, specially mips specific code...
That make me think that it would not so hard to change
it...
I look at arm-arch code, and at the definition of
"page_to_pfn" and it does what I need:
(((page) - mem_map) + PHYS_PFN_OFFSET)
I can't believe that I'm the first one on mips
architecture who is trying to run kernel code located
at a physicall address different from 0 !
> > Are these pages going be used when the Linux is
> > running ?
>
> Not much in MIPS case I suppose.
If these pages are not used during kernel life, it
could save space to not map kernel code in "mem_map".
PFN 0 could be the first page that map kernel data.
This is specialy true if code starts at 0x20000000.
>
> > I noticed CPHYSADDR macro. This macro only works
> if
> > PAGE_OFFSET is equal to 0x80000000. Why does this
> > macro exist ? Why not using __pa macro ?
>
> Don't know much about this one.
>
It is a typically mips specific code that prevents
kernel code to start at address different from 0.
> BTW, once there was a board whose memory starts from
> 0x90000000. It had
> similar problems as yours, but I think it ran in the
> end. Try to search
> the mailing list.
I can't find it in mailing list archive :(
Francis
Découvrez le nouveau Yahoo! Mail : 250 Mo d'espace de stockage pour vos mails !
Créez votre Yahoo! Mail sur http://fr.mail.yahoo.com/
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: port on exotic board.
2004-12-22 9:55 ` moreau francis
@ 2004-12-22 10:35 ` Stanislaw Skowronek
0 siblings, 0 replies; 8+ messages in thread
From: Stanislaw Skowronek @ 2004-12-22 10:35 UTC (permalink / raw)
To: linux-mips
> yes and anyway the default value for WIRED is zero
> after a reset.
PROMs *do* have interesting ideas sometimes.
> I can't believe that I'm the first one on mips
> architecture who is trying to run kernel code located
> at a physicall address different from 0 !
Sure you aren't. If you have a 64-bit machine, it's relatively easy in
fact. If your code and data is above 512 MB, you are a little more
screwed, but it still can be done (as evidenced by me), and CPHYSADDR does
not, enter the discussion at all. All you have to do is create a correct
memory map at start.
I don't know about running mapped kernels in 32-bit mode, though. It is a
different thing whatsoever.
Stanislaw Skowronek
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2004-12-22 11:24 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-21 8:53 port on exotic board moreau francis
2004-12-22 1:27 ` Jun Sun
2004-12-22 2:07 ` Ilya A. Volynets-Evenbakh
2004-12-22 10:00 ` moreau francis
2004-12-22 5:36 ` Manish Lachwani
2004-12-22 10:04 ` moreau francis
2004-12-22 9:55 ` moreau francis
2004-12-22 10:35 ` Stanislaw Skowronek
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.