diff --git a/doc/developer-guides/hld/virtio-console.rst b/doc/developer-guides/hld/virtio-console.rst index 52f149dcd..ee73f43e7 100644 --- a/doc/developer-guides/hld/virtio-console.rst +++ b/doc/developer-guides/hld/virtio-console.rst @@ -72,7 +72,7 @@ device model: STDIO, TTY, PTY and regular file. The device model configuration command syntax for virtio-console is:: virtio-console,[@]stdio|tty|pty|file:portname[=portpath]\ - [,[@]stdio|tty|pty|file:portname[=portpath]] + [,[@]stdio|tty|pty|file:portname[=portpath][:socket_type]] - Preceding with ``@`` marks the port as a console port, otherwise it is a normal virtio serial port @@ -86,6 +86,9 @@ The device model configuration command syntax for virtio-console is:: (e.g., by ``sleep 2d`` command), and will not read input from stdin before it is used by virtio-console to redirect guest output. +- When virtio-console socket_type is appointed to client, please make sure + server VM(socket_type is appointed to server) has started. + - Claiming multiple virtio serial ports as consoles is supported, however the guest Linux OS will only use one of them, through the ``console=hvcN`` kernel parameter. For example, the following command @@ -108,39 +111,43 @@ STDIO 1. Add a pci slot to the device model (``acrn-dm``) command line:: - -s n,virtio-console,@stdio:stdio_port + -s n,virtio-console,@stdio:stdio_port #. Add the ``console`` parameter to the guest OS kernel command line:: - console=hvc0 + console=hvc0 PTY === 1. Add a pci slot to the device model (``acrn-dm``) command line:: - -s n,virtio-console,@pty:pty_port + -s n,virtio-console,@pty:pty_port #. Add the ``console`` parameter to the guest os kernel command line:: - console=hvc0 + console=hvc0 One line of information, such as shown below, will be printed in the terminal after ``acrn-dm`` is launched (``/dev/pts/0`` may be different, depending on your use case): - .. code-block: console + .. code-block:: console - virt-console backend redirected to /dev/pts/0 + virt-console backend redirected to /dev/pts/0 #. Use a terminal emulator, such as minicom or screen, to connect to the - tty node:: + tty node: - minicom -D /dev/pts/0 + .. code-block:: console - or :: + # minicom -D /dev/pts/0 + + or : - screen /dev/pts/0 + .. code-block:: console + + # screen /dev/pts/0 TTY === @@ -149,41 +156,51 @@ TTY - If you're connected to your device over the network via ssh, use the linux ``tty`` command, and it will report the node (may be - different in your use case):: + different in your use case): - /dev/pts/0 - sleep 2d + .. code-block:: console + /dev/pts/0 + # sleep 2d + - If you do not have network access to your device, use screen - to create a new tty:: + to create a new tty: - screen - tty + .. code-block:: console - you will see (depending on your use case):: + # screen + # tty - /dev/pts/0 + you will see (depending on your use case): - Prevent the tty from responding by sleeping:: + .. code-block:: console - sleep 2d + /dev/pts/0 + + Prevent the tty from responding by sleeping: + + .. code-block:: console + + # sleep 2d and detach the tty by pressing :kbd:`CTRL-A` :kbd:`d`. #. Add a pci slot to the device model (``acrn-dm``) command line (changing the ``dev/pts/X`` to match your use case):: - -s n,virtio-console,@tty:tty_port=/dev/pts/X + -s n,virtio-console,@tty:tty_port=/dev/pts/X #. Add the console parameter to the guest OS kernel command line:: - console=hvc0 + console=hvc0 #. Go back to the previous tty. For example, if you're using - ``screen``, use:: + ``screen``, use: - screen -ls - screen -r + .. code-block:: console + + # screen -ls + # screen -r FILE ==== @@ -193,8 +210,44 @@ The File backend only supports console output to a file (no input). 1. Add a pci slot to the device model (``acrn-dm``) command line, adjusting the ```` to your use case:: - -s n,virtio-console,@file:file_port= + -s n,virtio-console,@file:file_port= #. Add the console parameter to the guest OS kernel command line:: - console=hvc0 + console=hvc0 + +SOCKET +====== + +The virtio-console socket-type can be set as socket server or client. Device model will +create an unix domain socket if appointed the socket_type as server, then server VM or +another user VM can bind and listen for communication requirement. If appointed to +client, please make sure the socket server is ready prior to launch device model. + +1. Add a pci slot to the device model (``acrn-dm``) command line, adjusting + the ```` to your use case in the VM1 configuration:: + + -s n,virtio-console,socket:socket_file_name=:server + +#. Add a pci slot to the device model (``acrn-dm``) command line, adjusting + the ```` to your use case in the VM2 configuration:: + + -s n,virtio-console,socket:socket_file_name=:client + +#. Login to VM1, connect to the virtual port(vport1p0, 1 is decided + by front-end driver): + + .. code-block:: console + + # minicom -D /dev/vport1p0 + +#. Login to VM2, connect to the virtual port(vport3p0, 3 is decided + by front-end driver): + + .. code-block:: console + + # minicom -D /dev/vport3p0 + +#. Input into minicom window of VM1 or VM2, the minicom window of VM1 + will indicate the input from VM2, the minicom window of VM2 will + indicate the input from VM1.