1.. _split-device-model:
2
3Split Device Model
4==================
5
6We usually emulate devices in the Device Model. However, in some cases, we
7need to emulate devices in the ACRN Hypervisor. For example, the
8post-launched RTVM needs to emulate passthrough PCI(e) devices in the ACRN
9Hypervisor so that it can continue to run even if the Device Model is
10no longer working. Nevertheless, the Device Model still owns the overall
11resource management such as memory/MMIO space and interrupt pins.
12
13One communication method provided by the ACRN Hypervisor aligns the resource information for the Device Model with the ACRN Hypervisor emulated device.
14
15Let's take the passthrough PCI(e) device as an example. Before we split
16passthrough PCI(e) devices from the Device Model to the ACRN Hypervisor, the
17whole picture looks like this:
18
19.. figure:: images/split-dm-image1.png
20   :align: center
21   :width: 900px
22   :name: split-dm-architecture-overview1
23
24   PCI Config space access in the Service VM or Pre-launched VM
25
26.. figure:: images/split-dm-image2.png
27   :align: center
28   :width: 900px
29   :name: split-dm-architecture-overview2
30
31   PCI Config space access in the Post-launched VM
32
33After we split passthrough PCI(e) devices from the Device Model to the
34ACRN Hypervisor, the whole picture looks like this:
35
36.. figure:: images/split-dm-image3.png
37   :align: center
38   :width: 900px
39   :name: split-dm-architecture-overview3
40
41.. figure:: images/split-dm-image4.png
42   :align: center
43   :width: 900px
44   :name: split-dm-architecture-overview4
45
46   PCI Config space access in the Post-launched VM
47
48Interfaces Design
49=================
50
51In order to achieve this, we have added a new pair of hypercalls to align
52the PCI(e) BAR and INTx information.
53
54.. doxygenfunction:: hcall_assign_pcidev
55   :project: Project ACRN
56
57.. doxygenfunction:: hcall_deassign_pcidev
58   :project: Project ACRN
59
60