xiaoxiang781216 edited a comment on pull request #5782: URL: https://github.com/apache/incubator-nuttx/pull/5782#issuecomment-1077383465
> I think that we are responsible for the SBI confusion, so let me explain a bit where we are. > > The OpenSBI library, which we added (by @eenurkka) is not really used by NuttX itself. It would be possible to use that to provide the SBI for nuttx in theory, but would require quite a lot of extra framework to bind it to nuttx. > > So why did we add the support for building the full OpenSBI library to the NuttX build scripts then? > > We have a NuttX based bootloader application for MPFS, which can either boot another NuttX or also uBoot&Linux (actually on in parallel on different harts on the same soc even). Now, Linux requires a lot more from the SBI than the NuttX, such as a bunch of extra trap handlers (unaligned access etc.), detection of hart capabilities etc. etc. So we are only passing the OpenSBI libarary from our bootloader app to uBoot and Linux after NuttX has initialized the HW. The underlying idea behind integrating the build scripts into NuttX was that maybe the OpenSBI could be usable for others as well... > > What @pussuw has implemented here is really clever; NuttX running in S-mode only needs the timer interrupt handling and hart id reading in M-mode. So it makes a world of sense to just make this very minimal "sbi" which is tailored for NuttX. But let's not mix these two SBIs at this point. It is most likely not feasible to take in the whole OpenSBI into NuttX use (since most of it is not really needed - it is way too big and generic). > Since OpenSBI is the standard way to expose M-mode functionality to S-mode, what I suggest it's that we use OpenSBI API definition, but write our own minimal implementation. This is just like how NuttX implementation POSIX API, which is much smaller than other(FreeBSD/Linux) implementation. It's always good to avoid the private(ad hoc) interface definition, especially a well defined interface(OpenSBI here) already exist. If you don' want to implement the minimal OpenSBI this time. It's better to use other hardware timer for OS scheduler. Since most SoC has a dozen of hardware timer, it isn't too difficult to find a free one. Actually, many chips supported NuttX use the chip specific hardware timer, instead of ARM recommend SYSTICK or general timer. > So I would suggest to let these live side-by-side for now, even though they partially implement the same thing. Enabling S-mode in NuttX is really only needed when you want to enable address environments (in CONFIG_BUILD_KERNEL), and what @pussuw has done here enables just that and nothing extra. It's fine to put the implementation to different location, the key point is that the interface follow OpenSBI definition. It's also good to make the timer selectable since it may more suitable to use other hardware timer on different chip. -- 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