On 02/21/2012 07:18 AM, Michael S. Tsirkin wrote:
On Tue, Feb 21, 2012 at 06:19:26AM -0500, Stefan Berger wrote:
On 02/20/2012 10:18 PM, Michael S. Tsirkin wrote:
On Mon, Feb 20, 2012 at 07:43:05PM -0500, Stefan Berger wrote:
On 02/20/2012 05:02 PM, Michael S. Tsirkin wrote:
On Wed, Dec 14, 2011 at 08:43:17AM -0500, Stefan Berger wrote:
Alternatively, I imagined that you can pass a copy
or pointer of the necessary state to the backend,
which queues the command and wakes the worker.
In the reverse direction, backend queues a response
and when OS polls you dequeue it and update state.

The OS doesn't necessarily need to poll. It is just one mode of
operation of the OS, the other being interrupt-driven where the
backend raises the interrupt once it has delivered the response to
the frontend.


    Stefan
So you will also need to signal the frontend when it
must interrupt the guest. This is not a problem,
for example you can use a qemu_eventfd object for this.


When the backend delivers the response it checks whether the interface is used in interrupt mode and raises the interrupt. The backend enters the frontend code with a callback. In this function also a signal is sent that may wake up the main thread that, upon suspend, may be waiting for the last command to be processed and be sleeping on a condition variable.

I now added a function to the backend interface that is invoked by the frontend to notify the backend of a TPM request. The backend code can then either notify a thread (passthrough and libtpms driver) or create a response right away and invoke that callback to the front-end to deliver the response (null driver). How frontend and backend handle notifications is isolated to the frontend and backend with some backends (libtpms, passthough) sharing the code for how the notification is done.

Stefan


Reply via email to