Commit graph

7513 commits

Author SHA1 Message Date
Andreas Färber 3aaa8dfae9 arm_boot: Pass ARMCPU to arm_load_kernel()
In particular this simplifies the &s->mpu->cpu->env expression again.

first_cpu and ->next_cpu are expected to be QOM'ified later.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com> (for exynos)
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber 17c2f0bf37 xilinx_zynq: Use cpu_arm_init() to obtain ARMCPU
Needed for arm_load_kernel().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter A.G. Crosthwaite <peter.crosthwaite@petalogix.com>
2012-06-11 00:23:04 +02:00
Andreas Färber 95d42bb5d7 pxa2xx_gpio: Store ARMCPU in PXA2xxGPIOInfo
Prepares for moving halted field into CPUState.

Add missing braces.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber e9d872cfe1 pxa2xx_pic: Store ARMCPU in PXA2xxPICState
Prepares for moving halted field to CPUState.

Add missing braces.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber f161bcd05f pxa2xx: Pass ARMCPU to pxa2xx_pic_init()
Cleans up after storing ARMCPU in PXA2xxState.
Prepares for storing ARMCPU in PXA2xxPICState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber ef6cbcc584 exynos4210: Use cpu_arm_init() to store ARMCPU
Needed for arm_pic_init_cpu().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
2012-06-11 00:23:04 +02:00
Andreas Färber 64c9e29708 vexpress: Use cpu_arm_init() to obtain ARMCPU
Needed for arm_pic_init_cpu().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber 9077f01b45 realview: Use cpu_arm_init() to obtain ARMCPU
Needed for arm_pic_init_cpu().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber 5d309320e3 arm_boot: Pass ARMCPU to arm_boot_info::secondary_cpu_reset_hook()
Adapt highbank accordingly.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber 9543b0cdd6 arm_boot: Pass ARMCPU to arm_boot_info::write_secondary_boot()
Adapt exynos4210 and highbank accordingly.
The parameter itself is unused.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com> (for exynos)
2012-06-11 00:23:04 +02:00
Andreas Färber 20e93374e9 versatilepb: Use cpu_arm_init() to obtain ARMCPU
Needed for arm_load_kernel().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber f25608e9dd musicpal: Use cpu_arm_init() to obtain ARMCPU
Needed for arm_load_kernel().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber 393a9eabb3 integratorcp: Use cpu_arm_init() to obtain ARMCPU
Needed for arm_load_kernel().

Add missing braces.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:04 +02:00
Andreas Färber 8bf502e2a6 strongarm: Use cpu_arm_init() to store ARMCPU in StrongARMState
Adapt collie accordingly.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:03 +02:00
Andreas Färber 5c6f4f178b z2: Rename PXA2xxState variable
Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:03 +02:00
Andreas Färber 8efa35e073 tosa: Rename PXA2xxState variable
Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:03 +02:00
Andreas Färber 2e7ad76018 spitz: Rename PXA2xxState variable
Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:03 +02:00
Andreas Färber 1c88de673e mainstone: Rename PXA2xxState variable
Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:03 +02:00
Andreas Färber f1eea068de palm: Rename omap_mpu_state_s variable
Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:03 +02:00
Andreas Färber 59b91996b9 omap_sx1: Rename omap_mpu_state_s variable
Avoid cpu->cpu by using "mpu" as variable name.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:03 +02:00
Andreas Färber 518ec1342c nseries: Rename n800_s::cpu to mpu
omap_mpu_state_s::env was renamed to cpu while changing its type.
With n800_s::cpu of type omap_mpu_state_s* this leads to s->cpu->cpu.

Rename the field to "mpu" to avoid this ugliness.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-11 00:23:03 +02:00
Andreas Färber 7c760cbcea target-ppc: Unbreak kvm_ppc.c build
The file is located in target-ppc/, not hw/.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-09 10:20:42 +00:00
Paolo Bonzini 27712df95d qdev: Remove PropertyInfo range checking
Range checking in PropertyInfo is now used only for pci_devfn
properties and some error reporting.  Remove all code that implements
it in the various property types, and the now unused fields.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Fix blocksize min/max for 32-bit hosts by using const int64_t.]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-08 16:11:14 +02:00
Michael Roth c08fb2ac00 qdev: Switch property accessors to fixed-width visitor interfaces
This introduces {get,set}_uint{8,16,32,64}() functions for the
respective qdev types.
TADDR and VLAN are switched to explicit int64, BLOCKSIZE to uint16.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-08 16:11:14 +02:00
Michael Roth 09f1bbcd83 qdev: Use int32_t container for devfn property
Valid range for devfn is -1 to 255 (-1 for automatic assignment). We do
not currently validate this due to devfn being stored as a uint32_t.
This can lead to segfaults and other strange behavior.

We could technically just cast it to int32_t to implement the checking,
but this will not work for visitor-based setting where we may do additional
bounds-checking based on target container type, which is int32_t for this
case.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-08 16:11:14 +02:00
Michael Roth 4e27e819be qapi: Add Visitor interfaces for uint*_t and int*_t
This adds visitor interfaces for fixed-width integers types.
Implementing these in visitors is optional, otherwise we fall back to
visit_type_int() (int64_t) with some additional bounds checking to avoid
integer overflows for cases where the value fetched exceeds the bounds
of our target C type.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[LE: exclude negative values in uint*_t Visitor interfaces]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
[AF: Merged fix by Laszlo]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-08 16:11:14 +02:00
Michael Tokarev dcf6f5e15e change iov_* function prototypes to be more appropriate
Reorder arguments to be more natural, readable and
consistent with other iov_* functions, and change
argument names, from:
 iov_from_buf(iov, iov_cnt, buf, iov_off, size)
to
 iov_from_buf(iov, iov_cnt, offset, buf, bytes)

The result becomes natural English:

 copy data to this `iov' vector with `iov_cnt'
 elements starting at byte offset `offset'
 from memory buffer `buf', processing `bytes'
 bytes max.

(Try to read the original prototype this way).

Also change iov_clear() to more general iov_memset()
(it uses memset() internally anyway).

While at it, add comments to the header file
describing what the routines actually does.

The patch only renames argumens in the header, but
keeps old names in the implementation.  The next
patch will touch actual code to match.

Now, it might look wrong to pay so much attention
to so small things.  But we've so many badly designed
interfaces already so the whole thing becomes rather
confusing or error prone.  One example of this is
previous commit and small discussion which emerged
from it, with an outcome that the utility functions
like these aren't well-understdandable, leading to
strange usage cases.  That's why I paid quite some
attention to this set of functions and a few
others in subsequent patches.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07 20:43:38 +04:00
Michael Tokarev 45270ad8a8 virtio-serial-bus: use correct lengths in control_out() message
Original code has one thing to process (cur_len), requests to
convert from iovec to buf another thing (len which is actually max_len),
and processes something else (copied).  Whole thing is very difficult
to understand, even if it does a right thing.  The iov_to_buf()
conversion in this case will always return cur_len, because it is
the length of the iovec it was asked to process, and the size we
asked to convert is the same or larger, and iov_to_buf() will stop
at reaching either iov or buf.

Make the code saner by doing the only sane thing: dropping `copied'
which is always the same as `cur_len' but just introduces questions.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2012-06-07 20:43:26 +04:00
Jan Kiszka 44701ab71a msi: Use msi/msix_present more consistently
Replace some open-coded msi/msix_present checks.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:19:01 +03:00
Jan Kiszka 95d6580024 msi: Invoke msi/msix_write_config from PCI core
Also this functions is better invoked by the core than by each and every
device. This allows to drop the config_write callbacks from ich and
intel-hda.

CC: Alexander Graf <agraf@suse.de>
CC: Gerd Hoffmann <kraxel@redhat.com>
CC: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:19:00 +03:00
Jan Kiszka 7c9958b043 msi: Guard msi/msix_write_config with msi_present
Terminate msi/msix_write_config early if support is not enabled. This
allows to remove checks at the caller site if MSI is optional.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:19:00 +03:00
Jan Kiszka cbd2d4342b msi: Invoke msi/msix_reset from PCI core
There is no point in pushing this burden to the devices, they tend to
forget to call them (like intel-hda, ahci, xhci did). Instead, reset
functions are now called from pci_device_reset. They do nothing if
MSI/MSI-X is not in use.

CC: Alexander Graf <agraf@suse.de>
CC: Gerd Hoffmann <kraxel@redhat.com>
CC: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:19:00 +03:00
Jan Kiszka 520064c8b1 msi: Guard msi_reset with msi_present
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:59 +03:00
Jan Kiszka 8ab60a0703 ahci: Clean up reset functions
Properly register reset functions via the device class.

CC: Alexander Graf <agraf@suse.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:59 +03:00
Jan Kiszka 8e729e3b52 intel-hda: Fix reset of MSI function
Call msi_reset on device reset as still required by the core.

CC: Gerd Hoffmann <kraxel@redhat.com>
CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:59 +03:00
Jan Kiszka 868a1a5226 ahci: Fix reset of MSI function
Call msi_reset on device reset as still required by the core.

CC: Alexander Graf <agraf@suse.de>
CC: qemu-stable@nongnu.org
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:59 +03:00
Fernando Luis Vazquez Cao fee9d348ff rtl8139: honor RxOverflow flag in can_receive method
Some drivers (Linux' 8139too among them) rely on the NIC
injecting an interrupt in the event of a receive buffer overflow
and, accordingly, set the RxOverflow bit in the interrupt
mask. Unfortunately rtl8139's can_receive method ignores the
RxOverflow flag, which may lead to a situation where rtl8139
stops receiving packets (can_receive returns 0) when the receive
buffer becomes full.

If the driver eventually read from the receive buffer or reset
the card the emulator could recover from this situation. However
some implementations only do this upon receiving an interrupt
with either RxOK or RxOverflow set in the ISR; interrupt that
will never come because QEMU's flow control mechanisms would
prevent rtl8139 from receiving any packet.

Letting packets go through when the overflow interrupt is enabled
makes the QEMU emulator compliant to the spec and solves the
problem.

This patch should fix a relatively common (in our experience)
network stall observed when running enterprise distros with
rtl8139 as the NIC; in some cases the 8139too device driver gets
loaded and when under heavy load the network eventually stops
working.

Reported-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp>
Tested-by: Hayato Kakuta <kakuta.hayato@oss.ntt.co.jp>
Acked-by: Igor Kovalenko <igor.v.kovalenko@gmail.com>
Signed-off-by: Fernando Luis Vazquez Cao <fernando@oss.ntt.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:58 +03:00
Michael S. Tsirkin e9adf2605d shpc: unparent device before free
Recent core change removed unparent
so we need to do this in all callers now.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-06-07 17:18:58 +03:00
Gerd Hoffmann f020ed36fe ehci: rework frame skipping
Move the framecount check out of the loop and use the new
ehci_update_frindex function to skip frames if needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann 3a21532626 ehci: adaptive wakeup rate.
Adapt the frame timer sleeps according to the actual needs.  With the
periodic schedule being active we'll have to wakeup 1000 times per
second and go check for work.  In case only the async schedule is active
we can be more lazy though.  When idle ehci will increate the sleep time
step by step, so qemu has to wake up less frequently.  When we'll see
transactions on the bus or the guest fiddles with the schedule
enable/disable bits we'll return to a 1000 Hz wakeup rate and full
speed.  With both schedules disabled we stop wakeups altogether.

This patch also drops the freq property (configures wakeup rate
manually) which is obsoleted by this patch.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann 6ceced0b2e ehci: create ehci_update_frindex
Factor out code from ehci_frame_timer.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann 863b474163 ehci: remove unused attach_poll_counter
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann daf25307b4 ehci: fix halt status handling
When the enable bits for controller / async schedule / periodic schedule
change just make sure we kick the frame timer and let
ehci_advance_periodic_state and ehci_advance_async_state handle the
controller state changes.

This will make ehci set USBSTS_HALT when the controller shutdown is
actually done, once both schedules are in inactive state and the
USBSTS_PSS and USBSTS_ASS bits are clear.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann b53f685d63 ehci: update status bits in ehci_set_state
Update the status register in the ehci_set_state function, to make sure
the guest-visible register is in sync with our internal schedule state.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann ec807d12bd ehci: add ehci_*_enabled() helpers
Add helper functions to query whenever the async / periodic schedule
is enabled or not.  Put them into use too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:23 +02:00
Gerd Hoffmann 7046530c36 ehci: fix reset
Check for the reset bit first when processing USBCMD register writes.
Also break out of the switch, there is no need to check the other bits.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 0f588df8b3 ehci: kick async schedule on wakeup
Kick async schedule when we get a wakeup
notification from a usb device.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann ae710b9905 ehci: schedule async bh on async packet completion
When a packet completes which happens to be part of the async schedule
kick the async bottom half for processing,

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 0fb3e299bd ehci: move async schedule to bottom half
This way we can kick the async schedule independant from the
periodic frame timer.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann ae0138a8ea ehci: add async field to EHCIQueue
Keep track whenever a EHCIQueue is part of the async or periodic
schedule.  This way we don't have to pass around the async flag
everywhere but can look it up from the EHCIQueue struct when needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 8f6d5e26b1 ehci: tweak queue initialization
Little tweak for the queue initialization, set the QH address in the
allocation function.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 773dc9cdfd ehci: add queuing support
Add packet queuing.  Follow the qTD chain to see if there are more
packets we can submit.  Improves performance on larger transfers,
especially with usb-host, as we don't have to wait for a packet to
finish before sending the next one to the host for processing.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann cd6657156e ehci: move ehci_flush_qh
Move ehci_flush_qh() function up in the source code.
No code change.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann e59928b3d1 ehci: cache USBDevice in EHCIQueue
Keep a USBDevice pointer in EHCIQueue so we don't have to lookup the
device on each usb packet submission.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 4224558f87 ehci: make ehci_execute work on EHCIPacket instead of EHCIQueue
This way it is possible to use ehci_execute to submit others than the
first EHCIPacket of the EHCIQueue.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann eb36a88e6b ehci: add EHCIPacket
Add a separate EHCIPacket struct and move fields over from EHCIQueue.
Preparing for supporting multiple packets per queue being in flight at
the same time.  No functional changes yet.

Fix some codestyle issues along the way.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 348f10374a xhci: trace: slots
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 97df650bb9 xhci: trace: transfers
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann c1f6b49326 xhci: trace: endpoints
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 0703a4a7a6 xhci: trace: ring fetch
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:22 +02:00
Gerd Hoffmann 7acd279f83 xhci: trace: irq + events
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann fc0ddaca33 xhci: trace: run+stop
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 2d754a10e4 xhci: trace: mmio reads+writes
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Jan Kiszka 64619739c4 xhci: Clean up reset function
Properly register reset function via the device class.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 5de88b1d46 usb-storage: migration support
With all scsi migration support bits in place the
final step is pretty simple ;)

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 1dc903673a usb-storage: add scsi_off, remove scsi_buf
Repace the running buffer pointer (scsi_buf) with a buffer offset
field (scsi_off).  The later is alot easier to live-migrate.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 1e6ed80b90 usb-storage: add usb_msd_packet_complete()
Factor out packet completion to a separate function which
cares to get the MSDState->packet update right.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 0659879e6e usb-storage: remove MSDState->residue
We have the field twice, once in MSDState directly and one in the status
word struct.  Drop one.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 18eef3bc4e scsi: prepare migration code for usb-storage support
usb-storage can't handle requests in one go as the data transfer can be
splitted into lots of usb packets.  Because of that there can be
normal in-flight requests at savevm time and we need to handle that.
With other scsi hba's this happens only in case i/o is stopped due to
errors and there are pending requests which need to be restarted
(req->retry = true).

So, first we need to save req->retry and then handle the req->retry =
false case.  Write requests are handled fine already.  For read requests
we have to save the buffer as we will not restart the request (and thus
not refill the buffer) on the target host.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:21 +02:00
Gerd Hoffmann 973002c114 uhci: fix irq routing
The multifunction ich9 ehci controller with uhci companions uses a
different interrupt pin for each function.  The three uhci devices
get pins A, B and C, whereas ehci uses pin D.  This way the guest
can assign different IRQ lines to each controller.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 5852d3bfe1 uhci: zap uhci_pre_save
Cancel transactions before saving vmstate is pretty pointless and just
causes disruptions.  We need to cancel them before *loading* vmstate,
but in that case uhci_reset() handles it already and no special action
is needed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 40141d12de uhci: make bandwidth tunable
Add a property for the uhci bandwidth.  Can be used to make uhci
emulation run faster than real hardware.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 9a16c5950d uhci: use bottom half
Schedule bottom half on completion of async packets instead of calling
uhci_process_frame directly.  This way we run uhci_process_frame only
once in case multiple packets finish in a row.  Also check whenever
there is bandwidth left before scheduling uhci_process_frame.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Gerd Hoffmann 4aed20e2d7 uhci: fix bandwidth management
uhci_process_frame() can be invoked multiple times per frame, so
accounting usb bandwith in a local variable doesn't fly, use a variable
in UHCIState instead.  Also check the limit more frequently.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-06-07 10:02:20 +02:00
Paolo Bonzini 49ac9e0a8c build: move device tree to per-target Makefile.objs
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:18 +02:00
Paolo Bonzini c353f26194 build: move per-target hw/ objects to nested Makefile.objs
This completes the move to nested Makefiles for virtio and a few
other files that were not part of obj-TARGET-y, but still were
compiled separately for each target.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:17 +02:00
Paolo Bonzini be1029ec30 build: convert libhw to nested Makefile.objs
After this patch, the libhw* directories will have a hierarchy
that mimics the source tree.  This is useful because we do have
a couple of files there that are in the top source directory.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:17 +02:00
Paolo Bonzini 3d5a3f9a7f build: move target-independent hw/ objects to nested Makefile.objs
This patch starts converting the hw/ directory.  Some files in hw/
are compiled once, some twice (32-/64-bit), some once per target.
Each category is moved in a separate patch.

After this patch, the files that are compiled once will show the
same hierarchy in the build tree as they do in the source tree,
for example hw/qdev.o instead of just qdev.o.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 09:21:16 +02:00
Paolo Bonzini 5e8861a036 build: move obj-TARGET-y variables to nested Makefile.objs
Also drop duplicate occurrence of device-hotplug.o.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-06-07 07:17:36 +02:00
Anthony Liguori 349417004a Merge remote-tracking branch 'qmp/queue/qmp' into staging
* qmp/queue/qmp: (29 commits)
  Add 'query-events' command to QMP to query async events
  qapi: convert netdev_del
  qapi: convert netdev_add
  net: net_client_init(): use error_set()
  net: purge the monitor object from all init functions
  qemu-config: introduce qemu_find_opts_err()
  qemu-config: find_list(): use error_set()
  qerror: introduce QERR_INVALID_OPTION_GROUP
  qemu-option: qemu_opts_from_qdict(): use error_set()
  qemu-option: introduce qemu_opt_set_err()
  qemu-option: opt_set(): use error_set()
  qemu-option: qemu_opts_validate(): use error_set()
  qemu-option: qemu_opt_parse(): use error_set()
  qemu-option: parse_option_size(): use error_set()
  qemu-option: parse_option_bool(): use error_set()
  qemu-option: parse_option_number(): use error_set()
  qemu-option: qemu_opts_create(): use error_set()
  introduce a new monitor command 'dump-guest-memory' to dump guest's memory
  make gdb_id() generally avialable and rename it to cpu_index()
  target-i386: Add API to get note's size
  ...
2012-06-06 20:57:56 +08:00
Anthony Liguori e1ae9a7a78 Merge remote-tracking branch 'afaerber-or/qom-cpu-3' into staging
* afaerber-or/qom-cpu-3: (74 commits)
  Kill off cpu_state_reset()
  linux-user: Use cpu_reset() after cpu_init() / cpu_copy()
  bsd-user: Use cpu_reset() in after cpu_init()
  leon3: Store SPARCCPU in ResetData
  leon3: Use cpu_sparc_init() to obtain SPARCCPU
  sun4u: Store SPARCCPU in ResetData
  sun4u: Let cpu_devinit() return SPARCCPU
  sun4u: Use cpu_sparc_init() to obtain SPARCCPU
  sun4m: Pass SPARCCPU to {main,secondary}_cpu_reset()
  sun4m: Use cpu_sparc_init() to obtain SPARCCPU
  target-sparc: Let cpu_sparc_init() return SPARCCPU
  cpu-exec: Use cpu_reset() in cpu_exec() for TARGET_PPC
  virtex_ml507: Pass PowerPCCPU to main_cpu_reset()
  virtex_ml507: Let ppc440_init_xilinx() return PowerPCCPU
  virtex_ml507: Use cpu_ppc_init() to obtain PowerPCCPU
  ppc_prep: Pass PowerPCCPU to ppc_prep_reset()
  ppc_prep: Use cpu_ppc_init() to obtain PowerPCCPU
  ppc_oldworld: Pass PowerPCCPU to ppc_heathrow_reset()
  ppc_oldworld: Use cpu_ppc_init() to obtain PowerPCCPU
  ppc_newworld: Pass PowerPCCPU to ppc_core99_reset()
  ...
2012-06-06 17:55:07 +08:00
Anthony Liguori 721589dd74 Revert "Revert "rtl8139: do the network/host communication only in normal operating mode""
This reverts commit 9c92bf7f6c.

Per Jason's request.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-06-05 09:05:51 +08:00
Andreas Färber c537d79cc5 leon3: Store SPARCCPU in ResetData
Allows us to use cpu_reset() in place of cpu_state_reset() in
main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04 23:00:45 +02:00
Andreas Färber 60ad073356 leon3: Use cpu_sparc_init() to obtain SPARCCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04 23:00:45 +02:00
Andreas Färber 403d7a2d73 sun4u: Store SPARCCPU in ResetData
We can now use cpu_reset() in place of cpu_state_reset() in
main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04 23:00:45 +02:00
Andreas Färber f9d1465f5b sun4u: Let cpu_devinit() return SPARCCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04 23:00:45 +02:00
Andreas Färber 8ebdf9dcc6 sun4u: Use cpu_sparc_init() to obtain SPARCCPU
This prepares using it in sun4uv_init().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04 23:00:45 +02:00
Andreas Färber 5414dec635 sun4m: Pass SPARCCPU to {main,secondary}_cpu_reset()
We can now use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04 23:00:45 +02:00
Andreas Färber 8968f588e3 sun4m: Use cpu_sparc_init() to obtain SPARCCPU
Needed for {main,secondary}_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Blue Swirl <blauwirbel@gmail.com>
2012-06-04 23:00:45 +02:00
Andreas Färber f8031482d7 virtex_ml507: Pass PowerPCCPU to main_cpu_reset()
Allows us to call cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 68281699ac virtex_ml507: Let ppc440_init_xilinx() return PowerPCCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber d1d4938ba8 virtex_ml507: Use cpu_ppc_init() to obtain PowerPCCPU
Needed to change ppc440_init_xilinx() return type.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 5c3e735f9b ppc_prep: Pass PowerPCCPU to ppc_prep_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber a9bf3df021 ppc_prep: Use cpu_ppc_init() to obtain PowerPCCPU
Needed for ppc_prep_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber cd79664f76 ppc_oldworld: Pass PowerPCCPU to ppc_heathrow_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 72c33dd714 ppc_oldworld: Use cpu_ppc_init() to obtain PowerPCCPU
Needed for ppc_heathrow_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 6680988c30 ppc_newworld: Pass PowerPCCPU to ppc_core99_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 8f8204ecb7 ppc_newworld: Use cpu_ppc_init() to obtain PowerPCCPU
Needed for ppc_core99_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 90cb09d9d3 ppc4xx_devs: Pass PowerPCCPU to ppc4xx_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 572747136d ppc4xx_devs: Use cpu_ppc_init() to obtain PowerPCCPU
Needed for ppc4xx_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 182fbbf218 ppc440_bamboo: Pass PowerPCCPU to main_cpu_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 322164e0db ppc440_bamboo: Use cpu_ppc_init() to obtain PowerPCCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 5b2038e049 spapr: Pass PowerPCCPU to spapr_cpu_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 05769733e0 spapr: Use cpu_ppc_init() to obtain PowerPCCPU
Needed for spapr_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:44 +02:00
Andreas Färber 38f92da6e7 ppce500_mpc8544ds: Pass PowerPCCPU to mpc8544ds_cpu_reset[_sec]
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber 397b457d86 target-ppc: Let cpu_ppc_init() return PowerPCCPU
Adapt e500 mpc8544ds machine accordingly.

Turn cpu_init() into a static inline function returning CPUPPCState for
backwards compatibility.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber fa156e5127 mips_r4k: Store MIPSCPU in ResetData
Allows us to use cpu_reset() in place of cpu_state_reset() in
main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber 9ac67e2168 mips_r4k: Use cpu_mips_init() to obtain MIPSCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber 2d44fc8e2e mips_mipssim: Store MIPSCPU in ResetData
Allows us to use cpu_reset() in place of cpu_state_reset() in
main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber 7ee274c193 mips_mipssim: Use cpu_mips_init() to obtain MIPSCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber 1004ee8d26 mips_malta: Pass MIPSCPU to main_cpu_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber 7688b134b8 mips_malta: Use cpu_mips_init() to obtain MIPSCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber f37f435a3e mips_jazz: Pass MIPSCPU to main_cpu_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Hervé Poussineau <hpoussin@reactos.org>
2012-06-04 23:00:43 +02:00
Andreas Färber 6bd8da655a mips_jazz: Use cpu_mips_init() to obtain MIPSCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Hervé Poussineau <hpoussin@reactos.org>
2012-06-04 23:00:43 +02:00
Andreas Färber 800cf598f9 mips_fulong2e: Pass MIPSCPU to main_cpu_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber f0f8036697 mips_fulong2e: Use cpu_mips_cpu() to obtain MIPSCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber 868bac81d7 r2d: Store SuperHCPU in ResetData
Allows us to use cpu_reset() in place of cpu_state_reset() in
main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber fd2f410b37 r2d: Use cpu_sh4_init() to obtain SuperHCPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-06-04 23:00:43 +02:00
Andreas Färber e5fe7a34d4 pc: Pass X86CPU to pc_cpu_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2012-06-04 23:00:42 +02:00
Andreas Färber 608911acac pc: Use cpu_x86_init() to obtain X86CPU
Needed for pc_cpu_reset().

Also change return type to X86CPU.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
2012-06-04 23:00:42 +02:00
Andreas Färber bf494367fa microblaze_boot: Pass MicroBlazeCPU to microblaze_load_kernel()
Allows us to use cpu_reset() in place of cpu_state_reset() in
main_cpu_reset().

Also pass it through to its reset callbacks, while at it.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-06-04 23:00:42 +02:00
Andreas Färber 3ed607333e petalogix_s3adsp1800_mmu: Use cpu_mb_init() to obtain MicroBlazeCPU
Needed for microblaze_load_kernel().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-06-04 23:00:42 +02:00
Andreas Färber a9480e5d32 petalogix_ml605: Use cpu_mb_init() to obtain MicroBlazeCPU
Needed for microblaze_load_kernel().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-06-04 23:00:42 +02:00
Andreas Färber 1584aafd02 cris-boot: Pass CRISCPU to main_cpu_reset().
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-06-04 23:00:42 +02:00
Andreas Färber 5935664fc0 cris-boot: Pass CRISCPU to cris_load_image()
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-06-04 23:00:42 +02:00
Andreas Färber ddeb9ae5fa axis_dev88: Use cpu_cris_init() to obtain CRISCPU
Needed for cris_load_image().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
2012-06-04 23:00:42 +02:00
Andreas Färber eded12679d xtensa_lx60: Pass XtensaCPU to lx60_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
2012-06-04 23:00:42 +02:00
Andreas Färber adbb0f75f0 xtensa_lx60: Use cpu_xtensa_init() to obtain XtensaCPU
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
2012-06-04 23:00:41 +02:00
Andreas Färber 11e7bfd7e0 xtensa_sim: Pass XtensaCPU to sim_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
2012-06-04 23:00:41 +02:00
Andreas Färber 06d26274cd xtensa_sim: Use cpu_xtensa_init() to obtain XtensaCPU
Needed for sim_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
2012-06-04 23:00:41 +02:00
Andreas Färber f6932a867d milkymist: Store LM32 in ResetInfo
Allows us to use cpu_reset() in place of cpu_state_reset() in
main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
2012-06-04 23:00:41 +02:00
Andreas Färber 1328cc01f1 milkymist: Use cpu_lm32_init() to obtain LM32CPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
2012-06-04 23:00:41 +02:00
Andreas Färber b143559655 lm32_boards: Store LM32CPU in ResetInfo
Allows us to use cpu_reset() in place of cpu_state_reset() in
main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
2012-06-04 23:00:41 +02:00
Andreas Färber 47dc4fa211 lm32_boards: Use cpu_lm32_init() to obtain LM32CPU
Needed for main_cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael Walle <michael@walle.cc>
2012-06-04 23:00:41 +02:00
Andreas Färber 351d566621 arm_boot: Pass ARMCPU to do_cpu_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-04 23:00:41 +02:00
Andreas Färber 31363f12f5 armv7m: Pass ARMCPU to armv7m_reset()
Allows us to use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-04 23:00:41 +02:00
Andreas Färber 0f37c99b27 armv7m: Use cpu_arm_init() to obtain ARMCPU
Needed for armv7m_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-04 23:00:41 +02:00
Andreas Färber 5f4ef08b20 omap: Use cpu_arm_init() to store ARMCPU in omap_mpu_state_s
Fix tab indentations of comments, add braces, use cpu_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-04 23:00:41 +02:00
Andreas Färber 43824588af pxa2xx: Use cpu_arm_init() and store ARMCPU
Also use cpu_reset() in place of cpu_state_reset().

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
2012-06-04 23:00:40 +02:00
Luiz Capitulino 4559a1dbcc net: net_client_init(): use error_set()
Callers are changed to use qerror_report_err() to keep their QError
semantics.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-By: Laszlo Ersek <lersek@redhat.com>
2012-06-04 13:49:35 -03:00
Luiz Capitulino 42dcc547e1 net: purge the monitor object from all init functions
The only backend that really uses it is the socket one, which calls
monitor_get_fd(). But it can use 'cur_mon' instead.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-By: Laszlo Ersek <lersek@redhat.com>
2012-06-04 13:49:35 -03:00
Luiz Capitulino 4e89978e20 qemu-option: qemu_opts_from_qdict(): use error_set()
do_device_add() and do_netdev_add() call qerror_report_err() to maintain
their QError semantics.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-By: Laszlo Ersek <lersek@redhat.com>
2012-06-04 13:49:34 -03:00
Luiz Capitulino 8be7e7e4c7 qemu-option: qemu_opts_create(): use error_set()
This commit converts qemu_opts_create() from qerror_report() to
error_set().

Currently, most calls to qemu_opts_create() can't fail, so most
callers don't need any changes.

The two cases where code checks for qemu_opts_create() erros are:

 1. Initialization code in vl.c. All of them print their own
    error messages directly to stderr, no need to pass the Error
    object

 2. The functions opts_parse(), qemu_opts_from_qdict() and
    qemu_chr_parse_compat() make use of the error information and
    they can be called from HMP or QMP. In this case, to allow for
    incremental conversion, we propagate the error up using
    qerror_report_err(), which keeps the QError semantics

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-By: Laszlo Ersek <lersek@redhat.com>
2012-06-04 13:49:34 -03:00
Jason Wang 9c92bf7f6c Revert "rtl8139: do the network/host communication only in normal operating mode"
This reverts commit ff71f2e8ca. This is because
the linux 8139cp driver would leave the card in "Config Register Write Enable"
mode after the eeprom were read or write ( which is unexpected in the spec
). Also a physical 8139 card can still DMA into host memory in modes other than
Normal mode, so we need revert this commit to align with the behavior of
physical card.

The issue of 8139cp driver should be fixed in linux seperately.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-06-04 12:58:36 +08:00
Anthony Liguori 74f4d2279b Merge remote-tracking branch 'qemu-kvm/uq/master' into staging
* qemu-kvm/uq/master:
  virtio/vhost: Add support for KVM in-kernel MSI injection
  msix: Add msix_nr_vectors_allocated
  kvm: Enable use of kvm_irqchip_in_kernel in hwlib code
  kvm: Introduce kvm_irqchip_add/remove_irqfd
  kvm: Make kvm_irqchip_commit_routes an internal service
  kvm: Publicize kvm_irqchip_release_virq
  kvm: Introduce kvm_irqchip_add_msi_route
  kvm: Rename kvm_irqchip_add_route to kvm_irqchip_add_irq_route
  msix: Introduce vector notifiers
  msix: Invoke msix_handle_mask_update on msix_mask_all
  msix: Factor out msix_get_message
  kvm: update vmxcap for EPT A/D, INVPCID, RDRAND, VMFUNC
  kvm: Enable in-kernel irqchip support by default
  kvm: Add support for direct MSI injections
  kvm: Update kernel headers
  kvm: x86: Wire up MSI support for in-kernel irqchip
  pc: Enable MSI support at APIC level
  kvm: Introduce basic MSI support for in-kernel irqchips
  Introduce MSIMessage structure
  kvm: Refactor KVMState::max_gsi to gsi_count
2012-06-03 07:56:23 +08:00
Daniel Verkamp 4bb9c939a5 ahci: SATA FIS is 20 bytes, not 0x20
As in the SATA and AHCI specifications, a FIS is 5 Dwords of 4 bytes
each, which comes to 20 bytes (decimal), not 0x20.

Signed-off-by: Daniel Verkamp <daniel@drv.nu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-05-30 14:51:09 +02:00
Christian Borntraeger 136be99e6e virtio-blk: Fix geometry sector calculation
Currently the sector value for the geometry is masked, even if the
user usesa command line parameter that explicitely gives a number.
This breaks dasd devices on s390. A dasd device can have
a physical block size of 4096 (== same for logical block size)
and a typcial geometry of 15 heads and 12 sectors per cyl.
The ibm partition detection relies on a correct geometry
reported by the device. Unfortunately the current code changes
12 to 8. This would be necessary if the total size is
not a multiple of logical sector size,  but for dasd this
is not the case.

This patch checks the device size and only applies sector
mask if necessary.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Christoph Hellwig <hch@lst.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-05-30 14:51:04 +02:00
Stefan Weil 47ce9ef7f8 virtio: Fix compiler warning for non Linux hosts
The local variables ret, i are only used if __linux__ is defined.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-05-30 09:49:49 +02:00
Amos Kong a6de8ed80e pci: call object_unparent() before free_qdev()
Start VM with 8 multiple-function block devs, hot-removing
those block devs by 'device_del ...' would cause qemu abort.

| (qemu) device_del virti0-0-0
| (qemu) **
|ERROR:qom/object.c:389:object_delete: assertion failed: (obj->ref == 0)

It's a regression introduced by commit 57c9fafe

The whole PCI slot should be removed once. Currently only one func
is cleaned in pci_unplug_device(), if you try to remove a single
func by monitor cmd.

free_qdev() are called for all functions in slot,
but unparent_delete() is only called for one
function.

Signed-off-by: XXXX
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-29 20:19:24 -05:00
Scott Moser 9c3a596a03 fix multiboot loading if load_end_addr == 0
The previous multiboot load code did not treat the case where
load_end_addr was 0 specially.  The multiboot specification says the
following:
 * load_end_addr
   Contains the physical address of the end of the data segment.
   (load_end_addr - load_addr) specifies how much data to load. This
   implies that the text and data segments must be consecutive in the
   OS image; this is true for existing a.out executable formats. If
   this field is zero, the boot loader assumes that the text and data
   segments occupy the whole OS image file.

Signed-off-by: Scott Moser <smoser@ubuntu.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-29 20:19:24 -05:00
Avi Kivity 8294a64d7f vga: fix vram double-mapping with -vga std and -M pc-0.12
With pc-0.12, we map the video RAM both through the PCI BAR (the guest does
this) and through a fixed mapping at 0xe0000000.  The memory API doesn't allow
this double map, and aborts.

Fix by using an alias.

Reported-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-29 20:19:24 -05:00
Anthony Liguori dd86df756e Merge remote-tracking branch 'sstabellini/for_1.1_rc3' into staging
* sstabellini/for_1.1_rc3:
  Call xc_domain_shutdown with the reboot flag when the guest requests a reboot.
  xen: Fix PV-on-HVM
  xen_disk: properly update stats in ioreq_release()
  xen_disk: use bdrv_aio_flush instead of bdrv_flush
  xen_disk: remove syncwrite option
  xen: disable rtc_clock
  xen: do not initialize the interval timer and PCSPK emulator
2012-05-29 04:32:13 -05:00
Anthony Liguori 306761537f Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony:
  fdc-test: introduced qtest no_media_on_start and cmos qtest for floppy
  fdc: fix media detection
  fdc: floppy drive should be visible after start without media
  qemu-iotests: mark 035 qcow2-only
  qcow2: Check qcow2_alloc_clusters_at() return value
  sheepdog: use heap instead of stack for BDRVSheepdogState
  sheepdog: return -errno on error
  sheepdog: mark image as snapshot when tag is specified
  qemu-img: Explain how rebase operation can be used to perform a 'diff' operation.
  qcow2: don't leak buffer for unexpected qcow_version in header
2012-05-29 04:30:49 -05:00
Pavel Hrdina cfb08fbafc fdc: fix media detection
We have to set up 'media_changed' after guest start so floppy driver
could detect that there is no media in drive. For this purpose we call
'fdctrl_change_cb' instead of 'fd_revalidate' in 'fdctrl_connect_drives'.
'fd_revalidate' is called inside 'fdctrl_change_cb'.

We still have to set default drive geometry in 'fd_revalidate' even
if there is no media in drive. When you try to open (windows) or mount (linux)
floppy the driver tries to seek on track 1. Linux guest stuck in loop then
kernel crashes and windows guest prints error message.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-05-25 18:21:12 +02:00
Pavel Hrdina 9ecd394753 fdc: floppy drive should be visible after start without media
If you start guest with floppy drive but without media inserted, guest
still should see floppy drive pressent.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-05-25 18:18:53 +02:00
Jim Meyering 12badfc238 scsi: declare vmstate_info_scsi_requests to be static
Signed-off-by: Jim Meyering <meyering@redhat.com>
2012-05-25 13:00:27 +02:00
Stefan Weil f8687bab91 es1370: Fix debug code
When DEBUG_ES1370 is defined, the compiler shows these warnings:

hw/es1370.c: In function ?es1370_update_voices?:
hw/es1370.c:414: warning: format ?%d? expects type ?int?, but argument 3 has type ?size_t?
hw/es1370.c: In function ?es1370_writel?:
hw/es1370.c:582: warning: format ?%d? expects type ?int?, but argument 3 has type ?long int?
hw/es1370.c:592: warning: format ?%d? expects type ?int?, but argument 3 has type ?long int?
hw/es1370.c:609: warning: format ?%d? expects type ?int?, but argument 3 has type ?long int?
hw/es1370.c: In function ?es1370_readl?:
hw/es1370.c:751: warning: suggest braces around empty body in an ?if? statement

Fix the format strings and add the missing braces.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: malc <av1474@comtv.ru>
2012-05-24 02:03:30 +04:00
Anthony PERARD 4accd107d0 xen: Fix PV-on-HVM
In the context of PV-on-HVM under Xen, the emulated nics are supposed to be
unplug before the guest drivers are initialized, when the guest write to a
specific IO port.

Without this patch, the guest end up with two nics with the same MAC, the
emulated nic and the PV nic.

Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:40:51 -05:00
dunrong huang a340046614 qdev: Fix memory leak
The str allocated in visit_type_str was not freed.

The visit_type_str function is an input visitor(<QMP/String/etc>-to-native)
here, it will allocate memory for caller, so the caller is responsible for
freeing the memory.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: dunrong huang <riegamaths@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:40:51 -05:00
Orit Wassermann 2a633c461e virtio: check virtio_load return code
Otherwise we crash on error.

Signed-off-by: Ulrich Obergfell <uobergfe@redhat.com>
Signed-off-by: Orit Wassermann <owasserm@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:40:50 -05:00
Paolo Bonzini a6c5c84ae2 virtio-blk: always enable VIRTIO_BLK_F_SCSI
VIRTIO_BLK_F_SCSI is supposed to mean whether the host can *parse*
SCSI requests, not *execute* them.  You could run QEMU with scsi=on
and a file-backed disk, and QEMU would fail all SCSI requests even
though it advertises VIRTIO_BLK_F_SCSI.

Because we need to do this to fix a migration compatibility problem
related to how QEMU is invoked by management, we must do this
unconditionally even on older machine types.  This more or less assumes
that no one ever invoked QEMU with scsi=off.

Here is how testing goes:

- old QEMU, scsi=on -> new QEMU, scsi=on
- new QEMU, scsi=on -> old QEMU, scsi=on
- old QEMU, scsi=off -> new QEMU, scsi=on
- new QEMU, scsi=off -> old QEMU, scsi=on
        ok (new QEMU has VIRTIO_BLK_F_SCSI, adding host features is fine)

- old QEMU, scsi=off -> new QEMU, scsi=off
        ok (new QEMU has VIRTIO_BLK_F_SCSI, adding host features is fine)

- old QEMU, scsi=on -> new QEMU, scsi=off
        ok, bug fixed

- new QEMU, scsi=on -> old QEMU, scsi=off
        doesn't work (same as: old QEMU, scsi=on -> old QEMU, scsi=off)

- new QEMU, scsi=off -> old QEMU, scsi=off
        broken by the patch

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:40:50 -05:00
Paolo Bonzini 12c5674b84 virtio-blk: define VirtIOBlkConf
We will have to add another field to the virtio-blk configuration in
the next patch.  Avoid a proliferation of arguments to virtio_blk_init.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:40:50 -05:00
Paolo Bonzini 0e47931b88 virtio-blk: blockdev_mark_auto_del is transport-independent
Move it from virtio_blk_exit_pci to virtio_blk_exit.

This is included here because the next patch removes proxy->block.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:40:50 -05:00
Paolo Bonzini f34e73cd69 virtio-blk: report non-zero status when failing SG_IO requests
Linux really looks only at scsi->errors for SG_IO requests; it does
not look at the virtio request status at all.  Because of this, when
a SG_IO request is failed early with virtio_blk_req_complete(req,
VIRTIO_BLK_S_UNSUPP), without writing hdr.status, it will look like
a success to the guest.

This is their bug, but we can make it safe for older guests now by
forcing scsi->errors to have a non-zero value whenever a request
has to be failed.

But if we fix the bug in the guest driver, we will have another problem
because QEMU returns VIRTIO_BLK_S_IOERR if the status is non-zero, and
Linux translates that to -EIO.  Rather, the guest should succeed the
request and pass the non-zero status via the userspace-provided SG_IO
structure.  So, remove the case where virtio_blk_handle_scsi can
return VIRTIO_BLK_S_IOERR.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:40:50 -05:00
Mark Langsdorf 80a2ba3d3c use an uint64_t for the max_sz parameter in load_image_targphys
Allow load_image_targphys to load files on systems with more than 2G of
emulated memory by changing the max_sz parameter from an int to an
uint64_t.

Reviewed-by: Andreas F=E4rber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-21 15:40:50 -05:00
Jan Kiszka 7d37d351df virtio/vhost: Add support for KVM in-kernel MSI injection
Make use of the new vector notifier to track changes of the MSI-X
configuration of virtio PCI devices. On enabling events, we establish
the required virtual IRQ to MSI-X message route and link the signaling
eventfd file descriptor to this vIRQ line. That way, vhost-generated
interrupts can be directly delivered to an in-kernel MSI-X consumer like
the x86 APIC.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-05-21 19:22:50 +03:00
Jan Kiszka cb697aaab9 msix: Add msix_nr_vectors_allocated
Analogously to msi_nr_vectors_allocated, add a service for MSI-X. Will
be used by the virtio-pci layer.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-05-21 19:22:50 +03:00
Jan Kiszka e7b2030862 kvm: Make kvm_irqchip_commit_routes an internal service
Automatically commit route changes after kvm_add_routing_entry and
kvm_irqchip_release_virq. There is no performance relevant use case for
which collecting multiple route changes is beneficial. This makes
kvm_irqchip_commit_routes an internal service which assert()s that the
corresponding IOCTL will always succeed.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-05-21 19:22:49 +03:00
Jan Kiszka 1df186df35 kvm: Rename kvm_irqchip_add_route to kvm_irqchip_add_irq_route
We will add kvm_irqchip_add_msi_route, so let's make the difference
clearer.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-05-21 19:22:49 +03:00
Jan Kiszka 2cdfe53c5f msix: Introduce vector notifiers
Vector notifiers shall be triggered by the MSI/MSI-X core whenever a
relevant configuration change is programmed by the guest. In case of
MSI-X, changes are reported when the effective mask (global &&
per-vector) alters its state. On unmask, the current vector
configuration is included in the event report. This allows users - e.g.
virtio-pci layer - to transfer this information to external MSI-X
routing subsystems - like vhost + KVM in-kernel irqchip.

This implementation only provides MSI-X support, but extension to MSI is
feasible and will be provided later on when adding support for KVM PCI
device assignment.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-05-21 19:22:49 +03:00
Jan Kiszka 5b5f1330da msix: Invoke msix_handle_mask_update on msix_mask_all
In preparation of firing vector notifiers on mask changes, call
msix_handle_mask_update also from msix_mask_all. So far, this will have
no real effect.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-05-21 19:22:49 +03:00
Jan Kiszka bc4caf49c7 msix: Factor out msix_get_message
This helper will also be used by the upcoming config notifier.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
2012-05-21 19:22:49 +03:00
Blue Swirl 4636b9d146 virtio-pci: add missing 'static'
There are no outside references to virtio_portio.
Add missing 'static' specifier.

Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-05-19 15:41:14 +00:00
Blue Swirl 5f2bf0fe55 sparc64: fix initrd loading
Initrd load address is too low, it conflicts with kernel load
address:
rom: requested regions overlap (rom phdr #0: /tmp/vmlinux-debian-6.0.4-sparc64. free=0x0000000000742519, addr=0x0000000000400000)
rom loading failed

Fix by making the initrd address variable, load initrd after kernel
image. Use 64 bit variables instead of longs or 32 bit types.

Tested-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-05-19 15:39:04 +00:00
John V. Baboval 180640ea07 Call xc_domain_shutdown with the reboot flag when the guest requests a reboot.
Signed-off-by: John V. Baboval <john.baboval@virtualcomputer.com>
Signed-off-by: Tom Goetz <tom.goetz@virtualcomputer.com>
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2012-05-17 10:52:38 +00:00
Anthony PERARD a4f1a7589a xen: Fix PV-on-HVM
In the context of PV-on-HVM under Xen, the emulated nics are supposed to be
unplug before the guest drivers are initialized, when the guest write to a
specific IO port.

Without this patch, the guest end up with two nics with the same MAC, the
emulated nic and the PV nic.

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-17 10:52:29 +00:00
Jan Beulich ed54776643 xen_disk: properly update stats in ioreq_release()
While for the "normal" case (called from blk_send_response_all())
decrementing requests_finished is correct, doing so in the parse error
case is wrong; requests_inflight needs to be decremented instead.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
2012-05-17 10:43:33 +00:00
Stefano Stabellini c6961b7d38 xen_disk: use bdrv_aio_flush instead of bdrv_flush
Use bdrv_aio_flush instead of bdrv_flush.

Make sure to call bdrv_aio_writev/readv after the presync bdrv_aio_flush is fully
completed and make sure to call the postsync bdrv_aio_flush after
bdrv_aio_writev/readv is fully completed.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2012-05-17 10:43:33 +00:00
Stefano Stabellini ba1dffed63 xen_disk: remove syncwrite option
This patch removes a dead option.

The same can be achieved removing BDRV_O_NOCACHE and BDRV_O_CACHE_WB
from the flags passed to bdrv_open.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2012-05-17 10:43:33 +00:00
Stefano Stabellini c2d8d311c1 xen: do not initialize the interval timer and PCSPK emulator
PIT and PCSPK are emulated by the hypervisor so we don't need to emulate
them in Qemu: this patch prevents Qemu from waking up needlessly at
PIT_FREQ on Xen.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2012-05-17 10:43:32 +00:00
Jan Kiszka ffb8d4296e kvm: x86: Wire up MSI support for in-kernel irqchip
Catch writes to the MSI MMIO region in the KVM APIC and forward them to
the kernel. Provide the kernel support GSI routing, this allows to
enable MSI support also for in-kernel irqchip mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-05-16 18:04:45 -03:00
Jan Kiszka 08a82ac01c pc: Enable MSI support at APIC level
Push msi_supported enabling to the APIC implementations where we can
encapsulate the decision more cleanly, hiding the details from the
generic code.

Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-05-16 18:04:44 -03:00
Jan Kiszka 14de9bab9e Introduce MSIMessage structure
Will be used for generating and distributing MSI messages, both in
emulation mode and under KVM.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
2012-05-16 18:04:44 -03:00
Anthony Liguori 8592d5259a Merge remote-tracking branch 'afaerber-or/qom-1.1' into staging
* afaerber-or/qom-1.1:
  mips_fulong2e: Don't register "cpu" VMState twice
  pc: Add back PCI.rombar compat property
  qdev: Fix adding of ptr properties
  qdev: Use object_property_print() in info qtree
  target-i386: Defer MCE init
  qom: Documentation addition for object_class_by_name()
  target-mips: Remove commented-out function declaration
2012-05-14 10:15:52 -05:00
Anthony Liguori 7a85d1cf1c Merge remote-tracking branch 'kraxel/usb.50' into staging
* kraxel/usb.50:
  usb-host: handle guest-issued clear halt
2012-05-14 10:07:23 -05:00
Anthony Liguori caa3d6d37b Merge remote-tracking branch 'spice/spice.v55' into staging
* spice/spice.v55:
  qxl: set size of PCI IO BAR correctly (16) for revision 2
2012-05-14 10:07:06 -05:00
Anthony Liguori 82ac96a72b Merge remote-tracking branch 'sweil/for-1.1' into staging
* sweil/for-1.1:
  qemu-doc: Use QEMU instead of qemu for product name
  qemu-doc: Fix executable name in examples
  qemu-doc: Add missing parameter in description of -D option
  configure: Use QEMU instead of Qemu
  fix some common typos
  qemu-timer: Fix wrong error message
2012-05-14 10:06:50 -05:00
Paolo Bonzini 90ca64a970 qdev: fix -device foo,?
Since most property types do not have a parse property now, this was
broken.  Fix it by looking at the setter instead.

Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Acked-by: Andreas F=E4rber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-05-14 10:06:21 -05:00
Gerd Hoffmann a2498f76b8 usb-host: handle guest-issued clear halt
Most important here is to update our internal endpoint state so we know
the endpoint isn't in halted state any more.  Without this usb-host
tries to clear halt again with the next data transfer submitted.  Doing
this twice is (a) not correct and (b) confuses some usb devices,
rendering them non-functional in the guest.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-14 10:22:20 +02:00
Uri Lublin 3f6297b922 qxl: set size of PCI IO BAR correctly (16) for revision 2
Also move it up into switch(qxl->revision) block

Signed-off-by: Uri Lublin <uril@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-14 10:22:18 +02:00
Jim Meyering a31f053129 fix some common typos
These were identified using: http://github.com/lyda/misspell-check
and run like this to create a bourne shell script using GNU sed's
-i option:

git ls-files|grep -vF .bin | misspellings -f - |grep -v '^ERROR:' |perl \
-pe 's/^(.*?)\[(\d+)\]: (\w+) -> "(.*?)"$/sed -i '\''${2}s!$3!$4!'\'' $1/'

Manually eliding the FP, "rela->real" and resolving "addres" to
address (not "adders") we get this:

  sed -i '450s!thru!through!' Changelog
  sed -i '260s!neccessary!necessary!' coroutine-sigaltstack.c
  sed -i '54s!miniscule!minuscule!' disas.c
  sed -i '1094s!thru!through!' hw/usb/hcd-ehci.c
  sed -i '1095s!thru!through!' hw/usb/hcd-ehci.c
  sed -i '21s!unecessary!unnecessary!' qapi-schema-guest.json
  sed -i '307s!explictly!explicitly!' qemu-ga.c
  sed -i '490s!preceeding!preceding!' qga/commands-posix.c
  sed -i '792s!addres!address!' qga/commands-posix.c
  sed -i '6s!beeing!being!' tests/tcg/test-mmap.c

Also, manually fix "arithmentic", spotted by Peter Maydell:

  sed -i 's!arithmentic!arithmetic!' coroutine-sigaltstack.c

Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2012-05-14 07:27:24 +02:00
Juan Quintela 0c9dfe460d mips_fulong2e: Don't register "cpu" VMState twice
We have the following simplified callgraph in mips_fulong2e_init():

  cpu_init() => cpu_mips_init()
    object_new()
      mips_cpu_initfn()
        cpu_exec_init()
          register_savevm(NULL, "cpu", cpu_index, CPU_SAVE_VERSION,
                          cpu_save, cpu_load, env)
  register_savevm(NULL, "cpu", 0, 3, cpu_save, cpu_load, env)

CPU_SAVE_VERSION is defined as 3 in target-mips/cpu.h.
fulong2e instantiates one CPU, so its cpu_index is 0.
Thus the two are fully identical.

Therefore just remove the second call in fulong2e.

Signed-off-by: Juan Quintela <quintela@redhat.com>
[AF: Extend explanation in commit message]
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-05-13 19:58:23 +02:00
Paolo Bonzini c115cd6578 pc: Add back PCI.rombar compat property
This was erroneously dropped in d6c730086c
(pc: reduce duplication in compat machine types).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
2012-05-13 18:55:50 +02:00
Anthony Liguori f3be016d03 qdev: Fix adding of ptr properties
ptr properties have neither a get/set or a print/parse which means that when
they're added they aren't treated as static or legacy properties.

Just assume properties like this are legacy properties and treat them as such.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-05-12 14:19:10 +02:00
Paolo Bonzini 8185bfc146 qdev: Use object_property_print() in info qtree
Otherwise, non-string properties without a legacy counterpart are missed.
Also fix error propagation in object_property_print() itself.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
2012-05-12 14:17:52 +02:00
Artyom Tarasenko 94d1991445 sun4u: implement interrupt clearing registers
Implement registers for clearing OBIO and PCI interrupts

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-05-12 09:49:19 +00:00
Artyom Tarasenko d1d80055ba sun4u: initialize OBIO interrupt mappings
Similarly to PCI interrupt mappings, the OBIO ones have to be initialized.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-05-12 09:49:17 +00:00
Anthony Liguori 4f08129eeb Merge remote-tracking branch 'mst/tags/for_anthony' into staging
* mst/tags/for_anthony:
  rtl8139: fix regression in TxStatus/TxAddr read
2012-05-08 09:41:10 -05:00
Anthony Liguori 7c652c1eaf Merge remote-tracking branch 'kwolf/for-anthony' into staging
* kwolf/for-anthony:
  fdc: simplify media change handling
  qcow2: lock on prealloc
  block: make bdrv_create adopt coroutine
  qcow2: Limit COW to where it's needed
  sheepdog: switch to writethrough mode if cluster doesn't support flush
2012-05-08 09:38:41 -05:00
Anthony Liguori e45bca682c Merge remote-tracking branch 'bonzini/scsi-next' into staging
* bonzini/scsi-next:
  scsi: Add assertion for use-after-free errors
  scsi: remove useless debug messages
  scsi: set VALID bit to 0 in fixed format sense data
  scsi: do not require a minimum allocation length for REQUEST SENSE
  scsi: do not require a minimum allocation length for INQUIRY
  scsi: parse 16-byte tape CDBs
  scsi: do not report bogus overruns for commands in the 0x00-0x1F range
  scsi-disk: add dpofua property
  scsi: change "removable" field to host many features
  scsi: Specify the xfer direction for UNMAP and ATA_PASSTHROUGH commands
  scsi: fix WRITE SAME transfer length and direction
  scsi: fix refcounting for reads
  scsi: prevent data transfer overflow
  ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs
2012-05-08 09:37:12 -05:00
Anthony Liguori acde8376ef Merge remote-tracking branch 'spice/spice.v54' into staging
* spice/spice.v54:
  qxl: don't assert on guest create_guest_primary
  qxl: ioport_write: remove guest trigerrable abort
  qxl: qxl_add_memslot: remove guest trigerrable panics
  qxl: interface_notify_update: remove guest trigerrable abort
  qxl: cleanup s/__FUNCTION__/__func__/
  qxl: don't abort on guest trigerrable ring indices mismatch
  qxl: fix > 80 chars line
  qxl: replace panic with guest bug in qxl_track_command
  qxl: check for NULL return from qxl_phys2virt
  hw/qxl.c: qxl_phys2virt: replace panics with guest_bug
  spice_info: add mouse_mode
  spice: require spice-protocol >= 0.8.1
2012-05-08 09:36:37 -05:00
Anthony Liguori 4b5463bfdf Merge remote-tracking branch 'sweil/fixes' into staging
* sweil/fixes:
  qemu-timer: Fix limits for w32 mmtimer
  qom: Fix memory leak in function container_get
  hw/pc_sysfw: Fix memory leak
  qdev: Fix memory leak in function set_pci_devfn
  arm-semi: Rename SYS_XXX macros to TARGET_SYS_XXX (fixes compiler warning)
  target-mips: Remove unused inline function
2012-05-08 09:36:18 -05:00
Avi Kivity bdc62e62ea rtl8139: fix regression in TxStatus/TxAddr read
Commit afe0a59535 added byte reads for TxStatus/TxAddr, but
broke 32-bit reads; the mask generation

   (1 << (8 * size)) - 1

is unspecified in C for size >= sizeof(int), and in fact returns 0
on x86.

Fix by using a larger type.

Fixes (at least) Fedora 9 i386 with -machine kernel_irqchip=on.  I
didn't see it with the qemu APIC implementation; may be due to timing
or (more likely) a tester error.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2012-05-08 17:09:53 +03:00
Hervé Poussineau 21fcf36095 fdc: simplify media change handling
This also (partly) fixes IBM OS/2 Warp 4.0 floppy installation, where
not all floppies have the same format (2x80x18 for the first ones,
2x80x23 for the next ones).

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-05-07 19:33:18 +02:00
Hans de Goede 847c25d01c hw/ac97: Mask out the EAPD bit on Powerdown Ctrl/Stat writes
The Linux AC97 driver tests this bit to decide wether or not to show
an External amplifier toggle control.

This patch was also tested with a Windows XP guest without any issues.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2012-05-07 16:31:40 +04:00
Hans de Goede 7873bfb866 hw/ac97: Mask out unused bits of volume controls
The Linux ac97 drivers does a number of register read/write tests to
see how much resolution a volume control actually has.

This patch takes this into account by masking out any bits written to
a volume control reg which should not be there according to the spec.

After this the Linux ac97 driver correctly uses a range of 0 - 0x1f for
the PCM out volume, as stated in the spec, and we can fix the FIXME
in update_combined_volume_out().

This patch was also tested with a Windows XP guest without any issues.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2012-05-07 16:31:40 +04:00
Hans de Goede f94e9b9b35 hw/ac97: Use AC97_Record_Gain_Mute not AC97_Line_In_Volume_Mute
After commit 19677a380a70348134ed7650b294522617eb03fc:
"hw/ac97: add support for volume control"

We are (correctly) using AC97_Record_Gain_Mute and not AC97_Line_In_Volume_Mute
for recording volume, but various places in hw/ac97 were still assumimg that
we are using AC97_Line_In_Volume_Mute for record volume control, this patch
fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2012-05-07 16:31:40 +04:00
Hans de Goede d044be3714 hw/ac97: Make a bunch of mixer registers read only
The Linux ac97 driver tries to see if optional things like video input
volume control are available in 2 ways:
1) See if the mute bit is set after reset, if it is no further tests are done
2) If the mute bit is not set it does a write/read test of the mute bit

This patch changes our ac97 to conform to what the Linux driver expects, it
initializes registers for things which we don't emulate to 0 (so the mute bit
is not set) and makes them read only.

This causes Linux to now longer show the following (functionless)
controls in alsamixer:

Master Mono vol + mute
3d Control toggle
PCM out pre / post 3d select
Surround toggle
CD vol + mute
Mic vol + mute
Mic boost toggle
Mic mic1 / mic2 select
Video vol + mute
Phone vol + mute
Beep mono vol + mute
Aux vol + mute
Mono "output mic" / "mix" select
Sigmatel 4 speaker stereo toggle
Sigmatel ADC 6Db att toggle
Sigmatel DAC 6Db att toggle

This patch was also tested with a Windows XP guest and there it also makes
a number of functionless mixer controls go away.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2012-05-07 16:31:40 +04:00
Hans de Goede a4e652ebc0 hw/ac97: Fix log message in mixer_load
Fix a small copy and paste error in logging.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2012-05-07 16:31:39 +04:00
Stefan Weil 68bd348ade scsi: Add assertion for use-after-free errors
The QEMU emulation which is currently used with Raspberry PI images
(qemu-system-arm -M versatilepb ...) accesses memory which was freed.

Valgrind output (extract):

==17857== Invalid write of size 4
==17857==    at 0x24EB06: scsi_req_unref (scsi-bus.c:1273)
==17857==    by 0x24FFAE: scsi_read_complete (scsi-disk.c:277)
==17857==    by 0x152ACC: bdrv_co_em_bh (block.c:3363)
==17857==    by 0x13D49C: qemu_bh_poll (async.c:71)
==17857==    by 0x211A8C: main_loop_wait (main-loop.c:503)
==17857==    by 0x207954: main_loop (vl.c:1555)
==17857==    by 0x20E9C9: main (vl.c:3653)
==17857==  Address 0x1c54383c is 12 bytes inside a block of size 260 free'd
==17857==    at 0x4824B3A: free (vg_replace_malloc.c:366)
==17857==    by 0x20ADFA: free_and_trace (vl.c:2250)
==17857==    by 0x4899FC5: g_free (in /lib/libglib-2.0.so.0.2400.1)
==17857==    by 0x24EB3B: scsi_req_unref (scsi-bus.c:1277)
==17857==    by 0x24F003: scsi_req_complete (scsi-bus.c:1383)
==17857==    by 0x25022A: scsi_read_data (scsi-disk.c:334)
==17857==    by 0x24EB9F: scsi_req_continue (scsi-bus.c:1289)
==17857==    by 0x1C7787: lsi_do_dma (lsi53c895a.c:575)
==17857==    by 0x1C8CDA: lsi_execute_script (lsi53c895a.c:1147)
==17857==    by 0x1C74EA: lsi_resume_script (lsi53c895a.c:510)
==17857==    by 0x1C7ECD: lsi_transfer_data (lsi53c895a.c:746)
==17857==    by 0x24EC90: scsi_req_data (scsi-bus.c:1307)

(There are some more similar messages.)

This patch adds an assertion which also detects those errors:

Calling scsi_req_unref is not allowed when the previous call
of that function has decremented refcount to 0, because in this
case req was freed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:44:21 +02:00
Paolo Bonzini 2a92fbff49 scsi: remove useless debug messages
Optional inquiry information is declared obsolete in the latest versions
of the standard; invalid CDBs or unsupported VPD pages are supported
can be diagnosed with trace_scsi_inquiry.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:44:21 +02:00
Paolo Bonzini 77e4743c94 scsi: set VALID bit to 0 in fixed format sense data
The INFORMATION field (bytes 3..6) is never set by QEMU, so the VALID
bit must be 0.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:44:21 +02:00
Paolo Bonzini e5f38ff6f5 scsi: do not require a minimum allocation length for REQUEST SENSE
The requirements on the REQUEST SENSE buffer size are not in my copy of SPC
(SPC-4 r27) and not observed by LIO.  Rip them out.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:44:21 +02:00
Paolo Bonzini 3c3d8a95ca scsi: do not require a minimum allocation length for INQUIRY
The requirements on the INQUIRY buffer size are not in my copy of SPC
(SPC-4 r27) and not observed by LIO.  Rip them out.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:44:21 +02:00
Paolo Bonzini 065c25996b scsi: parse 16-byte tape CDBs
The transfer length for these commands is different from the transfer
length of the corresponding disk commands, so parse it specially.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:44:21 +02:00
Paolo Bonzini f62d059460 scsi: do not report bogus overruns for commands in the 0x00-0x1F range
Interpreting cdb[4] == 0 as a request to transfer 256 blocks is only
needed for READ_6 and WRITE_6.  No other command in that range needs
that special-casing, and the resulting overrun breaks scsi-testsuite's
attempt to use command 2 as a known-invalid command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:44:20 +02:00
Paolo Bonzini da8365dbab scsi-disk: add dpofua property
Linux expects REQ_FUA to be advertised only if WRITE+FUA is faster than
WRITE+SYNCHRONIZE CACHE, so we should not set the DPOFUA bit.  However,
it is useful to have it for testing purposes, so add a qdev property to
set it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:44:19 +02:00
Paolo Bonzini bfe3d7ac6d scsi: change "removable" field to host many features
It is pointless to add a uint32_t field for every new feature.
Since we will need a new feature soon, convert accesses to "removable"
to look at bit 0 only.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-07 08:43:58 +02:00
Ronnie Sahlberg 381b634c27 scsi: Specify the xfer direction for UNMAP and ATA_PASSTHROUGH commands
scsi_cmd_xfer_mode() is used to specify the xfer direction for SCSI
commands that come in from the guest.  If the direction is set incorrectly
this will eventually cause QEMU to kernel-panic the guest.

Add UNMAP and ATAPASSTHROUGH as commands that send data to the device.

Without this change, recent kernels will send both UNMAP as well
as ATAPASSTHROUGH commands to any /dev/sg* device, which due to the
incorrect xfer direction very quickly causes the guest kernel to crash.

Example causing a crash without the patch applied:

./x86_64-softmmu/qemu-system-x86_64 -m 1024 -enable-kvm -cdrom linuxmint-12-gnome-dvd-64bit.iso -drive file=/dev/sg4,if=scsi,bus=0,unit=6

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-04 10:39:52 +02:00
Paolo Bonzini a5ee908562 scsi: fix WRITE SAME transfer length and direction
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-04 10:39:52 +02:00
Paolo Bonzini 31e8fd86f2 scsi: fix refcounting for reads
Recently introduced FUA support also gave us a use-after-free
of the BlockAcctCookie within a SCSIDiskReq, due to unbalanced
reference counting.

The patch fixes this by making scsi_do_read look like a combination
of scsi_*_complete + scsi_*_data.  It does both a ref (like
scsi_read_data) and an unref (like scsi_flush_complete).

Reported-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-04 10:39:52 +02:00
Paolo Bonzini 12a08998fe scsi: prevent data transfer overflow
Avoid sending more than 2GB of data, as that can cause overflows
in int32_t variables.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-05-04 10:39:51 +02:00
Alon Levy ddf9f4b707 qxl: don't assert on guest create_guest_primary
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy 4763e2cadd qxl: ioport_write: remove guest trigerrable abort
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy e954ea2873 qxl: qxl_add_memslot: remove guest trigerrable panics
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy baeae407e6 qxl: interface_notify_update: remove guest trigerrable abort
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy 75fe0d7bf8 qxl: cleanup s/__FUNCTION__/__func__/
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy 0b81c478cf qxl: don't abort on guest trigerrable ring indices mismatch
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy 2fce7edf46 qxl: fix > 80 chars line
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy 47eddfbfe0 qxl: replace panic with guest bug in qxl_track_command
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy fae2afb10e qxl: check for NULL return from qxl_phys2virt
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Alon Levy 4b635c59b0 hw/qxl.c: qxl_phys2virt: replace panics with guest_bug
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-05-03 10:45:04 +02:00
Stefan Weil 9cf1f002d7 hw/pc_sysfw: Fix memory leak
Valgrind reported this memory leak which occured a few times.

Test scenario:

qemu-system-i386 (no arguments), only BIOS started, terminate with
monitor command (quit).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
2012-05-03 07:04:48 +02:00
Stefan Weil 5c878008dd qdev: Fix memory leak in function set_pci_devfn
Valgrind reported this memory leak which occured very often.

Test scenario:

qemu-system-i386 (no arguments), only BIOS started, terminate with
monitor command (quit).

v2:
Use error_free instead of g_free (hint from Andreas Färber, thanks).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Andreas Färber <afaerber@suse.de>
2012-05-03 07:04:48 +02:00
Alexander Graf d5b406d95b ATA: Allow WIN_SECURITY_FREEZE_LOCK as nop
When using Windows 8 with an AHCI disk drive, it issues a blue screen.
The reason is that WIN_SECURITY_FREEZE_LOCK / CFA_WEAR_LEVEL is not
supported by our ATA implementation, but Windows expects it to be there.

Since without security stuff implemented, the lock would be a nop anyway
and CFA_WEAR_LEVEL already is treated as a nop, let's just allow the cmd
for HD drives as well. That way Windows is happy.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-05-02 18:47:08 +02:00
Anthony Liguori 174210fe70 Merge remote-tracking branch 'agraf/s390-for-upstream' into staging
* agraf/s390-for-upstream:
  s390: reset avail and used index on reboot
  S390: dont call system_shutdown on disabled wait
  S390: remove default cdrom, sd-card and floppy support
  S390: support reboot for kvm on s390
  S390: reboot: reset device pages on reboot
  S390: fix error handling on kernel and initrd failures
  S390: fix kernel_commandline handling
2012-05-01 18:46:39 -05:00
Stefan Weil 5f2c23e61a ppce500_spin: Replace assert by hw_error (fixes compiler warning)
The default case in function spin_read should never be reached,
therefore the old code used assert(0) to abort QEMU.

This does not work when QEMU is compiled with macro NDEBUG defined.
In this case (and also when the compiler does not know that assert
never returns), there is a compiler warning because of the missing
return value.

Using hw_error allows an improved error message and aborts always.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
[agraf: use __func__]
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:47:01 +02:00
Peter Portante 73f7821bac pseries: Fix use of global CPU state
Commit ed120055c7 (Implement PAPR VPA
functions for pSeries shared processor partitions) introduced the
deregister_dtl() function and typo "emv" as name of its argument.
This went unnoticed because the code in that function can access the
global variable "env" so that no build failure resulted.

Fix the argument to read "env". Resolves LP#986241.

Signed-off-by: Peter Portante <peter.portante@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
[agraf: fixed typo in commit message]
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:47:00 +02:00
David Gibson 7fb0bd3473 pseries: Use the same interrupt swizzling for host bridges as p2p bridges
Currently the pseries PCI code uses a somewhat strange scheme of PCI irq
allocation - one per slot up to a maximum that's greater than the usual 4.
This scheme more or less worked, because we were able to tell the guest the
irq mapping in the device tree, however it's a bit odd and may break
assumptions in the future.  Worse, the array used to construct the dev
tree interrupt map was mis-sized, we got away with it only because it
happened that our SPAPR_PCI_NUM_LSI value was greater than 7.

This patch changes the pseries PCI code to use the same interrupt swizzling
scheme as is standardized for PCI to PCI bridges.  This makes for better
consistency, deals better with any devices which use multiple interrupt
pins and will make life easier in the future when we add passthrough of
what may be either a host bridge or a PCI to PCI bridge.  This won't break
existing guests, because they don't assume a particular mapping scheme for
host bridges, but just follow what we tell them in the device tree (also
updated to match, of course).  This patch also fixes the allocation of the
irq map.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:47:00 +02:00
David Gibson d601fac478 pseries: Implement automatic PAPR VIO address allocation
PAPR virtual IO (VIO) devices require a unique, but otherwise arbitrary,
"address" used as a token to the hypercalls which manipulate them.

Currently the pseries machine code does an ok job of allocating these
addresses when the legacy -net nic / -serial and so forth options are used
but will fail to allocate them properly when using -device.

Specifically, you can use -device if all addresses are explicitly assigned.
Without explicit assignment, only one VIO device of each type (network,
console, SCSI) will be assigned properly, any further ones will attempt
to take the same address leading to a fatal error.

This patch fixes the situation by adding a proper address allocator to the
VIO "bus" code.  This is used both by -device and the legacy options and
default devices.  Addresses can still be explicitly assigned with -device
options if desired.

This patch changes the (guest visible) numbering of VIO devices, but since
their addresses are discovered using the device tree and already differ
from the numbering found on existing PowerVM systems, this does not break
compatibility.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:47:00 +02:00
Bharat Bhushan 58f90f21f4 booke:Use MMU API for creating initial mapping for secondary cpus
Initial Mapping creation for secondary CPU in SMP was missing new MMU API.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:47:00 +02:00
Jens Freimann 4170aea1a7 s390: reset avail and used index on reboot
reset the guest vring avail/used idx fields, otherwise it's possible
that old values remain in memory which would cause a reboot to fail
with a "Guest moved used index" message

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:04:06 +02:00
Einar Lueck ad0bbc5600 S390: remove default cdrom, sd-card and floppy support
This patch simply disables CDROM, SD card and floppy support for the
s390 virtio machine. Without this patch, a default CDROM drive would
get added which has currently no backing on s390.

Signed-off-by: Einar Lueck <elelueck@de.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:04:06 +02:00
Jens Freimann eb3caa44b0 S390: reboot: reset device pages on reboot
This patch fixes reboot on s390 by resetting the device
page on reboot.

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:04:06 +02:00
Christian Borntraeger 118a897743 S390: fix error handling on kernel and initrd failures
If the user specifies a non-existing or non-accessable kernel or initrd
qemu does not fail, instead it ipls into the system, which then falls
into a program check loop due to the zeroed memory with no kernel.
Lets add some sanity checks.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:04:06 +02:00
Christian Borntraeger cc3c7384ac S390: fix kernel_commandline handling
The current handling of kernel parameters is broken. The pointer
is always valid, even if no -kernel or -append is specified.
We must check if the kernel rom address is valid instead,
otherwise qemu might segfault.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-05-01 21:04:06 +02:00
Stefan Weil 1b296044b6 vga: Don't switch to 1 x 1 character text screen
Initially, vga_get_text_resolution returns a text resolution of 1 x 1
(vga register values are 0).

This is visible during MIPS Malta boot with SDL. It also occurs with the
i386 or x86_64 system emulation when it runs in single step mode:

QEMU changes the size of the SDL window to the smallest possible value
which is supported by the window manager. As this is not the calculated
size, QEMU switches to scaled mode. When the BIOS or the VGA driver sets
the normal text resolution, the window stays small and displays
microscopic characters.

Ignoring text resolutions of 1 x 1 or less avoids these problems.
A similar workaround already exists for too large resolutions.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-05-01 10:45:43 +00:00
Hervé Poussineau 6c84ce0dc7 prep: Move int-ack register from PReP to Raven PCI emulation
Register is one byte-wide (as per specification), so there is no need
to specify endianness.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
[AF: Limit access validity to size 1]
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
2012-04-30 17:15:59 +02:00
Hervé Poussineau 9357b1449a prep: Initialize PC speaker
Speaker init has been added in 506b7ddf88,
but audio subsystem init was missing.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
2012-04-28 21:15:53 +02:00
Hervé Poussineau a527b5452e isa: Add isa_bus_from_device() method
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
2012-04-28 20:51:54 +02:00