Commit Graph

23122 Commits

Author SHA1 Message Date
Evgeny Voevodin 8232a46a16 tcg/tcg.h: Duplicate global TCG variables in TCGContext
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-17 13:53:26 +00:00
Evgeny Voevodin 7b5eff4daa target-cris/translate.c: Code style clean-up
Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-11-17 13:53:24 +00:00
Anthony Liguori 9cb535fe4e rng-egd: don't use gslist_free_full
This function was only introduced in glib 2.28.0.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-16 13:09:34 -06:00
Anthony Liguori 500054f161 virtio-rng-pci: create a default backend if none exists
This allows you to specify:

  $ qemu -device virtio-rng-pci

And things will Just Work with a reasonable default.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-16 08:36:14 -06:00
Anthony Liguori 904d6f5880 virtio-rng: add rate limiting support
This adds parameters to virtio-rng-pci to allow rate limiting the entropy a
guest receives.  An example command line:

$ qemu -device virtio-rng-pci,max-bytes=1024,period=1000

Would limit entropy collection to 1Kb/s.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-16 08:36:13 -06:00
Amit Shah 16c915ba42 virtio-rng: hardware random number generator device
The Linux kernel already has a virtio-rng driver, this is the device
implementation.

When the guest asks for entropy from the virtio hwrng, it puts a buffer
in the vq.  We then put entropy into that buffer, and push it back to
the guest.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
aliguori: converted to new RngBackend interface
aliguori: remove entropy needed event
aliguori: fix migration
2012-11-16 08:36:13 -06:00
Anthony Liguori 1da2738f55 rng-egd: introduce EGD compliant RNG backend
This backend talks EGD to a CharDriverState.  A typical way to invoke this would
be:

qemu -chardev socket,host=localhost,port=1024,id=chr0 \
     -object rng-egd,chardev=chr0,id=egd0 \
     -device virtio-rng-pci,rng=egd0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-16 08:36:13 -06:00
Anthony Liguori 5c74521d24 rng-random: add an RNG backend that uses /dev/random (v3)
The filename can be overridden but it expects a non-blocking source of entropy.
A typical invocation would be:

qemu -object rng-random,id=rng0 -device virtio-rng-pci,rng=rng0

This can also be used with /dev/urandom by using the command line:

qemu -object rng-random,filename=/dev/urandom,id=rng0 \
     -device virtio-rng-pci,rng=rng0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - merged header split patch into this one
v2 -> v3
 - bug fix in rng-random (Paolo)
2012-11-16 08:36:13 -06:00
Anthony Liguori a9b7b2ad7b rng: add RndBackend abstract object class
This is the backend used by devices that need to request entropy.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-16 08:36:12 -06:00
Anthony Liguori 0e5588438d object: add object_property_add_bool (v2)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - Fix whitespace (Andreas Faerber)
2012-11-16 08:36:12 -06:00
Anthony Liguori 68d98d3e42 vl: add -object option to create QOM objects from the command line
This will create a new QOM object in the '/objects' path.  Note that properties
are set in order which allows for simple objects to be initialized entirely
with this option and then realized.

This option is roughly equivalent to -device but for things that are not
devices.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-16 08:36:12 -06:00
陳韋任 (Wei-Ren Chen) 6801038bc5 target-mips: fix wrong microMIPS opcode encoding
While reading microMIPS decoding, I found a possible wrong opcode
encoding. According to [1] page 166, the bits 13..12 for MULTU is
0x01 rather than 0x00. Please review, thanks.

[1] MIPS Architecture for Programmers VolumeIV-e: The MIPS DSP
    Application-Specific Extension to the microMIPS32 Architecture

Signed-off-by: Chen Wei-Ren <chenwj@iis.sinica.edu.tw>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-11-15 14:48:16 +01:00
Aurelien Jarno 68d001928b mips/malta: fix CBUS UART interrupt pin
According to the MIPS Malta Developement Platform User's Manual, the
i8259 interrupt controller is supposed to be connected to the hardware
IRQ0, and the CBUS UART to the hardware interrupt 2.

In QEMU they are both connected to hardware interrupt 0, the CBUS UART
interrupt being wrong. This patch fixes that. It should be noted that
the irq array in QEMU includes the software interrupts, hence
env->irq[2] is the first hardware interrupt.

Cc: Ralf Baechle <ralf@linux-mips.org>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-11-15 14:37:55 +01:00
Anthony Liguori ce34cf72fe vfio-pci: KVM INTx accel & common msi_get_message
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1.4.12 (GNU/Linux)
 
 iQIcBAABAgAGBQJQoqBtAAoJECObm247sIsidvMP/RCO4cyEAhCKjjjx6ujcwe1t
 PgBtqmcmlbyPgZvJ0cBdAx9EjU2cD48um9FuR+/oa1IXgORM3/2H7jS/HdxsL+wE
 jUEQqbT3U+f9VyAKuldMxk8Ojz8VBFZHxTVGwZAzQLjSehOZhcJ8SOd0wHcZUIQ/
 8ZxDRvrs2YO4+D0nYL/SKrfejHUoZW3uX86bW8XKBQaM6rAauAFZ96csQiquAQP4
 1q+QkYOXGf9WhIGUG3dD/UTkCUgFWLyZXtQISitTRs9Kfpq4ZXbvJ4Vl8+GmuVn+
 mH45Zg5RrFrRwiXRT/K0PUgNbwndp79Byr/q3VvhC2oM1xjdCChm3AQLr1cLkp3I
 C2ra0DhgrR6Ifo4g0m1dOZmGQoNn0fjzqhrSjp5m+dWnt5KpZ+QQs9UHNlnXwmVw
 iuxxbiwkUp58OihFkD8oGMLb08O+VpD+Avwn8/bMeO7l1onBKhIZc7wdsnwno9NY
 NVtlaF+GQm8P4sNA1WK8XHr3Hnm7FuZnluP/kFhr7vh7uiFSYtNdDb+8jtGBoeoN
 ngf9OLn5i9GJv1GHOTeam9nihb0KkihrjnFc1220W9XoWo6UZgi8iUz4ibpopPFP
 gxooE/nKA1dLcaFoOXq0RbirWSH8siqmnv+miZ9LaLCqhmfVWZFbbQDIdHSj6dl2
 /Q/vqEZwWlo+7As6UOCi
 =jze5
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0' into staging

vfio-pci: KVM INTx accel & common msi_get_message

* awilliam/tags/vfio-pci-for-qemu-1.3.0-rc0:
  vfio-pci: Use common msi_get_message
  vfio-pci: Add KVM INTx acceleration
  linux-headers: Update to 3.7-rc5

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14 08:53:40 -06:00
Anthony Liguori 662d263f28 Merge remote-tracking branch 'kraxel/pixman.v5' into staging
* kraxel/pixman.v5:
  pixman: cleanup properly on make distclean
  pixman: add licensing info
  pixman: build internal version early
  pixman: pass cflags, add -fPIC
  pixman: disable gtk
  pixman: set --host for cross builds
  pixman: add output dir to include path

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14 08:53:03 -06:00
Anthony Liguori de148eb79c Merge remote-tracking branch 'bonzini/nbd-next' into staging
* bonzini/nbd-next:
  nbd: fixes to read-only handling
  hmp: add NBD server commands
  nbd: disallow nbd-server-add before nbd-server-start
  nbd: force read-only export for read-only devices
  nbd: fix nbd_server_stop crash when no server was running
  nbd: accept URIs
  nbd: accept relative path to Unix socket
  qemu-nbd: initialize main loop before block layer

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14 08:51:06 -06:00
Anthony Liguori 5f580e9411 Merge remote-tracking branch 'bonzini/scsi-next' into staging
* bonzini/scsi-next:
  virtio-scsi: use dma_context_memory
  dma: Define dma_context_memory and use in sysbus-ohci
  megasas: Correct target/lun mapping
  scsi-disk: flush cache after disabling it
  megasas: do not include block_int.h
  scsi: remove superfluous call to scsi_device_set_ua
  virtio-scsi: factor checks for VIRTIO_SCSI_S_DRIVER_OK when reporting events
  scsi: do not return short responses for emulated commands

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14 08:50:45 -06:00
Anthony Liguori ce5e5b522e Merge remote-tracking branch 'kraxel/usb.70' into staging
* kraxel/usb.70:
  ehci: fix migration
  xhci: Fix some DMA host endian bugs
  usb/combined-packet: Move freeing of combined to usb_combined_packet_remove()
  xhci: Add support for packets with both data and an error status
  ehci: Add support for packets with both data and an error status
  ehci: Get rid of the magical PROC_ERR status
  usb-redir: Allow packets to have both data and an error-status
  usb: split packet result into actual_length + status

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14 08:50:18 -06:00
Anthony Liguori bf0dfb69f8 Merge remote-tracking branch 'spice/spice.v63' into staging
* spice/spice.v63:
  spice: fix initialization order
  pflib: unused, remove it.
  spice: switch to pixman
  qxl: call dpy_gfx_resize when entering vga mode
  qxl: fix cursor reset
  hw/qxl: qxl_send_events: nop if stopped
  hw/qxl: guest bug on primary create with stride %4 != 0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-11-14 08:49:54 -06:00
Gerd Hoffmann feb33ea728 pixman: cleanup properly on make distclean
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-14 13:46:08 +01:00
Gerd Hoffmann daa8e5a077 pixman: add licensing info
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-14 13:29:25 +01:00
Gerd Hoffmann b776eca138 pixman: build internal version early
Signed-off-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-14 13:29:12 +01:00
Gerd Hoffmann c28fa5a0b3 pixman: pass cflags, add -fPIC
Pass on CFLAGS to the pixman configure script.
Add -fPIC to the cflags, needed to make the final link succeed.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-14 13:28:40 +01:00
Gerd Hoffmann 4d5bdd0b46 pixman: disable gtk
gtk is only needed to build test cases.
Disable it to simplify the build.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-14 13:28:34 +01:00
Gerd Hoffmann 42da6041d5 pixman: set --host for cross builds
Set --host when calling pixman configure while doing cross builds so
pixman's autoconf picks up the cross build tools correctly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-14 12:59:04 +01:00
Gerd Hoffmann 5ca9388a4d pixman: add output dir to include path
Needed to make sure the (generated) pixman-version.h file is found.
Based on a patch from Blue Swirl.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2012-11-14 12:39:18 +01:00
Alex Williamson a771c51703 vfio-pci: Use common msi_get_message
We can get rid of our local version now that a helper exists.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2012-11-13 12:27:40 -07:00
Alex Williamson e1d1e5867d vfio-pci: Add KVM INTx acceleration
This makes use of the new level irqfd support enabling bypass of qemu
userspace both on INTx injection and unmask.  This significantly
boosts the performance of devices making use of legacy interrupts (ex.
~60% better netperf TCP_RR scores for an e1000e assigned to a Linux
guest and booted with pci=nomsi).  This also avoids flipping mmaps on
and off to simulate EOIs, so greatly improves performance of device
access in addition to interrupt latency.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2012-11-13 12:27:40 -07:00
Alex Williamson 716b8e4dd2 linux-headers: Update to 3.7-rc5
update-linux-headers.sh script run against Linux tag v3.7-rc5

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
2012-11-13 12:27:40 -07:00
Paolo Bonzini c8969eded2 nbd: fixes to read-only handling
We do not need BLKROSET if the kernel supports setting flags.
Also, always do BLKROSET even for a read-write export, otherwise
the read-only state remains "sticky" after the invocation of
"qemu-nbd -r".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-13 10:34:50 +01:00
Paolo Bonzini f5022a135e aio: fix aio_ctx_prepare with idle bottom halves
Commit ed2aec4867f0d5f5de496bb765347b5d0cfe113d changed the return
value of aio_ctx_prepare from false to true when only idle bottom
halves are available.  This broke PC old-style DMA, which uses them.
Fix this by making aio_ctx_prepare return true only when non-idle
bottom halves are scheduled to run.

Reported-by: malc <av1474@comtv.ru>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
2012-11-12 20:02:09 +04:00
Paolo Bonzini dd72fdd062 virtio-scsi: use dma_context_memory
Until address_space_rw was introduced, NULL was accepted as a
placeholder for DMA with no IOMMU (to address_space_memory).

This does not work anymore, and dma_context_memory needs to
be specified explicitly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 16:44:57 +01:00
Peter Maydell 9e11908f12 dma: Define dma_context_memory and use in sysbus-ohci
Define a new global dma_context_memory which is a DMAContext corresponding
to the global address_space_memory AddressSpace. This can be used by
sysbus peripherals like sysbus-ohci which need to do DMA.

In particular, use it in the sysbus-ohci device, which fixes a
segfault when attempting to use that device.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
2012-11-12 16:44:57 +01:00
Hannes Reinecke 4003e24fce megasas: Correct target/lun mapping
The structure to reference a logical drive has an unused field,
which can be used to carry the lun ID. This enabled seabios to
establish the proper target/LUN mapping.

Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 16:42:56 +01:00
Paolo Bonzini accfeb2dd3 scsi-disk: flush cache after disabling it
SBC says that "if an application client changes the WCE bit from one to
zero via a MODE SELECT command, then the device server shall write
any data in volatile cache to non-volatile medium before completing
the command".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 15:00:27 +01:00
Paolo Bonzini 346a3017ec megasas: do not include block_int.h
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 15:00:27 +01:00
Paolo Bonzini b5232e904f scsi: remove superfluous call to scsi_device_set_ua
Suggested by Laszlo Ersek.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 15:00:27 +01:00
Paolo Bonzini cd41a671b3 virtio-scsi: factor checks for VIRTIO_SCSI_S_DRIVER_OK when reporting events
Suggested by Laszlo Ersek.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 15:00:27 +01:00
Paolo Bonzini c8dcb531bc scsi: do not return short responses for emulated commands
The inquiry command, for the case of VPD=1, was returning short
responses; the number of returned bytes was just the number of bytes
in the request, without padding to the specified allocation length
with zero bytes.  This is usually harmless, but it is a violation
of the SCSI specification.

To fix this, always pad with zero bytes to r->cmd.xfer in
scsi_disk_emulate_command, and return at most r->buflen bytes
(the size of the buffer for command data) rather than at most
buflen bytes (the number of bytes that was filled in).

Before this patch, "strace sg_inq -p0x83 /dev/sda" would report a
non-zero resid value.  After this patch, it reports resid=0.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 15:00:27 +01:00
Paolo Bonzini 4057725f35 hmp: add NBD server commands
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 14:38:29 +01:00
Paolo Bonzini 17b6be4a7f nbd: disallow nbd-server-add before nbd-server-start
It works nicely with the QMP commands, but it adds useless complication
with HMP.  In particular, see the following:

    (qemu) nbd_server_add -w scsi0-hd0
    (qemu) nbd_server_start -a localhost:10809
    NBD server already exporting device scsi0-hd0

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 14:38:29 +01:00
Paolo Bonzini e644473445 nbd: force read-only export for read-only devices
This is the desired behavior for HMP, but it is a better choice for QMP as well.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 14:38:29 +01:00
Paolo Bonzini fc6467eaf2 nbd: fix nbd_server_stop crash when no server was running
This failed on the new assertion of qemu_set_fd_handler2:

qemu-system-x86_64: /home/pbonzini/work/upstream/qemu/iohandler.c:60: qemu_set_fd_handler2: Assertion `fd >= 0' failed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 14:38:29 +01:00
Paolo Bonzini 1d7d2a9d21 nbd: accept URIs
The URI syntax is consistent with the Gluster syntax.  Export names
are specified in the path, preceded by one or more (otherwise unused)
slashes.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 14:38:28 +01:00
Paolo Bonzini d04b0bbbc9 nbd: accept relative path to Unix socket
Adding the "is_unix" member now will simplify the parsing of NBD URIs.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 11:33:29 +01:00
Paolo Bonzini 7e7f4a0efc qemu-nbd: initialize main loop before block layer
qemu-nbd was broken because they initialized the block layer while
qemu_aio_context was still NULL.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2012-11-12 11:33:29 +01:00
Kirill Batuzov 3c5645fab3 tcg: properly check that op's output needs to be synced to memory
Fix typo introduced in b3a1be87ba.

Reported-by: Ruslan Savchenko <ruslan.savchenko@gmail.com>
Signed-off-by: Kirill Batuzov <batuzovk@ispras.ru>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2012-11-11 16:06:46 +01:00
Eric Johnson 7c2c3ea3fd target-mips: Fix seg fault for LUI when MIPS_DEBUG_DISAS==1.
The call to gen_logic_imm for OPC_LUI passes -1 for rs.  This
causes the MIPS_DEBUG statement to seg fault due to the deference
of regnames[rs].  This patch fixes that.

Signed-off-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
(aurel32: replaced static string formating by a static string)
2012-11-11 16:05:25 +01:00
Blue Swirl 0af10c86ed target-i386: avoid using cpu_single_env
Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
2012-11-10 13:49:21 +00:00
Blue Swirl 0c4fabea80 target-xtensa: avoid using cpu_single_env
Pass around CPUArchState instead of using global cpu_single_env.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
2012-11-10 13:49:20 +00:00