------ Forwarded Message
From: girish <girishvg@gmail.com>
Date: Tue, 26 Sep 2006 11:22:26 +0900
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: "linux-mips@linux-mips.org" <git-commits@linux-mips.org>
Conversation: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
Subject: Re: [PATCH] cleanup hardcoding __pa/__va macros etc. (take-2)
The idea is to differentiate the Kseg0/Kseg1 segments in the physical area.
Beyond these areas lies the mapped area (or the HIGHMEM). What complicates
this matter further is their overlapping nature. The __pa()/__va() treated
all addresses mapped into PAGE_OFFSET (8000_0000) area. The effort is to
correctly differentiate these areas.
I could not think of any better solution & the only simplification I came up
with -
#ifdef CONFIG_32BIT
/* 8000_0000 & above */
#define ISMAPPEDPA(x) ((x) > KSEG0)
/* below 2000_0000 */
#define ISUNMAPPEDVA(x) ((x) < HIGHMEM_START)
#else
#define ISMAPPEDPA(x) (1)
#define ISMAPPEDVA(x) (1)
#endif
#define ___pa(x) ((unsigned long) (x) - KSEGX((x)))
#define __pa(x) (ISUNMAPPEDPA(x) ? ___pa((x)) : (x))
#define ___va(x) ((void *)((unsigned long) (x) + KSEG0))
#define __va(x) (ISUNMAPPEDVA(x) ? ___va((x)) : (x))
On 9/26/06 12:43 AM, "Atsushi Nemoto" <anemo@mba.ocn.ne.jp> wrote:
> On Mon, 25 Sep 2006 23:51:46 +0900, girish <girishvg@gmail.com> wrote:
>> Here is the patch again, attached as a text file. I don't have idea how
>> these macros should be on a 64bit machine, so I just left them as it is.
>> Could you please verify these macros again?
>
> Well, I should ask first: Why do you change __pa() and __va() ?
>
> I can not see point of ISMAPPED() testing. And these macros are used
> quite often so they should be as fast as possible.
>
> ---
> Atsushi Nemoto
------ End of Forwarded Message
|