Skip to content

Commit

Permalink
OvmfPkg/VirtioSerialDxe: respond CONSOLE_PORT with PORT_OPEN
Browse files Browse the repository at this point in the history
The VirtIO spec states that "Upon receipt of a
VIRTIO_CONSOLE_CONSOLE_PORT message, the driver SHOULD treat the port in
a manner suitable for text console access and MUST respond with a
VIRTIO_CONSOLE_PORT_OPEN message, which MUST have value set to 1". See
https://docs.oasis-open.org/virtio/virtio/v1.3/virtio-v1.3.html#x1-3330002.

The current driver implementation, however, does not comply with that
and only sends PORT_OPEN messages upon receipt of PORT_OPEN messages.
This causes a problem in platforms like Apple's Virtualization
Framework, where PORT_OPEN messages are not sent back to the driver
after CONSOLE_PORT messages are received by the device, a behaviour that
is compliant with the VirtIO specification.

This patch addresses this issue by always responding CONSOLE_PORT
messages with PORT_OPEN messages.

Signed-off-by: Pedro Tôrres <[email protected]>
  • Loading branch information
t0rr3sp3dr0 authored and mergify[bot] committed Jan 4, 2025
1 parent dca265a commit f6e19ab
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions OvmfPkg/VirtioSerialDxe/VirtioSerial.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ VirtioSerialRxControl (
if (Control.Id < MAX_PORTS) {
VirtioSerialPortSetConsole (Dev, Control.Id);
Dev->NumConsoles++;
VirtioSerialPortSetDeviceOpen (Dev, Control.Id, 1);
}

break;
Expand Down

0 comments on commit f6e19ab

Please sign in to comment.