* [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host)
@ 2015-07-17 11:29 Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 1/4] Re-attach usb device to kernel while usb_host_open fails Gerd Hoffmann
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2015-07-17 11:29 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Here are usb fixes for 2.4.
please pull,
Gerd
The following changes since commit 2d5ee9e7a7dd495d233cf9613a865f63f88e3375:
Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150716' into staging (2015-07-16 10:40:23 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-usb-20150717-1
for you to fetch changes up to 92fdfa4bef9c92addcc009dd3e0131172b4fdc78:
Revert "xhci: set timer to retry xfers" (2015-07-17 13:20:53 +0200)
----------------------------------------------------------------
usb: fixes for 2.4 (ccid, xhci and usb-host)
----------------------------------------------------------------
Gerd Hoffmann (3):
usb-ccid: fix 61b4887b41b270bc837ead57bc502d904af023bb
usb-ccid: add missing wakeup calls
Revert "xhci: set timer to retry xfers"
Lin Ma (1):
Re-attach usb device to kernel while usb_host_open fails
hw/usb/dev-smartcard-reader.c | 21 +++++++++++++--------
hw/usb/hcd-xhci.c | 2 --
hw/usb/host-libusb.c | 3 +++
3 files changed, 16 insertions(+), 10 deletions(-)
^ permalink raw reply [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 1/4] Re-attach usb device to kernel while usb_host_open fails
2015-07-17 11:29 [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Gerd Hoffmann
@ 2015-07-17 11:29 ` Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 2/4] usb-ccid: fix 61b4887b41b270bc837ead57bc502d904af023bb Gerd Hoffmann
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2015-07-17 11:29 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann, Lin Ma
From: Lin Ma <lma@suse.com>
Signed-off-by: Lin Ma <lma@suse.com>
Reviewed-by: Gonglei <arei.gonglei@huawei.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/host-libusb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/usb/host-libusb.c b/hw/usb/host-libusb.c
index bc2944c..11429f5 100644
--- a/hw/usb/host-libusb.c
+++ b/hw/usb/host-libusb.c
@@ -889,6 +889,9 @@ static int usb_host_open(USBHostDevice *s, libusb_device *dev)
fail:
trace_usb_host_open_failure(bus_num, addr);
if (s->dh != NULL) {
+ usb_host_release_interfaces(s);
+ libusb_reset_device(s->dh);
+ usb_host_attach_kernel(s);
libusb_close(s->dh);
s->dh = NULL;
s->dev = NULL;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 2/4] usb-ccid: fix 61b4887b41b270bc837ead57bc502d904af023bb
2015-07-17 11:29 [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 1/4] Re-attach usb device to kernel while usb_host_open fails Gerd Hoffmann
@ 2015-07-17 11:29 ` Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 3/4] usb-ccid: add missing wakeup calls Gerd Hoffmann
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2015-07-17 11:29 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
QOMification dropped the parent device lookup, fix it.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-smartcard-reader.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index de534ba..904b568 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -1184,7 +1184,7 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card,
uint8_t *apdu, uint32_t len)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev);
+ USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
Answer *answer;
@@ -1207,7 +1207,7 @@ void ccid_card_send_apdu_to_guest(CCIDCardState *card,
void ccid_card_card_removed(CCIDCardState *card)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev);
+ USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
ccid_on_slot_change(s, false);
@@ -1218,7 +1218,7 @@ void ccid_card_card_removed(CCIDCardState *card)
int ccid_card_ccid_attach(CCIDCardState *card)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev);
+ USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
DPRINTF(s, 1, "CCID Attach\n");
@@ -1231,7 +1231,7 @@ int ccid_card_ccid_attach(CCIDCardState *card)
void ccid_card_ccid_detach(CCIDCardState *card)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev);
+ USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
DPRINTF(s, 1, "CCID Detach\n");
@@ -1244,7 +1244,7 @@ void ccid_card_ccid_detach(CCIDCardState *card)
void ccid_card_card_error(CCIDCardState *card, uint64_t error)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev);
+ USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
s->bmCommandStatus = COMMAND_STATUS_FAILED;
@@ -1263,7 +1263,7 @@ void ccid_card_card_error(CCIDCardState *card, uint64_t error)
void ccid_card_card_inserted(CCIDCardState *card)
{
DeviceState *qdev = DEVICE(card);
- USBDevice *dev = USB_DEVICE(qdev);
+ USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
s->bmCommandStatus = COMMAND_STATUS_NO_ERROR;
@@ -1275,7 +1275,7 @@ static int ccid_card_exit(DeviceState *qdev)
{
int ret = 0;
CCIDCardState *card = CCID_CARD(qdev);
- USBDevice *dev = USB_DEVICE(qdev);
+ USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
if (ccid_card_inserted(s)) {
@@ -1289,7 +1289,7 @@ static int ccid_card_exit(DeviceState *qdev)
static int ccid_card_init(DeviceState *qdev)
{
CCIDCardState *card = CCID_CARD(qdev);
- USBDevice *dev = USB_DEVICE(qdev);
+ USBDevice *dev = USB_DEVICE(qdev->parent_bus->parent);
USBCCIDState *s = USB_CCID_DEV(dev);
int ret = 0;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 3/4] usb-ccid: add missing wakeup calls
2015-07-17 11:29 [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 1/4] Re-attach usb device to kernel while usb_host_open fails Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 2/4] usb-ccid: fix 61b4887b41b270bc837ead57bc502d904af023bb Gerd Hoffmann
@ 2015-07-17 11:29 ` Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 4/4] Revert "xhci: set timer to retry xfers" Gerd Hoffmann
2015-07-17 12:51 ` [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2015-07-17 11:29 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Properly notify the host adapter that we have
data pending, so it doesn't has to poll us.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-smartcard-reader.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/hw/usb/dev-smartcard-reader.c b/hw/usb/dev-smartcard-reader.c
index 904b568..8952eff 100644
--- a/hw/usb/dev-smartcard-reader.c
+++ b/hw/usb/dev-smartcard-reader.c
@@ -283,6 +283,7 @@ typedef struct CCIDBus {
typedef struct USBCCIDState {
USBDevice dev;
USBEndpoint *intr;
+ USBEndpoint *bulk;
CCIDBus bus;
CCIDCardState *card;
BulkIn bulk_in_pending[BULK_IN_PENDING_NUM]; /* circular */
@@ -769,6 +770,7 @@ static void ccid_write_slot_status(USBCCIDState *s, CCID_Header *recv)
h->b.bError = s->bError;
h->bClockStatus = CLOCK_STATUS_RUNNING;
ccid_reset_error_status(s);
+ usb_wakeup(s->bulk, 0);
}
static void ccid_write_parameters(USBCCIDState *s, CCID_Header *recv)
@@ -789,6 +791,7 @@ static void ccid_write_parameters(USBCCIDState *s, CCID_Header *recv)
h->bProtocolNum = s->bProtocolNum;
h->abProtocolDataStructure = s->abProtocolDataStructure;
ccid_reset_error_status(s);
+ usb_wakeup(s->bulk, 0);
}
static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq,
@@ -810,6 +813,7 @@ static void ccid_write_data_block(USBCCIDState *s, uint8_t slot, uint8_t seq,
}
memcpy(p->abData, data, len);
ccid_reset_error_status(s);
+ usb_wakeup(s->bulk, 0);
}
static void ccid_report_error_failed(USBCCIDState *s, uint8_t error)
@@ -1319,6 +1323,7 @@ static void ccid_realize(USBDevice *dev, Error **errp)
NULL);
qbus_set_hotplug_handler(BUS(&s->bus), DEVICE(dev), &error_abort);
s->intr = usb_ep_get(dev, USB_TOKEN_IN, CCID_INT_IN_EP);
+ s->bulk = usb_ep_get(dev, USB_TOKEN_IN, CCID_BULK_IN_EP);
s->card = NULL;
s->migration_state = MIGRATION_NONE;
s->migration_target_ip = 0;
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [Qemu-devel] [PULL 4/4] Revert "xhci: set timer to retry xfers"
2015-07-17 11:29 [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Gerd Hoffmann
` (2 preceding siblings ...)
2015-07-17 11:29 ` [Qemu-devel] [PULL 3/4] usb-ccid: add missing wakeup calls Gerd Hoffmann
@ 2015-07-17 11:29 ` Gerd Hoffmann
2015-07-17 12:51 ` [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Gerd Hoffmann @ 2015-07-17 11:29 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
This reverts commit 4e8cfbe1143d8384387595b500212d7a7f11aeae.
We should not poll via timer, and with ccid being fixed
to properly notify us about pending transfers we don't have to.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/hcd-xhci.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/hw/usb/hcd-xhci.c b/hw/usb/hcd-xhci.c
index 90a5fbf..c673bed 100644
--- a/hw/usb/hcd-xhci.c
+++ b/hw/usb/hcd-xhci.c
@@ -2222,8 +2222,6 @@ static void xhci_kick_ep(XHCIState *xhci, unsigned int slotid,
if (xfer->running_retry) {
DPRINTF("xhci: xfer nacked, stopping schedule\n");
epctx->retry = xfer;
- timer_mod(epctx->kick_timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) +
- epctx->interval * 125000);
break;
}
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host)
2015-07-17 11:29 [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Gerd Hoffmann
` (3 preceding siblings ...)
2015-07-17 11:29 ` [Qemu-devel] [PULL 4/4] Revert "xhci: set timer to retry xfers" Gerd Hoffmann
@ 2015-07-17 12:51 ` Peter Maydell
4 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2015-07-17 12:51 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 17 July 2015 at 12:29, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> Here are usb fixes for 2.4.
>
> please pull,
> Gerd
>
> The following changes since commit 2d5ee9e7a7dd495d233cf9613a865f63f88e3375:
>
> Merge remote-tracking branch 'remotes/lalrae/tags/mips-20150716' into staging (2015-07-16 10:40:23 +0100)
>
> are available in the git repository at:
>
>
> git://git.kraxel.org/qemu tags/pull-usb-20150717-1
>
> for you to fetch changes up to 92fdfa4bef9c92addcc009dd3e0131172b4fdc78:
>
> Revert "xhci: set timer to retry xfers" (2015-07-17 13:20:53 +0200)
>
> ----------------------------------------------------------------
> usb: fixes for 2.4 (ccid, xhci and usb-host)
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-07-17 12:51 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-17 11:29 [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 1/4] Re-attach usb device to kernel while usb_host_open fails Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 2/4] usb-ccid: fix 61b4887b41b270bc837ead57bc502d904af023bb Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 3/4] usb-ccid: add missing wakeup calls Gerd Hoffmann
2015-07-17 11:29 ` [Qemu-devel] [PULL 4/4] Revert "xhci: set timer to retry xfers" Gerd Hoffmann
2015-07-17 12:51 ` [Qemu-devel] [PULL for-2.4 0/4] usb: fixes for 2.4 (ccid, xhci and usb-host) Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).