qemu-discuss
[Top][All Lists]
Advanced

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

RE: Get_page_addr_code_hostp function returns -1 after turning MMU on


From: ckim
Subject: RE: Get_page_addr_code_hostp function returns -1 after turning MMU on
Date: Fri, 12 Mar 2021 18:56:17 +0900

Hi, Peter Maydell

Thanks for the help.
I set the page tables for address 0 ~ 0x08000000 as read-only. (4 2MB blocks)
In the tlb_set_page_with_attrs function, is_ram is false, but is_romd is also 
false.
Is this normal? Because of this,  memory_region_section_get_iotlb is being 
called.
(Shouldn't_romd be true?)
and arm_cpu_tlb_fill (cc->tlb_fill) returns true. I'm not sure if this is 
normal or wrong.
Inside the get_page_addr_code_hostp fuction, after the tlb_fill is finished(as 
above), this entry->addr_code & TLB_MMIO makes it return -1.
Yes it's not RAM I want it to be ROM. (set the page table so).
the .text codes and page tables are all in the flash.
Why would I be trying to write to that area? 
Please give me some more advice and I'll try to analyze the tlb fill operation.
(I'm using -drive if=pflash,file=pflash.img,format=raw,readonly=on method to 
run the code in EL3, if it's releavant)

Thank you!

Chan Kim

> -----Original Message-----
> From: Peter Maydell <peter.maydell@linaro.org>
> Sent: Friday, March 12, 2021 5:50 PM
> To: Chan Kim <ckim@etri.re.kr>
> Cc: qemu-discuss <qemu-discuss@nongnu.org>
> Subject: Re: Get_page_addr_code_hostp function returns -1 after turning
> MMU on
> 
> On Fri, 12 Mar 2021 at 08:34, <ckim@etri.re.kr> wrote:
> >
> > When briefly following it with debugger, I found that in the function
> > below the condition “entry->addr_code & TLB_MMIO” is true and it
> > returns -1. (by the way I set the first 2MB’s to read-only blocks,
> > because they are flash/ROM)
> >
> > Could anyone explain to me what this condition is? Just a brief
> explanation will be much appreciated.
> >
> >     if (unlikely(entry->addr_code & TLB_MMIO)) {        <======= returns -
> 1
> >
> >         /* The region is not backed by RAM.  */
> 
> It's what the comment says : the physical address that the virtual address
> has been resolved to has something there, but it's not RAM.
> It's a device. (It might also be the flash device in 'programming'
> mode, ie where you've written to the flash device region, which the flash
> thinks is you sending it a command to erase or rewrite blocks.)
> 
> -- PMM







reply via email to

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