]> git.proxmox.com Git - qemu.git/log
qemu.git
10 years agoexec: Allow unaligned address_space_rw
Jan Kiszka [Sun, 26 May 2013 19:42:40 +0000 (21:42 +0200)]
exec: Allow unaligned address_space_rw

This will be needed for some corner cases with para-virtual I/O ports.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: move private types to exec.c
Paolo Bonzini [Tue, 21 May 2013 10:07:21 +0000 (12:07 +0200)]
memory: move private types to exec.c

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agomemory: Introduce address_space_lookup_region
Jan Kiszka [Mon, 6 May 2013 14:48:02 +0000 (16:48 +0200)]
memory: Introduce address_space_lookup_region

This introduces a wrapper for phys_page_find (before we complicate
address_space_translate with IOMMU translation).  This function will
also encapsulate locking and reference counting when we introduce
BQL-free dispatching.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoexec.c: address_space_translate: handle access to addr 0 of 2^64 sized region
Peter Maydell [Thu, 20 Jun 2013 14:18:04 +0000 (15:18 +0100)]
exec.c: address_space_translate: handle access to addr 0 of 2^64 sized region

The memory API allows a MemoryRegion's size to be 2^64, as a special
case (otherwise the size always fits in a 64 bit integer). This meant
that attempts to access address zero in a 2^64 sized region would
assert in address_space_translate():

  #3  0x00007ffff3e4d192 in __GI___assert_fail#(assertion=0x555555a43f32
    "!a.hi", file=0x555555a43ef0 "include/qemu/int128.h", line=18,
    function=0x555555a4439f "int128_get64") at assert.c:103
  #4  0x0000555555877642 in int128_get64 (a=...)
    at include/qemu/int128.h:18
  #5  0x00005555558782f2 in address_space_translate (as=0x55555668d140,
   /addr=0, xlat=0x7fffafac9918, plen=0x7fffafac9920, is_write=false)
    at exec.c:221

Fix this by doing the 'min' operation in 128 bit arithmetic
rather than 64 bit arithmetic (we know the result of the 'min'
definitely fits in 64 bits because one of the inputs did).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agodoc: Drop ref to Bochs from -no-fd-bootchk documentation
Markus Armbruster [Fri, 14 Jun 2013 11:15:06 +0000 (13:15 +0200)]
doc: Drop ref to Bochs from -no-fd-bootchk documentation

Manual page and qemu-doc on talk about "Bochs BIOS".  We use SeaBIOS,
and it implements the feature.  Replace by just "BIOS", and drop the
TODO line wondering about the Bochs reference.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1371208516-7857-7-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agopc: Make -no-fd-bootchk stick across boot order changes
Markus Armbruster [Fri, 14 Jun 2013 11:15:05 +0000 (13:15 +0200)]
pc: Make -no-fd-bootchk stick across boot order changes

Option -no-fd-bootchk asks the BIOS to attempt booting from a floppy
even when the boot sector signature isn't there, by setting a bit in
RTC CMOS.  It was added back in 2006 (commit 52ca8d6a).

Two years later, commit 0ecdffbb added monitor command boot_set.
Implemented by new function pc_boot_set().  It unconditionally clears
the floppy signature bit in CMOS.

Commit e0f084bf added -boot option once to automatically change the
boot order on first reset.  Reuses pc_boot_set(), thus also clears the
floppy signature bit.  Commit d9346e81 took care to preserve this
behavior.

Thus, -no-fd-bootchk applies to any number of boots.  Except it
applies just to the first boot with -boot once, and never after
boot_set.  Weird.  Make it stick instead: set the bit according to
-no-fd-bootchk in pc_boot_set().

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1371208516-7857-6-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agovl: Rename *boot_devices to *boot_order, for consistency
Markus Armbruster [Fri, 14 Jun 2013 11:15:04 +0000 (13:15 +0200)]
vl: Rename *boot_devices to *boot_order, for consistency

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1371208516-7857-5-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agovl: Fix -boot order and once regressions, and related bugs
Markus Armbruster [Fri, 14 Jun 2013 11:15:03 +0000 (13:15 +0200)]
vl: Fix -boot order and once regressions, and related bugs

Option "once" sets up a different boot order just for the initial
boot.  Boot order reverts back to normal on reset.  Option "order"
changes the normal boot order.

The reversal is implemented by reset handler restore_boot_devices(),
which takes the boot order to revert to as argument.
restore_boot_devices() does nothing on its first call, because that
must be the initial machine reset.  On its second call, it changes the
boot order back, and unregisters itself.

Because we register the handler right when -boot gets parsed, we can
revert to an incorrect normal boot order, and multiple -boot can
interact in funny ways.

Here's how things work without -boot once or order:

* boot_devices is "".

* main() passes machine->boot_order to to machine->init(), because
  boot_devices is "".  machine->init() configures firmware
  accordingly.  For PC machines, machine->boot_order is "cad", and
  pc_cmos_init() writes it to RTC CMOS, where SeaBIOS picks it up.

Now consider -boot order=:

* boot_devices is "".

* -boot order= sets boot_devices to "" (no change).

* main() passes machine->boot_order to to machine->init(), because
  boot_devices is "", as above.

  Bug: -boot order= has no effect.  Broken in commit e4ada29e.

Next, consider -boot once=a:

* boot_devices is "".

* -boot once=a registers restore_boot_devices() with argument "", and
  sets boot_devices to "a".

* main() passes boot_devices "a" to machine->init(), which configures
  firmware accordingly.  For PC machines, pc_cmos_init() writes the
  boot order to RTC CMOS.

* main() calls qemu_system_reset().  This runs reset handlers.

  - restore_boot_devices() gets called with argument "".  Does
    nothing, because it's the first call.

* Machine boots, boot order is "a".

* Machine resets (e.g. monitor command).  Reset handlers run.

  - restore_boot_devices() gets called with argument "".  Calls
    qemu_boot_set("") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

    Bug: boot order reverts to "" instead of machine->boot_order.  The
    actual boot order depends on how firmware interprets "".  Broken
    in commit e4ada29e.

Next, consider -boot once=a -boot order=c:

* boot_devices is "".

* -boot once=a registers restore_boot_devices() with argument "", and
  sets boot_devices to "a".

* -boot order=c sets boot_devices to "c".

* main() passes boot_devices "c" to machine->init(), which configures
  firmware accordingly.  For PC machines, pc_cmos_init() writes the
  boot order to RTC CMOS.

* main() calls qemu_system_reset().  This runs reset handlers.

  - restore_boot_devices() gets called with argument "".  Does
    nothing, because it's the first call.

* Machine boots, boot order is "c".

  Bug: it should be "a".  I figure this has always been broken.

* Machine resets (e.g. monitor command).  Reset handlers run.

  - restore_boot_devices() gets called with argument "".  Calls
    qemu_boot_set("") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

    Bug: boot order reverts to "" instead of "c".  I figure this has
    always been broken, just differently broken before commit
    e4ada29e.

Next, consider -boot once=a -boot once=b -boot once=c:

* boot_devices is "".

* -boot once=a registers restore_boot_devices() with argument "", and
  sets boot_devices to "a".

* -boot once=b registers restore_boot_devices() with argument "a", and
  sets boot_devices to "b".

* -boot once=c registers restore_boot_devices() with argument "b", and
  sets boot_devices to "c".

* main() passes boot_devices "c" to machine->init(), which configures
  firmware accordingly.  For PC machines, pc_cmos_init() writes the
  boot order to RTC CMOS.

* main() calls qemu_system_reset().  This runs reset handlers.

  - restore_boot_devices() gets called with argument "".  Does
    nothing, because it's the first call.

  - restore_boot_devices() gets called with argument "a".  Calls
    qemu_boot_set("a") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

  - restore_boot_devices() gets called with argument "b".  Calls
    qemu_boot_set("b") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

* Machine boots, boot order is "b".

  Bug: should really be "c", because that came last, and for all other
  -boot options, the last one wins.  I figure this was broken some
  time before commit 37905d6a, and fixed there only for a single
  occurence of "once".

* Machine resets (e.g. monitor command).  Reset handlers run.

  - restore_boot_devices() gets called with argument "".  Calls
    qemu_boot_set("") to reconfigure firmware.  For PC machines,
    pc_boot_set() writes it into RTC CMOS.  Reset handler
    unregistered.

    Same bug as above: boot order reverts to "" instead of
    machine->boot_order.

Fix by acting upon -boot options order, once and menu only after
option parsing is complete, and the machine is known.  This is how the
other -boot options work already.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1371208516-7857-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoqemu-option: check_params() is now unused, drop it
Markus Armbruster [Fri, 14 Jun 2013 11:15:02 +0000 (13:15 +0200)]
qemu-option: check_params() is now unused, drop it

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1371208516-7857-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agovl: Clean up parsing of -boot option argument
Markus Armbruster [Fri, 14 Jun 2013 11:15:01 +0000 (13:15 +0200)]
vl: Clean up parsing of -boot option argument

Commit 3d3b8303 threw in some QemuOpts parsing without replacing the
existing ad hoc parser, resulting in a confusing mess.  Clean it up.

Two user-visible changes:

1. Invalid options are reported more nicely.  Before:

        qemu: unknown boot parameter 'x' in 'x=y'

   After:

        qemu-system-x86_64: -boot x=y: Invalid parameter 'x'

2. If -boot is given multiple times, options accumulate, just like for
   -machine.  Before, only options order, once and menu accumulated.
   For the other ones, all but the first -boot in non-legacy syntax
   got simply ignored.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Message-id: 1371208516-7857-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agowdt_i6300esb: fix vmstate versioning
Michael Roth [Wed, 22 May 2013 16:32:51 +0000 (11:32 -0500)]
wdt_i6300esb: fix vmstate versioning

When this VMSD was introduced it's version fields were set to
sizeof(I6300State), making them essentially random from build to build,
version to version.

To fix this, we lock in a high version id and low minimum version id to
support old->new migration from all prior versions of this device's
state. This should work since the device state has not changed since
its introduction.

The potentially breaks migration from 1.5+ to 1.5, but since the
versioning was essentially random prior to this patch, new->old
migration was not consistently functional to begin with.

Reported-by: Nicholas Thomas <nick@bytemark.co.uk>
Suggested-by: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Tue, 18 Jun 2013 15:06:47 +0000 (10:06 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

# By Paolo Bonzini (3) and others
# Via Paolo Bonzini
* bonzini/scsi-next:
  iscsi: reorganize iscsi_readcapacity_sync
  iscsi: simplify freeing of tasks
  vhost-scsi: fix k->set_guest_notifiers() NULL dereference
  scsi-disk: scsi-block device for scsi pass-through should not be removable
  scsi-generic: check the return value of bdrv_aio_ioctl in execute_command
  scsi-generic: fix sign extension of READ CAPACITY(10) data
  scsi: reset cdrom tray statuses on scsi_disk_reset

Message-id: 1371565016-2643-1-git-send-email-pbonzini@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'bonzini/nbd-next' into staging
Anthony Liguori [Tue, 18 Jun 2013 15:06:39 +0000 (10:06 -0500)]
Merge remote-tracking branch 'bonzini/nbd-next' into staging

# By Ján Tomko
# Via Paolo Bonzini
* bonzini/nbd-next:
  nbd: strip braces from literal IPv6 address in URI
  qemu-socket: allow hostnames starting with a digit

10 years agovirtio-rng: Fix crash with non-default backend
Cole Robinson [Fri, 31 May 2013 18:12:48 +0000 (14:12 -0400)]
virtio-rng: Fix crash with non-default backend

'default_backend' isn't always set, but 'rng' is, so use that.

$ ./x86_64-softmmu/qemu-system-x86_64 -object rng-random,id=rng0,filename=/dev/random -device virtio-rng-pci,rng=rng0
Segmentation fault (core dumped)

Regressed with virtio refactoring in 59ccd20a9ac719cff82180429458728f03ec612f

CC: qemu-stable@nongnu.org
Signed-off-by: Cole Robinson <crobinso@redhat.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Message-id: bf4505014a0a941dbd3c62068f3cf2c496b69e6a.1370023944.git.crobinso@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoiscsi: reorganize iscsi_readcapacity_sync
Paolo Bonzini [Fri, 31 May 2013 11:56:24 +0000 (13:56 +0200)]
iscsi: reorganize iscsi_readcapacity_sync

Avoid the goto, and use the same retry logic for the 10- and 16-
byte versions.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoiscsi: simplify freeing of tasks
Paolo Bonzini [Fri, 31 May 2013 11:47:08 +0000 (13:47 +0200)]
iscsi: simplify freeing of tasks

Always free them in the iscsi_aio_*_acb functions and remove the
checks in their callers.  Remove ifs when the task struct was
previously dereferenced (spotted by Coverity).

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agovhost-scsi: fix k->set_guest_notifiers() NULL dereference
Stefan Hajnoczi [Thu, 30 May 2013 14:14:44 +0000 (16:14 +0200)]
vhost-scsi: fix k->set_guest_notifiers() NULL dereference

Coverity picked up a copy-paste bug.  In vhost_scsi_start() we check for
!k->set_guest_notifiers and error out.  The check probably got copied
but instead of erroring we actually use the function pointer!

Cc: Nicholas Bellinger <nab@linux-iscsi.org>
Cc: Asias He <asias@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoscsi-disk: scsi-block device for scsi pass-through should not be removable
Pavel Hrdina [Wed, 29 May 2013 13:47:23 +0000 (15:47 +0200)]
scsi-disk: scsi-block device for scsi pass-through should not be removable

This patch adds a new SCSI_DISK_F_NO_REMOVABLE_DEVOPS feature. By this
feature we can set that the scsi-block (scsi pass-through) device will still
be removable from the guest side, but from monitor it cannot be removed.

Cc: qemu-stable@nongnu.org
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoscsi-generic: check the return value of bdrv_aio_ioctl in execute_command
Pavel Hrdina [Wed, 29 May 2013 12:12:10 +0000 (14:12 +0200)]
scsi-generic: check the return value of bdrv_aio_ioctl in execute_command

This fixes the bug introduced by this commit ad54ae80c73f.
The bdrv_aio_ioctl() still could return null and we should return an error
in that case.

Cc: qemu-stable@nongnu.org
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoscsi-generic: fix sign extension of READ CAPACITY(10) data
Paolo Bonzini [Tue, 21 May 2013 12:08:53 +0000 (14:08 +0200)]
scsi-generic: fix sign extension of READ CAPACITY(10) data

Issuing the READ CAPACITY(10) command in the guest will cause QEMU
to update its knowledge of the maximum accessible LBA in the disk.
The recorded maximum LBA will be wrong if the disk is bigger than
1TB, because ldl_be_p returns a signed int.

When this is fixed, a latent bug will be unmasked.  If the READ
CAPACITY(10) command reported an overflow (0xFFFFFFFF), we must
not overwrite the previously-known maximum accessible LBA, or the guest
will fail to access the disk above the first 2TB.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoscsi: reset cdrom tray statuses on scsi_disk_reset
Pavel Hrdina [Mon, 20 May 2013 11:06:47 +0000 (13:06 +0200)]
scsi: reset cdrom tray statuses on scsi_disk_reset

Tray statuses should be also reset. Some guests may lock the tray and
right after resetting the guest it should be unlocked and closed. This
is done on power-on, reset and resume from suspend/hibernate on bare-metal.

This fix is already committed for IDE CD.
Check the commit a7f3d65b65b8c86a5ff0c0abcfefb45e2ec6fe4c.

Test results on bare-metal:
  - on reset/power-on the CD-ROM tray is closed even before the monitor
    is turned on
  - on resume from suspend/hibernate the tray is also closed before
    the monitor is turned on

From test results it seems that this behavior is OS and probably BIOS
independent.

Cc: qemu-stable@nongnu.org
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agonbd: strip braces from literal IPv6 address in URI
Ján Tomko [Mon, 3 Jun 2013 15:54:56 +0000 (17:54 +0200)]
nbd: strip braces from literal IPv6 address in URI

Otherwise they would get passed to getaddrinfo and fail with:
address resolution failed for [::1]:1234: Name or service not known

(Broken by commit v1.4.0-736-gf17c90b)

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agoqemu-socket: allow hostnames starting with a digit
Ján Tomko [Mon, 3 Jun 2013 15:54:55 +0000 (17:54 +0200)]
qemu-socket: allow hostnames starting with a digit

According to RFC 1123 [1], hostnames can start with a digit too.

[1] http://tools.ietf.org/html/rfc1123#page-13

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Cc: qemu-stable@nongnu.org
[Use strspn, not strcspn. - Paolo]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
10 years agointc/xilinx_intc: Dont lower IRQ when HIE cleared
Peter Crosthwaite [Tue, 11 Jun 2013 01:00:40 +0000 (11:00 +1000)]
intc/xilinx_intc: Dont lower IRQ when HIE cleared

This is a little strange. It is lowering the parent IRQ pin on input
when HIE is cleared. There is no such behaviour in the real hardware.

ISR changes based on interrupt pin state are already guarded on HIE
being set. So we can just delete this if in its entirety.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agointc/xilinx_intc: Inhibit write to ISR when HIE
Peter Crosthwaite [Tue, 11 Jun 2013 00:59:55 +0000 (10:59 +1000)]
intc/xilinx_intc: Inhibit write to ISR when HIE

When the Hardware Interrupt Enable (HIE) bit is set, software cannot
change ISR. Add write guard accordingly.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agointc/xilinx_intc: Handle level interrupt retriggering
Peter Crosthwaite [Tue, 11 Jun 2013 00:59:09 +0000 (10:59 +1000)]
intc/xilinx_intc: Handle level interrupt retriggering

Acking a level sensitive interrupt should have no effect if the
interrupt pin is still asserted. The current implementation requires
and edge condition to occur for setting a level sensitive IRQ, which
means an ACK can clear a level sensitive interrupt, until the original
source strobes the interrupt again.

Fix by keeping track of the interrupt pin state and setting ISR based
on this every time update_irq() is called.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agointc/xilinx_intc: Don't clear level sens. IRQs without ACK
Peter Crosthwaite [Tue, 11 Jun 2013 00:58:25 +0000 (10:58 +1000)]
intc/xilinx_intc: Don't clear level sens. IRQs without ACK

For level sensitive interrupts, ISR bits are cleared when the input pin
is lowered. This is incorrect. Only software can clear ISR bits (via
IAR or direct write to ISR with !MER(2)).

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agomicroblaze/petalogix_s3adsp1800_mmu: Fix UART IRQ
Peter Crosthwaite [Tue, 11 Jun 2013 00:57:41 +0000 (10:57 +1000)]
microblaze/petalogix_s3adsp1800_mmu: Fix UART IRQ

The UART IRQ is edge sensitive, whereas the machine was registering it
as level sensitive. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
10 years agoMerge remote-tracking branch 'luiz/queue/qmp' into staging
Anthony Liguori [Mon, 17 Jun 2013 18:14:46 +0000 (13:14 -0500)]
Merge remote-tracking branch 'luiz/queue/qmp' into staging

# By Luiz Capitulino
# Via Luiz Capitulino
* luiz/queue/qmp:
  qerror: drop QERR_OPEN_FILE_FAILED macro
  block: bdrv_reopen_prepare(): don't use QERR_OPEN_FILE_FAILED
  savevm: qmp_xen_save_devices_state(): use error_setg_file_open()
  dump: qmp_dump_guest_memory(): use error_setg_file_open()
  cpus: use error_setg_file_open()
  blockdev: use error_setg_file_open()
  block: mirror_complete(): use error_setg_file_open()
  rng-random: use error_setg_file_open()
  error: add error_setg_file_open() helper

Message-id: 1371484631-29510-1-git-send-email-lcapitulino@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 17 Jun 2013 18:14:13 +0000 (13:14 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Liu Yuan (2) and others
# Via Kevin Wolf
* kwolf/for-anthony:
  vmdk: Allow reading variable size descriptor files
  NVMe: Initial commit for new storage interface
  curl: Don't set curl options on the handle just before it's going to be deleted.
  vmdk: byteswap VMDK4Header.desc_offset field
  block/curl.c: Refuse to open the handle for writes.
  sheepdog: support 'qemu-img snapshot -a'
  sheepdog: fix snapshot tag initialization

Message-id: 1371486710-17793-1-git-send-email-kwolf@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'rth/fix-ppc64' into staging
Anthony Liguori [Mon, 17 Jun 2013 18:14:01 +0000 (13:14 -0500)]
Merge remote-tracking branch 'rth/fix-ppc64' into staging

# By Anton Blanchard
# Via Richard Henderson
* rth/fix-ppc64:
  tcg-ppc64: rotr_i32 rotates wrong amount
  tcg-ppc64: Fix add2_i64
  tcg-ppc64: bswap64 rotates output 32 bits
  tcg-ppc64: Fix RLDCL opcode

Message-id: 1371491129-30246-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agotcg-ppc64: rotr_i32 rotates wrong amount
Anton Blanchard [Sun, 2 Jun 2013 12:30:18 +0000 (22:30 +1000)]
tcg-ppc64: rotr_i32 rotates wrong amount

rotr_i32 calculates the amount to left shift and puts it into a
temporary, but then doesn't use it when doing the shift.

Cc: qemu-stable@nongnu.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Fix add2_i64
Anton Blanchard [Sun, 2 Jun 2013 12:29:39 +0000 (22:29 +1000)]
tcg-ppc64: Fix add2_i64

add2_i64 was adding the lower double word to the upper double word
of each input. Fix this so we add the lower double words, then the
upper double words with carry propagation.

Cc: qemu-stable@nongnu.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: bswap64 rotates output 32 bits
Anton Blanchard [Sun, 2 Jun 2013 12:28:27 +0000 (22:28 +1000)]
tcg-ppc64: bswap64 rotates output 32 bits

If our input and output is in the same register, bswap64 tries to
undo a rotate of the input. This just ends up rotating the output.

Cc: qemu-stable@nongnu.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agotcg-ppc64: Fix RLDCL opcode
Anton Blanchard [Tue, 11 Jun 2013 11:19:35 +0000 (21:19 +1000)]
tcg-ppc64: Fix RLDCL opcode

The rldcl instruction doesn't have an sh field, so the minor opcode
is shifted 1 bit. We were using the XO30 macro which shifted the
minor opcode 2 bits.

Remove XO30 and add MD30 and MDS30 macros which match the
Power ISA categories.

Cc: qemu-stable@nongnu.org
Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
10 years agovmdk: Allow reading variable size descriptor files
Evgeny Budilovsky [Wed, 12 Jun 2013 11:06:30 +0000 (14:06 +0300)]
vmdk: Allow reading variable size descriptor files

the hard-coded 2k buffer on the stack won't allow reading big descriptor
files which can be generated when storing big images. For example 500G
vmdk splitted to 2G chunks.

Signed-off-by: Evgeny Budilovsky <evgeny.budilovsky@ravellosystems.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoNVMe: Initial commit for new storage interface
Keith Busch [Tue, 4 Jun 2013 15:17:10 +0000 (09:17 -0600)]
NVMe: Initial commit for new storage interface

Initial commit for emulated Non-Volatile-Memory Express (NVMe) pci
storage device.

NVMe is an open, industry driven storage specification defining
an optimized register and command set designed to deliver the full
capabilities of non-volatile memory on PCIe SSDs. Further information
may be found on the organizations website at:

http://www.nvmexpress.org/

This commit implements the minimum from the specification to work with
existing drivers.

Cc: Keith Busch <keith.busch@gmail.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agocurl: Don't set curl options on the handle just before it's going to be deleted.
Richard W.M. Jones [Mon, 10 Jun 2013 16:40:15 +0000 (17:40 +0100)]
curl: Don't set curl options on the handle just before it's going to be deleted.

(Found by Kamil Dudka)

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Cc: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agovmdk: byteswap VMDK4Header.desc_offset field
Stefan Hajnoczi [Mon, 10 Jun 2013 09:07:33 +0000 (11:07 +0200)]
vmdk: byteswap VMDK4Header.desc_offset field

Remember to byteswap VMDK4Header.desc_offset on big-endian machines.

Cc: qemu-stable@nongnu.org
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock/curl.c: Refuse to open the handle for writes.
Richard W.M. Jones [Mon, 10 Jun 2013 11:38:43 +0000 (12:38 +0100)]
block/curl.c: Refuse to open the handle for writes.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: support 'qemu-img snapshot -a'
Liu Yuan [Fri, 7 Jun 2013 17:54:26 +0000 (01:54 +0800)]
sheepdog: support 'qemu-img snapshot -a'

Just call sd_create_branch() in the snapshot_goto to rollback the image is good
enough. With this patch, 'loadvm' process for sheepdog is modified:

Suppose we have a snapshot chain A --> B --> C, we do 'loadvm A' so as to get
a new chain,

A --> B
|
V
C1

in the old code:

1 reload inode of A (in snapshot_goto)
2 read vmstate via A's vdi_id (loadvm_state)
3 delete C and create C1, reload inode of C1 (sd_create_branch on write)

with this patch applied:

1 reload inode of A, delete C and create C1  (in snapshot_goto)
2 read vmstate via C1's parent, that is A's vdi_id (loadvm_state)

This will fix the possible bug that QEMU exit between 2 and 3 in the old code

Cc: qemu-devel@nongnu.org
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agosheepdog: fix snapshot tag initialization
Liu Yuan [Fri, 7 Jun 2013 17:54:25 +0000 (01:54 +0800)]
sheepdog: fix snapshot tag initialization

This is an old and obvious bug. We should pass snapshot_id to the
tag. Or simple command like 'qemu-img snapshot -a tag sheepdog:image' will fail

Cc: qemu-devel@nongnu.org
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Liu Yuan <namei.unix@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
10 years agoqerror: drop QERR_OPEN_FILE_FAILED macro
Luiz Capitulino [Fri, 7 Jun 2013 18:37:54 +0000 (14:37 -0400)]
qerror: drop QERR_OPEN_FILE_FAILED macro

Not used since the last commit.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: bdrv_reopen_prepare(): don't use QERR_OPEN_FILE_FAILED
Luiz Capitulino [Mon, 10 Jun 2013 15:29:27 +0000 (11:29 -0400)]
block: bdrv_reopen_prepare(): don't use QERR_OPEN_FILE_FAILED

The call to drv->bdrv_reopen_prepare() can fail due to reasons
other than an open failure. Unfortunately, we can't use errno
nor -ret, cause they are not always set.

Stick to a generic error message then.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agosavevm: qmp_xen_save_devices_state(): use error_setg_file_open()
Luiz Capitulino [Fri, 7 Jun 2013 18:36:58 +0000 (14:36 -0400)]
savevm: qmp_xen_save_devices_state(): use error_setg_file_open()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agodump: qmp_dump_guest_memory(): use error_setg_file_open()
Luiz Capitulino [Fri, 7 Jun 2013 18:36:01 +0000 (14:36 -0400)]
dump: qmp_dump_guest_memory(): use error_setg_file_open()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agocpus: use error_setg_file_open()
Luiz Capitulino [Fri, 7 Jun 2013 18:35:06 +0000 (14:35 -0400)]
cpus: use error_setg_file_open()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblockdev: use error_setg_file_open()
Luiz Capitulino [Fri, 7 Jun 2013 18:33:48 +0000 (14:33 -0400)]
blockdev: use error_setg_file_open()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agoblock: mirror_complete(): use error_setg_file_open()
Luiz Capitulino [Fri, 7 Jun 2013 18:31:46 +0000 (14:31 -0400)]
block: mirror_complete(): use error_setg_file_open()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agorng-random: use error_setg_file_open()
Luiz Capitulino [Fri, 7 Jun 2013 18:28:02 +0000 (14:28 -0400)]
rng-random: use error_setg_file_open()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agoerror: add error_setg_file_open() helper
Luiz Capitulino [Fri, 7 Jun 2013 18:24:49 +0000 (14:24 -0400)]
error: add error_setg_file_open() helper

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
10 years agoMerge remote-tracking branch 'pmaydell/configury.next' into staging
Anthony Liguori [Mon, 17 Jun 2013 13:57:56 +0000 (08:57 -0500)]
Merge remote-tracking branch 'pmaydell/configury.next' into staging

# By Paolo Bonzini (4) and others
# Via Peter Maydell
* pmaydell/configury.next:
  ppc: Remove CONFIG_FDT conditionals
  microblaze: Remove CONFIG_FDT conditionals
  arm: Remove CONFIG_FDT conditionals
  configure: Require libfdt for arm, ppc, microblaze softmmu targets
  configure: dtc: Probe for libfdt_env.h
  build: drop TARGET_TYPE
  main: use TARGET_ARCH only for the target-specific #define
  build: do not use TARGET_ARCH
  build: rename TARGET_ARCH2 to TARGET_NAME
  Add a stp file for usage from build directory

Message-id: 1371221594-11556-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agoMerge remote-tracking branch 'mjt/trivial-patches' into staging
Anthony Liguori [Mon, 17 Jun 2013 13:57:07 +0000 (08:57 -0500)]
Merge remote-tracking branch 'mjt/trivial-patches' into staging

# By Michael Tokarev (1) and Vladimir Senkov (1)
# Via Michael Tokarev
* mjt/trivial-patches:
  char/serial: fix copy&paste error (fifo8_is_full vs empty)
  vl: always define no_frame

Message-id: 1371455050-9523-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agochar/serial: fix copy&paste error (fifo8_is_full vs empty)
Vladimir Senkov [Mon, 17 Jun 2013 00:30:52 +0000 (20:30 -0400)]
char/serial: fix copy&paste error (fifo8_is_full vs empty)

Copy&paste error in serial.c causes a crash when attempting
to read from UART (if there is no data to be read)

Signed-off-by: Vladimir Senkov <hangup@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
10 years agovl: always define no_frame
Michael Tokarev [Sat, 15 Jun 2013 10:36:22 +0000 (14:36 +0400)]
vl: always define no_frame

Commit 047d4e151dd46 "Unbreak -no-quit for GTK, validate SDL options" broke
build of qemu without sdl, by referencing `no_frame' variable which is defined
inside #if SDL block.  Fix that by defining that variable unconditionally.

This is a better fix for the build issue introduced by that patch than
a revert.  This change keeps the new functinality introduced by that patch
and just fixes the compilation.  It still is not a complete fix around the
original issue (not working -no-frame et al with -display gtk), because it
makes only the legacy interface working, not the new suboption interface,
so a few more changes are needed.

Cc: Peter Wu <lekensteyn@gmail.com>
Cc: qemu-trivial@nongnu.org
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Wu <lekensteyn@gmail.com>
10 years agogtk: Fix compiler warning (GTK 3 deprecated function)
Stefan Weil [Sun, 16 Jun 2013 14:13:07 +0000 (16:13 +0200)]
gtk: Fix compiler warning (GTK 3 deprecated function)

With GTK 3, the function gdk_cursor_unref is deprecated:

qemu/ui/gtk.c: In function ‘gd_cursor_define’:
qemu/ui/gtk.c:380:5: error:
 ‘gdk_cursor_unref’ is deprecated (declared at /usr/include/gtk-3.0/gdk/gdkcursor.h:233): Use 'g_object_unref' instead [-Werror=deprecated-declarations]

Fix the gcc compiler warning by using conditional compilation.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Message-id: 1371391987-10795-1-git-send-email-sw@weilnetz.de
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
10 years agovl: always define no_frame
Michael Tokarev [Sat, 15 Jun 2013 10:42:03 +0000 (14:42 +0400)]
vl: always define no_frame

Commit 047d4e151dd46 "Unbreak -no-quit for GTK, validate SDL options" broke
build of qemu without sdl, by referencing `no_frame' variable which is defined
inside #if SDL block.  Fix that by defining that variable unconditionally.

This is a better fix for the build issue introduced by that patch than
a revert.  This change keeps the new functinality introduced by that patch
and just fixes the compilation.  It still is not a complete fix around the
original issue (not working -no-frame et al with -display gtk), because it
makes only the legacy interface working, not the new suboption interface,
so a few more changes are needed.

Cc: Peter Wu <lekensteyn@gmail.com>
Cc: qemu-trivial@nongnu.org
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Peter Wu <lekensteyn@gmail.com>
Tested-by: Andreas Färber <afaerber@suse.de>
Message-id: 1371292923-28105-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotarget-i386: fix over 80 chars warnings
liguang [Tue, 28 May 2013 08:21:10 +0000 (16:21 +0800)]
target-i386: fix over 80 chars warnings

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove redundant env->eip assignment
liguang [Tue, 28 May 2013 08:21:09 +0000 (16:21 +0800)]
target-i386/helper: remove redundant env->eip assignment

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove DF macro
liguang [Tue, 28 May 2013 08:21:08 +0000 (16:21 +0800)]
target-i386/helper: remove DF macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove EIP macro
liguang [Tue, 28 May 2013 08:21:07 +0000 (16:21 +0800)]
target-i386/helper: remove EIP macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove EDI macro
liguang [Tue, 28 May 2013 08:21:06 +0000 (16:21 +0800)]
target-i386/helper: remove EDI macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove ESI macro
liguang [Tue, 28 May 2013 08:21:05 +0000 (16:21 +0800)]
target-i386/helper: remove ESI macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove ESP macro
liguang [Tue, 28 May 2013 08:21:04 +0000 (16:21 +0800)]
target-i386/helper: remove ESP macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove EBP macro
liguang [Tue, 28 May 2013 08:21:03 +0000 (16:21 +0800)]
target-i386/helper: remove EBP macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove EDX macro
liguang [Tue, 28 May 2013 08:21:02 +0000 (16:21 +0800)]
target-i386/helper: remove EDX macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove ECX macro
liguang [Tue, 28 May 2013 08:21:01 +0000 (16:21 +0800)]
target-i386/helper: remove ECX macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove EBX macro
liguang [Tue, 28 May 2013 08:21:00 +0000 (16:21 +0800)]
target-i386/helper: remove EBX macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386/helper: remove EAX macro
liguang [Tue, 28 May 2013 08:20:59 +0000 (16:20 +0800)]
target-i386/helper: remove EAX macro

Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu
Blue Swirl [Sat, 15 Jun 2013 10:53:44 +0000 (10:53 +0000)]
Merge branch 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu

* 'realize-isa.v2' of git://github.com/afaerber/qemu-cpu:
  qdev: Drop FROM_QBUS() macro
  isa: QOM'ify ISADevice
  isa: QOM'ify ISABus
  i8259: Convert PICCommonState to use QOM realizefn
  kvm/i8259: QOM'ify some more
  i8259: QOM'ify some more
  i8254: Convert PITCommonState to QOM realizefn
  kvm/i8254: QOM'ify some more
  i8254: QOM'ify some more
  isa: Use realizefn for ISADevice
  cs4231a: QOM'ify some more
  gus: QOM'ify some more

11 years agoide-test: fix failure for test_flush
Michael Roth [Mon, 10 Jun 2013 18:23:20 +0000 (13:23 -0500)]
ide-test: fix failure for test_flush

bd07684aacfb61668ae2c25b7dd00b64f3d7c7f3 added a test to ensure BSY
flag is set when a flush request is in flight. It does this by setting
a blkdebug breakpoint on flush_to_os before issuing a CMD_FLUSH_CACHE.
It then resumes CMD_FLUSH_CACHE operation and checks that BSY is unset.

The actual unsetting of BSY does not occur until ide_flush_cb gets
called in a bh, however, so in some cases this check will race with
the actual completion.

Fix this by polling the ide status register until BSY flag gets unset
before we do our final sanity checks. According to
f68ec8379e88502b4841a110c070e9b118d3151c this is in line with how a guest
would determine whether or not the device is still busy.

Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoppc: Remove CONFIG_FDT conditionals
Peter Maydell [Fri, 24 May 2013 15:26:57 +0000 (16:26 +0100)]
ppc: Remove CONFIG_FDT conditionals

Now that we know we're compiling with libfdt we can remove the
CONFIG_FDT conditionals.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 1369409217-7553-5-git-send-email-peter.maydell@linaro.org

11 years agomicroblaze: Remove CONFIG_FDT conditionals
Peter Maydell [Fri, 24 May 2013 15:26:56 +0000 (16:26 +0100)]
microblaze: Remove CONFIG_FDT conditionals

Now that we know we're compiling with libfdt we can remove the
CONFIG_FDT conditionals.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 1369409217-7553-4-git-send-email-peter.maydell@linaro.org

11 years agoarm: Remove CONFIG_FDT conditionals
Peter Maydell [Fri, 24 May 2013 15:26:55 +0000 (16:26 +0100)]
arm: Remove CONFIG_FDT conditionals

Now that we know we're compiling with libfdt, we can remove the
CONFIG_FDT conditionals.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 1369409217-7553-3-git-send-email-peter.maydell@linaro.org

11 years agoconfigure: Require libfdt for arm, ppc, microblaze softmmu targets
Peter Maydell [Fri, 24 May 2013 15:26:54 +0000 (16:26 +0100)]
configure: Require libfdt for arm, ppc, microblaze softmmu targets

A number of our softmmu targets (PPC, ARM, Microblaze) now more or
less require flattened device tree support for various board models
to work correctly.  Make libfdt mandatory if the target list includes
these, rather than building unhelpful half-functional binaries.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Message-id: 1369409217-7553-2-git-send-email-peter.maydell@linaro.org

11 years agoconfigure: dtc: Probe for libfdt_env.h
Peter Crosthwaite [Mon, 27 May 2013 04:20:57 +0000 (14:20 +1000)]
configure: dtc: Probe for libfdt_env.h

Currently QEMU provides a local clone of the file libfdt_env.h in
/include. This file is supposed to come with the libfdt package and is
only needed for broken installs of libfdt. Now that we have submodule
dtc, just ignore these broken installs and prompt for the dtc submodule
install instead. QEMU's local libfdt_env.h is removed accordingly.

Manifests as a bug when building QEMU with modern libfdt. The new
version of libfdt does not compile when QEMUs libfdt_env.h takes
precedence over the hosts.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Kim Phillips <kim.phillips@freescale.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 9b6a3a52e3f46cfbc1ded9ab56385ec045e46705.1369628289.git.peter.crosthwaite@xilinx.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agobuild: drop TARGET_TYPE
Paolo Bonzini [Tue, 4 Jun 2013 12:45:28 +0000 (14:45 +0200)]
build: drop TARGET_TYPE

Just use the TARGET_NAME free string.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 1370349928-20419-6-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agomain: use TARGET_ARCH only for the target-specific #define
Paolo Bonzini [Tue, 4 Jun 2013 12:45:27 +0000 (14:45 +0200)]
main: use TARGET_ARCH only for the target-specific #define

Everything else needs to match the executable name, which is
TARGET_NAME.

Before:
    $ sh4eb-linux-user/qemu-sh4eb --help
    usage: qemu-sh4 [options] program [arguments...]
    Linux CPU emulator (compiled for sh4 emulation)

After:
    $ sh4eb-linux-user/qemu-sh4eb --help
    usage: qemu-sh4eb [options] program [arguments...]
    Linux CPU emulator (compiled for sh4eb emulation)

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1370349928-20419-5-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agobuild: do not use TARGET_ARCH
Paolo Bonzini [Tue, 4 Jun 2013 12:45:26 +0000 (14:45 +0200)]
build: do not use TARGET_ARCH

TARGET_ARCH is generally wrong to use, there are better variables
provided in config-target.mak.  The right one is usually TARGET_NAME
(previously TARGET_ARCH2), but for bsd-user we can also use TARGET_ABI_DIR
for consistency with linux-user.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1370349928-20419-4-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agobuild: rename TARGET_ARCH2 to TARGET_NAME
Paolo Bonzini [Fri, 14 Jun 2013 14:19:07 +0000 (15:19 +0100)]
build: rename TARGET_ARCH2 to TARGET_NAME

Do not introduce any new use yet.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1370349928-20419-3-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoAdd a stp file for usage from build directory
Alon Levy [Fri, 14 Jun 2013 14:19:07 +0000 (15:19 +0100)]
Add a stp file for usage from build directory

For systemtap the location of the process being tapped is crucial, as a
result the existing stp file requires installation for use.

There are now two files:
$(TARGET_DIR)/$(QEMU_PROG).stp-installed: copied to $(tapdir)/$(QEMU_PROG).stp
$(TARGET_DIR)/$(QEMU_PROG).stp: pointing to the built binary, usable
                                without installation

To use:
stap -I $(TARGET_DIR) ...

Signed-off-by: Alon Levy <alevy@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 1370349928-20419-2-git-send-email-pbonzini@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
11 years agoaudio/intel-hda: QOM casting sweep
Peter Crosthwaite [Thu, 6 Jun 2013 05:34:52 +0000 (15:34 +1000)]
audio/intel-hda: QOM casting sweep

Define and use standard QOM cast macro. Remove usages of DO_UPCAST and
direct -> style casting.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 96f00396338321f5a76c9b86c629b69895e4d2d0.1370496582.git.peter.crosthwaite@xilinx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoaudio/intel-hda: Fix Inheritance hierachy
Peter Crosthwaite [Thu, 6 Jun 2013 05:34:08 +0000 (15:34 +1000)]
audio/intel-hda: Fix Inheritance hierachy

The ich6 and ich9 variants either need to inherit one from the other,
or both from a common base class, otherwise its not possible to create
a QOM cast macro for use by the shared implementation functions.
Went for option B, with a common base class.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 54453b6aa8afa1a76b2ec1932f1d7fd25205d0bc.1370496582.git.peter.crosthwaite@xilinx.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosmbios: Check R in -smbios type=0, release=R parses okay
Markus Armbruster [Fri, 7 Jun 2013 13:00:36 +0000 (15:00 +0200)]
smbios: Check R in -smbios type=0, release=R parses okay

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-7-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosmbios: Fix -smbios type=0, release=... for big endian hosts
Markus Armbruster [Fri, 7 Jun 2013 13:00:35 +0000 (15:00 +0200)]
smbios: Fix -smbios type=0, release=... for big endian hosts

Classic endianness bug due to careless dirty coding: assuming reading
a byte from an int variable gets the least significant byte.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-6-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosmbios: Clean up smbios_add_field() parameters
Markus Armbruster [Fri, 7 Jun 2013 13:00:34 +0000 (15:00 +0200)]
smbios: Clean up smbios_add_field() parameters

Having size precede the associated pointer is odd.  Swap them, and fix
up the types.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-5-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agosmbios: Convert to error_report()
Markus Armbruster [Fri, 7 Jun 2013 13:00:33 +0000 (15:00 +0200)]
smbios: Convert to error_report()

Improves diagnistics from ad hoc messages like

    Invalid SMBIOS UUID string

to

    qemu-system-x86_64: -smbios type=1,uuid=gaga: Invalid UUID

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-4-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agolog.h: Supply missing includes
Markus Armbruster [Fri, 7 Jun 2013 13:00:32 +0000 (15:00 +0200)]
log.h: Supply missing includes

<stdio.h> has always been missing.  Rest missed in commit eeacee4.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-3-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoerror-report.h: Supply missing include
Markus Armbruster [Fri, 7 Jun 2013 13:00:31 +0000 (15:00 +0200)]
error-report.h: Supply missing include

Missed in commit e5924d8.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Laszlo "ever the optimist" Ersek <lersek@redhat.com>
Message-id: 1370610036-10577-2-git-send-email-armbru@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mjt/trivial-patches-next' into staging
Anthony Liguori [Fri, 14 Jun 2013 12:51:45 +0000 (07:51 -0500)]
Merge remote-tracking branch 'mjt/trivial-patches-next' into staging

# By Michael Tokarev (4) and others
# Via Michael Tokarev
* mjt/trivial-patches-next: (26 commits)
  piix: fix some printf errors when debug is enabled
  cputlb: fix debug logs
  create qemu_openpty_raw() helper function and move it to a separate file
  main-loop: do not include slirp/slirp.h, use libslirp.h instead
  libcacard/vscclient: fix leakage of socket on error paths
  linux-headers: Update to v3.10-rc5
  KVM: PPC: Add dummy kvm_arch_init_irq_routing()
  KVM: S390: Add dummy kvm_arch_init_irq_routing()
  KVM: ARM: Add dummy kvm_arch_init_irq_routing()
  ivshmem: add missing error exit(2)
  hw/xen: Use g_free instead of free and fix potential memory leaks
  target-sparc: Replace free by g_free
  hw/scsi: Don't increment a boolean value
  device tree: Fix cppcheck warning
  Makefile: Install qemu-img and qemu-nbd man pages only if built
  Unbreak -no-quit for GTK, validate SDL options
  gtk: implement -full-screen
  char/serial: serial_ioport_write: Factor out common code
  char/serial: Use generic Fifo8
  char/serial: cosmetic fixes.
  ...

Message-id: 1371207042-17980-1-git-send-email-mjt@msgid.tls.msk.ru
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Fri, 14 Jun 2013 12:51:30 +0000 (07:51 -0500)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

# By Andreas Färber (12) and others
# Via Andreas Färber
* afaerber/qom-cpu:
  spapr_rtas: Abstract rtas_start_cpu() with qemu_get_cpu()
  spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu()
  memory_mapping: Improve qemu_get_guest_memory_mapping() error reporting
  dump: Abstract dump_init() with cpu_synchronize_all_states()
  cpu: Change default for CPUClass::get_paging_enabled()
  dump: Drop qmp_dump_guest_memory() stub and build for all targets
  memory_mapping: Drop qemu_get_memory_mapping() stub
  cpu: Turn cpu_get_memory_mapping() into a CPUState hook
  memory_mapping: Move MemoryMappingList typedef to qemu/typedefs.h
  cpu: Turn cpu_paging_enabled() into a CPUState hook
  monitor: Simplify do_inject_mce() with qemu_get_cpu()
  target-i386: cpu: Fix potential buffer overrun in get_register_name_32()
  target-i386: Set level=4 on Conroe/Penryn/Nehalem
  target-i386: Update model values on Conroe/Penryn/Nehalem CPU models
  pc: Create pc-*-1.6 machine-types
  pc: Fix crash when attempting to hotplug CPU with negative ID
  dump: Move stubs into libqemustub.a

11 years agoMerge remote-tracking branch 'pmaydell/tcg-aarch64.next' into staging
Anthony Liguori [Fri, 14 Jun 2013 12:51:05 +0000 (07:51 -0500)]
Merge remote-tracking branch 'pmaydell/tcg-aarch64.next' into staging

# By Claudio Fontana (9) and others
# Via Peter Maydell
* pmaydell/tcg-aarch64.next:
  MAINTAINERS: add tcg/aarch64 maintainer
  configure: permit compilation on arm aarch64
  tcg/aarch64: implement user mode qemu ld/st
  user-exec.c: aarch64 initial implementation of cpu_signal_handler
  tcg/aarch64: implement sign/zero extend operations
  tcg/aarch64: implement byte swap operations
  tcg/aarch64: implement AND/TEST immediate pattern
  tcg/aarch64: improve arith shifted regs operations
  tcg/aarch64: implement new TCG target for aarch64
  include/elf.h: add aarch64 ELF machine and relocs
  configure: Drop CONFIG_ATFILE test
  linux-user: Drop direct use of openat etc syscalls
  linux-user: Allow getdents to be provided by getdents64

Message-id: 1371052645-9006-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'pmaydell/target-arm.next' into staging
Anthony Liguori [Fri, 14 Jun 2013 12:50:58 +0000 (07:50 -0500)]
Merge remote-tracking branch 'pmaydell/target-arm.next' into staging

# By Peter Chubb
# Via Peter Maydell
* pmaydell/target-arm.next:
  Fix rfe instruction

Message-id: 1370268884-25945-1-git-send-email-peter.maydell@linaro.org
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'rth/tcg-for-anthony' into staging
Anthony Liguori [Fri, 14 Jun 2013 12:50:36 +0000 (07:50 -0500)]
Merge remote-tracking branch 'rth/tcg-for-anthony' into staging

# By Richard Henderson
# Via Richard Henderson
* rth/tcg-for-anthony:
  tcg: Remove redundant tcg_target_init checks
  tcg: Use QEMU_BUILD_BUG_ON for CPU_TLB_ENTRY_BITS

Message-id: 1370437167-11278-1-git-send-email-rth@twiddle.net
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agopiix: fix some printf errors when debug is enabled
Hu Tao [Fri, 14 Jun 2013 07:11:30 +0000 (15:11 +0800)]
piix: fix some printf errors when debug is enabled

And use PRIxxx macros if possible.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agocputlb: fix debug logs
Hervé Poussineau [Wed, 5 Jun 2013 12:16:42 +0000 (20:16 +0800)]
cputlb: fix debug logs

'pd' variable has been removed in 06ef3525e1f271b6a842781a05eace5cf63b95c2.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
11 years agocreate qemu_openpty_raw() helper function and move it to a separate file
Michael Tokarev [Wed, 5 Jun 2013 14:44:54 +0000 (18:44 +0400)]
create qemu_openpty_raw() helper function and move it to a separate file

In two places qemu uses openpty() which is very system-dependent,
and in both places the pty is switched to raw mode as well.
Make a wrapper function which does both steps, and move all the
system-dependent complexity into a separate file, together
with static/local implementations of openpty() and cfmakeraw()
from qemu-char.c.

It is in a separate file, not part of oslib-posix.c, because
openpty() often resides in -lutil which is not linked to
every program qemu builds.

This change removes #including of <pty.h>, <termios.h>
and other rather specific system headers out of qemu-common.h,
which isn't a place for such specific headers really.

This version has been verified to build correctly on Linux,
OpenBSD, FreeBSD and OpenIndiana.  On the latter it lets qemu
to be built with gtk gui which were not possible there due to
missing openpty() and cfmakeraw().

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Tested-by: Andreas Färber <andreas.faerber@web.de>
11 years agospapr_rtas: Abstract rtas_start_cpu() with qemu_get_cpu()
Andreas Färber [Wed, 29 May 2013 19:06:39 +0000 (21:06 +0200)]
spapr_rtas: Abstract rtas_start_cpu() with qemu_get_cpu()

Instead of looping over all CPUArchState, use a helper to obtain the
desired CPUState.
Free the "cpu" variable for PowerPCCPU, to access its CPUPPCState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agospapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu()
Andreas Färber [Wed, 29 May 2013 19:03:31 +0000 (21:03 +0200)]
spapr_rtas: Abstract rtas_query_cpu_stopped_state() with qemu_get_cpu()

Instead of looping over all CPUArchState, use a helper to obtain the
desired CPUState directly. Saves a CPUPPCState variable and QOM cast.

Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoMAINTAINERS: add tcg/aarch64 maintainer
Claudio Fontana [Wed, 12 Jun 2013 15:20:24 +0000 (16:20 +0100)]
MAINTAINERS: add tcg/aarch64 maintainer

Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com>
Message-id: 51ACA0B2.80800@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>