qemu-ppc
[Top][All Lists]
Advanced

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

Re: Cannot Access Memory


From: Jesse Millwood
Subject: Re: Cannot Access Memory
Date: Wed, 06 Oct 2021 15:31:50 -0400
User-agent: Cyrus-JMAP/3.5.0-alpha0-1331-g5ae342296a-fm-20211005.001-g5ae34229

Balaton,

I broke on "booke206_initial_map_tsize" and found the "dt_end" to be set to 0x0190_0000, which is far smaller than the u-boot elf entry point.

I tried this hack to see if I could access memory:
static int booke206_initial_map_tsize(CPUPPCState *env)
{
-    struct boot_info *bi = env->load_info;
-    hwaddr dt_end;
     int ps;

     /* Our initial TLB entry needs to cover everything from 0 to
        the device tree top */
-    dt_end = bi->dt_base + bi->dt_size;
-    ps = booke206_page_size_to_tlb(dt_end) + 1;
+    ps = booke206_page_size_to_tlb(0xfff80000) + 1;
     if (ps & 1) {

I looked in the E500 Core Reference Manual and it says that at reset the first entry of the tlb should be a size of 4k but the p2020 says 4G. It seems there are some inconsistencies between some of these models.

I believe this solves my issue. At least I know what's going wrong now and to some extent why.

Thanks for your time and tips!

----- Original message -----
From: BALATON Zoltan <balaton@eik.bme.hu>
To: Jesse Millwood <jesse_dev@fastmail.com>
Cc: qemu-ppc@nongnu.org
Subject: Re: Cannot Access Memory
Date: Tuesday, October 05, 2021 9:02 PM

On Tue, 5 Oct 2021, Jesse Millwood wrote:
> Thanks for the int suggestion. These tracing flags are really useful. I added the int one and got the following:
>
> Raise exception at fff80000 => 0000000e (00)
> invalid/unsupported opcode: 00 - 00 - 00 - 00 (00000000) 00000000
> Raise exception at 00000000 => 00000060 (21)
> Raise exception at 00000000 => 00000060 (21)
> Raise exception at 00000000 => 00000060 (21)
> Raise exception at 00000000 => 00000060 (21)
>
> So it looks like the 0xe is the exception that happens at my pc, 
> 0xfff80000. It looks like that 0xe corresponds to the exception vectors 
> definitions enum in ppc/cpu.h? So that 0xe would be an instruction tlb 
> miss? Then the others at 0x60 would be Hypervisor emulation assistance? 
> That doesn't seem right.

Tho others after invalid instruction don't matter as that's just a result 
of trying to execute the non-existent handler for the exception you get 
first. Things have gone astray after that so that does not matter any 
more, the problem is before that. I'd expect that to result in program 
exception for illegal instruction at 0, not sure how you get 0x60 instead 
but it's already wrong that it can't get the first instruction so the rest 
does not really matter.

> Good find with the mmubooke_create_initial_mapping() suggestion. That function seems to be doing the following:
> - ps = 0x10
> - size = 0x800 (the ps shifted for the tsize field)
> - tlb mmu assist 1
>  - Looks like it is setting the valid bit and setting the tlb entries to 16KB
> - tlb mmu assist 2
> - tlb mmu assist 7_3 (I'm not entirely sure why this is 7_3 but I can only guess this is the mas3 register?)
>  - Seems to set the User read/write/execute bits and supervisor read, write, execute bits
>
> It looks like TLBnCFG_N_ENTRY is set to 0xfff
> So it looks like I would have 0xfff x 16000 entries? So then would only 65MB of memory be mapped then off the bat?

I don't know. Maybe try to print the dt_end in 
booke206_initial_map_tsize() which it says is the top address it's trying 
to map. If this is less than the end of your executable then that's the 
problem. Not sure how this should work. Also your image may expect a 
different machine than what's emulated by the e500 in QEMU so maybe it 
would work differently on real machine. It may help to know how it's 
working on real machine then you can compare that with what happens on 
QEMU. You may need to implement a model of that machine to get a firmware 
image working as the generic e500 machine may not be what it expects to 
run on.

Other than -d flags you can also look at trace-events file in the 
directory where the source for the part you're interested in is and can 
enable those with for example -rrace enable="ppc_excp*" to get more info. 
Or sometimes there are debug defines at the beginning of some files that 
one can enable.

Regards,
BALATON Zoltan




reply via email to

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