Re: [PATCH v2 31/34] ARM: mmu32: read TTB value from register

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

 



On 19.05.23 09:44, Sascha Hauer wrote:
> On Fri, May 19, 2023 at 08:53:34AM +0200, Ahmad Fatoum wrote:
>> On 17.05.23 16:39, Sascha Hauer wrote:
>>> On Wed, May 17, 2023 at 03:58:01PM +0200, Ahmad Fatoum wrote:
>>>> On 17.05.23 11:03, Sascha Hauer wrote:
>>>>> Instead of relying on a variable for the location of the TTB which we
>>>>> have to initialize in both PBL and barebox proper, just read the value
>>>>> back from the hardware register.
>>>>
>>>> Why not initialize on first call to get_ttb()?
>>>
>>> get_ttb() doesn't have access to endmem which we would need to get the
>>> address for the ttb.
>>>
>>> Also we have the value in the hardware register, why not use it?
>>
>> I meant initialization using the hardware register.
> 
> You mean something like:
> 
> static uint32_t *ttb;
> 
> static inline uint32_t *get_ttb(void)
> {
> 	if (!ttb)
> 		ttb = (uint32_t *)(get_ttbr() & ~0x3fff);
> 
> 	return ttb;
> }
> 
> If yes, I don't know what this is good for. If no, please explain, I
> don't seem to understand what you mean.

That's what I mean yes (but with ttb's scope limited to get_ttb()).

There are instances where get_ttb is called in a loop. Having a static
variable would mimic more closely the code we have before. I see now that
the Cortex-A9 TRM lists MRS cycle time as single cycle, so the static
variable seems indeed unnecessary.

> 
> Sascha
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |





[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux