From: Sergei Shtylyov <sshtylyov@ru.mvista.com>
To: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH v4] Virtual memory size detection for 64 bit MIPS CPUs
Date: Tue, 02 Feb 2010 13:04:24 +0300 [thread overview]
Message-ID: <4B67F8A8.6000706@ru.mvista.com> (raw)
In-Reply-To: <1265068979-12052-1-git-send-email-guenter.roeck@ericsson.com>
Hello.
Guenter Roeck wrote:
> Linux kernel 2.6.32 and later allocates memory from the top of virtual memory
> space.
>
> This patch implements virtual memory size detection for 64 bit MIPS CPUs
> to avoid resulting crashes.
>
> Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
>
[...]
> diff --git a/arch/mips/include/asm/pgtable-64.h b/arch/mips/include/asm/pgtable-64.h
> index 9cd5089..259ec58 100644
> --- a/arch/mips/include/asm/pgtable-64.h
> +++ b/arch/mips/include/asm/pgtable-64.h
> @@ -110,7 +110,9 @@
> #define VMALLOC_START MAP_BASE
> #define VMALLOC_END \
> (VMALLOC_START + \
> - PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE - (1UL << 32))
> + min(PTRS_PER_PGD * PTRS_PER_PMD * PTRS_PER_PTE * PAGE_SIZE, \
> + (1UL<<cpu_vmbits)) - (1UL << 32))
>
Why you've added spaces around the second << but not around the
first? Should be more consistent.
> +
> #if defined(CONFIG_MODULES) && defined(KBUILD_64BIT_SYM32) && \
> VMALLOC_START != CKSSEG
> /* Load modules into 32bit-compatible segment. */
> diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
> index 7a51866..ac9aca1 100644
> --- a/arch/mips/kernel/cpu-probe.c
> +++ b/arch/mips/kernel/cpu-probe.c
> @@ -282,6 +282,16 @@ static inline int __cpu_has_fpu(void)
> return ((cpu_get_fpu_id() & 0xff00) != FPIR_IMP_NONE);
> }
>
> +static inline void cpu_set_vmbits(struct cpuinfo_mips *c)
> +{
> + if (cpu_has_64bits) {
> + write_c0_entryhi(0xfffffffffffff000ULL);
> + back_to_back_c0_hazard();
> + c->vmbits = fls64(read_c0_entryhi() & 0x3ffffffffffff000ULL);
>
I don't quite understand why set bits 62-63 only to mask them off
later...
WBR, Sergei
prev parent reply other threads:[~2010-02-02 10:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-02 0:02 [PATCH v4] Virtual memory size detection for 64 bit MIPS CPUs Guenter Roeck
2010-02-02 10:04 ` Sergei Shtylyov [this message]
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=4B67F8A8.6000706@ru.mvista.com \
--to=sshtylyov@ru.mvista.com \
--cc=guenter.roeck@ericsson.com \
--cc=linux-mips@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