mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Hogan <james.hogan@imgtec.com>
To: Matt Redfearn <matt.redfearn@imgtec.com>
Cc: Ralf Baechle <ralf@linux-mips.org>, <linux-mips@linux-mips.org>,
	<linux-kernel@vger.kernel.org>,
	Paul Burton <paul.burton@imgtec.com>
Subject: Re: [PATCH] MIPS: generic: Fix KASLR for generic kernel.
Date: Mon, 17 Oct 2016 11:22:31 +0100	[thread overview]
Message-ID: <20161017102231.GB9443@jhogan-linux.le.imgtec.org> (raw)
In-Reply-To: <1476698709-6771-1-git-send-email-matt.redfearn@imgtec.com>

[-- Attachment #1: Type: text/plain, Size: 1961 bytes --]

Hi Matt,

On Mon, Oct 17, 2016 at 11:05:09AM +0100, Matt Redfearn wrote:
> The KASLR code requires that the plat_get_fdt() function return the
> address of the device tree, and it must be available early in the boot,
> before prom_init() is called. Move the code determining the address of
> the device tree into plat_get_fdt, and call that from prom_init().
> 
> The fdt pointer will be set up by plat_get_fdt() called from
> relocate_kernel initially and once the relocated kernel has started,
> prom_init() will use it again to determine the address in the relocated
> image.
> 
> Fixes: eed0eabd12ef

I believe this is the preferred form:

Fixes: eed0eabd12ef ("MIPS: generic: Introduce generic DT-based board support")

Otherwise looks good to me

Reviewed-by: James Hogan <james.hogan@imgtec.com>

Cheers
James

> Signed-off-by: Matt Redfearn <matt.redfearn@imgtec.com>
> ---
> 
>  arch/mips/generic/init.c | 16 ++++++++++------
>  1 file changed, 10 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/mips/generic/init.c b/arch/mips/generic/init.c
> index 0ea73e845440..d493ccbf274a 100644
> --- a/arch/mips/generic/init.c
> +++ b/arch/mips/generic/init.c
> @@ -30,9 +30,19 @@ static __initdata const void *mach_match_data;
>  
>  void __init prom_init(void)
>  {
> +	plat_get_fdt();
> +	BUG_ON(!fdt);
> +}
> +
> +void __init *plat_get_fdt(void)
> +{
>  	const struct mips_machine *check_mach;
>  	const struct of_device_id *match;
>  
> +	if (fdt)
> +		/* Already set up */
> +		return (void *)fdt;
> +
>  	if ((fw_arg0 == -2) && !fdt_check_header((void *)fw_arg1)) {
>  		/*
>  		 * We booted using the UHI boot protocol, so we have been
> @@ -75,12 +85,6 @@ void __init prom_init(void)
>  		/* Retrieve the machine's FDT */
>  		fdt = mach->fdt;
>  	}
> -
> -	BUG_ON(!fdt);
> -}
> -
> -void __init *plat_get_fdt(void)
> -{
>  	return (void *)fdt;
>  }
>  
> -- 
> 2.7.4
> 
> 

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

  reply	other threads:[~2016-10-17 10:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-17 10:05 Matt Redfearn
2016-10-17 10:22 ` James Hogan [this message]
2016-10-17 15:24 ` Paul Burton

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=20161017102231.GB9443@jhogan-linux.le.imgtec.org \
    --to=james.hogan@imgtec.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mips@linux-mips.org \
    --cc=matt.redfearn@imgtec.com \
    --cc=paul.burton@imgtec.com \
    --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

all inboxes | Powered by JetHome®