Merge remote-tracking branch 'kraxel/usb.67' into staging

* kraxel/usb.67:
  uhci: Raise interrupt when requested even for non active tds
  usb-redir: Don't make migration fail in none seamless case
  usb-redir: Change usbredir_open_chardev into usbredir_create_parser
This commit is contained in:
Anthony Liguori 2012-10-12 09:14:32 -05:00
commit 628cc97df7
2 changed files with 23 additions and 11 deletions

View File

@ -826,8 +826,16 @@ static int uhci_handle_td(UHCIState *s, uint32_t addr, UHCI_TD *td,
USBEndpoint *ep;
/* Is active ? */
if (!(td->ctrl & TD_CTRL_ACTIVE))
if (!(td->ctrl & TD_CTRL_ACTIVE)) {
/*
* ehci11d spec page 22: "Even if the Active bit in the TD is already
* cleared when the TD is fetched ... an IOC interrupt is generated"
*/
if (td->ctrl & TD_CTRL_IOC) {
*int_mask |= 0x01;
}
return TD_RESULT_NEXT_QH;
}
async = uhci_async_find_td(s, addr, td);
if (async) {

View File

@ -862,15 +862,11 @@ static void usbredir_chardev_close_bh(void *opaque)
}
}
static void usbredir_chardev_open(USBRedirDevice *dev)
static void usbredir_create_parser(USBRedirDevice *dev)
{
uint32_t caps[USB_REDIR_CAPS_SIZE] = { 0, };
int flags = 0;
/* Make sure any pending closes are handled (no-op if none pending) */
usbredir_chardev_close_bh(dev);
qemu_bh_cancel(dev->chardev_close_bh);
DPRINTF("creating usbredirparser\n");
dev->parser = qemu_oom_check(usbredirparser_create());
@ -982,7 +978,10 @@ static void usbredir_chardev_event(void *opaque, int event)
switch (event) {
case CHR_EVENT_OPENED:
DPRINTF("chardev open\n");
usbredir_chardev_open(dev);
/* Make sure any pending closes are handled (no-op if none pending) */
usbredir_chardev_close_bh(dev);
qemu_bh_cancel(dev->chardev_close_bh);
usbredir_create_parser(dev);
break;
case CHR_EVENT_CLOSED:
DPRINTF("chardev close\n");
@ -1615,12 +1614,17 @@ static int usbredir_get_parser(QEMUFile *f, void *priv, size_t unused)
}
/*
* Our chardev should be open already at this point, otherwise
* the usbredir channel will be broken (ie spice without seamless)
* If our chardev is not open already at this point the usbredir connection
* has been broken (non seamless migration, or restore from disk).
*
* In this case create a temporary parser to receive the migration data,
* and schedule the close_bh to report the device as disconnected to the
* guest and to destroy the parser again.
*/
if (dev->parser == NULL) {
ERROR("get_parser called with closed chardev, failing migration\n");
return -1;
WARNING("usb-redir connection broken during migration\n");
usbredir_create_parser(dev);
qemu_bh_schedule(dev->chardev_close_bh);
}
data = g_malloc(len);