Re: [PATCH] powerpc/64s: Clear PCR on boot
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Date: 2018-05-28 13:29:43
Also in:
lkml
On Sat, 2018-05-26 at 20:45 -0700, Guenter Roeck wrote:
I already have a patch, or at least one that does the trick for me. Getting qemu patched was not the problem. I just want to be sure that the problem is indeed a qemu problem.
Hey Guenter !
It's not quite the right patch though. The PCR is a hypervisor
priviledged register, your patch makes it supervisor accessible.
I don't have all my stuff at hand to provide a "proper" or tested patch
but it should look like
spr_register_hv(env, SPR_PCR, "PCR",
SPR_NOACCESS, SPR_NOACCESS,
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic, 0);
Additionally the TCG ppc instruction decoder should be made to check
the PCR for varous instructions (that or use a specific write callback
that affects the CPU flags) but that's less urgent.
Cheers,
Ben.
quoted hunk ↗ jump to hunk
Thanks, Guenter ---quoted
From 1617bac264b4c49d817b6947611affa9b73318f6 Mon Sep 17 00:00:00 2001From: Guenter Roeck <linux@roeck-us.net> Date: Fri, 25 May 2018 06:38:40 -0700 Subject: [PATCH] PowerPC: Permit privileged access to SPR_PCR for POWER7+ Without this access, Linux mainline bails out. Signed-off-by: Guenter Roeck <linux@roeck-us.net> --- target/ppc/translate_init.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)diff --git a/target/ppc/translate_init.c b/target/ppc/translate_init.c index 391b94b..3b09c49 100644 --- a/target/ppc/translate_init.c +++ b/target/ppc/translate_init.c@@ -7953,11 +7953,12 @@ static void gen_spr_power6_common(CPUPPCState *env) #endif /* * Register PCR to report POWERPC_EXCP_PRIV_REG instead of - * POWERPC_EXCP_INVAL_SPR. + * POWERPC_EXCP_INVAL_SPR in userspace. Permit privileged + * access. */ spr_register(env, SPR_PCR, "PCR", SPR_NOACCESS, SPR_NOACCESS, - SPR_NOACCESS, SPR_NOACCESS, + &spr_read_generic, &spr_write_generic, 0x00000000); }