From be441af5da7f5b99e4b536bf429be1b5685f59ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20T=C3=B4rres?= Date: Tue, 31 Dec 2024 06:26:59 -0800 Subject: [PATCH] respond CONSOLE_PORT with PORT_OPEN MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- OvmfPkg/VirtioSerialDxe/VirtioSerial.c | 1 + 1 file changed, 1 insertion(+) diff --git a/OvmfPkg/VirtioSerialDxe/VirtioSerial.c b/OvmfPkg/VirtioSerialDxe/VirtioSerial.c index fd34ad75a9a07..e0266ad006d0d 100644 --- a/OvmfPkg/VirtioSerialDxe/VirtioSerial.c +++ b/OvmfPkg/VirtioSerialDxe/VirtioSerial.c @@ -165,6 +165,7 @@ VirtioSerialRxControl ( if (Control.Id < MAX_PORTS) { VirtioSerialPortSetConsole (Dev, Control.Id); Dev->NumConsoles++; + VirtioSerialPortSetDeviceOpen (Dev, Control.Id, 1); } break;