29
Xen on ARM Cortex A15 Stefano Stabellini

XenSummit NA 2012: Xen on ARM Cortex A15

Embed Size (px)

DESCRIPTION

During the last few months of 2011 the Xen Community started an effort to port Xen to ARMv7 with virtualization extensions, using the Cortex A15 processor as reference platform.The new Xen port is exploiting this set of hardware capabilities to run guest VMs in the most efficient way possible while keeping the ARM specific changes to the hypervisor and the Linux kernel to a minimum. Developing the new port we took the chance to remove legacy concepts like PV or HVM guests and only support a single kind of guests that is comparable to "PV on HVM" in the Xen X86 world. This talk will explain the reason behind this and other design choices that we made during the early development process and it will go through the main technical challenges that we had to solve in order to accomplish our goal. Notable examples are the way Linux guests issue hypercalls and receive event channels notifications from Xen.

Citation preview

Page 1: XenSummit NA 2012: Xen on ARM Cortex A15

Xen onARM Cortex A15

Stefano Stabellini

Page 2: XenSummit NA 2012: Xen on ARM Cortex A15

Why?

Why?

Page 3: XenSummit NA 2012: Xen on ARM Cortex A15
Page 4: XenSummit NA 2012: Xen on ARM Cortex A15

Quad-core1.4 GHzCortex-A9

smartphones:getting smarter

Page 5: XenSummit NA 2012: Xen on ARM Cortex A15

ARM Serverscoming to market

4GB RAM, 4 cores per node3 x 6 x 4 x 4 = 288 cores

single node virtualization -manageability -

Page 6: XenSummit NA 2012: Xen on ARM Cortex A15

Challenges

Another PVOPs infrastructure for ARM in Linux?

How would the Linux Community react?

Page 7: XenSummit NA 2012: Xen on ARM Cortex A15
Page 8: XenSummit NA 2012: Xen on ARM Cortex A15

ARMv7 virtualization extensions to the rescue!

"The ARM Architecture virtualization extension and Large Physical Address Extension (LPAE) enable the efficient implementation of virtual machine hypervisors for ARM architecture compliant processors."

Page 9: XenSummit NA 2012: Xen on ARM Cortex A15

● exploit the hardware as much as possible

● one type of guest○ no PVOPs○ use PV interfaces for IO

● Rearchitected for the modern age:○ no QEMU○ no compat code○ no shadow pagetables

Design goals

Page 10: XenSummit NA 2012: Xen on ARM Cortex A15

One type of guest to rule them all

Page 11: XenSummit NA 2012: Xen on ARM Cortex A15

One type of guestLike PV guests do it:● support booting from a supplied kernel● no emulated devices● use PV interfaces for IO

no need for QEMU

Page 12: XenSummit NA 2012: Xen on ARM Cortex A15

Like HVM guests do it:● no PV MMU calls: exploit HW nested paging● same entry point on native and on Xen● use Device Tree to discover Xen presence● no unnecessary devices in the Device Tree● simple device emulation can be done in Xen

no need for QEMU

One type of guest

Page 13: XenSummit NA 2012: Xen on ARM Cortex A15

Exploit the hardwareExploit the hardware virtualization extensions support as much as possible:

● hypervisor mode● MMU: second stage translation

○ no PV MMU calls: no need for PVOPs○ no shadow pagetables: -10721 lines of code!!

● hypercall: HVC● generic timer

Page 14: XenSummit NA 2012: Xen on ARM Cortex A15

General Interrupt Controlleran interrupt controller with virtualization support● use the GIC to inject hardware interrupts into

dom0● use the GIC to inject event notifications into

any guest domains with Xen support○ use PPI 31○ advertise the IRQ via Device Tree

● No special Xen entry point● No Xen platform PCI device

Page 15: XenSummit NA 2012: Xen on ARM Cortex A15

The hypercall calling conventionthe hypercall interface:● hvc instruction● hypervisor specific imm 0xEA1● hypercall arguments passed on registers

Page 16: XenSummit NA 2012: Xen on ARM Cortex A15

a 64 bit "ready" ABI● a single hypercall ABI for 32 bit guests and

64 bit guests

no compat code in Xen○ 2600 lines of code lighter

Page 17: XenSummit NA 2012: Xen on ARM Cortex A15

a 64 bit "ready" ABImake unsigned long and pointers 8

bytes sized and 8 bytes aligned everywhere

Page 18: XenSummit NA 2012: Xen on ARM Cortex A15

a 64 bit "ready" ABI

Xen

Guest8 bytes unsigned long8 bytes aligned---8 bytes pointer8 bytes aligned

HVC | r0 | r1 | r2 | r3 | r4 | ... | r12

Page 19: XenSummit NA 2012: Xen on ARM Cortex A15

a 64 bit "ready" ABI

Xen

Guest

HVC | r0 | r1 | r2 | r3 | r4 | ... | r12

8 bytes unsigned long8 bytes aligned---8 bytes pointer8 bytes aligned

32 bit register

XEN_GUEST_HANDLE_PARAM XEN_GUEST_HANDLE

Page 20: XenSummit NA 2012: Xen on ARM Cortex A15

a 64 bit "ready" ABImake unsigned long and pointers 8

bytes sized and 8 bytes aligned everywhere

Collateral damage: a 1547 lines patch to

s/XEN_GUEST_HANDLE/XEN_GUEST_HANDLE_PARAM/

Page 21: XenSummit NA 2012: Xen on ARM Cortex A15

Device TreeUse Device Tree to describe the virtual platform

hypervisor {compatible = "xen,xen", "xen,xen-4.2";reg = <0xb0000000 0x20000>;interrupts = <1 15 0xf08>;

};

Page 22: XenSummit NA 2012: Xen on ARM Cortex A15

Device TreeUse Device Tree to describe the virtual platform

hypervisor {compatible = "xen,xen", "xen,xen-4.2";reg = <0xb0000000 0x20000>;interrupts = <1 15 0xf08>;

};

event notifications IRQ

Grant tablememory area

version of the Xen ABI

Page 23: XenSummit NA 2012: Xen on ARM Cortex A15

● exploit the hardware as much as possible

● one type of guest○ no PVOPs○ use PV interfaces for IO

● Rearchitected for the modern age:○ no QEMU○ no compat code○ no shadow pagetables

Design goals:did we meet them?

Page 24: XenSummit NA 2012: Xen on ARM Cortex A15

● exploit the hardware as much as possible

● one type of guest○ no PVOPs○ use PV interfaces for IO

● Rearchitected for the modern age:○ no QEMU○ no compat code○ no shadow pagetables

Design goals:did we meet them?

64 bit ready ABI

nested paging in HW

no device emulation, use DT to describe the HW

nested paging in HW, same entry point as native

no device emulation, use DT to describe the HW

Page 25: XenSummit NA 2012: Xen on ARM Cortex A15

Status of the Project● Xen and Dom0 booting

● VM creation and destruction

● PV console, disk and network working

● Xen ARM patches mostly upstream

● Linux Xen ARM patches v3 sent to LKML

Page 26: XenSummit NA 2012: Xen on ARM Cortex A15

Open Questions: ACPI"Modern PCs are horrible. ACPI is a complete design disaster in every way. But we're kind of stuck with it."Linus Torvalds

● ACPI? Really??

● What about Device Tree?

● Do we need an ACPI parser in Xen?drivers/acpi: 110418 lines of code!Equivalent to 38% of the Xen (x86 and ARM) code base!!

Page 27: XenSummit NA 2012: Xen on ARM Cortex A15

Open Questions: UEFI"EFI is this other [...] brain-damage (the first one being ACPI). "Linus Torvalds

● Xen as Portable Executable

● Grub2 on ARM: multiboot2?

● UEFI runtime services○ PVOPS? Trap and emulate?

Page 28: XenSummit NA 2012: Xen on ARM Cortex A15

Open Questions:Client Devices● lack of a reference architecture● UEFI Secure Boot● Windows 8

Page 29: XenSummit NA 2012: Xen on ARM Cortex A15