You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix "duplicate label" error (name of a figure collided with the name of
a document). Also fixed very long lines, cleaned up some stray extra
spaces that were breaking up words, and some grammar issues.
Signed-off-by: David B. Kinder <david.b.kinder@intel.com>
Copy file name to clipboardExpand all lines: doc/developer-guides/hld/vuart-virt-hld.rst
+58-25Lines changed: 58 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,15 +6,19 @@ vUART Virtualization
6
6
Architecture
7
7
************
8
8
9
-
vUART is virtual 16550 uart implemented in hypervisor. It can work as a console or a communication port. Currently, the vuart is mapped to the traditional COM port address. Uart driver in kernel can auto detect the port base and irq.
9
+
A vUART is a virtual 16550 UART implemented in the hypervisor. It can work as a
10
+
console or a communication port. Currently, the vUART is mapped to the
11
+
traditional COM port address. A UART driver in the kernel can auto detect the
12
+
port base and IRQ.
10
13
11
14
.. figure:: images/uart-virt-hld-1.png
12
15
:align:center
13
-
:name:uart-arch
16
+
:name:uart-arch-pic
14
17
15
18
UART virtualization architecture
16
19
17
-
Each vUART has two FIFOs, 8192 bytes Tx FIFO and 256 bytes Rx FIFO. Currently, we only provide 4 ports for use.
20
+
Each vUART has two FIFOs: 8192 bytes Tx FIFO and 256 bytes Rx FIFO.
21
+
Currently, we only provide 4 ports for use.
18
22
19
23
- COM1 (port base: 0x3F8, irq: 4)
20
24
@@ -24,12 +28,20 @@ Each vUART has two FIFOs, 8192 bytes Tx FIFO and 256 bytes Rx FIFO. Currently,
24
28
25
29
- COM4 (port base: 0x2E8, irq: 7)
26
30
27
-
A VM can enable one console vuart and several communication vuarts.
31
+
A VM can enable one console vUART and several communication vUARTs.
28
32
29
33
Console vUART
30
34
*************
31
35
32
-
vUART can be used as a console port, and it can be activated by ``vm_console <vm_id>`` command in hypervisor console. From :numref:`console-uart-arch`, there is only one physical uart, but four console vuarts (green color blocks). A hypervisor console is implemented above the physical uart, and it works in polling mode. There is a timer in hv console, the timer handler dispatches the input from physical uart to the vuart or the hypervisor shell process and get data from vuart’s Tx FIFO and send to physical uart. The data in vuart’s FIFOs will be overwritten when it is not taken out intime.
36
+
A vUART can be used as a console port, and it can be activated by
37
+
a ``vm_console <vm_id>`` command in the hypervisor console. From
38
+
:numref:`console-uart-arch`, there is only one physical UART, but four
39
+
console vUARTs (green color blocks). A hypervisor console is implemented
40
+
above the physical UART, and it works in polling mode. There is a timer
41
+
in hv console. The timer handler dispatches the input from physical UART
42
+
to the vUART or the hypervisor shell process and gets data from vUART's
43
+
Tx FIFO and sends it to the physical UART. The data in vUART's FIFOs will be
44
+
overwritten when it is not taken out in time.
33
45
34
46
.. figure:: images/uart-virt-hld-2.png
35
47
:align:center
@@ -40,33 +52,37 @@ vUART can be used as a console port, and it can be activated by ``vm_console <v
40
52
Communication vUART
41
53
*******************
42
54
43
-
The communication vuart is used to transfer data between two VMs in low speed. For kernel driver, it is a general uart, can be detected and probed by 8250 serial driver. But in hypervisor, it has special process.
55
+
The communication vUART is used to transfer data between two VMs in low
56
+
speed. For kernel driver, it is a general UART, can be detected and
57
+
probed by 8250 serial driver. But in hypervisor, it has special process.
44
58
45
-
From :numref:`communication-uart-arch`, the vuart in two VMs is connected according to the configuration in hypervisor. When user write a byte to the communication uart in VM0:
59
+
From :numref:`communication-uart-arch`, the vUART in two VMs is
60
+
connected according to the configuration in hypervisor. When user
61
+
writes a byte to the communication UART in VM0:
46
62
47
63
Operations in VM0
48
64
49
-
- VM0 uart driver put the data to THR.
65
+
- VM0 UART driver puts the data to THR.
50
66
51
-
- VM trap to hypervisor, and the vuart PIO handler is called.
67
+
- VM traps to hypervisor, and the vUART PIO handler is called.
52
68
53
-
- Put the data to its target vuart’s Rx FIFO.
69
+
- Puts the data to its target vUART's Rx FIFO.
54
70
55
-
- Inject a Data Ready interrupt to VM1.
71
+
- Injects a Data Ready interrupt to VM1.
56
72
57
-
- If the target vuart’s FIFO is not full, inject a THRE interrupt to VM0.
73
+
- If the target vUART's FIFO is not full, injects a THRE interrupt to VM0.
58
74
59
-
- Return.
75
+
- Returns.
60
76
61
77
Operations in VM1
62
78
63
-
- Receive an interrupt, dispatch to uart driver.
79
+
- Receives an interrupt, dispatches to UART driver.
64
80
65
-
- Read LSR register, find a Data Ready interrupt.
81
+
- Reads LSR register, finds a Data Ready interrupt.
66
82
67
-
- Read data from Rx FIFO.
83
+
- Reads data from Rx FIFO.
68
84
69
-
- If Rx FIFO is not full, inject THRE interrupt to VM0.
85
+
- If Rx FIFO is not full, injects THRE interrupt to VM0.
70
86
71
87
.. figure:: images/uart-virt-hld-3.png
72
88
:align:center
@@ -79,7 +95,11 @@ Usage
79
95
80
96
- For console vUART
81
97
82
-
To enable the console port for a VM, only need to change the port_base and irq in ``acrn-hypervi sor/hypervisor/scenarios/<scenario name>/vm_configurations.c``. If the irq number has been used in your system ( ``cat /proc/interrupt``), you can choose other IRQ number. Set the .irq =0, the vuart will work in polling mode.
98
+
To enable the console port for a VM, change the
99
+
port_base and IRQ in ``acrn-hypervisor/hypervisor/scenarios/<scenario
100
+
name>/vm_configurations.c``. If the IRQ number has been used in your
101
+
system ( ``cat /proc/interrupt``), you can choose other IRQ number. Set
102
+
the .irq =0, the vUART will work in polling mode.
83
103
84
104
- COM1_BASE (0x3F8) + COM1_IRQ(4)
85
105
@@ -97,16 +117,23 @@ Usage
97
117
.irq = COM1_IRQ,
98
118
}
99
119
100
-
The kernel bootargs ``console=ttySx`` should be the same with vuart[0], otherwise, the kernel co nsole log can not captured by hypervisor.Then, after bringup the system, you can switch the cons ole to the target VM by:
120
+
The kernel bootargs ``console=ttySx`` should be the same with
121
+
vuart[0], otherwise, the kernel console log can not captured by
122
+
hypervisor. Then, after bringing up the system, you can switch the console
123
+
to the target VM by:
101
124
102
125
.. code-block:: console
103
-
126
+
104
127
ACRN:\>vm_console 0
105
128
----- Entering VM 0 Shell -----
106
129
107
130
- For communication vUART
108
-
109
-
To enable the communication port, you should configure vuart[1] in the two VMs which want to com municate. The port_base and irq should not repeat with the vuart[0] in the same VM. t_vuart.vm_i d is the target VM's vm_id, start from 0 (0 means VM0). t_vuart.vuart_id is the target vuart ind ex in the target VM, start from 1 (1 means vuart[1]).
131
+
132
+
To enable the communication port, you should configure vuart[1] in
133
+
the two VMs which want to communicate. The port_base and IRQ should
134
+
not repeat with the vuart[0] in the same VM. t_vuart.vm_id is the
135
+
target VM's vm_id, start from 0 (0 means VM0). t_vuart.vuart_id is the
136
+
target vUART index in the target VM, start from 1 (1 means vuart[1]).
110
137
111
138
Example::
112
139
@@ -130,7 +157,13 @@ Usage
130
157
.t_vuart.vuart_id = 1U,
131
158
},
132
159
133
-
.. note:: As the device mode also has virtual uart, and also use 0x3F8 and 0x2F8 as port base. If y ou add ``-s <slot>, lpc`` in launch script, the device model will create COM0 and COM1 for the p ost launched VM. It will also add the port info to ACPI table. This is useful for windows, vxwor ksas they probe driver according to ACPI table.
134
-
135
-
If user enable both the device model uart and hypervisor vuart in the same port address, the ac cess to the port address will be response by hypervisor vuart directly and will not pass to devi ce model.
160
+
.. note:: The device mode also has a virtual UART, and also uses 0x3F8
161
+
and 0x2F8 as port base. If you add ``-s <slot>, lpc`` in the launch
162
+
script, the device model will create COM0 and COM1 for the post
163
+
launched VM. It will also add the port info to the ACPI table. This is
164
+
useful for Windows and vxworks as they probe the driver according to the ACPI
165
+
table.
136
166
167
+
If user enables both the device model UART and hypervisor vUART at the
168
+
same port address, access to the port address will be responded to
169
+
by the hypervisor vUART directly, and will not pass to the device model.
0 commit comments