Skip to contentSkip to conversation

USB CCID device

PATCH Alon Levy 3 participants 9 messages Oct 6, 2010 – Oct 7, 2010 1 message not in the archive

lore
Share & tools
lore

Alon Levy

author
#1 lore raw
In reply to a message not in the archive
Quoted 12 lines · ----- "Anthony Liguori
Quoted 1 line · Alon Levy

This patch adds a new device, it is described in full in the second

patch

Quoted 1 line

intro and also in the documentation in docs. In brief it provides a

standard

Quoted 4 lines

smart card reader device.

The first patch is the configure change and docs.
The second patch contains the actual device, I couldn't figure out a

good

Quoted 1 line

way to split it to ease review, so if the first reviewer can

suggest

Quoted 9 lines
Quoted 6 lines

a good way to split it I would gladly do that.

Alon Levy (2):
usb-ccid: add CCID device. add configure option.
usb-ccid: add CCID device (device itself)

Does this work with live migration? I can't see how it would.

No, it doesn't right now. It would require cooperation with the client, to tell it to reconnect to the target qemu (kind of like spice).

Quoted 16 lines

Regards,

Anthony Liguori

Quoted 4 lines
  Makefile.objs      |    1 +
  configure          |   12 +
  docs/usb-ccid.txt  |  115 +++++
  hw/usb-ccid.c      | 1254

++++++++++++++++++++++++++++++++++++++++++++++++++++

Quoted 7 lines
  hw/vscard_common.h |  123 +++++
  5 files changed, 1505 insertions(+), 0 deletions(-)

create mode 100644 docs/usb-ccid.txt
create mode 100644 hw/usb-ccid.c
create mode 100644 hw/vscard_common.h

#2 lore raw
Quoted 7 lines · Alon Levy
Quoted 4 lines

Does this work with live migration? I can't see how it would.

No, it doesn't right now. It would require cooperation with the client, to tell it to reconnect to the target qemu (kind of like spice).

I think until we have this migration should have pretty much the same effect as a chardev disconnect, i.e. detach the usb device (which the guest will see as unplug).

Needs some code though, at minimum you'll have to xfer the connected state from the migration source and have some bits in post_load() which do attach/detach if needed.

cheers,
Gerd

#3 lore raw
Quoted 10 lines · Gerd Hoffmann
Quoted 7 lines · Alon Levy
Quoted 4 lines

Does this work with live migration? I can't see how it would.

No, it doesn't right now. It would require cooperation with the client, to tell it to reconnect to the target qemu (kind of like spice).

I think until we have this migration should have pretty much the same effect as a chardev disconnect, i.e. detach the usb device (which the guest will see as unplug).

Better yet, mark the guest as unmigrateable and let the management tool unplug the usb device before migration and replug it after migration.

It's the same principle behind device assignment.

Regards,

Anthony Liguori

Quoted 5 lines

Needs some code though, at minimum you'll have to xfer the connected state from the migration source and have some bits in post_load() which do attach/detach if needed.

cheers,
Gerd

#7 lore raw
In reply to Alon Levy
Quoted 31 lines · Alon Levy
Quoted 28 lines · ----- "Anthony Liguori
Quoted 2 lines · Alon Levy

This patch adds a new device, it is described in full in the second

patch

Quoted 2 lines

intro and also in the documentation in docs. In brief it provides a

standard

Quoted 5 lines

smart card reader device.

The first patch is the configure change and docs.
The second patch contains the actual device, I couldn't figure out a

good

Quoted 2 lines

way to split it to ease review, so if the first reviewer can

suggest

Quoted 7 lines

a good way to split it I would gladly do that.

Alon Levy (2):
usb-ccid: add CCID device. add configure option.
usb-ccid: add CCID device (device itself)

Quoted 6 lines
Quoted 3 lines

Does this work with live migration? I can't see how it would.

No, it doesn't right now. It would require cooperation with the client, to tell it to reconnect to the target qemu (kind of like spice).

Is that because the device's logic is implemented in software outside of qemu or because it's somehow tied to hardware?

If it's the former, disconnect is not acceptable. The logic for the software implementation should reside in qemu such that the device can be properly migrated.

If it's tied to hardware, it's just another form of device assignment and see my other mail.

Regards,

Anthony Liguori

author
#8 lore raw
Quoted 38 lines · ----- "Anthony Liguori
Quoted 6 lines · Alon Levy
Quoted 3 lines · ----- "Anthony Liguori
Quoted 1 line · Alon Levy

This patch adds a new device, it is described in full in the

second

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

patch

Quoted 1 line

intro and also in the documentation in docs. In brief it provides

a

Quoted 7 lines
Quoted 7 lines
Quoted 1 line

standard

Quoted 4 lines

smart card reader device.

The first patch is the configure change and docs.
The second patch contains the actual device, I couldn't figure out

a

Quoted 17 lines
Quoted 17 lines
Quoted 1 line

good

Quoted 2 lines

way to split it to ease review, so if the first reviewer can

suggest

Quoted 7 lines

a good way to split it I would gladly do that.

Alon Levy (2):
usb-ccid: add CCID device. add configure option.
usb-ccid: add CCID device (device itself)

Does this work with live migration? I can't see how it would.

Quoted 8 lines
Quoted 1 line

No, it doesn't right now. It would require cooperation with the

client,

Quoted 2 lines

to tell it to reconnect to the target qemu (kind of like spice).

Is that because the device's logic is implemented in software outside of
qemu or because it's somehow tied to hardware?

Actually, both are possible - but the later is the interesting use case (the former is mainly for debugging). To elaborate: the device is meant to allow a hardware reader to be available to the guest while still being available to the client (which is running on the computer with the real reader attached). So the real card is what we are talking to. The other usage is to have a virtual card, which would actually be more logical to put with the qemu device, but It isn't my current focus (the focus being the real card, and the virtual card being implemented in the client side is a testing measure).

Quoted 6 lines

If it's the former, disconnect is not acceptable. The logic for the software implementation should reside in qemu such that the device can

be properly migrated.

Yes, I'd like to do that eventually, but it isn't the focus right now.

Quoted 4 lines

If it's tied to hardware, it's just another form of device assignment

and see my other mail.

I'll do this.

A side note: I tried migrating a QSIMPLEQ today - not a fun experience. I'm wondering if this is a result of a mentality that "all devices should allocate memory upfront" that makes using / migrating dynamic linked lists a non-starter, or just an oversight (no one wrote VMSTATE_QSIMPLEQ yet). As it stands migrating a QSIMPLEQ (or any other list) is much easier the old way without using VMSTATE. </rant>.

Quoted 3 lines

Regards,

Anthony Liguori

#4 lore raw
In reply to Anthony Liguori
Quoted 2 lines · Anthony Liguori

Better yet, mark the guest as unmigrateable and let the management tool unplug the usb device before migration and replug it after migration.

Yep, that will work too.

cheers,
Gerd

author
#5 lore raw
In reply to Anthony Liguori
Quoted 14 lines · ----- "Anthony Liguori
Quoted 7 lines · Gerd Hoffmann
Quoted 6 lines · Alon Levy
Quoted 4 lines

Does this work with live migration? I can't see how it would.

No, it doesn't right now. It would require cooperation with the

client,

Quoted 3 lines
Quoted 1 line

to tell it to reconnect to the target qemu (kind of like spice).

I think until we have this migration should have pretty much the

same

Quoted 1 line

effect as a chardev disconnect, i.e. detach the usb device (which

Quoted 9 lines

the

Quoted 1 line

guest will see as unplug).

Better yet, mark the guest as unmigrateable and let the management tool
unplug the usb device before migration and replug it after migration.

It's the same principle behind device assignment.

Is there any way to also get a pre_migrate callback with register_device_unmigratable? I'd like to send a VSC_Reconnect message, then the guest sees an unplug, then migration, then (no plug yet since the device is marked as auto_attach=0) client reconnects (actually this happens before but to a paused machine waiting for migration), and then causes attachement, same as a new machine.

Quoted 12 lines

Regards,

Anthony Liguori

Quoted 8 lines

Needs some code though, at minimum you'll have to xfer the connected

state from the migration source and have some bits in post_load() which do attach/detach if needed.

cheers,
Gerd

#6 lore raw
Quoted 31 lines · Alon Levy
Quoted 28 lines · ----- "Anthony Liguori
Quoted 8 lines · Gerd Hoffmann
Quoted 6 lines · Alon Levy
Quoted 4 lines

Does this work with live migration? I can't see how it would.

No, it doesn't right now. It would require cooperation with the

client,

Quoted 4 lines
Quoted 2 lines

to tell it to reconnect to the target qemu (kind of like spice).

I think until we have this migration should have pretty much the

same

Quoted 2 lines

effect as a chardev disconnect, i.e. detach the usb device (which

the

Quoted 2 lines

guest will see as unplug).

Better yet, mark the guest as unmigrateable and let the management tool
unplug the usb device before migration and replug it after migration.

Quoted 6 lines
Quoted 3 lines

It's the same principle behind device assignment.

Is there any way to also get a pre_migrate callback with register_device_unmigratable? I'd like to send a VSC_Reconnect message, then the guest sees an unplug, then migration,

No. The disconnect needs to happen in the management tooling layer. Same is true for any device doing hardware passthrough.

Automagic unplugging/plugging during migration is not a good idea universally so it's something that needs to happen as a policy at the management level.

Regards,

Anthony Liguori

Quoted 20 lines

then (no plug yet since the device is marked as auto_attach=0) client reconnects (actually this happens before but to a paused machine waiting for migration), and then causes attachement, same as a new machine.

Quoted 15 lines

Regards,

Anthony Liguori

Quoted 10 lines

Needs some code though, at minimum you'll have to xfer the connected

state from the migration source and have some bits in post_load() which do attach/detach if needed.

cheers,
Gerd

#9 lore raw
In reply to Alon Levy
Quoted 9 lines · Alon Levy

Actually, both are possible - but the later is the interesting use case (the former is mainly for debugging). To elaborate: the device is meant to allow a hardware reader to be available to the guest while still being available to the client (which is running on the computer with the real reader attached). So the real card is what we are talking to. The other usage is to have a virtual card, which would actually be more logical to put with the qemu device, but It isn't my current focus (the focus being the real card, and the virtual card being implemented in the client side is a testing measure).

Okay, that makes sense.

Quoted 9 lines

I'll do this.

A side note: I tried migrating a QSIMPLEQ today - not a fun experience. I'm wondering if this is a result of a mentality that "all devices should allocate memory upfront" that makes using / migrating dynamic linked lists a non-starter, or just an oversight (no one wrote VMSTATE_QSIMPLEQ yet). As it stands migrating a QSIMPLEQ (or any other list) is much easier the old way without using VMSTATE. </rant>.

Yeah, complex types are not at all easy to migrate today. Something we need to tackle with vmstate2 eventually.

Regards,

Anthony Liguori

Quoted 4 lines
Quoted 4 lines

Regards,

Anthony Liguori