[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] RFC: connecting chardev to a command forked by qemu

From: Patrick Ohly
Subject: [Qemu-devel] RFC: connecting chardev to a command forked by qemu
Date: Mon, 06 Nov 2017 18:11:43 +0100


When Amarnath proposed the initial patch set for interacting with swtpm
without relying on CUSE, letting QEMU invoke swtpm was part of the
patch series. When using some virtual machine management framework like
 virt-manager that might not be necessary. But our goal was to use
QEMU+swtpm to test TPM support in Yocto, and there QEMU is started by a
simple wrapper script where handling additional processes would be

To achieve that goal without having to make that script more complex,
I'd like to propose that with some minor (?) changes, a chardev could
also be configured to use an external command. As a proof of concept
I'm attaching a patch which modifies char-socket.c accordingly.

Because it's now implemented using the chardev concept, this feature
could also be useful for other purposes besides connecting to swtpm.
For example, it could also be used to connect a serial port to anything
that socat supports, which is more than the builtin code can handle.

Is that something that has a chance of getting merged?

The specific implementation may need more work. I'm not entirely happy
about adding the "cmd" option to the existing char-socket.c. It might
be cleaner to have a separate char-cmd.c. I'm just not sure how the
common code (for example, everything related to read/write, like
tcp_chr_read) then could be shared.

Or perhaps it shouldn't be shared? Introducing yet another base class
for SocketChardev and a future SocketCmd looks like overkill to me.

Regarding SocketChardev, for what are the "addr" and "connected"
properties used? Would it be useful to also have something like that in
a hypothetical char-cmd.c?

When SocketChardev is configured to establish a connection as client,
does it do that only on demand? I haven't checked what triggers that
code. It might be useful to only spawn the command when actually needed
by some frontend. Perhaps then the command can also be spawned multiple
times. Right now it gets spawned exactly once when creating thechardev. 

Best Regards, Patrick Ohly

The content of this message is my personal opinion only and although
I am an employee of Intel, the statements I make here in no way
represent Intel's position on the issue, nor am I authorized to speak
on behalf of Intel on this matter.

Attachment: 0001-chardev-connect-socket-to-a-spawned-command.patch
Description: Text Data

reply via email to

[Prev in Thread] Current Thread [Next in Thread]