aboutsummaryrefslogtreecommitdiff
path: root/hw
AgeCommit message (Collapse)Author
2012-04-26Merge remote-tracking branch 'kraxel/usb.49' into stagingAnthony Liguori
* kraxel/usb.49: usb-uhci: update irq line on reset usb: add serial number generator usb-redir: Not finding an async urb id is not an error usb-redir: Reset device address and speed on disconnect usb-redir: An interface count of 0 is a valid value usb-xhci: fix bit test usb-xhci: Use PCI DMA helper functions usb-host: fix zero-length packets usb-host: don't dereference invalid iovecs usb-storage: fix request canceling usb-ehci: Ensure frindex writes leave a valid frindex value usb-ehci: add missing usb_packet_init() call usb-ehci: remove hack
2012-04-26Merge remote-tracking branch 'mst/tags/for_anthony' into stagingAnthony Liguori
* mst/tags/for_anthony: e1000: set E1000_ICR_INT_ASSERTED only for 8257x e1000: link auto-negotiation emulation e1000: introduce bit for debugging PHY emulation e1000: introduce helpers to manipulate link status e1000: PHY loopback mode support e1000: conditionally raise irq at the end of MDI cycle e1000: introduce bits of PHY control register eepro100: Fix multicast regression virtio: order index/descriptor reads virtio: add missing mb() on enable notification virtio: add missing mb() on notification e1000: move reset function earlier in file
2012-04-26Merge remote-tracking branch 'amit/master' into stagingAnthony Liguori
* amit/master: virtio-serial-bus: Unset guest_connected at reset and driver reset virtio-serial-bus: fix guest_connected init before driver init
2012-04-26pc-sysfw: make sure to call qdev_initAnthony Liguori
We're not actually calling qdev_init for the pc-sysfw device. Since we create the canonical path during realize, this was causing an assert to trigger when attempting to read a link pointing to pc-sysfw. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-26usb-uhci: update irq line on resetGerd Hoffmann
uhci_reset() clears irq mask and irq status registers, but doesn't update the irq line. Which may result in suspious IRQs after uhci reset. Fix it. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb: add serial number generatorGerd Hoffmann
This patch adds a function which creates unique serial numbers for usb devices and puts it into use. Windows guests tend to become unhappy if they find two identical usb devices in the system. Effects range from non-functional devices (with yellow exclamation mark in device manager) to BSODs. Handing out unique serial numbers to devices fixes this. With this patch applied almost all emulated devices get a generated, unique serial number. There are two exceptions: * usb-storage devices will prefer a user-specified serial number and will only get a generated number in case the serial property is unset. * usb-hid devices keep the fixed serial number "42" as it is used to signal "remote wakeup actually works". See commit 7b074a22dab4bdda9864b933f1bc811a3db42845 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-redir: Not finding an async urb id is not an errorHans de Goede
We clear our pending async urb list on device disconnect and we may still receive "packet complete" packets from our peer after this, which will then refer to packet ids no longer in our list. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-redir: Reset device address and speed on disconnectHans de Goede
Without this disconnected devices look like the last redirected device in the monitor in "info usb". Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-redir: An interface count of 0 is a valid valueHans de Goede
An interface-count of 0 happens when a device is in unconfigured state when it gets redirected. So we should not use 0 to detect not having received interface info from our peer. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-xhci: fix bit testLai Jiangshan
use & instead of the wrong && Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-xhci: Use PCI DMA helper functionsDavid Gibson
Shortly before 1.0, we added helper functions / wrappers for doing PCI DMA from individual devices. This makes what's going on clearer and means that when we add IOMMU support somewhere in the future, only the general PCI code will have to change, not every device that uses PCI DMA. However, usb-xhci is not using these wrappers, despite being a PCI only device. This patch remedies the situation, using the pci dma functions instead of direct calls to cpu_physical_memory_{read,write}(). Likewise address parameters for DMA are changed to dma_addr_t instead of target_phys_addr_t. [ kraxel: removed #ifdefs ] Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-host: fix zero-length packetsGerd Hoffmann
usb-host optimizes away zero-length packets by not entering the processing loop at all. Which isn't correct, we should submit a zero-length urb to the host devicein that case. This patch makes sure we run the processing loop at least once. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-host: don't dereference invalid iovecsGerd Hoffmann
usb-host assumes the first iovec element is always valid. In case of a zero-length packet this isn't true though. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-storage: fix request cancelingGerd Hoffmann
Little fix for usb packet handling on i/o cancelation. The usb packet pointer (s->packet) is cleared at the wrong place: The scsi request cancel handler does it. When a usb packet is canceled the usb-storage emulation canceles the scsi request if present. In most cases there is one, so usually s->packet is cleared as needed even with the code sitting at the wrong place. If there is no scsi request in flight s->packet is not cleared though. The usb-storage emulation will then try to complete an usb packet which is not in flight any more and thereby trigger an assert() in the usb core. Fix this by clearing s->packet at the correct place, which is the usb packet cancel header. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-ehci: Ensure frindex writes leave a valid frindex valueHans de Goede
frindex is a 14 bits counter, so bits 31-14 should always be 0, and after the commit titled "usb-ehci: frindex always is a 14 bits counter" we rely on frindex always being a multiple of 8. I've not seen this in practice, but theoretically a guest can write a value >= 0x4000 or a value which is not a multiple of 8 value to frindex, this patch ensures that things will still work when that happens. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-ehci: add missing usb_packet_init() callGerd Hoffmann
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26usb-ehci: remove hackGerd Hoffmann
To answer the question in the comment removed by this patch: I think this was needed because several places in the ehci emulation did not check the T bit of link entries correctly and thus might have followed invalid references. See commit 2a5ff735dc1074171a0cbb1dc228d6d6e907f571 Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-04-26hda: fix codec idsGerd Hoffmann
Our hda codecs exist in two variants: With CONFIG_MIXEMU=y they expose amplifiers for volume control to the guest, with CONFIG_MIXEMU=n they don't. This patch changes the codec ids, they are different now for these two cases. This makes sure windows guests will notice the difference. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
2012-04-26hda: add hda-micro codecGerd Hoffmann
It's identical to the hda-duplex codec, except that it advertises the input as microphone instead of line-in and the output as speaker instead of line-out. Some guest apps (microsoft netmeeting being one) are picky when it comes to selecting the recording source and don't accept line-in, so give them what they expect. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
2012-04-26hda: move input widgets from duplex to commonGerd Hoffmann
Preparing for a new user of the input widget definitions. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: malc <av1474@comtv.ru>
2012-04-25virtio-serial-bus: Unset guest_connected at reset and driver resetAmit Shah
When a guest driver resets the virtio status to not ready, or when qemu is reset, reset all ports' guest_connected bit and let port users know of this event if they have the guest_close() callback registered. Reviewed-by: Alon Levy <alevy@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2012-04-25virtio-serial-bus: fix guest_connected init before driver initAlon Levy
guest_connected should be false before guest driver initialization, and true after, both for multiport aware and non multiport aware drivers. Don't set it before the guest_features are available; instead use set_status which is called by io to VIRTIO_PCI_STATUS with VIRTIO_CONFIG_S_DRIVER_OK by even older non multiport drivers. [Amit: Add comment, tweak summary, only set guest_connected and not reset it as a side-effect.] Signed-off-by: Alon Levy <alevy@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com>
2012-04-25e1000: set E1000_ICR_INT_ASSERTED only for 8257xJason Wang
E1000_ICR_INT_ASSERTED were introduced only for 8257x, so we need to check the E1000_DEVID before setting this bit in ICS. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25e1000: link auto-negotiation emulationJason Wang
Indeed, there's nothing else except for the time spent on the negotiation needs to be emulated. This is needed for resuming windows guest from hibernation, as without a proper delay, qemu would send the packet too early ( guest even does not have a proper intr handler), which could lead windows guest hang. This patch first introduces an array of function pointers to make it possible to emulate per-register write behavior. Then traps the PHY_CTRL register write and when guest want to restart the link auto negotiation, we would down the link and mark the auto negotiation in progress in PHY_STATUS register. After time, a timer with 500 ms ( which is the minimum timeout of auto-negotation specified in 802.3 spec). The link would be up when timer expired. Test with resuming windows guest plus flood ping and linux ethtool linkstatus test. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25e1000: introduce bit for debugging PHY emulationJason Wang
Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25e1000: introduce helpers to manipulate link statusJason Wang
This patch introduces helpers to change link status bit for phy/mac register. This would help to reduce code duplication and would be used by following patches. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25e1000: PHY loopback mode supportJason Wang
The missing of loopback mode prevent the running of self diagnosis program in guest. This patch adds this support. After this patch, loopback test of ethtool were passed in guest. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25e1000: conditionally raise irq at the end of MDI cycleJason Wang
According to the spec: "When set to 1b by software, it causes an Interrupt to be asserted to indicate the end of an MDI cycle." We need check the Interrupt Enable bit and raise irq only when it is set. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25e1000: introduce bits of PHY control registerJason Wang
This would be used be following patches. Signed-off-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25eepro100: Fix multicast regressionStefan Weil
Commit 7fc8d918b9674c3e9233d6d25da2457345d414a0 removed code from eepro100.c and replaced it by different code: the code in net.c returns bits 31...26, but eepro100 needs bits 7...2. This patch partially reverts 7fc8d918b9674c3e9233d6d25da2457345d414a0. To avoid future problems, I renamed the function and changed the comment. Signed-off-by: Stefan Weil <sw@weilnetz.de> Acked-by: Jason Wang <jasowang@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25virtio: order index/descriptor readsMichael S. Tsirkin
virtio has the equivalent of: if (vq->last_avail_index != vring_avail_idx(vq)) { read descriptor head at vq->last_avail_index; } In theory, processor can reorder descriptor head read to happen speculatively before the index read. this would trigger the following race: host descriptor head read <- reads invalid head from ring guest writes valid descriptor head guest writes avail index host avail index read <- observes valid index as a result host will use an invalid head value. This was not observed in the field by me but after the experience with the previous two races I think it is prudent to address this theoretical race condition. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25virtio: add missing mb() on enable notificationMichael S. Tsirkin
This fixes an issue dual to the one fixed by patch 'virtio: add missing mb() on notification' and applies on top. In this case, to enable vq kick to exit to host, qemu writes out used flag then reads the avail index. if these are reordered we get a race: host avail index read: ring is empty guest avail index write guest flag read: exit disabled host used flag write: enable exit which results in a lost exit: host will never be notified about the avail index update. Again, happens in the field but only seems to trigger on some specific hardware. Insert an smp_mb barrier operation to ensure the correct ordering. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25virtio: add missing mb() on notificationMichael S. Tsirkin
During normal operation, virtio first writes a used index and then checks whether it should interrupt the guest by reading guest avail index/flag values. Guest does the reverse: writes the index/flag, then checks the used ring. The ordering is important: if host avail flag read bypasses the used index write, we could in effect get this timing: host avail flag read guest enable interrupts: avail flag write guest check used ring: ring is empty host used index write which results in a lost interrupt: guest will never be notified about the used ring update. This actually can happen when using kvm with an io thread, such that the guest vcpu and qemu run on different host cpus, and this has actually been observed in the field (but only seems to trigger on very specific processor types) with userspace virtio: vhost has the necessary smp_mb() in place to prevent the regordering, so the same workload stalls forever waiting for an interrupt with vhost=off but works fine with vhost=on. Insert an smp_mb barrier operation in userspace virtio to ensure the correct ordering. Applying this patch fixed the race condition we have observed. Tested on x86_64. I checked the code generated by the new macro for i386 and ppc but didn't run virtio. Note: mb could in theory be implemented by __sync_synchronize, but this would make us hit old GCC bugs. Besides old GCC not implementing __sync_synchronize at all, there were bugs http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36793 in this functionality as recently as in 4.3. As we need asm for rmb,wmb anyway, it's just as well to use it for mb. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-25e1000: move reset function earlier in fileMichael S. Tsirkin
Make it easier to reuse this function. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-04-24Limit ptimer rate to something achievablePeter Chubb
If a guest sets very short timeouts, and asks for a timer to be reloaded on timeout, QEMU can go to 100%CPU utilisation and become unresponsive, as it is spending all its time generating timeout interrupts. On real hardware this doesn't matter, as the interrupts are just coalesced, and the effect is to have the interrupt asserted all the time. This patch is a band-aid, that prevents timeouts less than 10 microseconds from being set. 10 microseconds is a limit that was determined empirically on a variety of machines as the shortest that allowed QEMU to pick up a control-a c sequence to get at the monitor. Reported-by: Anna Lyons <anna.lyons@nicta.com.au> Signed-off-by: Peter Chubb <peter.chubb@nicta.com.au> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-24qom: Refine container_get() to allow using a custom rootAndreas Färber
Specify the root to search from as argument. This avoids hardcoding "/machine" in some places and makes it more flexible. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Anthony Liguori <anthony@codemonkey.ws> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-04-23Merge remote-tracking branch 'kwolf/for-anthony' into stagingAnthony Liguori
* kwolf/for-anthony: (38 commits) qemu-iotests: Fix test 031 for qcow2 v3 support qemu-iotests: Add -o and make v3 the default for qcow2 qcow2: Zero write support qemu-iotests: Test backing file COW with zero clusters qemu-iotests: add a simple test for write_zeroes qcow2: Support for feature table header extension qcow2: Support reading zero clusters qcow2: Version 3 images qcow2: Ignore reserved bits in check_refcounts qcow2: Ignore reserved bits in refcount table entries qcow2: Simplify count_cow_clusters qcow2: Refactor qcow2_free_any_clusters qcow2: Ignore reserved bits in L1/L2 entries qcow2: Fail write_compressed when overwriting data qcow2: Ignore reserved bits in count_contiguous_clusters() qcow2: Ignore reserved bits in get_cluster_offset qcow2: Save disk size in snapshot header Specification for qcow2 version 3 qcow2: Fix refcount block allocation during qcow2_alloc_cluster_at() iotests: Resolve test failures caused by hostname ...
2012-04-23Merge remote-tracking branch 'origin/master' into stagingAnthony Liguori
* origin/master: fix BCD mask for date (Solaris 2.5 guest hang fix)
2012-04-23fix BCD mask for date (Solaris 2.5 guest hang fix)Artyom Tarasenko
Fix BCD mask for date. The most visible effect of this patch is Solaris 2.5.1 doesn't hang at boot if the day of month is >21. Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-04-23Merge remote-tracking branch 'origin/master' into stagingAnthony Liguori
* origin/master: (27 commits) target-arm: Move reset handling to arm_cpu_reset target-arm: Drop cpu_reset_model_id() target-arm: Move cache ID register setup to cpu specific init fns target-arm: Move OMAP cp15_i_{max,min} reset to cpu_state_reset target-arm: Move feature register setup to per-CPU init fns target-arm: Move iWMMXT wCID reset to cpu_state_reset target-arm: Drop JTAG_ID documentation target-arm: Move SCTLR reset value setup to per cpu init fns target-arm: Move CTR setup to per cpu init fns target-arm: Move MVFR* setup to per cpu init fns target-arm: Move FPSID config to cpu init fns target-arm: Move feature bit settings to CPU init fns target-arm: Add QOM subclasses for each ARM cpu implementation target-arm: remind to keep arm features in sync with linux-user/elfload.c tci: GETPC() macro must return an uintptr_t gdbstub: Synchronize CPU state unconditionally in gdb_set_cpu_pc softfloat: make USE_SOFTFLOAT_STRUCT_TYPES compile target-xtensa: add tests for LOOPNEZ and LOOPGTZ target-xtensa: fix LOOPNEZ/LOOPGTZ translation qtest: add m48t59 tests for Sparc ...
2012-04-23Merge remote-tracking branch 'sstabellini/build_fix' into stagingAnthony Liguori
* sstabellini/build_fix: xen: add a dummy xc_hvm_inject_msi for Xen < 4.2 xen,configure: detect Xen 4.2
2012-04-23Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori
* stefanha/trivial-patches: Add .gitignore for tests/ e1000: Fix spelling (segmentaion -> segmentation) in debug output spice-qemu-char.c: Show what name is unsupported pflash_cfi01: remove redundant line qxl: Add missing GCC_FMT_ATTR and fix format specifier fix block_job_set_speed name in documentation error.c: don't return value for void function
2012-04-23Merge remote-tracking branch 'bonzini/scsi-next' into stagingAnthony Liguori
* bonzini/scsi-next: scsi: add SANITIZE command SCSI emulation: should tell the guest that we actually support thin provisioning SCSI emulation: Support unmap via WRITE_SAME_10. scsi: advertise DPOFUA scsi: small refactoring of MMC mode-sense scsi: support FUA on reads scsi: add a started field to SCSIDiskReq scsi: force unit access on VERIFY scsi: add support for FUA on writes scsi: move scsi_flush_complete around scsi: make code more homogeneous in AIO callback functions scsi: add missing test for cancelled request virtio-scsi: add multiqueue capability virtio: add virtio_queue_get_id virtio-scsi: prepare migration format for multiqueue scsi: fix memory leak
2012-04-20versatiblepb: add NOR flash supportEric Benard
- add support for the 64MB NOR CFI01 flash available at 0x34000000 on the versatilepb board http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0225d/BBAJIHEC.html - tested with barebox bootloader Signed-off-by: Eric Bénard <eric@eukrea.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-04-20hw/arm_mptimer: Reset the qemu_timer at resetPeter Maydell
On reset of the mpcore timer/watchdog block we need to delete the qemu_timer in case it was running. Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-04-20versatilepb: add ds1338 rtc deviceOskar Andero
Add ds1338 rtc attached on i2c. Signed-off-by: Oskar Andero <oskar.andero@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-04-20realview: break out versatile i2c controller codeOskar Andero
The versatile i2c controller implementation was separated to its own file called versatile_i2c.c. This is done as a preparation for adding i2c support to the versatilepb board. Signed-off-by: Oskar Andero <oskar.andero@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2012-04-20e1000: Fix spelling (segmentaion -> segmentation) in debug outputStefan Weil
This was reported by https://bugs.launchpad.net/qemu/+bug/984476. I also changed the case for 'error'. Signed-off-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-04-20pflash_cfi01: remove redundant lineEric Bénard
Signed-off-by: Eric Bénard <eric@eukrea.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2012-04-20qxl: Add missing GCC_FMT_ATTR and fix format specifierStefan Weil
val is an uint64_t, therefore %d was not correct. Signed-off-by: Stefan Weil <sw@weilnetz.de> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>