Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Wu Zhangjin <wuzhangjin@gmail.com>
To: David Daney <ddaney@caviumnetworks.com>
Cc: post@pfrst.de, Ralf Baechle <ralf@linux-mips.org>,
	linux-mips <linux-mips@linux-mips.org>
Subject: Re: [PATCH] MIPS: Calculate proper ebase value for 64-bit kernels
Date: Tue, 27 Apr 2010 12:05:37 +0800	[thread overview]
Message-ID: <1272341137.21095.55.camel@localhost> (raw)
In-Reply-To: <4BD62E38.10707@caviumnetworks.com>

On Mon, 2010-04-26 at 17:22 -0700, David Daney wrote:
[...]
> > Some time ago we needed to handle multiple (virtual) address-spaces
> > (in TO_CAC/TO_UNCAC as well as in virt_to_phys and the like) for
> > SGI's Indigo2/R10k and Octane (neither could run a 32bit kernel).
> > So in addrspace.h we provided
> > 	#ifdef CONFIG_64BIT
> > 	static inline unsigned long kernel_physaddr(unsigned long kva)
> > 	{
> > 		if((kva&0xffffffff80000000UL)==0xffffffff80000000UL)
> > 			return CPHYSADDR(kva);
> > 		return XPHYSADDR(kva);
> > 	}
> > 	#else
> > 	#define kernel_physaddr CPHYSADDR
> > 	#endif
> > while mach-ipXX/spaces.h defined
> > 	#define TO_PHYS(x)	(             kernel_physaddr(x))
> > 	#define TO_CAC(x)	(CAC_BASE   | kernel_physaddr(x))
> > 	#define TO_UNCAC(x)	(UNCAC_BASE | kernel_physaddr(x))
> > which did the job.
> > But at that time these defines didn't meet much acceptance for general
> > use in 64bit kernels.  Now, to my amusement, some modern processor
> > (and/or system) seems to urge this kind of address-handling again  ;-)
> >
> >
> 
> FWIW, that seems cleaner than what I did (actually I didn't try my 
> code).  That should be the default definition for 64-bit kernels I think.

Should we let this stuff be a common implementation? then we can also
provide the TO_CAC(), TO_PHYS(), TO_UNCAC() to the 32bit kernel and
remove some #ifdef from the kernel, for example:

> diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
> index 1a4dd65..fb8cd40 100644
> --- a/arch/mips/kernel/traps.c
> +++ b/arch/mips/kernel/traps.c
> @@ -1557,12 +1557,7 @@ static char panic_null_cerr[] __cpuinitdata =
>  void __cpuinit set_uncached_handler(unsigned long offset, void *addr,
>         unsigned long size)
>  {
> -#ifdef CONFIG_32BIT
> -       unsigned long uncached_ebase = KSEG1ADDR(ebase);
> -#endif
> -#ifdef CONFIG_64BIT
>         unsigned long uncached_ebase = TO_UNCAC(ebase);
> -#endif
> 

And I have found lots of places have used KSEG1ADDR() in the kernel source code,
If the TO_UNCAC() for 32bit is provided, then we can also replace it by TO_UNCAC().

I will try to make a patch for it.

Regards,
	Wu Zhangjin

  reply	other threads:[~2010-04-27  4:05 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <Pine.LNX.4.21.1004270049440.1248-100000@Mobile0.Peter>
2010-04-27  0:22 ` [PATCH] MIPS: Calculate proper ebase value for 64-bit kernels David Daney
2010-04-27  4:05   ` Wu Zhangjin [this message]
2010-04-06 20:29 David Daney
2010-04-07 15:39 ` Ralf Baechle
2010-04-13  5:03 ` Wu Zhangjin
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

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=1272341137.21095.55.camel@localhost \
    --to=wuzhangjin@gmail.com \
    --cc=ddaney@caviumnetworks.com \
    --cc=linux-mips@linux-mips.org \
    --cc=post@pfrst.de \
    --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