-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RISCV] running zephyr scheduler in user-/supervisor mode (instead of machine mode)? #68133
Comments
Random notes:
I think moving Zephyr from m-mode to s-mode when available should be rather |
Thank you for your notes. I mostly agree with it.
Regarding the zephyr fully in user mode. I think of an oportunity where user interrupts can be used exactly the same way like in machine mode. instead of MTVEC = > UTVEC; MSTATUS = > USTATUS; MRET => URET, ... and so on. Additonally I was wondering, if I would propose changes in that way and create a PR, would that be in the range of acceptable, or rejected, because of any strategic / theoretical / conceptional reasons. |
Right. If UTVEC and friends are implemented then MSTATUS/SSTATUS/USTATUS
And then only a few corner cases are conditionally selected with However, given this is deep architecture stuff, we'd need a way for CI to |
It may also need some m-mode/s-mode starting code to prepare the forwarding/delegating of interrupts from machine to user and also take care of actual timer setup (user may not have access to it directly). additionally I m wonding if syscall like openSBI could be used to communicate between user mode and machine mode supervisor. |
If you decide to use https://github.com/riscv-software-src/opensbi, it will takeover/hande the M-mode, leaving you with S and U mode for the OS. |
yes, then zephyr OS will run S or U mode then. ex. running a save device with secure/certified drivers and user zephyr OS for application. additionally the user zephyr OS will be compatible to any host providing the opensbi interface. |
Just to note, I don't thing there is an equivalent to |
The |
checklist for changes
... in progress |
Really cool! Let me know if there is anything you want tested from my side. I just so happen to have a board with a heterogenous core-complex sitting on my desk 😃 |
zephyr has the option to be compiled for |
Enabling |
Zephyr does not compile user space application and kernel separately.
The "user space" in Zephyr is simply a way to isolate some threads by
granting them a minimum amount of system privileges at run time. System
call numbers are therefore only an internal implementation mechanism and
not meant to be a public interface.
|
Yes, thats correct, the idea is as follows:
communication from USER to MACHINE via openSBI currently zephyr is not meant to make use of the USER mode at all, but would be great to have the option to do that. update to get the ball rolling, we could start to prepare zephyr to be able to run in USER mode, ... |
By my opinion, what would be great, is to introduce (make use) of S-mode, as defined in |
Agree. There are architectures with Machine / Supervisor / User mode or a subset (Machine / User) of it. So for first start, zephyr should be able to run in any mode Machine or Supervisor or User mode. |
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user mode. the idea is:
PR: #76682 notes: I tested both: starting zephyr in machine mode and user mode. works for me. |
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user mode. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]>
just added #76682 drivers for openSBI running in qemu (
finally run in qemu:
|
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Hey @tswaehn a quick update. I thought I would update here instead of spamming the PR. I am working on the Qemu side of things now. Zephyr's toolchain cannot compile openSBI as it requires Position Independent Execution (-fPIE, -pie). HOWEVER, openSBI provides binaries as assets hanging off their GitHub repository. These could possibly be pulled in as a module or blob (or the repo could be forked into ZephyrProject, whatever is the correct thing to do). Anyway, as I see it, that aspect will have to be a separate PR. in fact, I would imagine getting this support will end up being 3/4 PR's Here is the output of SMP boot in S mode: OpenSBI v1.2
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : Microchip PolarFire(R) SoC
Platform Features : medeleg
Platform HART Count : 5
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 1000000Hz
Platform Console Device : mmuart
Platform HSM Device : mpfs_hsm
Platform PMU Device : ---
Platform Reboot Device : mpfs_reset
Platform Shutdown Device : mpfs_reset
Firmware Base : 0xa000000
Firmware Size : 144 KB
Runtime SBI Version : 1.0
Domain0 Name : root
Domain0 Boot HART : 1
Domain0 HARTs : 1,2,3,4
Domain0 Region00 : 0x0000000002008000-0x000000000200bfff (I)
Domain0 Region01 : 0x0000000002000000-0x0000000002007fff (I)
Domain0 Region02 : 0x000000000a000000-0x000000000a03ffff ()
Domain0 Region03 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain0 Next Address : 0x0000000080000000
Domain0 Next Arg1 : 0x000000000a02534a
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Domain1 Name : zephyr
Domain1 Boot HART : 1
Domain1 HARTs : 1*,2*,3*,4*
Domain1 Region00 : 0x000000000a000000-0x000000000a03ffff ()
Domain1 Region01 : 0x0000000000000000-0xffffffffffffffff (R,W,X)
Domain1 Next Address : 0x0000000080000000
Domain1 Next Arg1 : 0x000000000a02534a
Domain1 Next Mode : S-mode
Domain1 SysReset : yes
Boot HART ID : 1
Boot HART Domain : zephyr
Boot HART Priv Version : v1.10
Boot HART Base ISA : rv64imafdc
Boot HART ISA Extensions : none
Boot HART PMP Count : 16
Boot HART PMP Granularity : 4
Boot HART PMP Address Bits: 36
Boot HART MHPM Count : 2
Boot HART MIDELEG : 0x0000000000000222
Boot HART MEDELEG : 0x000000000000b109
*** Booting Zephyr OS build v3.7.0-783-g7ccbee350c0f ***
Calculate first 240 digits of Pi independently by 16 threads.
Pi value calculated by thread #0: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #1: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #2: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #3: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #4: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #5: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #6: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #7: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #8: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #9: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #10: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #11: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #12: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #13: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #14: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
Pi value calculated by thread #15: 314159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316
All 16 threads executed by 4 cores in 41 msec For anyone else thats interested, the commits for the above are here: https://github.com/polarfire-soc/zephyr/commits/wip-zephyr-smode/ |
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Hey @tswaehn another positive update: using the opensbi firmware binaries found here: https://github.com/riscv-software-src/opensbi/releases/download/v1.5.1/opensbi-1.5.1-rv-bin.tar.xz here is my command: /mnt/dev/z_workspace$ qemu-system-riscv64 -machine virt -nographic -m 256 -bios opensbi-1.5.1-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin -kernel build/zephyr/zephyr.elf OpenSBI v1.5.1
____ _____ ____ _____
/ __ \ / ____| _ \_ _|
| | | |_ __ ___ _ __ | (___ | |_) || |
| | | | '_ \ / _ \ '_ \ \___ \| _ < | |
| |__| | |_) | __/ | | |____) | |_) || |_
\____/| .__/ \___|_| |_|_____/|____/_____|
| |
|_|
Platform Name : riscv-virtio,qemu
Platform Features : medeleg
Platform HART Count : 1
Platform IPI Device : aclint-mswi
Platform Timer Device : aclint-mtimer @ 10000000Hz
Platform Console Device : semihosting
Platform HSM Device : ---
Platform PMU Device : ---
Platform Reboot Device : syscon-reboot
Platform Shutdown Device : syscon-poweroff
Platform Suspend Device : ---
Platform CPPC Device : ---
Firmware Base : 0x80000000
Firmware Size : 327 KB
Firmware RW Offset : 0x40000
Firmware RW Size : 71 KB
Firmware Heap Offset : 0x49000
Firmware Heap Size : 35 KB (total), 2 KB (reserved), 10 KB (used), 23 KB (free)
Firmware Scratch Size : 4096 B (total), 408 B (used), 3688 B (free)
Runtime SBI Version : 2.0
Domain0 Name : root
Domain0 Boot HART : 0
Domain0 HARTs : 0*
Domain0 Region00 : 0x0000000000100000-0x0000000000100fff M: (I,R,W) S/U: (R,W)
Domain0 Region01 : 0x0000000002000000-0x000000000200ffff M: (I,R,W) S/U: ()
Domain0 Region02 : 0x0000000080040000-0x000000008005ffff M: (R,W) S/U: ()
Domain0 Region03 : 0x0000000080000000-0x000000008003ffff M: (R,X) S/U: ()
Domain0 Region04 : 0x000000000c400000-0x000000000c5fffff M: (I,R,W) S/U: (R,W)
Domain0 Region05 : 0x000000000c000000-0x000000000c3fffff M: (I,R,W) S/U: (R,W)
Domain0 Region06 : 0x0000000000000000-0xffffffffffffffff M: () S/U: (R,W,X)
Domain0 Next Address : 0x0000000080200000
Domain0 Next Arg1 : 0x0000000082200000
Domain0 Next Mode : S-mode
Domain0 SysReset : yes
Domain0 SysSuspend : yes
Boot HART ID : 0
Boot HART Domain : root
Boot HART Priv Version : v1.10
Boot HART Base ISA : rv64imafdch
Boot HART ISA Extensions : zicntr
Boot HART PMP Count : 16
Boot HART PMP Granularity : 2 bits
Boot HART PMP Address Bits: 54
Boot HART MHPM Info : 0 (0x00000000)
Boot HART Debug Triggers : 0 triggers
Boot HART MIDELEG : 0x0000000000001666
Boot HART MEDELEG : 0x0000000000f0b509
*** Booting Zephyr OS build v3.7.0-2103-g906c6d99dea2 ***
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64!
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64!
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64!
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64!
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64!
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64!
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64!
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64!
thread_a: Hello World from cpu 0 on qemu_riscv64!
thread_b: Hello World from cpu 0 on qemu_riscv64! So the good news is for single core applications, using the firmware provided by opensbi works fine. The bad news is that for SMP, the generic platform, opensbi uses a lottery for the boot hart, which is no good for Zephyr. I have tested multiple times and each time, the boot hart in opensbi is different. as always, my commits are here: https://github.com/polarfire-soc/zephyr/commits/wip-zephyr-smode/ |
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Before that fix, zephyr was able to start only in machine mode. With that fix, zephyr can start (as guest) in user or supervisor mode. Defined new board type qemu_riscv32/qemu_virt_riscv32/opensbi Drivers for running zephyr in supervisor with qemu included. Fixes zephyrproject-rtos#68133 Signed-off-by: Sven Ginka <[email protected]> Signed-off-by: Sven Ginka <[email protected]>
Is your feature request related to a problem? Please describe.
It appears to me that on RISCV the expectation is, that zephyr runs in machine mode (guessing from here). I am wondering why this is needed. Lets say we have a supervisor running multiple applications, where zephyr is just one of them. Then zephyr should be able to run in USER mode.
Describe the solution you'd like
I think it could be accomplished when using a generic hook for the "yield" and a generic hook for a timer interrupt. Additionally the switching routine could use defined CSRs (currently fixed machine mode CSRs are expected). Speaking of that actually there are RISCV cpus, where not all CSRs are implemented ex: mscratch might not be available => want to redefine and use another CSR instead?
Describe alternatives you've considered
Copy paste the RISCV architecture, name it RISCV-IN-USER and replace the interrupt/ ECALL handling. Which might a bit messy - because actually only the interrupt handling need to be changed a little.
Did anybody already think about that - or is that completely non-sense?
The text was updated successfully, but these errors were encountered: