Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Oct 2018 15:08:05 -0500
From:      Justin Hibbits <chmeeedalf@gmail.com>
To:        Leandro Lupori <luporl@FreeBSD.org>
Cc:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   Re: svn commit: r339316 - projects/power8_bringup_hacks/sys/powerpc/powerpc
Message-ID:  <20181011150805.7234d85c@ralga.knownspace>
In-Reply-To: <201810111918.w9BJI6Ak067450@repo.freebsd.org>
References:  <201810111918.w9BJI6Ak067450@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 11 Oct 2018 19:18:06 +0000 (UTC)
Leandro Lupori <luporl@FreeBSD.org> wrote:

> Author: luporl
> Date: Thu Oct 11 19:18:06 2018
> New Revision: 339316
> URL: https://svnweb.freebsd.org/changeset/base/339316
> 
> Log:
>   Initialize SPRG0 before its first possible use.
> 
> Modified:
>   projects/power8_bringup_hacks/sys/powerpc/powerpc/machdep.c
> 
> Modified: projects/power8_bringup_hacks/sys/powerpc/powerpc/machdep.c
> ==============================================================================
> ---
> projects/power8_bringup_hacks/sys/powerpc/powerpc/machdep.c
> Thu Oct 11 19:06:54 2018	(r339315) +++
> projects/power8_bringup_hacks/sys/powerpc/powerpc/machdep.c
> Thu Oct 11 19:18:06 2018	(r339316) @@ -383,12 +383,12 @@
> powerpc_init(vm_offset_t fdt, vm_offset_t toc, vm_offs if
> (platform_smp_get_bsp(&bsp) != 0) bsp.cr_cpuid = 0; pc =
> &__pcpu[bsp.cr_cpuid];
> +	__asm __volatile("mtsprg 0, %0" :: "r"(pc));
>  	pcpu_init(pc, bsp.cr_cpuid, sizeof(struct pcpu));
>  	pc->pc_curthread = &thread0;
>  	thread0.td_oncpu = bsp.cr_cpuid;
>  	pc->pc_cpuid = bsp.cr_cpuid;
>  	pc->pc_hwref = bsp.cr_hwref;
> -	__asm __volatile("mtsprg 0, %0" :: "r"(pc));
>  
>  	/*
>  	 * Init KDB
> 

Wow, that's quite some sleuthing!

Consider this approved by me, and email re@ to get it into head.  Then
hop on IRC and give me the play-by-play on how you figured it out.  I'm
really curious!

At first I thought it was a fairly innocuous change, because "nothing"
could be doing a PCPU_GET() for pcpu[0], right?  Then I saw AIM's
cpu_pcpu_init() doing a memcpy() from PCPU_GET(aim.slb).  So, with this
change you're making a memcpy() overwrite itself (which, I hope, is a
real nop in code?).

- Justin



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20181011150805.7234d85c>