From: Wu Zhangjin <wuzhangjin@gmail.com>
To: David Daney <ddaney@caviumnetworks.com>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org
Subject: Re: [PATCH] MIPS: Calculate proper ebase value for 64-bit kernels
Date: Tue, 13 Apr 2010 13:03:54 +0800 [thread overview]
Message-ID: <1271135034.25797.41.camel@falcon> (raw)
In-Reply-To: <1270585790-12730-1-git-send-email-ddaney@caviumnetworks.com>
Hi, David and Ralf
This patch have broken the support to the MIPS variants whose
cpu_has_mips_r2 is 0 for the CAC_BASE and CKSEG0 is completely different
in these MIPSs.
With the patch, the kernel will exit when booting(later after
trap_init()).
A potential patch to fix the above problem is:
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 1a4dd65..d8cb554 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1599,7 +1599,7 @@ void __init trap_init(void)
ebase = (unsigned long)
__alloc_bootmem(size, 1 << fls(size), 0);
} else {
- ebase = CKSEG0;
+ ebase = (cpu_has_mips_r2) ? CKSEG0 : CAC_BASE;
if (cpu_has_mips_r2)
ebase += (read_c0_ebase() & 0x3ffff000);
}
Regards,
Wu Zhangjin
On Tue, 2010-04-06 at 13:29 -0700, David Daney wrote:
> The ebase is relative to CKSEG0 not CAC_BASE. On a 32-bit kernel they
> are the same thing, for a 64-bit kernel they are not.
>
> It happens to kind of work on a 64-bit kernel as they both reference
> the same physical memory. However since the CPU uses the CKSEG0 base,
> determining if a J instruction will reach always gives the wrong
> result unless we use the same number the CPU uses.
>
> Signed-off-by: David Daney <ddaney@caviumnetworks.com>
> ---
> arch/mips/kernel/traps.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
> index 7ce84bb..b122f76 100644
> --- a/arch/mips/kernel/traps.c
> +++ b/arch/mips/kernel/traps.c
> @@ -1706,7 +1706,7 @@ void __init trap_init(void)
> ebase = (unsigned long)
> __alloc_bootmem(size, 1 << fls(size), 0);
> } else {
> - ebase = CAC_BASE;
> + ebase = CKSEG0;
> if (cpu_has_mips_r2)
> ebase += (read_c0_ebase() & 0x3ffff000);
> }
next prev parent reply other threads:[~2010-04-13 5:04 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-06 20:29 [PATCH] MIPS: Calculate proper ebase value for 64-bit kernels David Daney
2010-04-07 15:39 ` Ralf Baechle
2010-04-13 5:03 ` Wu Zhangjin [this message]
2010-04-13 7:34 ` Thomas Bogendoerfer
2010-04-13 17:16 ` Ralf Baechle
2010-04-13 18:15 ` Thomas Bogendoerfer
2010-04-14 8:03 ` Wu Zhangjin
2010-04-14 11:24 ` Thomas Bogendoerfer
2010-04-26 12:13 ` Wu Zhangjin
2010-04-26 17:19 ` David Daney
2010-04-27 2:53 ` Wu Zhangjin
2010-04-27 23:06 ` Maciej W. Rozycki
[not found] <Pine.LNX.4.21.1004270049440.1248-100000@Mobile0.Peter>
2010-04-27 0:22 ` David Daney
2010-04-27 4:05 ` Wu Zhangjin
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=1271135034.25797.41.camel@falcon \
--to=wuzhangjin@gmail.com \
--cc=ddaney@caviumnetworks.com \
--cc=linux-mips@linux-mips.org \
--cc=ralf@linux-mips.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