All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Daney <ddaney@caviumnetworks.com>
To: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [PATCH v2] Virtual memory size detection for 64 bit MIPS CPUs
Date: Mon, 01 Feb 2010 13:42:53 -0800	[thread overview]
Message-ID: <4B674ADD.1050306@caviumnetworks.com> (raw)
In-Reply-To: <1265058019-21484-1-git-send-email-guenter.roeck@ericsson.com>

Guenter Roeck wrote:
[...]
>  
> +static inline void cpu_set_vmbits(struct cpuinfo_mips *c)
> +{
> +	if (cpu_has_64bits) {
> +		unsigned long zbits;
> +
> +		asm volatile(".set mips64\n"
> +			     "and %0, 0\n"
> +			     "dsubu %0, 1\n"
> +			     "dmtc0 %0, $10, 0\n"
> +			     "dmfc0 %0, $10, 0\n"
> +			     "dsll %0, %0, 2\n"
> +			     "dsra %0, %0, 2\n"
> +			     "dclz %0, %0\n"
> +			     ".set mips0\n"
> +			     : "=r" (zbits));
> +		c->vmbits = 64 - zbits;
> +	} else
> +		c->vmbits = 32;
> +}
> +

It should be possible to express this in 'pure' C using 
read_c0_entryhi()/write_c0_entryhi(), also you need to be sure you are 
not writing 1s to any reserved bits of the register.


David Daney

  reply	other threads:[~2010-02-01 21:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-01 21:00 [PATCH v2] Virtual memory size detection for 64 bit MIPS CPUs Guenter Roeck
2010-02-01 21:42 ` David Daney [this message]
2010-02-01 22:04   ` Guenter Roeck
2010-02-01 22:12     ` David Daney
2010-02-01 22:34       ` Guenter Roeck
2010-02-01 22:39     ` 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=4B674ADD.1050306@caviumnetworks.com \
    --to=ddaney@caviumnetworks.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 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.