Wednesday, August 17, 2016

refactoring patch files and where rtems should be modified for jailhouse.

I got 5 patch files from Jan.
0001-RTEMS-Jailhouse-port-1st-batch-including.patch
0002-Add-PCI-management-using-port-I-O.patch
0003-Fix-build-problem-missing-defines-in-cpu.h.patch
0004-Add-IOAPIC-for-PCI-interrupts-and-networking-with-e1.patch
0005-Generalize-some-HW-interfaces-for-Qemu-and-real-HW-e.patch

I should patch 4 points, booting rtems, timer ( select timer and calibrate ), pci ( uart ), networking.

And I should write test code to test whether patched rtems works successfully.

1. booting rtems.

I add jailhouse BSP variant. instead of modifying the make/custom/pc386.cfg file (patch 0001), a new jailhouse.cfg would be added that sets the build rules as needed for jailhouse.

for example

jailhouse.cfg :
   start16addr=0x00097c00 -> 0x000f0000



2. pci

in 0001 patch, patched rtems supports early printk() with no malloc
bsp_start_default() function is modified ( i386/pc386/startup/bspstart.c )

patched rtems is removed _IBMPC_initVideo because jailhouse dosn't support video  (start.S)


3. timer ( select timer and calibrate )
I also add local apic timer option for clock driver. There appears to be conflicting definitions for some of the APIC macros between libbsp/i386/shared/irq/apic.h and the changes made for jailhouse.

because jailhouse non-root cells must use the xAPIC as minimum but should use the x2APIC for best performance, I add local apic option to use x2apic.

pc386/configure.ac :

#define CLOCK_DRIVER_USE_LAPIC $CLOCK_DRIVER_USE_LAPIC
RTEMS_BSPOPTS_SET([CLOCK_DRIVER_USE_LAPIC,[*],[0])
RTEMS_BSPOPTS_HELP([CLOCK_DRIVER_USE_LAPIC],
[ if enabled, the clock driver will be set for jailhouse and use x2apic,
  it is not completed yet.
]

jailhouse use APIC Timers per tick and TSC/APIC Timer ratio to calibrate timer.
I patch ckinit.c file

add function

static void calibrate_pmtimer(void)
> calibrate apic timer / tsc cycle per tick using pm timer


set address and port address for jailhouse

Comm-region/PM-Timer port. ( 0x90000/0x608 )


4. networking
 ....


5. test

I am writing test code divided into three stages.

1) pci - check whether printk function works successfully or not.
2) timer - check ioapic and lapic
3) networking

No comments:

Post a Comment