opensbi icon indicating copy to clipboard operation
opensbi copied to clipboard

added mmu support for k210

Open lizhirui opened this issue 4 years ago • 13 comments

added mmu support for k210(Sv39 Mode,0x00000000~0xffffffff are directly mapped to physical address) and set boot address to 0x80030000

lizhirui avatar Apr 16 '21 05:04 lizhirui

@damien-lemoal wow, would this help linux be able to use virtual memory?

pdp7 avatar Apr 16 '21 18:04 pdp7

The patch title should be "Add ..." instead of "Added ...". It would also be nice if you could git send-email the patch to opensbi mailing list ([email protected]). That makes commenting easier for some... github web interface is not the preferred comment interface for many :)

damien-lemoal avatar Apr 16 '21 23:04 damien-lemoal

@pdp7 Yes, this would definitely allow running the regular MMU kernel. Sean is working on U-Boot improvements for the K210, and now that the kernel has SD card support for all K210 boards, swap could even be used :) So all the pieces are here for MMU kernel on K210.

However, we are talking about a non-standard MMU here. So Anup (opensbi) and Palmer (kernel) will need some convincing to take patches to enable such non-standard HW support. My opinion is that if there is a valid use case for it, we should make an effort to take that support. In the case of the K210, it certainly would make things easier (c.f. my ongoing fight with elf2flt and flatbin support for NOMMU userspace...). But I am not entirely convinced that "it is easier" is a valid argument enough as a justification for the non-standard HW support. If we start opening that door, things could start getting ugly very quickly. C.f. Palmer comments recently on the kernel list about support for non-frozen ISA extensions. We (the risc-v dev community) need to carefully consider this and come up with a reasonable policy.

damien-lemoal avatar Apr 16 '21 23:04 damien-lemoal

The patch title should be "Add ..." instead of "Added ...". It would also be nice if you could git send-email the patch to opensbi mailing list ([email protected]). That makes commenting easier for some... github web interface is not the preferred comment interface for many :)

OK,I will do this next time.

lizhirui avatar Apr 17 '21 05:04 lizhirui

If i understand correctly, the K210 quirks because of K210 being based on riscv-privileged-v1.9.1 specification are not tackled here, correct? This has been outlined by @wangrunji0408 in rcore-os/rCore.

parasew avatar May 01 '21 17:05 parasew

If i understand correctly, the K210 quirks because of K210 being based on riscv-privileged-v1.9.1 specification are not tackled here, correct? This has been outlined by @wangrunji0408 in rcore-os/rCore.

Yes, correct. The ISA v1.9 specifications are not the ratified version so generally not supported anywhere. Both OpenSBI and the kernel do not support this draft version. As a result, Linux support for the K210 is NOMMU only as the v1.9 mmu specifications are not compatible with the ratified version 2.0.

damien-lemoal avatar May 05 '21 00:05 damien-lemoal

I can compile with these changes and get MMU support on Linux?

JoyBed avatar Aug 03 '22 17:08 JoyBed

This never got accepted - so I guess there is no way to have MMU Linux on Sipeed Maixduino?

z3cko avatar Jun 25 '23 21:06 z3cko

This never got accepted - so I guess there is no way to have MMU Linux on Sipeed Maixduino?

In theory, that can be implemented, just it's a non-standard implementation.

lizhirui avatar Jun 26 '23 02:06 lizhirui

If you have code to enable mmu in opensbi and Linux, try submitting it and see what happens... The non-standard mmu may be a blocker, or not. In the past, it was.

damien-lemoal avatar Jun 26 '23 02:06 damien-lemoal

If you have code to enable mmu in opensbi and Linux, try submitting it and see what happens... The non-standard mmu may be a blocker, or not. In the past, it was.

I just have an implementation with RT-Thread Smart

lizhirui avatar Jun 26 '23 04:06 lizhirui

@lizhirui did you ever send your patch to the e-mail list?

z3cko avatar Jun 28 '23 05:06 z3cko

There is a recent discussion on HN that I started, with some additional K210 context

z3cko avatar Jun 28 '23 07:06 z3cko