summaryrefslogtreecommitdiffstats
path: root/hw/usb
Commit message (Collapse)AuthorAgeFilesLines
* Rename target_phys_addr_t to hwaddrAvi Kivity2012-10-234-27/+27
| | | | | | | | | | | | | | | target_phys_addr_t is unwieldly, violates the C standard (_t suffixes are reserved) and its purpose doesn't match the name (most target_phys_addr_t addresses are not target specific). Replace it with a finger-friendly, standards conformant hwaddr. Outstanding patchsets can be fixed up with the command git rebase -i --exec 'find -name "*.[ch]" | xargs s/target_phys_addr_t/hwaddr/g' origin Signed-off-by: Avi Kivity <avi@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* usb-serial: only expose device in guest when the chardev is openGerd Hoffmann2012-10-221-2/+17
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* usb-serial: don't magically zap chardev on umplugGerd Hoffmann2012-10-221-1/+1
| | | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* uhci: Raise interrupt when requested even for non active tdsHans de Goede2012-10-111-1/+9
| | | | | | | | | | | | | | | | | According to the spec we must raise an interrupt when one is requested even for non active tds. Linux depends on this, for bulk transfers it runs an inactivity timer to work around a bug in early uhci revisions, when we take longer then 200 ms to process a packet, this timer goes of, and as part of the handling Linux then unlinks the qh, and relinks it after the frindex has increased by atleast 1, the problem is Linux only checks for the frindex increases on an interrupt, and we don't send that, causing the qh to go inactive for more then 32 frames, at which point we consider the packet cancelled. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-redir: Don't make migration fail in none seamless caseHans de Goede2012-10-111-4/+9
| | | | | | | | Instead simple disconnect the device like host redirection does on migration. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-redir: Change usbredir_open_chardev into usbredir_create_parserHans de Goede2012-10-111-6/+5
| | | | | | | As we need to create the parser at more places. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Merge branch 'trivial-patches' of git://github.com/stefanha/qemuAurelien Jarno2012-10-063-5/+0
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'trivial-patches' of git://github.com/stefanha/qemu: versatilepb: Use symbolic indices for ARM PIC qdev: kill bogus comment qemu-barrier: Fix compiler version check for future gcc versions hw: Add missing 'static' attribute for QEMUMachine cleanup useless return sentence qemu-sockets: Fix compiler warning (regression for MinGW) vnc: Fix spelling (hellmen -> hellman) in comment slirp: Fix spelling in comment (enought -> enough, insure -> ensure) tcg/arm: Use tcg_out_mov_reg rather than inline equivalent code cpu: Add missing 'static' attribute to qemu_global_mutex configure: Support empty target list (--target-list=) hw: Fix return value check for bdrv_read, bdrv_write
| * cleanup useless return sentenceAmos Kong2012-10-053-5/+0
| | | | | | | | | | | | | | | | This patch cleans up return sentences in the end of void functions. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Amos Kong <akong@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
* | Remove libhwStefan Weil2012-10-051-7/+7
|/ | | | | | | | | | The entries for libhw* are no longer needed in .gitignore. There is also no longer a difference between common-obj-y and hw-obj-y, so one of those two macros is sufficient. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* usb: Fix usb_packet_map() in the presence of IOMMUsDavid Gibson2012-09-261-9/+15
| | | | | | | | | | | | | | | | | | | | | With the IOMMU infrastructure introduced before 1.2, we need to use dma_memory_map() to obtain a qemu pointer to memory from an IO bus address. However, dma_memory_map() alters the given length to reflect the length over which the used DMA translation is valid - which could be either more or less than the requested length. usb_packet_map() does not correctly handle these cases, simply failing if dma_memory_map() alters the requested length. If dma_memory_map() increased the length, we just need to use the requested length for the qemu_iovec_add(). However, if it decreased the length, it means that a single DMA translation is not valid for the whole sglist element, and so we need to loop, splitting it up into multiple iovec entries for each piece with a DMA translation (in practice >2 pieces is unlikely). This patch implements the correct behaviour Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* ehci: Fix interrupt packet MULT handlingHans de Goede2012-09-261-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are several issues with our handling of the MULT epcap field of interrupt qhs, which this patch fixes. 1) When we don't execute a transaction because of the transaction counter being 0, p->async stays EHCI_ASYNC_NONE, and the next time we process the same qtd we hit an assert in ehci_state_fetchqtd because of this. Even though I believe that this is caused by 3 below, this patch still removes the assert, as that can still happen without 3, when multiple packets are queued for the same interrupt ep. 2) We only *check* the transaction counter from ehci_state_execute, any packets queued up by fill_queue bypass this check. This is fixed by not calling fill_queue for interrupt packets. 3) Some versions of Windows set the MULT field of the qh to 0, which is a clear violation of the EHCI spec, but still they do it. This means that we will never execute a qtd for these, making interrupt ep-s on USB-2 devices not work, and after recent changes, triggering 1). So far we've stored the transaction counter in our copy of the mult field, but with this beginnig at 0 already when dealing with these version of windows this won't work. So this patch adds a transact_ctr field to our qh struct, and sets this to the MULT field value on fetchqh. When the MULT field value is 0, we set it to 4. Assuming that windows gets way with setting it to 0, by the actual hardware going horizontal on a 1 -> 0 transition, which will give it 4 transactions (MULT goes from 0 - 3). Note that we cannot stop on detecting the 1 -> 0 transition, as our decrement of the transaction counter, and checking for it are done in 2 different places. Reported-by: Shawn Starr <shawn.starr@rogers.com> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: create a memory region for each portGerd Hoffmann2012-09-261-42/+43
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: route string & usb hub supportGerd Hoffmann2012-09-261-31/+55
| | | | | Parse route string in slot contexts and support devices connected via hub.
* xhci: tweak limitsGerd Hoffmann2012-09-261-4/+4
| | | | | | | | | | | | | Set maxports to 15. This is what the usb3 route string can handle. Set maxslots to 64. This is more than the number of root ports we can have, but with additional hubs you can end up with more devices. Set maxintrs (aka msi vectors) to 16. Should be enougth, especially considering that vectors are a limited ressource. Linux guests use only three at the moment. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* Merge branch 'usb.65' of git://git.kraxel.org/qemuAurelien Jarno2012-09-214-134/+618
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'usb.65' of git://git.kraxel.org/qemu: uhci: Don't queue up packets after one with the SPD flag set usb-redir: Revert usb-redir part of commit 93bfef4c usb-redir: Add chardev open / close debug logging usb-redir: Add support for migration usb-redir: Store max_packet_size in endp_data usb-redir: Add an already_in_flight packet-id queue usb-redir: Change cancelled packet code into a generic packet-id queue ehci: Walk async schedule before and after migration ehci: Don't set seen to 0 when removing unseen queue-heads configure: usbredir fixes ehci: Don't process too much frames in 1 timer tick (v2) ehci: Fix interrupts stopping when Interrupt Threshold Control is 8 ehci: switch to new-style memory ops usb-host: allow emulated (non-async) control requests without USBPacket
| * uhci: Don't queue up packets after one with the SPD flag setHans de Goede2012-09-131-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | Don't queue up packets after a packet with the SPD (short packet detect) flag set. Since we won't know if the packet will actually be short until it has completed, and if it is short we should stop the queue. This fixes a miniature photoframe emulating a USB cdrom with the windows software for it not working. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * usb-redir: Revert usb-redir part of commit 93bfef4cHans de Goede2012-09-131-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 93bfef4c6e4b23caea9d51e1099d06433d8835a4 makes qemu-devices which report the qemu version string to the guest in some way use a qemu_get_version function which reports a machine-specific version string. However usb-redir does not expose the qemu version to the guest, only to the usbredir-host as part of the initial handshake. This can then be logged on the usbredir-host side for debugging purposes and is otherwise completely unused! For debugging purposes it is important to have the real qemu version in there, rather then the machine-specific version. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * usb-redir: Add chardev open / close debug loggingHans de Goede2012-09-131-0/+6
| | | | | | | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * usb-redir: Add support for migrationHans de Goede2012-09-131-3/+346
| | | | | | | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * usb-redir: Store max_packet_size in endp_dataHans de Goede2012-09-131-1/+3
| | | | | | | | | | | | | | | | So that we've a place to migrate it to / from to allow restoring it after migration. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * usb-redir: Add an already_in_flight packet-id queueHans de Goede2012-09-131-0/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After a live migration, the usb-hcd will re-queue all packets by walking over the schedule in the guest memory again, but requests which were encountered on the migration source before will already be in flight, so these should *not* be re-send to the usbredir-host. This patch adds an already in flight packet ud queue, which will be filled by the source before migration and then moved over to the migration dest, any async handled packets are then checked against this queue to avoid sending the same packet to the usbredir-host twice. Signed-off-by: Hans de Goede <hdegoede@redhat,com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * usb-redir: Change cancelled packet code into a generic packet-id queueHans de Goede2012-09-131-31/+71
| | | | | | | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * ehci: Walk async schedule before and after migrationHans de Goede2012-09-131-0/+28
| | | | | | | | | | Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * ehci: Don't set seen to 0 when removing unseen queue-headsHans de Goede2012-09-131-6/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When removing unseen queue-heads from the async queue list, we should not set the seen flag to 0, as this may cause them to be removed by ehci_queues_rip_unused() during the next call to ehci_advance_async_state() if the timer is late or running at a low frequency. Note: 1) This *may* have caused the instant unlink / relinks described in commit 9bc3a3a216e2689bfcdd36c3e079333bbdbf3ba0 2) Rather then putting more if-s inside ehci_queues_rip_unused, this patch instead introduces a new ehci_queues_rip_unseen function. 3) This patch also makes it save to call ehci_queues_rip_unseen() multiple times, which gets used in the folluw up patch titled: "ehci: Walk async schedule before and after migration" Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * ehci: Don't process too much frames in 1 timer tick (v2)Hans de Goede2012-09-121-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Linux ehci isoc scheduling code fills the entire schedule ahead of time minus 80 frames. If we make a large jump in where we are in the schedule, ie 40 frames, then the scheduler all of a sudden will only have 40 frames left to work in, causing it to fail packet submissions with error -27 (-EFBIG). Changes in v2: -Don't hardcode a maximum number of frames to process in one tick, instead: -Process a minimum number of frames to ensure we do eventually catch up -Stop (after the minimum number) when the guest has requested an irq Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * ehci: Fix interrupts stopping when Interrupt Threshold Control is 8Hans de Goede2012-09-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | If Interrupt Threshold Control is 8 or a multiple of 8, then s->usbsts_frindex can become exactly 0x4000, at which point (s->usbsts_frindex > s->frindex) will never become true, as s->usbsts_frindex will not be lowered / reset in this case. This patch fixes this. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * ehci: switch to new-style memory opsGerd Hoffmann2012-09-121-89/+84
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also register different memory regions for capabilities, operational registers and port status registers. Create separate tracepoints for operational regs and port status regs. Ditch a bunch of sanity checks because the memory core will do this for us now. Offloading the byte, word and dword access handling to the memory core also has the side effect of fixing ehci register access on bigendian hosts. Cc: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
| * usb-host: allow emulated (non-async) control requests without USBPacketGerd Hoffmann2012-09-121-1/+1
| | | | | | | | | | | | | | xhci needs this for USB_REQ_SET_ADDRESS due to the way usb addressing is handled by the xhci hardware. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | net: fix usbnet_receive() packet dropsStefan Hajnoczi2012-09-141-3/+16
| | | | | | | | | | | | | | | | | | | | | | The USB network interface has a single buffer which the guest reads from. This patch prevents multiple calls to usbnet_receive() from clobbering the input buffer. Instead we queue packets until buffer space becomes available again. This is inspired by virtio-net and e1000 rxbuf handling. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* | net: clean up usbnet_receive()Stefan Hajnoczi2012-09-141-13/+17
|/ | | | | | | | | | | The USB network interface has two code paths depending on whether or not RNDIS mode is enabled. Refactor usbnet_receive() so that there is a common path throughout the function instead of duplicating everything across if (is_rndis(s)) ... else ... code paths. Clean up coding style and 80 character line wrap along the way. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
* xhci: allow bytewise capability register readsGerd Hoffmann2012-09-111-1/+3
| | | | | | | Some guests need this according to Alejandro Martinez Ruiz <alex@securiforest.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: kill xhci_mem_{read,write} dispatcher functionsGerd Hoffmann2012-09-111-65/+75
| | | | | | | ... and register subregions instead, so we offload the dispatching to the the memory subsystem which is designed to handle it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: support multiple interruptersGerd Hoffmann2012-09-111-5/+1
| | | | | | | Everything is in place, flip the big switch now and enable support for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: pick target interrupterGerd Hoffmann2012-09-111-6/+16
| | | | | | Pick the correct interrupter when queuing an event. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: prepare xhci_runtime_{read,write} for multiple interruptersGerd Hoffmann2012-09-111-43/+57
| | | | | | Prepare xhci runtime register access function for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: add XHCIInterrupterGerd Hoffmann2012-09-111-147/+160
| | | | | | | Move all state belonging to the (single) interrupter into a separate struct. First step in adding support for multiple interrupters. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: move register update into xhci_intr_raiseGerd Hoffmann2012-09-111-9/+5
| | | | | | | Now that we have a separate function to raise an IRQ we can move some comon code into the function. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: add msix supportGerd Hoffmann2012-09-111-1/+46
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: rework interrupt handlingGerd Hoffmann2012-09-111-14/+33
| | | | | | | | Split xhci_irq_update into a function which handles intx updates (including lowering the irq line once the guests acks the interrupt) and one which is used for raising an irq only. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: fix & cleanup msi.Gerd Hoffmann2012-09-111-18/+9
| | | | | | | | | | Drop custom write_config function which isn't needed any more. Make the msi property a bit property so it accepts 'on' & 'off'. Enable MSI by default. TODO: add compat property to disable on old machine types. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb-storage: usb3 supportGerd Hoffmann2012-09-111-3/+43
| | | | | | | Add usb3 descriptors to usb-storage, so it shows up as superspeed device when connected to xhci. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb3: bos decriptorGerd Hoffmann2012-09-112-0/+134
| | | | | | | Add support for creating BOS descriptor and device cappability descriptors. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb3: superspeed endpoint companionGerd Hoffmann2012-09-112-20/+61
| | | | | | | Add support for building superspeed endpoint companion descriptors, create them for superspeed usb devices. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* usb3: superspeed descriptorsGerd Hoffmann2012-09-112-1/+10
| | | | | | | Add superspeed descriptor entry to USBDesc, advertise superspeed support when present. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: update port handlingGerd Hoffmann2012-09-111-40/+97
| | | | | | | | | | | | | | This patch changes the way xhci ports are linked to USBPorts. The fixed 1:1 relationship between xhci ports and USBPorts is gone. Now each USBPort represents a physical plug which has usually two xhci ports assigned: one usb2 and ond usb3 port. usb devices show up at one or the other, depending on whenever they support superspeed or not. This patch also makes the number of usb2 and usb3 ports runtime configurable by adding 'p2' and 'p3' properties. It is allowed to have different numbers of usb2 and usb3 ports. Specifying p2=4,p3=2 will give you an xhci adapter which supports all speeds on physical ports 1+2 and usb2 only on ports 3+4.
* xhci: update register layoutGerd Hoffmann2012-09-111-8/+13
| | | | | | Change the register layout to be a bit more sparse and also not depend on the number of ports. Useful when for making the number of ports runtime-configurable.
* xhci: fix runtime write tracepointGerd Hoffmann2012-09-111-1/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: add trace_usb_xhci_ep_set_dequeueGerd Hoffmann2012-09-111-1/+1
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: trace cc codes in cleartextGerd Hoffmann2012-09-111-1/+47
| | | | Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* xhci: iso xfer supportGerd Hoffmann2012-09-111-16/+101
| | | | | | Add support for iso transfers. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
OpenPOWER on IntegriCloud