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.

  Maciej

Reply via email to