public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Andres Salomon <dilinger@queued.net>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org, tglx@linutronix.de,
	mingo@redhat.com, x86@kernel.org, Mitch Bradley <wmb@laptop.org>
Subject: Re: [PATCH] x86: OLPC: add support for calling into OpenFirmware (v4)
Date: Thu, 17 Jun 2010 11:35:21 -0700	[thread overview]
Message-ID: <4C1A6AE9.2020307@zytor.com> (raw)
In-Reply-To: <20100616223220.326bee18@dev.queued.net>

On 06/16/2010 07:32 PM, Andres Salomon wrote:
> 
> Add support for saving OFW's cif, and later calling into it to run OFW
> commands.  OFW remains resident in memory, living within virtual range
> 0xff800000 - 0xffc00000.  A single page directory entry points to the
> pgdir that OFW actually uses, so rather than saving the entire page
> table, we grab and install that one entry permanently in the kernel's
> page table.
> 
> This is currently only used by the OLPC XO.
> 

OK, down to the nitpick level...

> +
> +/* page dir entry containing OFW's pgdir table; filled in by head_32.S */
> +pgd_t *olpc_ofw_pgd __initdata;
> +

This is a physical address, not a pointer.  As such it should be
physaddr_t or u32.

> +static DEFINE_SPINLOCK(ofw_lock);
> +
> +#define MAXARGS 10
> +
> +void __init setup_olpc_ofw_pgd(void)
> +{
> +	pgd_t *base, *pde, *ofw_pde;
> +
> +	if (!olpc_ofw_cif)
> +		return;
> +
> +	/* fetch the kernel's current PDE */
> +	base = __va(read_cr3());
> +	pde = &base[OLPC_OFW_PDE_NR];
> +

Since you're touching this so early, you already know that you're
manipulating swapper_pg_dir.  If you *didn't* know that, the above code
would be wrong, since the change you're about to make wouldn't propagate
to other kernel tasks.

So just use swapper_pg_dir[OLPC_OFW_PDE_NR] directly.

	-hpa

      reply	other threads:[~2010-06-17 18:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-17  2:32 [PATCH] x86: OLPC: add support for calling into OpenFirmware (v4) Andres Salomon
2010-06-17 18:35 ` H. Peter Anvin [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=4C1A6AE9.2020307@zytor.com \
    --to=hpa@zytor.com \
    --cc=akpm@linux-foundation.org \
    --cc=dilinger@queued.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=wmb@laptop.org \
    --cc=x86@kernel.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