diff --git a/doc/developer-guides/hld/hld-emulated-devices.rst b/doc/developer-guides/hld/hld-emulated-devices.rst index d16c86f6d..034832977 100644 --- a/doc/developer-guides/hld/hld-emulated-devices.rst +++ b/doc/developer-guides/hld/hld-emulated-devices.rst @@ -21,3 +21,4 @@ documented in this section. RTC emulation in hypervisor Hostbridge emulation AT keyboard controller emulation + Split Device Model diff --git a/doc/developer-guides/hld/hv-dev-passthrough.rst b/doc/developer-guides/hld/hv-dev-passthrough.rst index 8fe895668..1b41c891f 100644 --- a/doc/developer-guides/hld/hv-dev-passthrough.rst +++ b/doc/developer-guides/hld/hv-dev-passthrough.rst @@ -155,24 +155,10 @@ directly. EPT mapping is not built for these pages having MSI-X table. Device configuration emulation ****************************** -PCI configuration is based on access of port 0xCF8/CFC. ACRN -implements PCI configuration emulation to handle 0xCF8/CFC to control -PCI device through two paths: implemented in hypervisor or in Service VM device -model. - -- When configuration emulation is in the hypervisor, the interception of - 0xCF8/CFC port and emulation of PCI configuration space access are - tricky and unclean. Therefore the final solution is to reuse the - PCI emulation infrastructure of Service VM device model. The hypervisor - routes the UOS 0xCF8/CFC access to device model, and keeps blind to the - physical PCI devices. Upon receiving UOS PCI configuration space access - request, device model needs to emulate some critical space, for instance, - BAR, MSI capability, and INTLINE/INTPIN. - -- For other access, device model - reads/writes physical configuration space on behalf of UOS. To do - this, device model is linked with lib pci access to access physical PCI - device. +PCI configuration space could been accessed by PCI-compatible Configuration Mechanism +(IO port 0xCF8/CFC) and PCI Express Enhanced Configuration Access Mechanism (PCI MMCONFIG). +ACRN hypervisor will trap these PCI configuration space access and emulate it. You may refer +to :ref:`split-device-model` for detail. MSI-X table emulation ********************* diff --git a/doc/developer-guides/hld/images/split-dm-image1.png b/doc/developer-guides/hld/images/split-dm-image1.png new file mode 100644 index 000000000..a4083183a Binary files /dev/null and b/doc/developer-guides/hld/images/split-dm-image1.png differ diff --git a/doc/developer-guides/hld/images/split-dm-image2.png b/doc/developer-guides/hld/images/split-dm-image2.png new file mode 100644 index 000000000..9a6e43b28 Binary files /dev/null and b/doc/developer-guides/hld/images/split-dm-image2.png differ diff --git a/doc/developer-guides/hld/images/split-dm-image3.png b/doc/developer-guides/hld/images/split-dm-image3.png new file mode 100644 index 000000000..4ae0e928e Binary files /dev/null and b/doc/developer-guides/hld/images/split-dm-image3.png differ diff --git a/doc/developer-guides/hld/images/split-dm-image4.png b/doc/developer-guides/hld/images/split-dm-image4.png new file mode 100644 index 000000000..6e790c47c Binary files /dev/null and b/doc/developer-guides/hld/images/split-dm-image4.png differ diff --git a/doc/developer-guides/hld/split-dm.rst b/doc/developer-guides/hld/split-dm.rst new file mode 100644 index 000000000..99af9836f --- /dev/null +++ b/doc/developer-guides/hld/split-dm.rst @@ -0,0 +1,58 @@ +.. _split-device-model: + +Split Device Model +================== + +We usually emulate device in Device Model. However, we need to emulate device in +ACRN Hypervisor for some reasons. For example, post-launched RTVM needs to emulate +pass through PCI(e) devices in ACRN Hypervisor in which case it could continue to +running even if the Device Model is killed. In spite of this, the Device Model still +should own the overall resouce management like memroy/MMIO space, interrupt pin etc. +So there shall be one communication method provided by ACRN Hypervisor, which used +to align the resource information for Device Model to ACRN Hypervisor emulated device. + +Let's still take the pass through PCI(e) device as an example: +Before we split pass through PCI(e) device from Device Model to ACRN Hypervisor, the +whole picture is like this: + +.. figure:: images/split-dm-image1.png + :align: center + :width: 900px + :name: split-dm-architecture-overview1 + + PCI Config space access in Service VM or Pre-launched VM + +.. figure:: images/split-dm-image2.png + :align: center + :width: 900px + :name: split-dm-architecture-overview2 + + PCI Config space access in Post-launched VM + +After we split pass through PCI(e) device from Device Model to ACRN Hypervisor, the +whole picture is like this: + +.. figure:: images/split-dm-image3.png + :align: center + :width: 900px + :name: split-dm-architecture-overview3 + +.. figure:: images/split-dm-image4.png + :align: center + :width: 900px + :name: split-dm-architecture-overview4 + + PCI Config space access in Post-launched VM + +Interfaces Design +================= + +In order to achieve this, we add a new pair of hypercall to align the PCI(e) BAR +and INTx information. + +.. doxygenfunction:: hcall_assign_pcidev + :project: Project ACRN + +.. doxygenfunction:: hcall_deassign_pcidev + :project: Project ACRN +