porting freebsd on xen on arm - how to support your os as xen

20
Porting FreeBSD on Xen on ARM How to support your OS as Xen ARM guest Julien Grall [email protected] FOSDEM – February 1, 2014

Upload: vuongtu

Post on 28-Dec-2016

228 views

Category:

Documents


2 download

TRANSCRIPT

Porting FreeBSD on Xen on ARMHow to support your OS as Xen ARM guest

Julien [email protected]

FOSDEM – February 1, 2014

Intro Requirements FreeBSD Conclusion

Xen

I Type-I hypervisor

I Support for ARM v7 and ARM v8 with virtualization extensionI Hardware support

I Fast ModelI Versatile Express Cortex A15I Arndale BoardI Allwinner A20/A31 (SunXi)I TI OMAP5I Applied Micro X-GeneI Calxeda ”Midway”I ...

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 2/ 20

Intro Requirements FreeBSD Conclusion

Xen architecture

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 3/ 20

Intro Requirements FreeBSD Conclusion

ARM architecture

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 4/ 20

Intro Requirements FreeBSD Conclusion

Xen on ARM architecture

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 5/ 20

Intro Requirements FreeBSD Conclusion

Requirements

I Guest boot ABI

I Device tree support

I Specific memory attribute

I Xen PV driversI Copy of xen/include/public

I arch-arm.h provides hypercalls convention

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 6/ 20

Intro Requirements FreeBSD Conclusion

Guest boot ABI

Interface of the virtual machine:I Linux zImage

I Specific values on some registersI r0 = 0I r1 = 0xffffffffI r2 = Device Tree physical address

I MMU disabledI Data cache disabledI Instruction cache in an unknown state

I ELF (in progress)

I Use of PSCI to bring up secondary CPUs

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 7/ 20

Intro Requirements FreeBSD Conclusion

Device Tree

I Basic Device Tree generated by the toolstack which contains:I CPUsI MemoryI TimerI GICI Hypervisor

I The guest should use the values from the Device Tree

I Working group to decide core bindings

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 8/ 20

Intro Requirements FreeBSD Conclusion

Memory

I Before calling hypercalls the OS must enable:I MMUI Data and Instruction cache

I RAM attribute should be Write-Through or Write-Back

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 9/ 20

Intro Requirements FreeBSD Conclusion

Xen PV drivers

I Xen core architectureI XenstoreI Grant-TableI Event-channel

I Xen device driversI ConsoleI BlockI NetworkI Framebuffer (need to recompile QEMU)

I Drivers already available under BSD license in FreeBSD

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 10 / 20

Intro Requirements FreeBSD Conclusion

DOM0

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 11 / 20

Intro Requirements FreeBSD Conclusion

DOM0 (2)

I First guest to startI Nearly every devices are assigned to DOM0

I Serial, IOMMU, Timer and GIC are used by XenI Some devices can be blacklisted by Xen

I DOM0 kernel should use the Device Tree to discover thehardware

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 12 / 20

Intro Requirements FreeBSD Conclusion

FreeBSD on Xen

I Support for x86 PVHVM

I Experimental support for ARM architectureI Patch series to support Xen on ARM guest

I New kernel config XENHVM createdI Non-modular guest configuration (memory, ...)I Only support for guest with 1 VCPU

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 13 / 20

Intro Requirements FreeBSD Conclusion

Device Tree

Device Tree is hardcoded:

I Missing support to use Device Tree with Linux boot ABII FreeBSD enumerates the devices in DTB order

I The interrupt controller should be loaded firstI Discussion made on FreeBSD ML ARM

I Some bindings are differentI FreeBSD only supports interrupt with 2 cellsI Work in progress to handle 3 cellsI On-going work to standardize the bindings

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 14 / 20

Intro Requirements FreeBSD Conclusion

Memory

I Modify early page table attributeI Use Write-Back instead of Write-ThroughI On-going patch to resolve the issue in Xen

I Create a new pmap function to map memory region cacheable

I FreeBSD requests to be loaded at a specific physical address

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 15 / 20

Intro Requirements FreeBSD Conclusion

Xen PV drivers

I Update interface headers to Xen 4.4I FreeBSD is based on Xen 4.2 headersI ARM interface was not set in stone

I Drivers common with x86I Use the right xen type (xen pfn t, xen ulong t,...)I Support for HVM in console drivers

I Rework event channel handlingI was x86 specificI still missing features

I suspend/resumeI pirq

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 16 / 20

Intro Requirements FreeBSD Conclusion

What needs to be done?

FreeBSD port to Xen on ARM has started. Still to come...

I Add support for Device Tree loading via Linux Boot ABI

I Uniform Xen drivers across the different architecture

I Guest SMP support

I DOM0 support

I Stability

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 17 / 20

Intro Requirements FreeBSD Conclusion

OS supported by Xen

I Out-of-boxI Linux based distribution

I Future supportI FreeBSDI Erika OSI other *BSD

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 18 / 20

Intro Requirements FreeBSD Conclusion

Questions?

I Xen devel ML: [email protected]

I Xen user ML: [email protected]

I #xenarm on freenode

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 19 / 20

Intro Requirements FreeBSD Conclusion

Fin

FOSDEM – February 1, 2014 Porting FreeBSD on Xen on ARM 20 / 20