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: Tue, 16 Mar 2021 12:10:09 +0900

Hi, Peter Maydell,

I tried setting the page table entry for the first 32 MB to read-only and 
removed the NS (not secure)flag, so that it's secure range.(actually this is 
the right setting).  After this setting the 'is_romd' flag is now true, and 
this made mmio call back not called for the read I guess. 
Now sctlr_el3 doesn't make exception and proceeds further.
Thanks!

Chan Kim

> -----Original Message-----
> From: ckim@etri.re.kr <ckim@etri.re.kr>
> Sent: Friday, March 12, 2021 6:56 PM
> To: 'Peter Maydell' <peter.maydell@linaro.org>
> Cc: 'qemu-discuss' <qemu-discuss@nongnu.org>
> Subject: RE: Get_page_addr_code_hostp function returns -1 after turning
> MMU on
> 
> 
> 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]