[PATCH 2/7] efi: Allow runtime relocate to be disabled

Jiaxun Yang jiaxun.yang at flygoat.com
Tue Jun 4 12:45:05 CEST 2024



在2024年6月1日六月 下午5:37,Maciej W. Rozycki写道:
> On Tue, 21 May 2024, Jiaxun Yang wrote:
>
>> It's nearly impossible to run MIPS OS in virtual (or paged)
>> segment. All MIPS OS and bootloaders are running in KSEG/XKPHYS
>> segment, which directly mapping lower bits of virtual address
>> into physical address. So I suppose set_virtual_address_map
>> is unnecessary on MIPS because the mapping for U-Boot is
>> always here and can't be disabled in hardware.
>
>  Surely it's possible to run a MIPS OS kernel mapped via page tables, it 
> is what KSEG2 and XKSEG segments can be used for with 32-bit and 64-bit 
> configurations respectively.  Both CP0.Context and CP0.XContext registers 
> support placing page tables in virtual memory too, KSEG2 and XKSEG 
> segments respectively, and a nested TLB refill exception is supported.  
> Only the TLB exception handlers themselves obviously have to be unmapped.
>
>  These features have hardly ever been used (original MIPSCO OS reportedly 
> was an example, perhaps unsurprisingly), but they are there and it cannot 
> be stated that it is nearly impossible to make use of them.  It is not.
>
>  Note that the MIPS architecture does not have a real mode, but its 
> purpose is served by the unmapped segments, which are also convenient to 
> use for various reasons by OSes that otherwise do virtual addressing.
>
>  Also for the record there are SGI IP27 Linux configurations that run from 
> XKSEG rather than XKPHYS (running from KSEG2 used to be supported too, but 
> has been since dropped), via a wired page mapping.
>
>  I guess none of this really matters for U-Boot, but let's get the facts 
> straight so that people who are not MIPS experts are not led into false 
> understanding.
Hi Maciej,

Thanks for your insights!

I was trying to implement a mapped kernel on MIPS M5150 and faced many
many issues like wired entry + FTLB is not big enough to hold page table,
thus I came out with this conclusion.

Thanks for letting me know it's possible!

For U-Boot this is irrelevant as the main concern is whether KSEG0
is working after hand over control to OS. Disabling KSEG0 is impossible
without SegCtl.

Anyway, nice to have you here.

Thanks
>
>   Maciej

-- 
- Jiaxun


More information about the U-Boot mailing list