SlideShare una empresa de Scribd logo
1 de 20
Descargar para leer sin conexión
Status of PCI emulation in Xen
Roger Pau Monn´e
roger.pau@citrix.com
Chicago – July 9th, 2019
PCI bus PCI-passthroughon Xen Moving forward
PCI bus
Allows attaching hardware devices in a computer.
First specification developed by Intel in 1992.
Superseded VESA, MCA, EISA, NuBus...
Two standards:
PCI local bus.
PCI Express.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 2 / 20
PCI bus PCI-passthroughon Xen Moving forward
PCI slots on a motherboard
Obtained from wikipedia author snickerdo.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 3 / 20
PCI bus PCI-passthroughon Xen Moving forward
PCI card
Chicago – July 9th, 2019 Status of PCI emulation in Xen 4 / 20
PCI bus PCI-passthroughon Xen Moving forward
PCI configuration space
The PCI configuration space provides 256bytes or 4096bytes
of configuration space to each device.
Devices are identified by a 8bit bus, 5bit device and 3bit
function integers.
First 64bytes is standardized, the rest is device dependent
(contains capability structures).
Allows for easy discovery of devices. OS can scan the whole
bus in order to detect present devices.
On x86 can be accessed from IO space (legacy) or memory
(enhanced).
Chicago – July 9th, 2019 Status of PCI emulation in Xen 5 / 20
PCI bus PCI-passthroughon Xen Moving forward
Legacy PCI configuration access
Indirect access using the IO address space.
Address port at 0xcf8:
012781011151623243031
E RSV Bus Device Func Register RSV
Data port at 0xcfc.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 6 / 20
PCI bus PCI-passthroughon Xen Moving forward
Enhanced PCI configuration access
Maps the full config space registers into memory space.
0111214151920272831
Base Bus Device Func Register
If on 64bit mode bits from 63-32 also contain the base
address.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 7 / 20
PCI bus PCI-passthroughon Xen Moving forward
PCI header
0781516232431
Status Command 04h
Base Address 0 16h
Base Address 1 20h
Base Address 2 24h
Base Address 3 28h
Base Address 4 32h
Base Address 5 36h
CardBus CIS Pointer 40h
Subsystem ID Subsystem Vendor ID 44h
Expansion ROM Base Address 44h
Chicago – July 9th, 2019 Status of PCI emulation in Xen 8 / 20
PCI bus PCI-passthroughon Xen Moving forward
MSI capability
0781516232431
Message control Next pointer Capability ID 00h
Message Address [31, 0] 04h
Message Address [63, 32] 08h
Reserved Message Data 12h
Mask Bits 16h
Pending bits 20h
Chicago – July 9th, 2019 Status of PCI emulation in Xen 9 / 20
PCI bus PCI-passthroughon Xen Moving forward
MSI-X capability
0781516232431
Message control Next pointer Capability ID 00h
MSI-X Table Offset BIR 04h
PBA Offset BIR 08h
0
31
32
63
64
Vector Control Message Data
Upper Address Lower Address
Entry 0
...
...
Vector Control Message Data
Upper Address Lower Address
Entry N
Chicago – July 9th, 2019 Status of PCI emulation in Xen 10 / 20
PCI bus PCI-passthroughon Xen Moving forward
PCI handling in Xen
PV privileged domain (dom0) gets almost unlimited access to
the PCI config space:
Xen controls the MSI(-X) mask bits in order to keep a
coherent state when doing PCI-passthrough to HVM guests.
Read only access is allowed to the MSI-X table and the MSI
data and address registers.
Passthrough of PCI devices to unprivileged guests:
PV guests can access the PCI config space using a Xen PV
specific protocol (pciif).
HVM guests can access the PCI config space emulated by a
device model (QEMU).
PVH guests have no PCI-passthrough support yet.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 11 / 20
PCI bus PCI-passthroughon Xen Moving forward
PCI-passthrough for domUs
Hardware
Xen
Control Domain (VM0)
PV1 HVM1
user-space
kernel
QEMU
evtchn devpciback
Chicago – July 9th, 2019 Status of PCI emulation in Xen 12 / 20
PCI bus PCI-passthroughon Xen Moving forward
PCI-passthrough for domUs
PV domU communicates directly with pciback using a shared
memory ring and a Xen specific protocol.
Passthrough to HVM domUs is handled by QEMU, much like
emulated devices:
PCI config space accesses are forwarded by Xen to QEMU
using ioreqs.
QEMU emulates or forwards those accesses to the underlying
device.
Xen directly handles guest writes to the MSI-X mask bits for
performance reasons.
Device MMIO regions (BARs) are directly mapped to the
guest physmap, except for the MSI-X region if present.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 13 / 20
PCI bus PCI-passthroughon Xen Moving forward
PV dom0
Has almost unlimited read/write access to the configuration
space except for certain parts of the MSI(-X) capabilities.
Has to use hypercalls to deal with certain capabilities:
MSI/MSI-X.
Is fully trusted to not misbehave.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 14 / 20
PCI bus PCI-passthroughon Xen Moving forward
PVH dom0
PVH is a HVM guest from Xen’s point of view.
HVM-like access to the configuration space:
Transparent access to the MSI/MSI-X capabilities.
Transparent mapping of BARs into the physmap and handling
of writes to the BAR registers.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 15 / 20
PCI bus PCI-passthroughon Xen Moving forward
PVH dom0
Current PCI-passthrough code for HVM is in QEMU.
Impossible to use QEMU for PVH dom0.
No re-use of the QEMU PCI-passthrough code: would need
heavy modifications that would make sharing changes very
difficult.
Added a PCI config space mediator to the hypervisor: vPCI.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 16 / 20
PCI bus PCI-passthroughon Xen Moving forward
PCI-passthrough mediators in Xen
QEMU (user-space) and Xen for MSI-X mask bits for HVM
domUs.
pciback (hardware domain OS) for PV domUs.
Direct access / hypercalls for PV dom0.
vPCI (hypervisor) for PVH dom0.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 17 / 20
PCI bus PCI-passthroughon Xen Moving forward
Shortcomings
No support for VFIO/MDEV on Xen:
Threatening support for vGPU/XenGT in future releases.
3 different code bases to deal with PCI config space accesses:
More maintainership work.
Non uniform behaviour across different guests types.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 18 / 20
PCI bus PCI-passthroughon Xen Moving forward
Future items
Re-work vPCI so it can be used both inside the hypervisor and
in user-space.
Could be used by HVM and PVH guests as a standalone
PCI-passthrough utility.
Unify PCI-passthrough for HVM and PVH both domU and
dom0 into a single code-base.
Add support for the extended config space to HVM domUs:
allow to passthrough PCIe capabilities.
Add support to passthrough SRIOV capability to vPCI, for
PVH dom0.
Chicago – July 9th, 2019 Status of PCI emulation in Xen 19 / 20
PCI bus PCI-passthroughon Xen Moving forward
Q&A
Thanks
Questions?
Chicago – July 9th, 2019 Status of PCI emulation in Xen 20 / 20

Más contenido relacionado

Similar a XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D

PCI_Express_Basics_Background.pdf
PCI_Express_Basics_Background.pdfPCI_Express_Basics_Background.pdf
PCI_Express_Basics_Background.pdf
zahixdd
 
Io Architecture
Io ArchitectureIo Architecture
Io Architecture
Aero Plane
 
directCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI ExpressdirectCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI Express
Heiko Joerg Schick
 

Similar a XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D (20)

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
 
Status update-qemu-pcie
Status update-qemu-pcieStatus update-qemu-pcie
Status update-qemu-pcie
 
XS Boston 2008 VT-D PCI
XS Boston 2008 VT-D PCIXS Boston 2008 VT-D PCI
XS Boston 2008 VT-D PCI
 
PCI_Express_Basics_Background.pdf
PCI_Express_Basics_Background.pdfPCI_Express_Basics_Background.pdf
PCI_Express_Basics_Background.pdf
 
Graphics virtualization
Graphics virtualizationGraphics virtualization
Graphics virtualization
 
Graphics virtualization
Graphics virtualizationGraphics virtualization
Graphics virtualization
 
Slideshare - PCIe
Slideshare - PCIeSlideshare - PCIe
Slideshare - PCIe
 
PCIe BUS: A State-of-the-Art-Review
PCIe BUS: A State-of-the-Art-ReviewPCIe BUS: A State-of-the-Art-Review
PCIe BUS: A State-of-the-Art-Review
 
PLNOG 13: Artur Pająk: Storage w sieciach Ethernet, czyli coś o iSCSI I FCoE
PLNOG 13: Artur Pająk: Storage w sieciach Ethernet, czyli coś o iSCSI I FCoEPLNOG 13: Artur Pająk: Storage w sieciach Ethernet, czyli coś o iSCSI I FCoE
PLNOG 13: Artur Pająk: Storage w sieciach Ethernet, czyli coś o iSCSI I FCoE
 
Pci express modi
Pci express modiPci express modi
Pci express modi
 
XS Boston 2008 Project Status
XS Boston 2008 Project StatusXS Boston 2008 Project Status
XS Boston 2008 Project Status
 
XPDDS17: Keynote: Towards a Configurable and Slimmer x86 Hypervisor - Wei Liu...
XPDDS17: Keynote: Towards a Configurable and Slimmer x86 Hypervisor - Wei Liu...XPDDS17: Keynote: Towards a Configurable and Slimmer x86 Hypervisor - Wei Liu...
XPDDS17: Keynote: Towards a Configurable and Slimmer x86 Hypervisor - Wei Liu...
 
PCI.pdf
PCI.pdfPCI.pdf
PCI.pdf
 
Cisco UCS vs HP Virtual Connect
Cisco UCS vs HP Virtual ConnectCisco UCS vs HP Virtual Connect
Cisco UCS vs HP Virtual Connect
 
Io Architecture
Io ArchitectureIo Architecture
Io Architecture
 
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
 
An AI accelerator ASIC architecture
An AI accelerator ASIC architectureAn AI accelerator ASIC architecture
An AI accelerator ASIC architecture
 
directCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI ExpressdirectCell - Cell/B.E. tightly coupled via PCI Express
directCell - Cell/B.E. tightly coupled via PCI Express
 
ACRN Kata Container on ACRN
ACRN Kata Container on ACRNACRN Kata Container on ACRN
ACRN Kata Container on ACRN
 
Pcie basic
Pcie basicPcie basic
Pcie basic
 

Más de The Linux Foundation

Más de The Linux Foundation (20)

ELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made SimpleELC2019: Static Partitioning Made Simple
ELC2019: Static Partitioning Made Simple
 
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: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, XilinxXPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
XPDDS19 Keynote: Xen Dom0-less - Stefano Stabellini, Principal Engineer, Xilinx
 
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: [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: 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
 
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
 

Último

Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
Apidays New York 2024 - Passkeys: Developing APIs to enable passwordless auth...
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
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
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
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
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
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
 

XPDDS19: Status of PCI Emulation in Xen - Roger Pau Monné, Citrix Systems R&D

  • 1. Status of PCI emulation in Xen Roger Pau Monn´e roger.pau@citrix.com Chicago – July 9th, 2019
  • 2. PCI bus PCI-passthroughon Xen Moving forward PCI bus Allows attaching hardware devices in a computer. First specification developed by Intel in 1992. Superseded VESA, MCA, EISA, NuBus... Two standards: PCI local bus. PCI Express. Chicago – July 9th, 2019 Status of PCI emulation in Xen 2 / 20
  • 3. PCI bus PCI-passthroughon Xen Moving forward PCI slots on a motherboard Obtained from wikipedia author snickerdo. Chicago – July 9th, 2019 Status of PCI emulation in Xen 3 / 20
  • 4. PCI bus PCI-passthroughon Xen Moving forward PCI card Chicago – July 9th, 2019 Status of PCI emulation in Xen 4 / 20
  • 5. PCI bus PCI-passthroughon Xen Moving forward PCI configuration space The PCI configuration space provides 256bytes or 4096bytes of configuration space to each device. Devices are identified by a 8bit bus, 5bit device and 3bit function integers. First 64bytes is standardized, the rest is device dependent (contains capability structures). Allows for easy discovery of devices. OS can scan the whole bus in order to detect present devices. On x86 can be accessed from IO space (legacy) or memory (enhanced). Chicago – July 9th, 2019 Status of PCI emulation in Xen 5 / 20
  • 6. PCI bus PCI-passthroughon Xen Moving forward Legacy PCI configuration access Indirect access using the IO address space. Address port at 0xcf8: 012781011151623243031 E RSV Bus Device Func Register RSV Data port at 0xcfc. Chicago – July 9th, 2019 Status of PCI emulation in Xen 6 / 20
  • 7. PCI bus PCI-passthroughon Xen Moving forward Enhanced PCI configuration access Maps the full config space registers into memory space. 0111214151920272831 Base Bus Device Func Register If on 64bit mode bits from 63-32 also contain the base address. Chicago – July 9th, 2019 Status of PCI emulation in Xen 7 / 20
  • 8. PCI bus PCI-passthroughon Xen Moving forward PCI header 0781516232431 Status Command 04h Base Address 0 16h Base Address 1 20h Base Address 2 24h Base Address 3 28h Base Address 4 32h Base Address 5 36h CardBus CIS Pointer 40h Subsystem ID Subsystem Vendor ID 44h Expansion ROM Base Address 44h Chicago – July 9th, 2019 Status of PCI emulation in Xen 8 / 20
  • 9. PCI bus PCI-passthroughon Xen Moving forward MSI capability 0781516232431 Message control Next pointer Capability ID 00h Message Address [31, 0] 04h Message Address [63, 32] 08h Reserved Message Data 12h Mask Bits 16h Pending bits 20h Chicago – July 9th, 2019 Status of PCI emulation in Xen 9 / 20
  • 10. PCI bus PCI-passthroughon Xen Moving forward MSI-X capability 0781516232431 Message control Next pointer Capability ID 00h MSI-X Table Offset BIR 04h PBA Offset BIR 08h 0 31 32 63 64 Vector Control Message Data Upper Address Lower Address Entry 0 ... ... Vector Control Message Data Upper Address Lower Address Entry N Chicago – July 9th, 2019 Status of PCI emulation in Xen 10 / 20
  • 11. PCI bus PCI-passthroughon Xen Moving forward PCI handling in Xen PV privileged domain (dom0) gets almost unlimited access to the PCI config space: Xen controls the MSI(-X) mask bits in order to keep a coherent state when doing PCI-passthrough to HVM guests. Read only access is allowed to the MSI-X table and the MSI data and address registers. Passthrough of PCI devices to unprivileged guests: PV guests can access the PCI config space using a Xen PV specific protocol (pciif). HVM guests can access the PCI config space emulated by a device model (QEMU). PVH guests have no PCI-passthrough support yet. Chicago – July 9th, 2019 Status of PCI emulation in Xen 11 / 20
  • 12. PCI bus PCI-passthroughon Xen Moving forward PCI-passthrough for domUs Hardware Xen Control Domain (VM0) PV1 HVM1 user-space kernel QEMU evtchn devpciback Chicago – July 9th, 2019 Status of PCI emulation in Xen 12 / 20
  • 13. PCI bus PCI-passthroughon Xen Moving forward PCI-passthrough for domUs PV domU communicates directly with pciback using a shared memory ring and a Xen specific protocol. Passthrough to HVM domUs is handled by QEMU, much like emulated devices: PCI config space accesses are forwarded by Xen to QEMU using ioreqs. QEMU emulates or forwards those accesses to the underlying device. Xen directly handles guest writes to the MSI-X mask bits for performance reasons. Device MMIO regions (BARs) are directly mapped to the guest physmap, except for the MSI-X region if present. Chicago – July 9th, 2019 Status of PCI emulation in Xen 13 / 20
  • 14. PCI bus PCI-passthroughon Xen Moving forward PV dom0 Has almost unlimited read/write access to the configuration space except for certain parts of the MSI(-X) capabilities. Has to use hypercalls to deal with certain capabilities: MSI/MSI-X. Is fully trusted to not misbehave. Chicago – July 9th, 2019 Status of PCI emulation in Xen 14 / 20
  • 15. PCI bus PCI-passthroughon Xen Moving forward PVH dom0 PVH is a HVM guest from Xen’s point of view. HVM-like access to the configuration space: Transparent access to the MSI/MSI-X capabilities. Transparent mapping of BARs into the physmap and handling of writes to the BAR registers. Chicago – July 9th, 2019 Status of PCI emulation in Xen 15 / 20
  • 16. PCI bus PCI-passthroughon Xen Moving forward PVH dom0 Current PCI-passthrough code for HVM is in QEMU. Impossible to use QEMU for PVH dom0. No re-use of the QEMU PCI-passthrough code: would need heavy modifications that would make sharing changes very difficult. Added a PCI config space mediator to the hypervisor: vPCI. Chicago – July 9th, 2019 Status of PCI emulation in Xen 16 / 20
  • 17. PCI bus PCI-passthroughon Xen Moving forward PCI-passthrough mediators in Xen QEMU (user-space) and Xen for MSI-X mask bits for HVM domUs. pciback (hardware domain OS) for PV domUs. Direct access / hypercalls for PV dom0. vPCI (hypervisor) for PVH dom0. Chicago – July 9th, 2019 Status of PCI emulation in Xen 17 / 20
  • 18. PCI bus PCI-passthroughon Xen Moving forward Shortcomings No support for VFIO/MDEV on Xen: Threatening support for vGPU/XenGT in future releases. 3 different code bases to deal with PCI config space accesses: More maintainership work. Non uniform behaviour across different guests types. Chicago – July 9th, 2019 Status of PCI emulation in Xen 18 / 20
  • 19. PCI bus PCI-passthroughon Xen Moving forward Future items Re-work vPCI so it can be used both inside the hypervisor and in user-space. Could be used by HVM and PVH guests as a standalone PCI-passthrough utility. Unify PCI-passthrough for HVM and PVH both domU and dom0 into a single code-base. Add support for the extended config space to HVM domUs: allow to passthrough PCIe capabilities. Add support to passthrough SRIOV capability to vPCI, for PVH dom0. Chicago – July 9th, 2019 Status of PCI emulation in Xen 19 / 20
  • 20. PCI bus PCI-passthroughon Xen Moving forward Q&A Thanks Questions? Chicago – July 9th, 2019 Status of PCI emulation in Xen 20 / 20