qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-ppc] [PATCH v3 06/24] target-ppc: Enable writes to user-privil


From: Alexey Kardashevskiy
Subject: Re: [Qemu-ppc] [PATCH v3 06/24] target-ppc: Enable writes to user-privileged PMU registers
Date: Wed, 28 May 2014 20:44:25 +1000
User-agent: Mozilla/5.0 (X11; Linux i686 on x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0

On 05/28/2014 08:07 PM, Alexey Kardashevskiy wrote:
> On 05/27/2014 08:37 PM, Alexey Kardashevskiy wrote:
>> This adds spr_write_ureg() helper and uses it for UPMCx and MMCR0 SPRs.
>>
>> Signed-off-by: Alexey Kardashevskiy <address@hidden>
>> ---
>>  target-ppc/translate_init.c | 25 +++++++++++++++----------
>>  1 file changed, 15 insertions(+), 10 deletions(-)
>>
>> diff --git a/target-ppc/translate_init.c b/target-ppc/translate_init.c
>> index 88acf70..595fd3f 100644
>> --- a/target-ppc/translate_init.c
>> +++ b/target-ppc/translate_init.c
>> @@ -175,6 +175,11 @@ static void spr_read_ureg (void *opaque, int gprn, int 
>> sprn)
>>      gen_load_spr(cpu_gpr[gprn], sprn + 0x10);
>>  }
>>  

Should have been this (gprn <-> sprn):

static void spr_write_ureg(void *opaque, int sprn, int gprn)

So this topic can be closed :)


>> +static void spr_write_ureg(void *opaque, int gprn, int sprn)
>> +{
>> +    gen_store_spr(sprn + 0x10, cpu_gpr[gprn]);
>> +}
> 
> 
> Here I need assistance. I defined spr_write_ureg() similar to
> spr_read_ureg() and tried using it for UMMCR2. And QEMU crashes on
> segfault. May be spr_read_ureg() is broken too, it is not called in my
> example. Does this xxx_ureg() do something fundamentally wrong with TCG?
> 
> 
> 
>  Info: performing kexec reboot
> 
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 0x3fff93deeee0 (LWP 10648)]
> 0x000000001053153c in tcg_constant_folding (s=0x10c2a000 <tcg_ctx>,
> tcg_opc_ptr=0x10c312e6 <tcg_ctx+29414>, args=0x10c3
> 19f8 <tcg_ctx+31224>, tcg_op_defs=0x10761730 <tcg_op_defs>) at
> /home/alexey/p/qemu/tcg/optimize.c:550
> 550                 if (temps[args[i]].state == TCG_TEMP_COPY) {
> Missing separate debuginfos, use: debuginfo-install
> glusterfs-api-3.4.0-8.fc19.ppc64 glusterfs-libs-3.4.0-8.fc19.ppc64
> gnutls-3.1.17-2.fc19.ppc64 keyutils-libs-1.5.6-1.fc19.ppc64
> libgcc-4.8.2-1.fc19.ppc64 libgcrypt-1.5.3-2.fc19.ppc64 libi
> bverbs-1.1.7-3.fc19.ppc64 libiscsi-1.7.0-5.fc19.ppc64
> libpng-1.5.13-2.fc19.ppc64 librdmacm-1.0.17-1.fc19.ppc64 libusbx-
> 1.0.16-3.fc19.ppc64 systemd-libs-204-17.fc19.ppc64 usbredir-0.6-2.fc19.ppc64
> (gdb) bt
> #0  0x000000001053153c in tcg_constant_folding (s=0x10c2a000 <tcg_ctx>,
> tcg_opc_ptr=0x10c312e6 <tcg_ctx+29414>, args=0x10c319f8 <tcg_ctx+31224>,
> tcg_op_defs=0x10761730 <tcg_op_defs>) at 
> /home/alexey/p/qemu/tcg/optimize.c:550
> #1  0x0000000010534a68 in tcg_optimize (s=0x10c2a000 <tcg_ctx>,
> tcg_opc_ptr=0x10c312e6 <tcg_ctx+29414>, args=0x10c317a0 <tcg_ctx+30624>,
> tcg_op_defs=0x10761730 <tcg_op_defs>) at
> /home/alexey/p/qemu/tcg/optimize.c:1294
> #2  0x00000000105439e4 in tcg_gen_code_common (s=0x10c2a000 <tcg_ctx>,
> gen_code_buf=0x3fffb1145010, search_pc=0xffffffffffffffff) at
> /home/alexey/p/qemu/tcg/tcg.c:2536
> #3  0x0000000010544138 in tcg_gen_code (s=0x10c2a000 <tcg_ctx>,
> gen_code_buf=0x3fffb1145010) at /home/alexey/p/qemu/tcg/tcg.c:2659
> #4  0x00000000105456d4 in cpu_ppc_gen_code (env=0x10ee23a0,
> tb=0x3fff9af9bc78, gen_code_size_ptr=0x3fff93dee078) at
> /home/alexey/p/qemu/translate-all.c:179
> #5  0x000000001054704c in tb_gen_code (cpu=0x10ed9f70,
> pc=0xc000000000028790, cs_base=0x0, flags=0x1, cflags=0x0) at
> /home/alexey/p/qemu/translate-all.c:966
> #6  0x0000000010328dc8 in tb_find_slow (env=0x10ee23a0,
> pc=0xc000000000028790, cs_base=0x0, flags=0x1) at
> /home/alexey/p/qemu/cpu-exec.c:157
> #7  0x00000000103290bc in tb_find_fast (env=0x10ee23a0) at
> /home/alexey/p/qemu/cpu-exec.c:185
> #8  0x000000001032964c in cpu_ppc_exec (env=0x10ee23a0) at
> /home/alexey/p/qemu/cpu-exec.c:609
> #9  0x000000001032d684 in tcg_cpu_exec (env=0x10ee23a0) at
> /home/alexey/p/qemu/cpus.c:1271
> #10 0x000000001032d814 in tcg_exec_all () at /home/alexey/p/qemu/cpus.c:1303
> #11 0x000000001032c7bc in qemu_tcg_cpu_thread_fn (arg=0x10ed9f70) at
> /home/alexey/p/qemu/cpus.c:952
> #12 0x00000080bcd0c29c in start_thread (arg=0x3fff93deeee0) at
> pthread_create.c:310
> #13 0x00000080bcb1ddb0 in .__clone () at
> ../sysdeps/unix/sysv/linux/powerpc/powerpc64/clone.S:111
> (gdb)
> 
> 
> 
> 
> 
>> +
>>  /* SPR common to all non-embedded PowerPC */
>>  /* DECR */
>>  #if !defined(CONFIG_USER_ONLY)
>> @@ -7379,28 +7384,28 @@ static void gen_spr_book3s_pmu(CPUPPCState *env)
>>                   &spr_read_generic, SPR_NOACCESS,
>>                   0x00000000);
>>      spr_register(env, SPR_POWER_UMMCR0, "UMMCR0",
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> +                 &spr_read_ureg, &spr_write_ureg,
>> +                 &spr_read_ureg, &spr_write_ureg,
>>                   0x00000000);
>>      spr_register(env, SPR_POWER_UMMCR1, "UMMCR1",
>>                   &spr_read_ureg, SPR_NOACCESS,
>>                   &spr_read_ureg, SPR_NOACCESS,
>>                   0x00000000);
>>      spr_register(env, SPR_POWER_UPMC1, "UPMC1",
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> +                 &spr_read_ureg, &spr_write_ureg,
>> +                 &spr_read_ureg, &spr_write_ureg,
>>                   0x00000000);
>>      spr_register(env, SPR_POWER_UPMC2, "UPMC2",
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> +                 &spr_read_ureg, &spr_write_ureg,
>> +                 &spr_read_ureg, &spr_write_ureg,
>>                   0x00000000);
>>      spr_register(env, SPR_POWER_UPMC3, "UPMC3",
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> +                 &spr_read_ureg, &spr_write_ureg,
>> +                 &spr_read_ureg, &spr_write_ureg,
>>                   0x00000000);
>>      spr_register(env, SPR_POWER_UPMC4, "UPMC4",
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> -                 &spr_read_ureg, SPR_NOACCESS,
>> +                 &spr_read_ureg, &spr_write_ureg,
>> +                 &spr_read_ureg, &spr_write_ureg,
>>                   0x00000000);
>>      spr_register(env, SPR_POWER_USIAR, "USIAR",
>>                   &spr_read_ureg, SPR_NOACCESS,
>>
> 
> 


-- 
Alexey



reply via email to

[Prev in Thread] Current Thread [Next in Thread]