pussuw commented on pull request #5782:
URL: https://github.com/apache/incubator-nuttx/pull/5782#issuecomment-1077331325


   > Why not implement OpenSBI API in M-mode required by S-mode NuttX directly? 
I think is more simple and general than a private MiniSBI. We can write from 
scratch in M-mode NuttX without link OpenSBI package and implement function and 
argument which actually used by S-mode NuttX. The benefit of this approach is:
   > 
   >     1. One copy code in S-mode can work with M-mode NuttX or other OpenSBI 
compliant implementation
   > 
   >     2. M-mode NuttX can enable your minimal OpenSBI implementation, or 
switch to the full feature OpenSBI package
   > 
   > 
   > Both side get the flexibility and avoid to lock to some special 
implementation.
   
   It can be done. The skeleton for this pretty much exists in this patch 
already.
   
   The abstraction point in this case would be the riscv_mcall.c module:
   
   ```
   void riscv_mcall_ack_timer(void)
   {
      mcall0(MCALL_ACK_TIMER);
   }
   ```
   
   Instead of directly calling mcall0 it would call some "openSBI_wrap_timerxx" 
function, which would ecall into OpenSBI which would do the work.
   
   This requires obviously that OpenSBI is built & linked with NuttX (or 
separately) and placed into memory somehow. NuttX would then be provided as a 
payload binary to OpenSBI. Adding this infrastructure is a lot of work.
   
   > Actually, you can split the patch into at least two part:
   > 
   >     1. M-mode add the minimal OpenSBI implementation
   > 
   >     2. S-mode implementation
   
   Yes, of course. I can do the split. 
   
   At this point I would like to clarify, that the task given to me is "enable 
CONFIG_BUILD_KERNEL=y" for RISC-V on MPFS platform, and S-mode is just one of 
the requirements to get that done. What this patch includes does not break any 
existing code or what we already have. It was made just as an enabler to get 
CONFIG_BUILD_KERNEL working with the minimal amount of extra effort.
   
   I can do the abstraction / enabler to use OpenSBI instead of my "MiniSBI" 
but at this point I will not implement full OpenSBI support to NuttX as it is a 
lot of extra work and does not bring me any closer to the target / task I have 
been given.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to