Hi, Everyone:
As you may know, the RTEMS has a paravirtualization project in GSoC, and hence we are trying to adapt the POK to a hypervisor, This year we are focus on interrupt virtualization. The detail is post in my blog[1], but I'd like to give you a brief introduced here:
This year, the jobs including two aspect, one is implement a Hypercall system, the other is develop a interrupt handling system in POK with the function we design in Hypercall system.
The implementation of Hypercall system will not be difficult, but we should take heed about the reusability and flexibility of the code, since we certainly will reuse the job and extend the functionality of Hypercall system.
In the other hand, we need to design a interrupt dandling system to delivery the interrupt. As we discussed, the following should be the workflow of interruption:
1. When the RTEMS startup, It should register the interrupt by hypercall, then we will bond the corresponding interruption to this partition that the RTEMS locals in.
2. When an interrupt(or events including traps like a floating point error), the POK will intercept the interrupt, do some common handler and decide to whether delivery it or not by the type of this interrupt.For example, if the time interrupt occurs, the POK will deal it in kernel, but then send a dummy clock interrupt to every RTEMS.
3. If a interrupt should be delivery to Partitions(RTEMS), then the POK kernel compact the context of the interruption, and send the package of interrupt to corresponding Partitions, then mask a bit in some mechanism, to notify the Partitions that there happens a interrupt when you are suspended.
4. When the Partitions being evoked, it should check the mask bit, if the mask bit is settled, then using the native interrupt handler in RTEMS(but should change some sensitive function by Hypercall in VIrtualization Layer).
So, as we can see, in this section, we need to design a system to save and delivery the interruptions.This system is called event channel in XEN, and Phillpp named it as "notify", which is more accurate(because there are no necessary to implement a complicated system like event channel). About this part, I have upload a blog to describe, and I have conclude the to-dos as following:
1. Build a structure to store the context of interrupt.
2. Build a structure to mark that there is an event pending.
3. When the partition(RTEMS) resume, check the value of the bit.
4. Design a callback function mechanism. Including the operation of register an event and callback function. The register of events should bind the corresponding partitions.
5. In the callback function, we should invoke the normal interrupt handler in RTEMS, let the RTEMS deal with this interrupt.
6. Adapt the interrupt structure in POK, make it able to bond a Partitions.
The POK, which is obey to ARINC-653, already supplied series mechanism to communicate between partitions or threads in a single process. I want to find some mechanism could use to communicate between POK kernel and Partitions, so we can adapt it directly. I have read the examples in POK and DO NOT find any example about it. If the POK did not support such mechanism, the mostly worse, we have to write a notify system from nothing.
--
Best Regards.
Youren Shen.