5 ms·
Status of Linux MMU on RISC-V Sipeed M1 / Maixduino / K210
There are not a lot of RISC-V dts in the Linux Kernel, but the K210 is (see https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/riscv/boot/dts/canaan?h=v6.3.9 )
Since it has been discussed several times on HN, i wanted to ask who is using the K210 in their projects, and if anyone has managed to run Linux kernel with MMU? There have been patches submitted to OpenSBI (https://github.com/oscourse-tsinghua/rcore_plus/issues/34 ) but it seems no one is running Linux kernel MMU with K210 (Sipeed M1)?
- brucehoult 3y agoK210 was a great chip four years ago. The problem with running Linux on it is not the MMU -- which follows the RISC-V priv arch 1.9.1 spec precisely, as far as anyone can tell -- but the mere 8 MB of RAM, which is not enough for any modern Linux kernel. It seems strongly likely that Canaan simply took a snapshot of Berkeley Rocket at some date (when it still implemented priv arch 1.9.1 not the ratified 1.10), including MMU, FPU, L1 cache etc and added their peripherals to it to make the SoC. It doesn't have a "buggy MMU" (or anything else). It's just older spec. Linux used to run on Rocket with priv arch 1.9.1. It's not hard to find the tags in Berkeley or SiFive repos (of course it was not upstreamed). The problem is it wanted a lot more than 8 MB RAM! These days you're better off using the BL808 (Sipeed M1s Dock, Pine Ox64) which is about the same performance as the K210, or the CV1800B (Milk-V Duo) which is considerably faster. Both have 64 MB of on-chip RAM, enough to boot modern server Linux with plenty to spare, and at $8 to $10 cost less than the K210 boards. And of course they have the ratified-spec MMU. And also, incidentally, 128 bit RVV 0.7.1 vector units.
- opengears 3y agoI have recently discovered "rustsbi-k210" which describes itself as "Kendryte K210 SBI support using RustSBI, provides privileged spec 1.12 environment by emulating it using 1.9.1". https://github.com/rustsbi/rustsbi-k210 https://github.com/rustsbi/rustsbi-k210 Anyone has experience with this?
- opengears 3y agoThanks a lot for this longer answer, this helps a lot in understanding the situation better! Would you mind sharing more information about "rocket"? (are you referring to the SOC generator?) I am really interested to see what still can be done with the Maixduino, as we have a larger amount of units (if someone reads this and is interested, i can post you a board - @audiores on twitter)
- brucehoult 3y agoYes, Rocket Chip generator. From Berkeley, now managed by The CHIPS Alliance. SiFive still contributes improvements to it, I think. K210 seems to be exactly pre May 2017 (when priv 1.10 was published) Rocket plus their "AI" stuff. SiFive's FE310 in HiFive1, Sparkfun RED-V and others is also basically pure Rocket. It's from 2016, but is basically only User mode instructions plus a couple of CSRs, so priv arch is irrelevant. SiFive's FU540 quad core 1.5 GHz Linux chip (HiFive Unleashed) is almost pure Rocket with ethernet and DRR IP added and some GPIO, SPI, UART etc. It came out in early 2018 and implements priv arch 1.10,so is still compatible with the eventual ratified spec. Even the SiFive U74 in the VisionFive 2, Star64, Milk-V Mars etc is mostly Rocket, with the pipeline expanded to dual-issue. But the ALU, MMU, FPU, instruction decoder etc is essentially Rocket. You could certainly run a pretty nice Linux-like OS in 8 MB on the K210. xv6 is interesting, and runs on it, but I think doesn't use the MMU. Maybe a mid-90s Linux could be ported. From sometime just after ISAs other than x86 started to be supported. Linus originally developed Linux on a 4 MB machine, and it could boot with 2 MB. I have a MaixDuino. And a Maix Amigo. They don't get much love now with all the new stuff coming out :-(