Skip to content

Commit b5f77c0

Browse files
gaojunhao0504deb-intel
authored andcommitted
doc: add socket console backend for virtio-console
add new console backend of socket for virtio-console Signed-off-by: Gao Junhao <junhao.gao@intel.com>
1 parent d3ac30c commit b5f77c0

File tree

1 file changed

+81
-28
lines changed

1 file changed

+81
-28
lines changed

doc/developer-guides/hld/virtio-console.rst

Lines changed: 81 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ device model: STDIO, TTY, PTY and regular file.
7272
The device model configuration command syntax for virtio-console is::
7373

7474
virtio-console,[@]stdio|tty|pty|file:portname[=portpath]\
75-
[,[@]stdio|tty|pty|file:portname[=portpath]]
75+
[,[@]stdio|tty|pty|file:portname[=portpath][:socket_type]]
7676

7777
- Preceding with ``@`` marks the port as a console port, otherwise it is a
7878
normal virtio serial port
@@ -86,6 +86,9 @@ The device model configuration command syntax for virtio-console is::
8686
(e.g., by ``sleep 2d`` command), and will not read input from stdin before it
8787
is used by virtio-console to redirect guest output.
8888

89+
- When virtio-console socket_type is appointed to client, please make sure
90+
server VM(socket_type is appointed to server) has started.
91+
8992
- Claiming multiple virtio serial ports as consoles is supported,
9093
however the guest Linux OS will only use one of them, through the
9194
``console=hvcN`` kernel parameter. For example, the following command
@@ -108,39 +111,43 @@ STDIO
108111

109112
1. Add a pci slot to the device model (``acrn-dm``) command line::
110113

111-
-s n,virtio-console,@stdio:stdio_port
114+
-s n,virtio-console,@stdio:stdio_port
112115

113116
#. Add the ``console`` parameter to the guest OS kernel command line::
114117

115-
console=hvc0
118+
console=hvc0
116119

117120
PTY
118121
===
119122

120123
1. Add a pci slot to the device model (``acrn-dm``) command line::
121124

122-
-s n,virtio-console,@pty:pty_port
125+
-s n,virtio-console,@pty:pty_port
123126

124127
#. Add the ``console`` parameter to the guest os kernel command line::
125128

126-
console=hvc0
129+
console=hvc0
127130

128131
One line of information, such as shown below, will be printed in the terminal
129132
after ``acrn-dm`` is launched (``/dev/pts/0`` may be different,
130133
depending on your use case):
131134

132-
.. code-block: console
135+
.. code-block:: console
133136

134-
virt-console backend redirected to /dev/pts/0
137+
virt-console backend redirected to /dev/pts/0
135138

136139
#. Use a terminal emulator, such as minicom or screen, to connect to the
137-
tty node::
140+
tty node:
141+
142+
.. code-block:: console
138143
139-
minicom -D /dev/pts/0
144+
# minicom -D /dev/pts/0
145+
146+
or :
140147

141-
or ::
148+
.. code-block:: console
142149
143-
screen /dev/pts/0
150+
# screen /dev/pts/0
144151
145152
TTY
146153
===
@@ -149,41 +156,51 @@ TTY
149156

150157
- If you're connected to your device over the network via ssh, use
151158
the linux ``tty`` command, and it will report the node (may be
152-
different in your use case)::
159+
different in your use case):
153160

154-
/dev/pts/0
155-
sleep 2d
161+
.. code-block:: console
156162
163+
/dev/pts/0
164+
# sleep 2d
165+
157166
- If you do not have network access to your device, use screen
158-
to create a new tty::
167+
to create a new tty:
168+
169+
.. code-block:: console
170+
171+
# screen
172+
# tty
173+
174+
you will see (depending on your use case):
159175

160-
screen
161-
tty
176+
.. code-block:: console
162177
163-
you will see (depending on your use case)::
178+
/dev/pts/0
164179
165-
/dev/pts/0
180+
Prevent the tty from responding by sleeping:
166181

167-
Prevent the tty from responding by sleeping::
182+
.. code-block:: console
168183
169-
sleep 2d
184+
# sleep 2d
170185
171186
and detach the tty by pressing :kbd:`CTRL-A` :kbd:`d`.
172187

173188
#. Add a pci slot to the device model (``acrn-dm``) command line
174189
(changing the ``dev/pts/X`` to match your use case)::
175190

176-
-s n,virtio-console,@tty:tty_port=/dev/pts/X
191+
-s n,virtio-console,@tty:tty_port=/dev/pts/X
177192

178193
#. Add the console parameter to the guest OS kernel command line::
179194

180-
console=hvc0
195+
console=hvc0
181196

182197
#. Go back to the previous tty. For example, if you're using
183-
``screen``, use::
198+
``screen``, use:
184199

185-
screen -ls
186-
screen -r <pid_of_your_tty>
200+
.. code-block:: console
201+
202+
# screen -ls
203+
# screen -r <pid_of_your_tty>
187204
188205
FILE
189206
====
@@ -193,8 +210,44 @@ The File backend only supports console output to a file (no input).
193210
1. Add a pci slot to the device model (``acrn-dm``) command line,
194211
adjusting the ``</path/to/file>`` to your use case::
195212

196-
-s n,virtio-console,@file:file_port=</path/to/file>
213+
-s n,virtio-console,@file:file_port=</path/to/file>
197214

198215
#. Add the console parameter to the guest OS kernel command line::
199216

200-
console=hvc0
217+
console=hvc0
218+
219+
SOCKET
220+
======
221+
222+
The virtio-console socket-type can be set as socket server or client. Device model will
223+
create an unix domain socket if appointed the socket_type as server, then server VM or
224+
another user VM can bind and listen for communication requirement. If appointed to
225+
client, please make sure the socket server is ready prior to launch device model.
226+
227+
1. Add a pci slot to the device model (``acrn-dm``) command line, adjusting
228+
the ``</path/to/file.sock>`` to your use case in the VM1 configuration::
229+
230+
-s n,virtio-console,socket:socket_file_name=</path/to/file.sock>:server
231+
232+
#. Add a pci slot to the device model (``acrn-dm``) command line, adjusting
233+
the ``</path/to/file.sock>`` to your use case in the VM2 configuration::
234+
235+
-s n,virtio-console,socket:socket_file_name=</path/to/file.sock>:client
236+
237+
#. Login to VM1, connect to the virtual port(vport1p0, 1 is decided
238+
by front-end driver):
239+
240+
.. code-block:: console
241+
242+
# minicom -D /dev/vport1p0
243+
244+
#. Login to VM2, connect to the virtual port(vport3p0, 3 is decided
245+
by front-end driver):
246+
247+
.. code-block:: console
248+
249+
# minicom -D /dev/vport3p0
250+
251+
#. Input into minicom window of VM1 or VM2, the minicom window of VM1
252+
will indicate the input from VM2, the minicom window of VM2 will
253+
indicate the input from VM1.

0 commit comments

Comments
 (0)