SlideShare une entreprise Scribd logo
1  sur  17
Télécharger pour lire hors ligne
Device Passthrough Overall Introduction
Binbin Wu
Wu, Binbin <binbin.wu@intel.com>
04/15/2020
Agenda
● Device Passthrough Overview
● DMA Remapping
● Interrupt Remapping
● Passthrough related code overview
● Passthrough limitations
I/O virtualization
• Software Emulation
• :) Device sharing; Native driver
• :( Low performance, complex to full emulation modern hardware device
• Para-virtualization (VirtIO)
• :) Better performance, device sharing
• :( Specific driver in VM
• Direct I/O (Pass-through)
• :) Near-to-native performance; Good isolation; Native driver
• :( Exclusive device access
Device Passthrough Overview
Device
(PCIe)
CPU
Shared
Memory
Interrupt
Register Access
DMA
• CPU access to device
o ACRN traps PCI Configuration space access
o BARs (MMIO / PIO)
▪ No support for PIO BAR in UOS?
▪ Traps MSI-X Table access
▪ Passthrough other MMIO resource vie EPT mapping
• Device DMA to system memory directly with VT-d DMA Remapping
• Device notifies CPU / driver through interrupt
o When receiving a physical interrupt from device, hypervisor will convert the physical
interrupt to virtual interrupt and inject the virtual interrupt to VM
Passthrough device
• Passthrough object should be
• PCI/PCIe device Physical Function (PF)
• Virtual Function (VF, SR-IOV)
• Uniquely Identifiable Source-Id
• For isolation, the platform must be capable of uniquely identifying the requestor
(Source-Id) for each DMA request.
• PCI devices may use the same source-id
o Devices Behind PCI Express to PCI/PCI-X Bridges
o Devices Behind Conventional PCI Bridges
• Devices that may use a same source-id can only be passed-through collectively
DMA Remapping
• (Native) Driver in guest uses guest physical address as DMA target
• Device issue DMA access using address setup by guest (which is GPA)
• All DMA transactions are captured by chipset
• IOMMU do the translation from GPA to HPA according to the
o Device Assignment Structures
▪ Map a pass-through device to a domain, also the translation structures of the domain
o Address Translation Structures
▪ ACRN reuse EPT tables of a VM as the address translation tables
Interrupt Remapping VS Interrupt virtualization
MSI address MSI data
0xFEExxxxx vector 30
MSI address MSI data
0xFEExxxxx
Interrupt_format is 1 -> remappable
Interrupt_index
Interrupt Remapping Eanbled
IRT address
Interrupt Remapping Table
...
B:D.F, Vector 60, Dest LAPIC ID
...
Interrupt index
Remappable
interrupt request
Interrupt 60 VMCS configured to
cause vmexit on
external interrupt
VMEXIT
Hypervisor
Hypervisor
Injects
interrupt 30
Process interrupt 30
Guest VM
VMENTRY
IOMMUPhyscial vector 60
• Interrupt Remapping
o Control and censor external interrupt requests generated by passthrough device
o X2APIC support
• Interrupt Virtualization without Interrupt Posting
o physical interrupt to virtual interrupt
o Inject virtual interrupt to VM
Code for device passthrough
• Passthrough driver in Device Model
(devicemodel/hw/pci/passthrough.c)
o Allocate virtual BAR address spaces
o For device only support INTx
▪ Allocate virtual Interrupt Line/Pin
▪ Call API (passthru_bind_irq) to bind pin information
o Call API (vm_assign_pcidev) to assign a pci device to a VM
o ACPI Virtualization
• Passthrough device interrupt handling
(hypervisor/arch/x86/guest/assign.c, hypervisor/common/ptdev.c)
• vPCI related (hypervisor/dm/vpci/)
• VT-d support (hypervisor/arch/x86/vtd.c)
How to passthrough a device
• Unbind device driver in SOS
• Bind device to pci_stub driver
• Add the device as a option to acrn-dm
-s <slot>,passthru,B/D/F
Refer to laucn_xxx.sh in devicemodel/samples/<board>/
Device level reset
• Passthrough device should provide device level reset capability:
• FLR or PCI PM reset.
• Without device level reset, may have issue
o VM restart
o Used in SOS first and then passthrough to UOS
PCI Interrupt Pin Programming
• In general, ACRN doesn’t recommend to passthrough a device that only
support legacy interrupt
• Especially, ACRN doesn’t support to passthrough devices only support legacy
interrupt in pre-launched VM / RTVM.
• ACRN relies on BIOS / bootloader to program PCI interrupt pin
• ACRN device model relies on the value programmed in “Interrupt Line” (offset 0x3c)
by BIOS / bootloader.
o Although such information can be parsed and extracted from ACPI table, it would be too
complicated to do it in ACRN.
o Although Linux kernel will re-program the field when probe the driver, the driver for the
device may not be present in Service VM, so if BIOS / bootloader doesn’t program it, the
legacy interrupt will not work.
Avoid Global System Interrupt (GSI) sharing
• Devices physically sharing a same GSI pin make trouble when passed-
through to different VMs
• How to avoid
• Disable virtual IOAPIC link for MSI capable device
o Guest driver should use MSI instead of legacy interrupt.
o Some native driver still use legacy interrupt even when the device supports MSI !!
• GSI sharing violation check in device model
• Pre-launch VM doesn’t support devices using legacy interrupt
• Platform specific, need extra effort for a new platform, not scalable.
• BIOS / bootloader should avoid GSI pin sharing for GSI only device
Driver should no IOMMU dependency
• Driver should not depend on IOMMU for functionality.
• ACRN hypervisor take use of IOMMU for DMA remapping and Interrupt Remapping.
• ACRN hypervisor doesn’t support virtual IOMMU.
• Otherwise, need extra efforts to remove the dependency on IOMMU in guest
kernel framework or device driver
• Eg. Device using multiple MSI Vectors
o Device doesn’t support MSI-X but requires multiple vectors.
o Device driver use IOMMU to mitigate the issue, but it will not work on ACRN
Virtual PCI slot allocation requirements
• Device driver should not hardcode BDF for a device
• Some device drivers hardcoded BDF in code
o Need extra effort to debug
o Virtual slot should be the same as physical slot as a workaround
ACPI virtualization
• Blackbox
• Huge efforts when expose host ACPI to guest
• Additional resource access needs to be virtualized
• Refer to write_dsdt_xxx in devicemodel/hw/pci/passthrough.c
When enable a new passthrough device
• Figure out the BIOS / driver dependency
• Test functionality on native platform
• Test functionality in SOS on ACRN
• Test functionality is UOS on ACRN
• APIC virtualization needed?
• Other device dependency (e.g. GPIO?)
• Check if interrupt injected in guest properly
• Driver issue?
• ...
Q&A

Contenu connexe

Tendances

Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device driversHoucheng Lin
 
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introductionProject ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introductionProject ACRN
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Adrian Huang
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecturehugo lu
 
How to Speak Intel DPDK KNI for Web Services.
How to Speak Intel DPDK KNI for Web Services.How to Speak Intel DPDK KNI for Web Services.
How to Speak Intel DPDK KNI for Web Services.Naoto MATSUMOTO
 
/proc/irq/&lt;irq>/smp_affinity
/proc/irq/&lt;irq>/smp_affinity/proc/irq/&lt;irq>/smp_affinity
/proc/irq/&lt;irq>/smp_affinityTakuya ASADA
 
Page Cache in Linux 2.6.pdf
Page Cache in Linux 2.6.pdfPage Cache in Linux 2.6.pdf
Page Cache in Linux 2.6.pdfycelgemici1
 
EBPF and Linux Networking
EBPF and Linux NetworkingEBPF and Linux Networking
EBPF and Linux NetworkingPLUMgrid
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File SystemAdrian Huang
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and ToolsBrendan Gregg
 
Fast Userspace OVS with AF_XDP, OVS CONF 2018
Fast Userspace OVS with AF_XDP, OVS CONF 2018Fast Userspace OVS with AF_XDP, OVS CONF 2018
Fast Userspace OVS with AF_XDP, OVS CONF 2018Cheng-Chun William Tu
 
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedVmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedAdrian Huang
 
eBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KerneleBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KernelThomas Graf
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)shimosawa
 
Cilium - BPF & XDP for containers
 Cilium - BPF & XDP for containers Cilium - BPF & XDP for containers
Cilium - BPF & XDP for containersDocker, Inc.
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in LinuxAdrian Huang
 

Tendances (20)

Arm device tree and linux device drivers
Arm device tree and linux device driversArm device tree and linux device drivers
Arm device tree and linux device drivers
 
Project ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introductionProject ACRN Yocto Project meta-acrn layer introduction
Project ACRN Yocto Project meta-acrn layer introduction
 
Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...Process Address Space: The way to create virtual address (page table) of user...
Process Address Space: The way to create virtual address (page table) of user...
 
The linux networking architecture
The linux networking architectureThe linux networking architecture
The linux networking architecture
 
How to Speak Intel DPDK KNI for Web Services.
How to Speak Intel DPDK KNI for Web Services.How to Speak Intel DPDK KNI for Web Services.
How to Speak Intel DPDK KNI for Web Services.
 
/proc/irq/&lt;irq>/smp_affinity
/proc/irq/&lt;irq>/smp_affinity/proc/irq/&lt;irq>/smp_affinity
/proc/irq/&lt;irq>/smp_affinity
 
Understanding DPDK
Understanding DPDKUnderstanding DPDK
Understanding DPDK
 
Linux Device Tree
Linux Device TreeLinux Device Tree
Linux Device Tree
 
Page Cache in Linux 2.6.pdf
Page Cache in Linux 2.6.pdfPage Cache in Linux 2.6.pdf
Page Cache in Linux 2.6.pdf
 
EBPF and Linux Networking
EBPF and Linux NetworkingEBPF and Linux Networking
EBPF and Linux Networking
 
Linux Kernel - Virtual File System
Linux Kernel - Virtual File SystemLinux Kernel - Virtual File System
Linux Kernel - Virtual File System
 
Linux Performance Analysis and Tools
Linux Performance Analysis and ToolsLinux Performance Analysis and Tools
Linux Performance Analysis and Tools
 
Fast Userspace OVS with AF_XDP, OVS CONF 2018
Fast Userspace OVS with AF_XDP, OVS CONF 2018Fast Userspace OVS with AF_XDP, OVS CONF 2018
Fast Userspace OVS with AF_XDP, OVS CONF 2018
 
Using strace
Using straceUsing strace
Using strace
 
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is bootedVmlinux: anatomy of bzimage and how x86 64 processor is booted
Vmlinux: anatomy of bzimage and how x86 64 processor is booted
 
eBPF maps 101
eBPF maps 101eBPF maps 101
eBPF maps 101
 
eBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux KerneleBPF - Rethinking the Linux Kernel
eBPF - Rethinking the Linux Kernel
 
Linux Initialization Process (2)
Linux Initialization Process (2)Linux Initialization Process (2)
Linux Initialization Process (2)
 
Cilium - BPF & XDP for containers
 Cilium - BPF & XDP for containers Cilium - BPF & XDP for containers
Cilium - BPF & XDP for containers
 
malloc & vmalloc in Linux
malloc & vmalloc in Linuxmalloc & vmalloc in Linux
malloc & vmalloc in Linux
 

Similaire à Project ACRN Device Passthrough Introduction

PCI Pass-through - FreeBSD VM on Hyper-V (MeetBSD California 2016)
PCI Pass-through - FreeBSD VM on Hyper-V (MeetBSD California 2016)PCI Pass-through - FreeBSD VM on Hyper-V (MeetBSD California 2016)
PCI Pass-through - FreeBSD VM on Hyper-V (MeetBSD California 2016)iXsystems
 
Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN
 
Project ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config toolProject ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config toolProject ACRN
 
Project ACRN GVT-d introduction and tutorial
Project ACRN GVT-d introduction and tutorialProject ACRN GVT-d introduction and tutorial
Project ACRN GVT-d introduction and tutorialProject ACRN
 
Project ACRN hypervisor introduction
Project ACRN hypervisor introduction Project ACRN hypervisor introduction
Project ACRN hypervisor introduction Project ACRN
 
Device virtualization and management in xen
Device virtualization and management in xenDevice virtualization and management in xen
Device virtualization and management in xenLingfei Kong
 
5. IO virtualization
5. IO virtualization5. IO virtualization
5. IO virtualizationHwanju Kim
 
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...The Linux Foundation
 
Hardware support for efficient virtualization
Hardware support for efficient virtualizationHardware support for efficient virtualization
Hardware support for efficient virtualizationLennox Wu
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersLinaro
 
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...The Linux Foundation
 
Embedded Systems Conference 2014 Presentation
Embedded Systems Conference 2014 PresentationEmbedded Systems Conference 2014 Presentation
Embedded Systems Conference 2014 PresentationManish Jaggi
 
Lecture_Chapter_8.ppt
Lecture_Chapter_8.pptLecture_Chapter_8.ppt
Lecture_Chapter_8.pptHailsh
 
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 introductionProject ACRN
 
Gal Diskin - Virtually Impossible
Gal Diskin - Virtually Impossible Gal Diskin - Virtually Impossible
Gal Diskin - Virtually Impossible DefconRussia
 

Similaire à Project ACRN Device Passthrough Introduction (20)

PCI Pass-through - FreeBSD VM on Hyper-V (MeetBSD California 2016)
PCI Pass-through - FreeBSD VM on Hyper-V (MeetBSD California 2016)PCI Pass-through - FreeBSD VM on Hyper-V (MeetBSD California 2016)
PCI Pass-through - FreeBSD VM on Hyper-V (MeetBSD California 2016)
 
XS Boston 2008 VT-D PCI
XS Boston 2008 VT-D PCIXS Boston 2008 VT-D PCI
XS Boston 2008 VT-D PCI
 
Project ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOSProject ACRN expose and pass through platform hidden PCIe devices to SOS
Project ACRN expose and pass through platform hidden PCIe devices to SOS
 
Graphics virtualization
Graphics virtualizationGraphics virtualization
Graphics virtualization
 
Graphics virtualization
Graphics virtualizationGraphics virtualization
Graphics virtualization
 
Project ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config toolProject ACRN configuration scenarios and config tool
Project ACRN configuration scenarios and config tool
 
Project ACRN GVT-d introduction and tutorial
Project ACRN GVT-d introduction and tutorialProject ACRN GVT-d introduction and tutorial
Project ACRN GVT-d introduction and tutorial
 
Project ACRN hypervisor introduction
Project ACRN hypervisor introduction Project ACRN hypervisor introduction
Project ACRN hypervisor introduction
 
Device virtualization and management in xen
Device virtualization and management in xenDevice virtualization and management in xen
Device virtualization and management in xen
 
5. IO virtualization
5. IO virtualization5. IO virtualization
5. IO virtualization
 
17-virtualization.pptx
17-virtualization.pptx17-virtualization.pptx
17-virtualization.pptx
 
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...
XPDDS17: Keynote: Shared Coprocessor Framework on ARM - Oleksandr Andrushchen...
 
Hardware support for efficient virtualization
Hardware support for efficient virtualizationHardware support for efficient virtualization
Hardware support for efficient virtualization
 
HKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 ServersHKG18-116 - RAS Solutions for Arm64 Servers
HKG18-116 - RAS Solutions for Arm64 Servers
 
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...
 
Embedded Systems Conference 2014 Presentation
Embedded Systems Conference 2014 PresentationEmbedded Systems Conference 2014 Presentation
Embedded Systems Conference 2014 Presentation
 
XS Boston 2008 Self IO Emulation
XS Boston 2008 Self IO EmulationXS Boston 2008 Self IO Emulation
XS Boston 2008 Self IO Emulation
 
Lecture_Chapter_8.ppt
Lecture_Chapter_8.pptLecture_Chapter_8.ppt
Lecture_Chapter_8.ppt
 
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
 
Gal Diskin - Virtually Impossible
Gal Diskin - Virtually Impossible Gal Diskin - Virtually Impossible
Gal Diskin - Virtually Impossible
 

Plus de Project ACRN

ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...Project ACRN
 
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 BootProject ACRN
 
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
ACRN vMeet-Up EU 2021 - debug ACRN hypervisorACRN vMeet-Up EU 2021 - debug ACRN hypervisor
ACRN vMeet-Up EU 2021 - debug ACRN hypervisorProject ACRN
 
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
ACRN vMeet-Up EU 2021 -  functional safety design and certification planACRN vMeet-Up EU 2021 -  functional safety design and certification plan
ACRN vMeet-Up EU 2021 - functional safety design and certification planProject ACRN
 
ACRN vMeet-Up EU 2021 - community and development model
ACRN vMeet-Up EU 2021 - community and development modelACRN vMeet-Up EU 2021 - community and development model
ACRN vMeet-Up EU 2021 - community and development modelProject ACRN
 
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enablingACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enablingProject ACRN
 
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introductionACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introductionProject ACRN
 
ACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization
ACRN vMeet-Up EU 2021 - Real Time Management and Performance OptimizationACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization
ACRN vMeet-Up EU 2021 - Real Time Management and Performance OptimizationProject ACRN
 
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look ForwardACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look ForwardProject ACRN
 
ACRN Kata Container on ACRN
ACRN Kata Container on ACRNACRN Kata Container on ACRN
ACRN Kata Container on ACRNProject ACRN
 
Project ACRN USB mediator introduction
Project ACRN USB mediator introductionProject ACRN USB mediator introduction
Project ACRN USB mediator introductionProject ACRN
 
Project ACRN I2C mediator introduction
Project ACRN I2C mediator introductionProject ACRN I2C mediator introduction
Project ACRN I2C mediator introductionProject ACRN
 
Project ACRN system debug
Project ACRN system debugProject ACRN system debug
Project ACRN system debugProject ACRN
 
Project ACRN SR-IOV on ACRN
Project ACRN SR-IOV on ACRNProject ACRN SR-IOV on ACRN
Project ACRN SR-IOV on ACRNProject ACRN
 
Project ACRN Device Model architecture introduction
Project ACRN Device Model architecture introductionProject ACRN Device Model architecture introduction
Project ACRN Device Model architecture introductionProject ACRN
 
Project ACRN CPU sharing BVT scheduler in ACRN hypervisor
Project ACRN CPU sharing BVT scheduler in ACRN hypervisorProject ACRN CPU sharing BVT scheduler in ACRN hypervisor
Project ACRN CPU sharing BVT scheduler in ACRN hypervisorProject ACRN
 
Project ACRN how to build a Yocto Project-based SOS
Project ACRN how to build a Yocto Project-based SOSProject ACRN how to build a Yocto Project-based SOS
Project ACRN how to build a Yocto Project-based SOSProject ACRN
 
Project ACRN EtherCAT 101
Project ACRN EtherCAT 101Project ACRN EtherCAT 101
Project ACRN EtherCAT 101Project ACRN
 
Project ACRN GPIO mediator introduction
Project ACRN GPIO mediator introductionProject ACRN GPIO mediator introduction
Project ACRN GPIO mediator introductionProject ACRN
 
Project ACRN schedule framework introduction
Project ACRN schedule framework introductionProject ACRN schedule framework introduction
Project ACRN schedule framework introductionProject ACRN
 

Plus de Project ACRN (20)

ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
ACRN vMeet-Up EU 2021 - Bridging Orchestrator and Hard Realtime Workload Cons...
 
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
 
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
ACRN vMeet-Up EU 2021 - debug ACRN hypervisorACRN vMeet-Up EU 2021 - debug ACRN hypervisor
ACRN vMeet-Up EU 2021 - debug ACRN hypervisor
 
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
ACRN vMeet-Up EU 2021 -  functional safety design and certification planACRN vMeet-Up EU 2021 -  functional safety design and certification plan
ACRN vMeet-Up EU 2021 - functional safety design and certification plan
 
ACRN vMeet-Up EU 2021 - community and development model
ACRN vMeet-Up EU 2021 - community and development modelACRN vMeet-Up EU 2021 - community and development model
ACRN vMeet-Up EU 2021 - community and development model
 
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enablingACRN vMeet-Up EU 2021 - hypervisor new platform enabling
ACRN vMeet-Up EU 2021 - hypervisor new platform enabling
 
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introductionACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
ACRN vMeet-Up EU 2021 - shared memory based inter-vm communication introduction
 
ACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization
ACRN vMeet-Up EU 2021 - Real Time Management and Performance OptimizationACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization
ACRN vMeet-Up EU 2021 - Real Time Management and Performance Optimization
 
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look ForwardACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
ACRN vMeet-Up EU 2021 - Introduction and Architecture Look Forward
 
ACRN Kata Container on ACRN
ACRN Kata Container on ACRNACRN Kata Container on ACRN
ACRN Kata Container on ACRN
 
Project ACRN USB mediator introduction
Project ACRN USB mediator introductionProject ACRN USB mediator introduction
Project ACRN USB mediator introduction
 
Project ACRN I2C mediator introduction
Project ACRN I2C mediator introductionProject ACRN I2C mediator introduction
Project ACRN I2C mediator introduction
 
Project ACRN system debug
Project ACRN system debugProject ACRN system debug
Project ACRN system debug
 
Project ACRN SR-IOV on ACRN
Project ACRN SR-IOV on ACRNProject ACRN SR-IOV on ACRN
Project ACRN SR-IOV on ACRN
 
Project ACRN Device Model architecture introduction
Project ACRN Device Model architecture introductionProject ACRN Device Model architecture introduction
Project ACRN Device Model architecture introduction
 
Project ACRN CPU sharing BVT scheduler in ACRN hypervisor
Project ACRN CPU sharing BVT scheduler in ACRN hypervisorProject ACRN CPU sharing BVT scheduler in ACRN hypervisor
Project ACRN CPU sharing BVT scheduler in ACRN hypervisor
 
Project ACRN how to build a Yocto Project-based SOS
Project ACRN how to build a Yocto Project-based SOSProject ACRN how to build a Yocto Project-based SOS
Project ACRN how to build a Yocto Project-based SOS
 
Project ACRN EtherCAT 101
Project ACRN EtherCAT 101Project ACRN EtherCAT 101
Project ACRN EtherCAT 101
 
Project ACRN GPIO mediator introduction
Project ACRN GPIO mediator introductionProject ACRN GPIO mediator introduction
Project ACRN GPIO mediator introduction
 
Project ACRN schedule framework introduction
Project ACRN schedule framework introductionProject ACRN schedule framework introduction
Project ACRN schedule framework introduction
 

Dernier

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentationvaddepallysandeep122
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...Technogeeks
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmSujith Sukumaran
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 

Dernier (20)

办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
PREDICTING RIVER WATER QUALITY ppt presentation
PREDICTING  RIVER  WATER QUALITY  ppt presentationPREDICTING  RIVER  WATER QUALITY  ppt presentation
PREDICTING RIVER WATER QUALITY ppt presentation
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...What is Advanced Excel and what are some best practices for designing and cre...
What is Advanced Excel and what are some best practices for designing and cre...
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Intelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalmIntelligent Home Wi-Fi Solutions | ThinkPalm
Intelligent Home Wi-Fi Solutions | ThinkPalm
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 

Project ACRN Device Passthrough Introduction

  • 1. Device Passthrough Overall Introduction Binbin Wu Wu, Binbin <binbin.wu@intel.com> 04/15/2020
  • 2. Agenda ● Device Passthrough Overview ● DMA Remapping ● Interrupt Remapping ● Passthrough related code overview ● Passthrough limitations
  • 3. I/O virtualization • Software Emulation • :) Device sharing; Native driver • :( Low performance, complex to full emulation modern hardware device • Para-virtualization (VirtIO) • :) Better performance, device sharing • :( Specific driver in VM • Direct I/O (Pass-through) • :) Near-to-native performance; Good isolation; Native driver • :( Exclusive device access
  • 4. Device Passthrough Overview Device (PCIe) CPU Shared Memory Interrupt Register Access DMA • CPU access to device o ACRN traps PCI Configuration space access o BARs (MMIO / PIO) ▪ No support for PIO BAR in UOS? ▪ Traps MSI-X Table access ▪ Passthrough other MMIO resource vie EPT mapping • Device DMA to system memory directly with VT-d DMA Remapping • Device notifies CPU / driver through interrupt o When receiving a physical interrupt from device, hypervisor will convert the physical interrupt to virtual interrupt and inject the virtual interrupt to VM
  • 5. Passthrough device • Passthrough object should be • PCI/PCIe device Physical Function (PF) • Virtual Function (VF, SR-IOV) • Uniquely Identifiable Source-Id • For isolation, the platform must be capable of uniquely identifying the requestor (Source-Id) for each DMA request. • PCI devices may use the same source-id o Devices Behind PCI Express to PCI/PCI-X Bridges o Devices Behind Conventional PCI Bridges • Devices that may use a same source-id can only be passed-through collectively
  • 6. DMA Remapping • (Native) Driver in guest uses guest physical address as DMA target • Device issue DMA access using address setup by guest (which is GPA) • All DMA transactions are captured by chipset • IOMMU do the translation from GPA to HPA according to the o Device Assignment Structures ▪ Map a pass-through device to a domain, also the translation structures of the domain o Address Translation Structures ▪ ACRN reuse EPT tables of a VM as the address translation tables
  • 7. Interrupt Remapping VS Interrupt virtualization MSI address MSI data 0xFEExxxxx vector 30 MSI address MSI data 0xFEExxxxx Interrupt_format is 1 -> remappable Interrupt_index Interrupt Remapping Eanbled IRT address Interrupt Remapping Table ... B:D.F, Vector 60, Dest LAPIC ID ... Interrupt index Remappable interrupt request Interrupt 60 VMCS configured to cause vmexit on external interrupt VMEXIT Hypervisor Hypervisor Injects interrupt 30 Process interrupt 30 Guest VM VMENTRY IOMMUPhyscial vector 60 • Interrupt Remapping o Control and censor external interrupt requests generated by passthrough device o X2APIC support • Interrupt Virtualization without Interrupt Posting o physical interrupt to virtual interrupt o Inject virtual interrupt to VM
  • 8. Code for device passthrough • Passthrough driver in Device Model (devicemodel/hw/pci/passthrough.c) o Allocate virtual BAR address spaces o For device only support INTx ▪ Allocate virtual Interrupt Line/Pin ▪ Call API (passthru_bind_irq) to bind pin information o Call API (vm_assign_pcidev) to assign a pci device to a VM o ACPI Virtualization • Passthrough device interrupt handling (hypervisor/arch/x86/guest/assign.c, hypervisor/common/ptdev.c) • vPCI related (hypervisor/dm/vpci/) • VT-d support (hypervisor/arch/x86/vtd.c)
  • 9. How to passthrough a device • Unbind device driver in SOS • Bind device to pci_stub driver • Add the device as a option to acrn-dm -s <slot>,passthru,B/D/F Refer to laucn_xxx.sh in devicemodel/samples/<board>/
  • 10. Device level reset • Passthrough device should provide device level reset capability: • FLR or PCI PM reset. • Without device level reset, may have issue o VM restart o Used in SOS first and then passthrough to UOS
  • 11. PCI Interrupt Pin Programming • In general, ACRN doesn’t recommend to passthrough a device that only support legacy interrupt • Especially, ACRN doesn’t support to passthrough devices only support legacy interrupt in pre-launched VM / RTVM. • ACRN relies on BIOS / bootloader to program PCI interrupt pin • ACRN device model relies on the value programmed in “Interrupt Line” (offset 0x3c) by BIOS / bootloader. o Although such information can be parsed and extracted from ACPI table, it would be too complicated to do it in ACRN. o Although Linux kernel will re-program the field when probe the driver, the driver for the device may not be present in Service VM, so if BIOS / bootloader doesn’t program it, the legacy interrupt will not work.
  • 12. Avoid Global System Interrupt (GSI) sharing • Devices physically sharing a same GSI pin make trouble when passed- through to different VMs • How to avoid • Disable virtual IOAPIC link for MSI capable device o Guest driver should use MSI instead of legacy interrupt. o Some native driver still use legacy interrupt even when the device supports MSI !! • GSI sharing violation check in device model • Pre-launch VM doesn’t support devices using legacy interrupt • Platform specific, need extra effort for a new platform, not scalable. • BIOS / bootloader should avoid GSI pin sharing for GSI only device
  • 13. Driver should no IOMMU dependency • Driver should not depend on IOMMU for functionality. • ACRN hypervisor take use of IOMMU for DMA remapping and Interrupt Remapping. • ACRN hypervisor doesn’t support virtual IOMMU. • Otherwise, need extra efforts to remove the dependency on IOMMU in guest kernel framework or device driver • Eg. Device using multiple MSI Vectors o Device doesn’t support MSI-X but requires multiple vectors. o Device driver use IOMMU to mitigate the issue, but it will not work on ACRN
  • 14. Virtual PCI slot allocation requirements • Device driver should not hardcode BDF for a device • Some device drivers hardcoded BDF in code o Need extra effort to debug o Virtual slot should be the same as physical slot as a workaround
  • 15. ACPI virtualization • Blackbox • Huge efforts when expose host ACPI to guest • Additional resource access needs to be virtualized • Refer to write_dsdt_xxx in devicemodel/hw/pci/passthrough.c
  • 16. When enable a new passthrough device • Figure out the BIOS / driver dependency • Test functionality on native platform • Test functionality in SOS on ACRN • Test functionality is UOS on ACRN • APIC virtualization needed? • Other device dependency (e.g. GPIO?) • Check if interrupt injected in guest properly • Driver issue? • ...
  • 17. Q&A