Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OvmfPkg/VirtioSerialDxe: respond CONSOLE_PORT with PORT_OPEN #10575

Merged
merged 1 commit into from
Jan 4, 2025

Conversation

t0rr3sp3dr0
Copy link
Contributor

Description

The VirtIO spec states the following (from https://docs.oasis-open.org/virtio/virtio/v1.3/virtio-v1.3.html#x1-3330002):

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

The current driver implementation, however, does not comply with that and only send PORT_OPEN messages when receiving 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, a behaviour that is compliant with the specification.

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

  • Breaking change?
    • Breaking change - Does this PR cause a break in build or boot behavior?
    • Examples: Does it add a new library class or move a module to a different repo.
  • Impacts security?
    • Security - Does this PR have a direct security impact?
    • Examples: Crypto algorithm change or buffer overflow fix.
  • Includes tests?
    • Tests - Does this PR include any explicit test code?
    • Examples: Unit tests or integration tests.

How This Was Tested

The driver was compiled and tested on QEMU and Virtualization Framework VMs.

Integration Instructions

N/A

@ardbiesheuvel
Copy link
Member

Please put the description in the commit log of the patch so it does not get lost when merging the PR.

@t0rr3sp3dr0 t0rr3sp3dr0 force-pushed the patch-2 branch 2 times, most recently from be441af to bfef97c Compare January 2, 2025 21:12
@t0rr3sp3dr0
Copy link
Contributor Author

Done, @ardbiesheuvel!

@ardbiesheuvel
Copy link
Member

Done, @ardbiesheuvel!

Thanks. Could you also fix the title please?

@t0rr3sp3dr0 t0rr3sp3dr0 force-pushed the patch-2 branch 2 times, most recently from 9032c93 to cfaf8cb Compare January 2, 2025 21:26
@t0rr3sp3dr0
Copy link
Contributor Author

Sorry, missed that. Done!

@ardbiesheuvel ardbiesheuvel added the push Auto push patch series in PR if all checks pass label Jan 2, 2025
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]>
@mergify mergify bot merged commit f6e19ab into tianocore:master Jan 4, 2025
126 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
push Auto push patch series in PR if all checks pass
Projects
None yet
3 participants