Friday, August 19, 2016

Final report of GSOC 2016 : RTEMS improvemt for Jailhouse hypervisor

Introduction and Project idea
 Jailhouse and RTEMS are open source project.
Jailhouse(https://github.com/siemens/jailhouse) is Linux-based partitioning hypervisor. 
initial version of Jailhouse developed x86 BSP. RTEMS also support x86, RTEMS can be easily as Jailhouse “inmate”. But Jailhouse needs required step for porting. The project aims to Integration, Merging, Fixup of existing support for Jailhouse and port support for other architectures (ARM). Other specifics of the project can be obtained from my proposal.

Status of Work Done
the work is divided into 2 part of bsp and starting jailhouse. And the individual bsps have 4 steps for being patched.

1) x86 : It is completed about 50 %

 (a) booting rtems for jailhouse.
   jailhouse use 0x000f0000 for start16addr ( it should move to jailhouse.cfg )
   pc386.cfg :


   jailhouse doesn't support video.
   start.S :
  
  jailhouse doesn't use local segment descriptor and A20
  start16.S :
 
 jailhouse starts inmate at 0x10000c to start of 32 bit code. and stack pointer address is 0xe0000
  start16.S :
 
   when rtems bsp reset on jailhouse, rtems just halt.


 jailhouse allocate 8Mb memory for rtems inmate cell.
 bspgetworkarea.c :


 
 (b) change pci port
   jailhouse only uses polled serial 1 and use 115200 baud rate.

   conscfg.c :

   last of bsp_console_select, end of libbsp/shared/console_select.c :
   
 (c) change lagacy pic(8259a) to apic(x2apic) to support timer and network.
 
Jailhouse non-root cells must use the xAPIC as minimum but should use
the x2APIC for best performance. 
When wanting to use x2apic, you need to enable it in the APIC BASE MSR. The BIOS may or may not have done this already on real hardware. Jailhouse behaves like a BIOS here in that it does enable x2apic when Linux was using it as well. So you just leave the APIC BASE MSR untouched and can even access the APIC in both ways then (memory mapped or via rdmsr/wrmsr) - Jailhouse maps one on the other.

in irq.c : you should remove all lagacy pic control things and add ioapic like


  for IOAPIC, bsae address is 0xfec00000
  irq.h : ( it should move to ioapic.h )
 
  in irq_asm.S, ack x2apic irq
 
 
in ldsgs.S, 8259a must not be used.

 
Work left: 
 (a) I should change config of jailhouse to execute rtems on jailhouse to test.
 (b) in patch files, rtems was patched to use early printk.
 (c)  In my cace, I use x408 port for pm timer but it can be changed by cases. I should check more.
 (d) rtems use e100, I have only e1000 device. It may change e100 to e1000.

2) arm : I couldn't start this part.


The workflow
The workflow in this project is important because you allow sufficient hardware support to execute jailhouse on qemu. When it comes to hardware spec to execute jailhouse successfully, you should use latest linux on native not vmware or qemu and latest version of qemu. For porting apic to RTEMS, latest qemu is required. A detailed explanation of this follows 

STEP-1:  install jailhouse and start example non-root cell on jailhouse.

STEP-2:  patch rtems-4.11 with origin patch files to test files.

STEP-3:  patch master rtems with origin patch.

in my proposal, I would use rtems-4.11 to execute patched rtems on jailhouse. bacause master rtems has lots of different with rtems-4.11, I change my workflow to patch master rtems.

there are many changes. rtems-4.11 uses 8259s pci but master rtems uses 8259a. cpu.h is removed. clock timer functions are changed. 

in pcibios.c of patch files, many functions are changed but master rtems use already same codes alread changed.

Explanation:
STEP-1: 

I wrote a instruction at this blog before.


jailhouse is still being developed. when you execute qemu with kvm options, there are different between when I executed jailhouse 2 month before and now. you can use iommu, intremap=on by using qemu 2.7.0-rc3. then you can see all of specifications is satisfied distincted from not using iommu,intremap=on.


STEP 2:

I wrote a instruction at this blog before.


STEP 3:

I worte a the strategy of patching rtems at this blog before


rtems-jailhouse-wonjun is my repository to patch rtems for jailhouse.

I am still working to execute rtems as inmate on jailhouse.
I am modifying jailhouse inmate/lib files to change communication address for rtems.
( 0x100000 to 0x900000 )

jailhouse-wonjun is my repository to execute rtems as inmate

Thank you for patient reading.

No comments:

Post a Comment