SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
Porting Xen on ARM to a new SOC
Julien Grall <julien.grall@arm.com>
Xen Developper Summit 2016
© ARM 2016
Xen Architecture
2 © ARM 2016
Virtualization
ARMv7 and ARMv8
Provides virtualization for
Timer
Interrupt Controller
Page Table
3 © ARM 2016
Virtualization - 2
4 © ARM 2016
Xen on ARM
5 © ARM 2016
Dom0
First guest to start
Known as the hardware domain
Nearly all devices are assigned to DOM0
Serial, IOMMU, Timer and GIC are used by Xen
Some devices can be blacklisted by Xen
DOM0 kernel should discover devices via ACPI or Device Tree
6 © ARM 2016
Groundwork
7 © ARM 2016
Preparation before porting
Before starting to port Xen, some groundwork needs to be done:
Check the hardware support
Having the firmware/bootloader to boot the image at EL2
Having an OS supporting the targeted platform
8 © ARM 2016
Hardware
ARMv7 and ARMv8 processor with virtualization extension
General Interrupt Controller (GIC) v2 or later
9 © ARM 2016
Firmware and bootloader
The firmware or bootloader must drop into EL2 (hypervisor) before starting Xen.
Some vendors locked down the firmware/bootloader to drop into Non-secure EL1 (kernel mode).
Hypervisor Call instruction (HVC) must be enabled.
It can be done by setting SCR EL3.HCE (AArch64) or SCR.HCE (AArch32) to 1.
10 © ARM 2016
Firmware tables
Xen supports the below firmware tables out-of-box:
Device Tree
https://www.devicetree.org/
ACPI 6.0 and onwards
http://www.uefi.org/acpi/specs
UEFI only
Technical preview in Xen 4.7
DOM0 with ACPI support has been merged for Linux 4.8
11 © ARM 2016
DOM0 kernel
Before adding Xen in the equation, it is highly recommended to get the kernel booting natively
DOM0 support is upstreamed in Linux
Adding support to any other kernel is easy
See http://www.slideshare.net/xen_com_mgr/bsdcan-2015-how-to-port-your-bsd
12 © ARM 2016
DOM0 kernel - Linux
DOM0 support has been added in Linux 3.8
It is recommended to use the latest release when possible
Minimal list of options to enable:
CONFIG_XEN_DOM0=y
CONFIG_XEN=y
CONFIG_XEN_BLKDEV_BACKEND=y
CONFIG_XEN_NETDEV_BACKEND=y
CONFIG_HVC_XEN=y
CONFIG_XEN_BACKEND=y
CONFIG_XENFS=y
CONFIG_XEN_SYS_HYPERVISOR=y
13 © ARM 2016
Porting Xen
14 © ARM 2016
A single binary to rule them all
A single Xen binary can
be loaded via different methods (e.g multiboot, UEFI).
boot on multiple hardware.
15 © ARM 2016
It is recommended to use the latest
version of Xen when porting to a new
SOC.
16 © ARM 2016
Early debugging with Xen
Xen provides early printk to debug crash before the UART driver is initialized.
Only available when CONFIG DEBUG=y
Xen will not be portable, intented only for development
UART selected on the build command line with
CONFIG EARL PRINTK=mach
CONFIG EARL PRINTK= INC>, BASE ADDRESS>, OTHER OPTIONS>
More details on
http://xenbits.xen.org/docs/unstable/misc/arm/early-printk.txt
17 © ARM 2016
Early debugging with Xen - 2
Major UARTs supported: pl011, 8250,...
8250: CONFIG EARL PRINTK=8250, BASE ADDRESS>, REG SHIFT>
REG SHIFT> is the left-shift to apply to register offsets within the uart (optional).
pl011: CONFIG EARL PRINTK=pl011, BASE ADDRESS>, BAUD RATE>
BAUD RATE is optional. We recommend to let the bootloader setting the baud rate.
18 © ARM 2016
Getting the firmware to load Xen and DOM0
The firmware needs to load in memory Xen, DOM0 kernel and potentially others modules (e.g
initramfs, XSM...). There are 3 methods to do it:
Multiboot
UEFI
GRUB via UEFI (work in progress)
19 © ARM 2016
Loading Xen and DOM0 using multiboot
Multiboot is a protocol based on Device Tree.
It is used to describe where the kernel, initramfs... reside in memory.
An example to generate multiboot nodes with U-Boot can be found on the wiki.
https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions#
Boot_Modules
20 © ARM 2016
Loading Xen and DOM0 via UEFI
On AArch64, Xen is built as an EFI application.
A configuration file is used to describe:
The command line
The binaries to load (device tree, kernel, initramfs...) in memory.
The configure file could be passed to the EFI application using the parameter -cfg=myxen.cfg
https://xenbits.xenproject.org/docs/unstable/misc/efi.html
21 © ARM 2016
Loading Xen and DOM0 via UEFI - Example
Configuration file example for UEFI:
[global]
default=model
[model]
options=console=dtuart conswitch=x dom0_max_vcpus=2 dtuart=serial0
kernel=vmlinuz console=hvc0 earlycon=pl011,0xf2a00000 root=/dev/ram1 rootwait
ramdisk=initrd.img
dtb=model.dtb
22 © ARM 2016
Troubleshooting - Xen is not entering in EL2
Xen will panic when it is not entered in EL2 with the following message:
For AArch32:
- Xen must be entered in Hyp mode -
- Please update the bootloader -
For AArch64:
- Xen must be entered in NS EL2 mode -
- Please update the bootloader -
23 © ARM 2016
What to do if Xen is not entered in EL2?
Even if the hardware supports virtualization extensions, the firmware/bootloader may be configured
to enter the kernel/hypervisor in EL1.
Find a version which dropped in EL2.
Find the source code and modify it to enter the hypervisor in EL2.
24 © ARM 2016
Platform specific code
In most of the case, platform specific code is not necessary.
Hooks in the core code is provided specific initialization is required.
Platform code resides in xen/arch/arm/platforms
25 © ARM 2016
Platform specific code - 2
List of callbacks available:
/* Platform initialization */
int (*init)(void);
int (*init_time)(void);
int (*smp_init)(void);
int (*cpu_up)(int cpu);
/* Specific mapping for dom0 */
int (*specific_mapping)(struct domain *d);
/* Platform reset */
void (*reset)(void);
/* Platform power-off */
void (*poweroff)(void);
/*
* Platform blacklist devices
* List of devices which must not pass-through to a guest
*/
const struct dt_device_match *blacklist_dev;
26 © ARM 2016
UART support
Xen has multiple UART drivers (pl011, 8250,...).
They can be found in xen/drivers/char.
The UART used by Xen will not be available for DOM0.
A virtual UART will shadow the real one.
Useful if the kernel use early printk
Very basic: Only write is supported
The UART configuration can be read from:
the parameter dtuart=cfg
stdout-path in the device tree
The SCPR table in ACPI
27 © ARM 2016
Debugging DOM0 kernel
Xen console
Switch from DOM0 console to Xen console via CTLR-a three times
Useful key
0 Dump Dom0 vCPUs
q Domains information
e Event channel information
R Reboot the machine
28 © ARM 2016
Using Xen debugging facilities in the kernel
Use of hvc 0xFFXX
Supported when Xen is compiled with debug=y
Requires to modify the kernel
0xFFEX
0xFFFD
0xFFFE
0xFFFF
Print the register rX/xX
Print the program counter
Print the character stored in r0/x0
Dump the state of the vCPU
29 © ARM 2016
SMP support
Xen is able to bring up secondary processors via different protocols:
Power State Coordination Interface (PSCI)
This is the recommended protocol to bring up CPU.
PSCI 0.1, 0.2 and 1.0 supported
It can be used for rebooting the platform (PSCI >= 0.2).
Spin table (AArch64 only)
Platform specific bringup (AArch32 only)
This protocol should be avoided in favor of PSCI.
It can be implemented with the callcack smp init and cpu up.
30 © ARM 2016
Upstreaming
Even if your platform does not require platform specific code, it is recommended to
Document the step to boot Xen on the wiki.
Testing new release of Xen.
31 © ARM 2016
Where to ask questions?
devel ML: xen-devel@lists.xenproject.org
#xenarm or #xendevel on freenode
32 © ARM 2016
Questions?
33 © ARM 2016
The trademarks featured in this presentation are registered and/or unregistered trademarks of ARM limited
(or its subsidiaries) in the EU and/or elsewhere. All rights reserved. All other marks featured may be
trademarks of their respective owners.
Copyright © 2016 ARM Limited
© ARM 2016

Weitere ähnliche Inhalte

Was ist angesagt?

Fosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using VirtualizationFosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using Virtualization
The Linux Foundation
 
Virtualization - Kernel Virtual Machine (KVM)
Virtualization - Kernel Virtual Machine (KVM)Virtualization - Kernel Virtual Machine (KVM)
Virtualization - Kernel Virtual Machine (KVM)
Wan Leung Wong
 

Was ist angesagt? (20)

XPDDS18: Design and Implementation of Automotive: Virtualization Based on Xen...
XPDDS18: Design and Implementation of Automotive: Virtualization Based on Xen...XPDDS18: Design and Implementation of Automotive: Virtualization Based on Xen...
XPDDS18: Design and Implementation of Automotive: Virtualization Based on Xen...
 
Xen Memory Management
Xen Memory ManagementXen Memory Management
Xen Memory Management
 
Embedded Hypervisor for ARM
Embedded Hypervisor for ARMEmbedded Hypervisor for ARM
Embedded Hypervisor for ARM
 
LCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted FirmwareLCU13: An Introduction to ARM Trusted Firmware
LCU13: An Introduction to ARM Trusted Firmware
 
ELC21: VM-to-VM Communication Mechanisms for Embedded
ELC21: VM-to-VM Communication Mechanisms for EmbeddedELC21: VM-to-VM Communication Mechanisms for Embedded
ELC21: VM-to-VM Communication Mechanisms for Embedded
 
Fosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using VirtualizationFosdem 18: Securing embedded Systems using Virtualization
Fosdem 18: Securing embedded Systems using Virtualization
 
XPDDS17: PVH Dom0: The Road so Far - Roger Pau Monné, Citrix
XPDDS17: PVH Dom0: The Road so Far - Roger Pau Monné, CitrixXPDDS17: PVH Dom0: The Road so Far - Roger Pau Monné, Citrix
XPDDS17: PVH Dom0: The Road so Far - Roger Pau Monné, Citrix
 
From printk to QEMU: Xen/Linux Kernel debugging
From printk to QEMU: Xen/Linux Kernel debuggingFrom printk to QEMU: Xen/Linux Kernel debugging
From printk to QEMU: Xen/Linux Kernel debugging
 
Xen Debugging
Xen DebuggingXen Debugging
Xen Debugging
 
Safety-Certifying Open Source Software: The Case of the Xen Hypervisor
Safety-Certifying Open Source Software: The Case of the Xen HypervisorSafety-Certifying Open Source Software: The Case of the Xen Hypervisor
Safety-Certifying Open Source Software: The Case of the Xen Hypervisor
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Xen Hypervisor.pptx
Xen Hypervisor.pptxXen Hypervisor.pptx
Xen Hypervisor.pptx
 
Linux PV on HVM
Linux PV on HVMLinux PV on HVM
Linux PV on HVM
 
Virtualization with KVM (Kernel-based Virtual Machine)
Virtualization with KVM (Kernel-based Virtual Machine)Virtualization with KVM (Kernel-based Virtual Machine)
Virtualization with KVM (Kernel-based Virtual Machine)
 
Xen in Safety-Critical Systems - Critical Summit 2022
Xen in Safety-Critical Systems - Critical Summit 2022Xen in Safety-Critical Systems - Critical Summit 2022
Xen in Safety-Critical Systems - Critical Summit 2022
 
LFCollab14: Xen vs Xen Automotive
LFCollab14: Xen vs Xen AutomotiveLFCollab14: Xen vs Xen Automotive
LFCollab14: Xen vs Xen Automotive
 
XPDDS18: CPUFreq in Xen on ARM - Oleksandr Tyshchenko, EPAM Systems
XPDDS18: CPUFreq in Xen on ARM - Oleksandr Tyshchenko, EPAM SystemsXPDDS18: CPUFreq in Xen on ARM - Oleksandr Tyshchenko, EPAM Systems
XPDDS18: CPUFreq in Xen on ARM - Oleksandr Tyshchenko, EPAM Systems
 
Virtualization - Kernel Virtual Machine (KVM)
Virtualization - Kernel Virtual Machine (KVM)Virtualization - Kernel Virtual Machine (KVM)
Virtualization - Kernel Virtual Machine (KVM)
 
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime RipardKernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
Kernel Recipes 2017 - An introduction to the Linux DRM subsystem - Maxime Ripard
 
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSEXPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
XPDDS19: Core Scheduling in Xen - Jürgen Groß, SUSE
 

Andere mochten auch

OSCON16: Analysis of the Xen code review process: An example of software deve...
OSCON16: Analysis of the Xen code review process: An example of software deve...OSCON16: Analysis of the Xen code review process: An example of software deve...
OSCON16: Analysis of the Xen code review process: An example of software deve...
The Linux Foundation
 
LinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and BeyondLinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and Beyond
The Linux Foundation
 

Andere mochten auch (20)

XPDS16: Keeping coherency on ARM - Julien Grall, ARM
XPDS16: Keeping coherency on ARM - Julien Grall, ARMXPDS16: Keeping coherency on ARM - Julien Grall, ARM
XPDS16: Keeping coherency on ARM - Julien Grall, ARM
 
Fosdem 17 - Towards a HVM-like Dom0 for Xen
Fosdem 17 - Towards a HVM-like Dom0 for XenFosdem 17 - Towards a HVM-like Dom0 for Xen
Fosdem 17 - Towards a HVM-like Dom0 for Xen
 
XPDS16: High-Performance Virtualization for HPC Cloud on Xen - Jun Nakajima &...
XPDS16: High-Performance Virtualization for HPC Cloud on Xen - Jun Nakajima &...XPDS16: High-Performance Virtualization for HPC Cloud on Xen - Jun Nakajima &...
XPDS16: High-Performance Virtualization for HPC Cloud on Xen - Jun Nakajima &...
 
XPDS16: libvirt and Tools: What's New and What's Next - James Fehlig, SUSE
XPDS16: libvirt and Tools: What's New and What's Next - James Fehlig, SUSEXPDS16: libvirt and Tools: What's New and What's Next - James Fehlig, SUSE
XPDS16: libvirt and Tools: What's New and What's Next - James Fehlig, SUSE
 
XPDS16: Patch review for non-maintainers - George Dunlap, Citrix Systems R&D...
 XPDS16: Patch review for non-maintainers - George Dunlap, Citrix Systems R&D... XPDS16: Patch review for non-maintainers - George Dunlap, Citrix Systems R&D...
XPDS16: Patch review for non-maintainers - George Dunlap, Citrix Systems R&D...
 
XPDS16: Scope and Performance of Credit-2 Scheduler. - Anshul Makkar, Ctirix...
XPDS16:  Scope and Performance of Credit-2 Scheduler. - Anshul Makkar, Ctirix...XPDS16:  Scope and Performance of Credit-2 Scheduler. - Anshul Makkar, Ctirix...
XPDS16: Scope and Performance of Credit-2 Scheduler. - Anshul Makkar, Ctirix...
 
XPDS16: CPUID handling for guests - Andrew Cooper, Citrix
XPDS16:  CPUID handling for guests - Andrew Cooper, CitrixXPDS16:  CPUID handling for guests - Andrew Cooper, Citrix
XPDS16: CPUID handling for guests - Andrew Cooper, Citrix
 
XPDS16: Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
XPDS16:  Hypervisor-based Security: Vicarious Learning via Introspektioneerin...XPDS16:  Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
XPDS16: Hypervisor-based Security: Vicarious Learning via Introspektioneerin...
 
XPDS16: Making Migration More Secure - John Shackleton, Adventium Labs
XPDS16: Making Migration More Secure - John Shackleton, Adventium LabsXPDS16: Making Migration More Secure - John Shackleton, Adventium Labs
XPDS16: Making Migration More Secure - John Shackleton, Adventium Labs
 
XPDS16: Xen Orchestra: building a Cloud on top of Xen - Olivier Lambert & Jul...
XPDS16: Xen Orchestra: building a Cloud on top of Xen - Olivier Lambert & Jul...XPDS16: Xen Orchestra: building a Cloud on top of Xen - Olivier Lambert & Jul...
XPDS16: Xen Orchestra: building a Cloud on top of Xen - Olivier Lambert & Jul...
 
XPDS16: Live Migration of vGPU - Xiao Zheng, Intel Asia-Pacific Research & De...
XPDS16: Live Migration of vGPU - Xiao Zheng, Intel Asia-Pacific Research & De...XPDS16: Live Migration of vGPU - Xiao Zheng, Intel Asia-Pacific Research & De...
XPDS16: Live Migration of vGPU - Xiao Zheng, Intel Asia-Pacific Research & De...
 
Fosdem17 - Mixed License FOSS Projects
Fosdem17 - Mixed License FOSS ProjectsFosdem17 - Mixed License FOSS Projects
Fosdem17 - Mixed License FOSS Projects
 
XPDS16: Xen Scalability Analysis - Weidong Han, Zhichao Huang & Wei Yang, Huawei
XPDS16: Xen Scalability Analysis - Weidong Han, Zhichao Huang & Wei Yang, HuaweiXPDS16: Xen Scalability Analysis - Weidong Han, Zhichao Huang & Wei Yang, Huawei
XPDS16: Xen Scalability Analysis - Weidong Han, Zhichao Huang & Wei Yang, Huawei
 
XPDS16: Xen Development Update
XPDS16: Xen Development UpdateXPDS16: Xen Development Update
XPDS16: Xen Development Update
 
XPDS16: Live scalability for vGPU using gScale - Xiao Zheng, Intel
XPDS16: Live scalability for vGPU using gScale - Xiao Zheng, IntelXPDS16: Live scalability for vGPU using gScale - Xiao Zheng, Intel
XPDS16: Live scalability for vGPU using gScale - Xiao Zheng, Intel
 
OSCON16: Analysis of the Xen code review process: An example of software deve...
OSCON16: Analysis of the Xen code review process: An example of software deve...OSCON16: Analysis of the Xen code review process: An example of software deve...
OSCON16: Analysis of the Xen code review process: An example of software deve...
 
LinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and BeyondLinuxCon Japan 13 : 10 years of Xen and Beyond
LinuxCon Japan 13 : 10 years of Xen and Beyond
 
XPDS14 - Xen on ARM: Status and Performance - Stefano Stabellini, Citrix
XPDS14 - Xen on ARM: Status and Performance - Stefano Stabellini, CitrixXPDS14 - Xen on ARM: Status and Performance - Stefano Stabellini, Citrix
XPDS14 - Xen on ARM: Status and Performance - Stefano Stabellini, Citrix
 
Linaro connect : Introduction to Xen on ARM
Linaro connect : Introduction to Xen on ARMLinaro connect : Introduction to Xen on ARM
Linaro connect : Introduction to Xen on ARM
 
Xen summit amd_2010v3
Xen summit amd_2010v3Xen summit amd_2010v3
Xen summit amd_2010v3
 

Ähnlich wie XPDS16: Porting Xen on ARM to a new SOC - Julien Grall, ARM

Xen Euro Par07
Xen Euro Par07Xen Euro Par07
Xen Euro Par07
congvc
 
Kernel compilation
Kernel compilationKernel compilation
Kernel compilation
mcganesh
 
4 implementation
4 implementation4 implementation
4 implementation
hanmya
 
Aix5[1].3+hacmp+oracle9 i+weblogic8.1安装实施报告
Aix5[1].3+hacmp+oracle9 i+weblogic8.1安装实施报告Aix5[1].3+hacmp+oracle9 i+weblogic8.1安装实施报告
Aix5[1].3+hacmp+oracle9 i+weblogic8.1安装实施报告
fm2008
 

Ähnlich wie XPDS16: Porting Xen on ARM to a new SOC - Julien Grall, ARM (20)

3. configuring a compute node for nfv
3. configuring a compute node for nfv3. configuring a compute node for nfv
3. configuring a compute node for nfv
 
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted FirmwareHKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
HKG15-505: Power Management interactions with OP-TEE and Trusted Firmware
 
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
ACRN vMeet-Up EU 2021 - Boot Process and Secure BootACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
ACRN vMeet-Up EU 2021 - Boot Process and Secure Boot
 
XPDS13: HVM Dom0 - Any unmodified OS as Dom0 - Will Auld, Intel
XPDS13: HVM Dom0 - Any unmodified OS as Dom0 - Will Auld, IntelXPDS13: HVM Dom0 - Any unmodified OS as Dom0 - Will Auld, Intel
XPDS13: HVM Dom0 - Any unmodified OS as Dom0 - Will Auld, Intel
 
Q2.12: Power Management Across OSs
Q2.12: Power Management Across OSsQ2.12: Power Management Across OSs
Q2.12: Power Management Across OSs
 
Xen Euro Par07
Xen Euro Par07Xen Euro Par07
Xen Euro Par07
 
ACRN vMeet-Up EU 2021 - installation and configuration introduction
ACRN vMeet-Up EU 2021 - installation and configuration introductionACRN vMeet-Up EU 2021 - installation and configuration introduction
ACRN vMeet-Up EU 2021 - installation and configuration introduction
 
Kernel compilation
Kernel compilationKernel compilation
Kernel compilation
 
4 implementation
4 implementation4 implementation
4 implementation
 
Release notes 3_d_v61
Release notes 3_d_v61Release notes 3_d_v61
Release notes 3_d_v61
 
BSDCan 2015: How to Port BSD as a Xen on ARM Guest
BSDCan 2015: How to Port BSD as a Xen on ARM GuestBSDCan 2015: How to Port BSD as a Xen on ARM Guest
BSDCan 2015: How to Port BSD as a Xen on ARM Guest
 
Aix5[1].3+hacmp+oracle9 i+weblogic8.1安装实施报告
Aix5[1].3+hacmp+oracle9 i+weblogic8.1安装实施报告Aix5[1].3+hacmp+oracle9 i+weblogic8.1安装实施报告
Aix5[1].3+hacmp+oracle9 i+weblogic8.1安装实施报告
 
TRENDnet IP Camera Multiple Vulnerabilities
TRENDnet IP Camera Multiple VulnerabilitiesTRENDnet IP Camera Multiple Vulnerabilities
TRENDnet IP Camera Multiple Vulnerabilities
 
Raspberry Pi tutorial
Raspberry Pi tutorialRaspberry Pi tutorial
Raspberry Pi tutorial
 
XPDDS17: PL011 UART Emulation in Xen on ARM - Bhupinder Thakur, Qualcomm Data...
XPDDS17: PL011 UART Emulation in Xen on ARM - Bhupinder Thakur, Qualcomm Data...XPDDS17: PL011 UART Emulation in Xen on ARM - Bhupinder Thakur, Qualcomm Data...
XPDDS17: PL011 UART Emulation in Xen on ARM - Bhupinder Thakur, Qualcomm Data...
 
Kdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysisKdump and the kernel crash dump analysis
Kdump and the kernel crash dump analysis
 
Building
BuildingBuilding
Building
 
ELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made SimpleELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made Simple
 
LFCOLLAB15: Xen 4.5 and Beyond
LFCOLLAB15: Xen 4.5 and BeyondLFCOLLAB15: Xen 4.5 and Beyond
LFCOLLAB15: Xen 4.5 and Beyond
 
Qemu device prototyping
Qemu device prototypingQemu device prototyping
Qemu device prototyping
 

Mehr von The Linux Foundation

Mehr von The Linux Foundation (20)

XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
XPDDS19: How TrenchBoot is Enabling Measured Launch for Open-Source Platform ...
 
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
XPDDS19 Keynote: Xen in Automotive - Artem Mygaiev, Director, Technology Solu...
 
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
XPDDS19 Keynote: Xen Project Weather Report 2019 - Lars Kurth, Director of Op...
 
XPDDS19 Keynote: Unikraft Weather Report
XPDDS19 Keynote:  Unikraft Weather ReportXPDDS19 Keynote:  Unikraft Weather Report
XPDDS19 Keynote: Unikraft Weather Report
 
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
XPDDS19 Keynote: Secret-free Hypervisor: Now and Future - Wei Liu, Software E...
 
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
XPDDS19 Keynote: Patch Review for Non-maintainers - George Dunlap, Citrix Sys...
 
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, BitdefenderXPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
XPDDS19: Memories of a VM Funk - Mihai Donțu, Bitdefender
 
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...OSSJP/ALS19:  The Road to Safety Certification: Overcoming Community Challeng...
OSSJP/ALS19: The Road to Safety Certification: Overcoming Community Challeng...
 
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making... OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
OSSJP/ALS19: The Road to Safety Certification: How the Xen Project is Making...
 
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, CitrixXPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
XPDDS19: Speculative Sidechannels and Mitigations - Andrew Cooper, Citrix
 
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltdXPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
XPDDS19: Keeping Coherency on Arm: Reborn - Julien Grall, Arm ltd
 
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
XPDDS19: QEMU PV Backend 'qdevification'... What Does it Mean? - Paul Durrant...
 
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&DXPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D
 
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM SystemsXPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
XPDDS19: [ARM] OP-TEE Mediator in Xen - Volodymyr Babchuk, EPAM Systems
 
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
XPDDS19: Bringing Xen to the Masses: The Story of Building a Community-driven...
 
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
XPDDS19: Will Robots Automate Your Job Away? Streamlining Xen Project Contrib...
 
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
XPDDS19: Client Virtualization Toolstack in Go - Nick Rosbrook & Brendan Kerr...
 
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information SecurityXPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
XPDDS19: Implementing AMD MxGPU - Jonathan Farrell, Assured Information Security
 
XPDDS19: Support of PV Devices in Nested Xen - Jürgen Groß, SUSE
XPDDS19: Support of PV Devices in Nested Xen - Jürgen Groß, SUSEXPDDS19: Support of PV Devices in Nested Xen - Jürgen Groß, SUSE
XPDDS19: Support of PV Devices in Nested Xen - Jürgen Groß, SUSE
 
XPDDS19: Application Agnostic High Availability Solution On Hypervisor Level ...
XPDDS19: Application Agnostic High Availability Solution On Hypervisor Level ...XPDDS19: Application Agnostic High Availability Solution On Hypervisor Level ...
XPDDS19: Application Agnostic High Availability Solution On Hypervisor Level ...
 

Kürzlich hochgeladen

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 

Kürzlich hochgeladen (20)

2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 

XPDS16: Porting Xen on ARM to a new SOC - Julien Grall, ARM

  • 1. Porting Xen on ARM to a new SOC Julien Grall <julien.grall@arm.com> Xen Developper Summit 2016 © ARM 2016
  • 3. Virtualization ARMv7 and ARMv8 Provides virtualization for Timer Interrupt Controller Page Table 3 © ARM 2016
  • 4. Virtualization - 2 4 © ARM 2016
  • 5. Xen on ARM 5 © ARM 2016
  • 6. Dom0 First guest to start Known as the hardware domain Nearly all devices are assigned to DOM0 Serial, IOMMU, Timer and GIC are used by Xen Some devices can be blacklisted by Xen DOM0 kernel should discover devices via ACPI or Device Tree 6 © ARM 2016
  • 8. Preparation before porting Before starting to port Xen, some groundwork needs to be done: Check the hardware support Having the firmware/bootloader to boot the image at EL2 Having an OS supporting the targeted platform 8 © ARM 2016
  • 9. Hardware ARMv7 and ARMv8 processor with virtualization extension General Interrupt Controller (GIC) v2 or later 9 © ARM 2016
  • 10. Firmware and bootloader The firmware or bootloader must drop into EL2 (hypervisor) before starting Xen. Some vendors locked down the firmware/bootloader to drop into Non-secure EL1 (kernel mode). Hypervisor Call instruction (HVC) must be enabled. It can be done by setting SCR EL3.HCE (AArch64) or SCR.HCE (AArch32) to 1. 10 © ARM 2016
  • 11. Firmware tables Xen supports the below firmware tables out-of-box: Device Tree https://www.devicetree.org/ ACPI 6.0 and onwards http://www.uefi.org/acpi/specs UEFI only Technical preview in Xen 4.7 DOM0 with ACPI support has been merged for Linux 4.8 11 © ARM 2016
  • 12. DOM0 kernel Before adding Xen in the equation, it is highly recommended to get the kernel booting natively DOM0 support is upstreamed in Linux Adding support to any other kernel is easy See http://www.slideshare.net/xen_com_mgr/bsdcan-2015-how-to-port-your-bsd 12 © ARM 2016
  • 13. DOM0 kernel - Linux DOM0 support has been added in Linux 3.8 It is recommended to use the latest release when possible Minimal list of options to enable: CONFIG_XEN_DOM0=y CONFIG_XEN=y CONFIG_XEN_BLKDEV_BACKEND=y CONFIG_XEN_NETDEV_BACKEND=y CONFIG_HVC_XEN=y CONFIG_XEN_BACKEND=y CONFIG_XENFS=y CONFIG_XEN_SYS_HYPERVISOR=y 13 © ARM 2016
  • 14. Porting Xen 14 © ARM 2016
  • 15. A single binary to rule them all A single Xen binary can be loaded via different methods (e.g multiboot, UEFI). boot on multiple hardware. 15 © ARM 2016
  • 16. It is recommended to use the latest version of Xen when porting to a new SOC. 16 © ARM 2016
  • 17. Early debugging with Xen Xen provides early printk to debug crash before the UART driver is initialized. Only available when CONFIG DEBUG=y Xen will not be portable, intented only for development UART selected on the build command line with CONFIG EARL PRINTK=mach CONFIG EARL PRINTK= INC>, BASE ADDRESS>, OTHER OPTIONS> More details on http://xenbits.xen.org/docs/unstable/misc/arm/early-printk.txt 17 © ARM 2016
  • 18. Early debugging with Xen - 2 Major UARTs supported: pl011, 8250,... 8250: CONFIG EARL PRINTK=8250, BASE ADDRESS>, REG SHIFT> REG SHIFT> is the left-shift to apply to register offsets within the uart (optional). pl011: CONFIG EARL PRINTK=pl011, BASE ADDRESS>, BAUD RATE> BAUD RATE is optional. We recommend to let the bootloader setting the baud rate. 18 © ARM 2016
  • 19. Getting the firmware to load Xen and DOM0 The firmware needs to load in memory Xen, DOM0 kernel and potentially others modules (e.g initramfs, XSM...). There are 3 methods to do it: Multiboot UEFI GRUB via UEFI (work in progress) 19 © ARM 2016
  • 20. Loading Xen and DOM0 using multiboot Multiboot is a protocol based on Device Tree. It is used to describe where the kernel, initramfs... reside in memory. An example to generate multiboot nodes with U-Boot can be found on the wiki. https://wiki.xenproject.org/wiki/Xen_ARM_with_Virtualization_Extensions# Boot_Modules 20 © ARM 2016
  • 21. Loading Xen and DOM0 via UEFI On AArch64, Xen is built as an EFI application. A configuration file is used to describe: The command line The binaries to load (device tree, kernel, initramfs...) in memory. The configure file could be passed to the EFI application using the parameter -cfg=myxen.cfg https://xenbits.xenproject.org/docs/unstable/misc/efi.html 21 © ARM 2016
  • 22. Loading Xen and DOM0 via UEFI - Example Configuration file example for UEFI: [global] default=model [model] options=console=dtuart conswitch=x dom0_max_vcpus=2 dtuart=serial0 kernel=vmlinuz console=hvc0 earlycon=pl011,0xf2a00000 root=/dev/ram1 rootwait ramdisk=initrd.img dtb=model.dtb 22 © ARM 2016
  • 23. Troubleshooting - Xen is not entering in EL2 Xen will panic when it is not entered in EL2 with the following message: For AArch32: - Xen must be entered in Hyp mode - - Please update the bootloader - For AArch64: - Xen must be entered in NS EL2 mode - - Please update the bootloader - 23 © ARM 2016
  • 24. What to do if Xen is not entered in EL2? Even if the hardware supports virtualization extensions, the firmware/bootloader may be configured to enter the kernel/hypervisor in EL1. Find a version which dropped in EL2. Find the source code and modify it to enter the hypervisor in EL2. 24 © ARM 2016
  • 25. Platform specific code In most of the case, platform specific code is not necessary. Hooks in the core code is provided specific initialization is required. Platform code resides in xen/arch/arm/platforms 25 © ARM 2016
  • 26. Platform specific code - 2 List of callbacks available: /* Platform initialization */ int (*init)(void); int (*init_time)(void); int (*smp_init)(void); int (*cpu_up)(int cpu); /* Specific mapping for dom0 */ int (*specific_mapping)(struct domain *d); /* Platform reset */ void (*reset)(void); /* Platform power-off */ void (*poweroff)(void); /* * Platform blacklist devices * List of devices which must not pass-through to a guest */ const struct dt_device_match *blacklist_dev; 26 © ARM 2016
  • 27. UART support Xen has multiple UART drivers (pl011, 8250,...). They can be found in xen/drivers/char. The UART used by Xen will not be available for DOM0. A virtual UART will shadow the real one. Useful if the kernel use early printk Very basic: Only write is supported The UART configuration can be read from: the parameter dtuart=cfg stdout-path in the device tree The SCPR table in ACPI 27 © ARM 2016
  • 28. Debugging DOM0 kernel Xen console Switch from DOM0 console to Xen console via CTLR-a three times Useful key 0 Dump Dom0 vCPUs q Domains information e Event channel information R Reboot the machine 28 © ARM 2016
  • 29. Using Xen debugging facilities in the kernel Use of hvc 0xFFXX Supported when Xen is compiled with debug=y Requires to modify the kernel 0xFFEX 0xFFFD 0xFFFE 0xFFFF Print the register rX/xX Print the program counter Print the character stored in r0/x0 Dump the state of the vCPU 29 © ARM 2016
  • 30. SMP support Xen is able to bring up secondary processors via different protocols: Power State Coordination Interface (PSCI) This is the recommended protocol to bring up CPU. PSCI 0.1, 0.2 and 1.0 supported It can be used for rebooting the platform (PSCI >= 0.2). Spin table (AArch64 only) Platform specific bringup (AArch32 only) This protocol should be avoided in favor of PSCI. It can be implemented with the callcack smp init and cpu up. 30 © ARM 2016
  • 31. Upstreaming Even if your platform does not require platform specific code, it is recommended to Document the step to boot Xen on the wiki. Testing new release of Xen. 31 © ARM 2016
  • 32. Where to ask questions? devel ML: xen-devel@lists.xenproject.org #xenarm or #xendevel on freenode 32 © ARM 2016
  • 34. The trademarks featured in this presentation are registered and/or unregistered trademarks of ARM limited (or its subsidiaries) in the EU and/or elsewhere. All rights reserved. All other marks featured may be trademarks of their respective owners. Copyright © 2016 ARM Limited © ARM 2016