sdk/emulator/qemu.git
14 years agosavevm: Generate a name when run without one
Miguel Di Ciurcio Filho [Wed, 4 Aug 2010 17:55:49 +0000 (14:55 -0300)]
savevm: Generate a name when run without one

When savevm is run without a name, the name stays blank and the snapshot is
saved anyway.

The new behavior is when savevm is run without parameters a name will be
created automaticaly, so the snapshot is accessible to the user without needing
the id when loadvm is run.

(qemu) savevm
(qemu) info snapshots
ID        TAG                 VM SIZE                DATE       VM CLOCK
1         vm-20100728134640      978K 2010-07-28 13:46:40   00:00:08.603

We use a name with the format 'vm-YYYYMMDDHHMMSS'.

This is a first step to hide the internal id, because I don't see a reason to
expose this kind of internals to the user.

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agomonitor: make 'info snapshots' show only fully available snapshots
Miguel Di Ciurcio Filho [Wed, 4 Aug 2010 17:55:48 +0000 (14:55 -0300)]
monitor: make 'info snapshots' show only fully available snapshots

The output generated by 'info snapshots' shows only snapshots that exist on the
block device that saves the VM state. This output can cause an user to
erroneously try to load an snapshot that is not available on all block devices.

$ qemu-img snapshot -l xxtest.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
1                                1.5M 2010-07-26 16:51:52   00:00:08.599
2                                1.5M 2010-07-26 16:51:53   00:00:09.719
3                                1.5M 2010-07-26 17:26:49   00:00:13.245
4                                1.5M 2010-07-26 19:01:00   00:00:46.763

$ qemu-img snapshot -l xxtest2.qcow2
Snapshot list:
ID        TAG                 VM SIZE                DATE       VM CLOCK
3                                   0 2010-07-26 17:26:49   00:00:13.245
4                                   0 2010-07-26 19:01:00   00:00:46.763

Current output:
$ qemu -hda xxtest.qcow2 -hdb xxtest2.qcow2 -monitor stdio -vnc :0
QEMU 0.12.4 monitor - type 'help' for more information
(qemu) info snapshots
Snapshot devices: ide0-hd0
Snapshot list (from ide0-hd0):
ID        TAG                 VM SIZE                DATE       VM CLOCK
1                                1.5M 2010-07-26 16:51:52   00:00:08.599
2                                1.5M 2010-07-26 16:51:53   00:00:09.719
3                                1.5M 2010-07-26 17:26:49   00:00:13.245
4                                1.5M 2010-07-26 19:01:00   00:00:46.763

Snapshots 1 and 2 do not exist on xxtest2.qcow, but they are displayed anyway.

This patch sumarizes the output to only show fully available snapshots.

New output:
(qemu) info snapshots
ID        TAG                 VM SIZE                DATE       VM CLOCK
3                                1.5M 2010-07-26 17:26:49   00:00:13.245
4                                1.5M 2010-07-26 19:01:00   00:00:46.763

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoposix-aio-compat: Fix async_conmtext for ioctl
Andrew de Quincey [Sun, 8 Aug 2010 20:04:50 +0000 (21:04 +0100)]
posix-aio-compat: Fix async_conmtext for ioctl

Set the async_context_id field when queuing an async ioctl call

Signed-off-by: Andrew de Quincey <adq@lidskialf.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agonbd: Introduce NBD named exports.
Laurent Vivier [Wed, 25 Aug 2010 20:48:33 +0000 (22:48 +0200)]
nbd: Introduce NBD named exports.

This patch allows to connect Qemu using NBD protocol to an nbd-server
using named exports.

For instance, if on the host "isoserver", in /etc/nbd-server/config, you have:

[generic]
[debian-500-ppc-netinst]
        exportname = /ISO/debian-500-powerpc-netinst.iso
[Fedora-10-ppc-netinst]
        exportname = /ISO/Fedora-10-ppc-netinst.iso

You can connect to it, using:

    qemu -cdrom nbd:isoserver:exportname=debian-500-ppc-netinst
    qemu -cdrom nbd:isoserver:exportname=Fedora-10-ppc-netinst

NOTE: you need at least nbd-server 2.9.18

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agovvfat: fat_chksum(): fix access above array bounds
Loïc Minier [Sat, 21 Aug 2010 22:47:23 +0000 (00:47 +0200)]
vvfat: fat_chksum(): fix access above array bounds

Signed-off-by: Loïc Minier <loic.minier@linaro.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoqemu-img rebase: Open new backing file read-only
Kevin Wolf [Tue, 17 Aug 2010 16:58:55 +0000 (18:58 +0200)]
qemu-img rebase: Open new backing file read-only

We never write to a backing file, so opening rw is useless. It just means that
you can't rebase on top of a file for which you don't have write permissions.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agosheepdog: remove unnecessary includes
Izumi Tsutsui [Sun, 8 Aug 2010 09:31:04 +0000 (18:31 +0900)]
sheepdog: remove unnecessary includes

"qemu_socket.h" includes all necessary files and
including <netinet/tcp.h> without <netinet/in.h>
could cause errors on some systems.

Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Fix image re-open in bdrv_commit
Kevin Wolf [Thu, 5 Aug 2010 11:05:22 +0000 (13:05 +0200)]
block: Fix image re-open in bdrv_commit

Arguably we should re-open the backing file with the backing file format and
not with the format of the snapshot image.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agovirtio-blk: Fix migration of queued requests
Kevin Wolf [Tue, 3 Aug 2010 14:57:02 +0000 (16:57 +0200)]
virtio-blk: Fix migration of queued requests

in_sg[].iovec and out_sg[].ioved are pointer to (source) host memory and
therefore invalid after migration. When loading the device state we must
create a new mapping on the destination host.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agovirtio: Factor virtqueue_map_sg out
Kevin Wolf [Tue, 3 Aug 2010 14:54:38 +0000 (16:54 +0200)]
virtio: Factor virtqueue_map_sg out

Separate the mapping of requests to host memory from the descriptor iteration.
The next patch will make use of it in a different context.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoisapc: fix segfault.
Isaku Yamahata [Wed, 4 Aug 2010 08:43:20 +0000 (17:43 +0900)]
isapc: fix segfault.

https://bugs.launchpad.net/bugs/611646
reports that ./i386-softmmu/qemu -M isapc segfaults.
This patch fixes the segfault introduced by
f885f1eaa8711c06033ceb1599e3750fb37c306f

It's because i440fx_state in pc_init1() isn't initialized.

> Core was generated by `./i386-softmmu/qemu -M isapc'.
> Program terminated with signal 11, Segmentation fault.
> [New process 19686]
>     at qemu/hw/piix_pci.c:136
> (gdb) where
>     at qemu/hw/piix_pci.c:136
>     boot_device=0x7fffe1f5b040 "cad", kernel_filename=0x0,
>     kernel_cmdline=0x6469bf "", initrd_filename=0x0,
>     cpu_model=0x654d10 "486", pci_enabled=0)
>     at qemu/hw/pc_piix.c:178
>     boot_device=0x7fffe1f5b040 "cad", kernel_filename=0x0,
>     kernel_cmdline=0x6469bf "", initrd_filename=0x0, cpu_model=0x654d10 "486")
>     at qemu/hw/pc_piix.c:207
>     envp=0x7fffe1f5b188)
>     at qemu/vl.c:2871

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix segfault in mmio subpage handling code.
Gleb Natapov [Thu, 29 Jul 2010 07:41:45 +0000 (10:41 +0300)]
Fix segfault in mmio subpage handling code.

It is possible that subpage mmio is registered over existing memory
page. When this happens "memory" will have real memory address and not
index into io_mem array so next access to the page will generate
segfault. It is uncommon to have some part of a page to be accessed as
memory and some as mmio, but qemu shouldn't crash even when guest does
stupid things. So lets just pretend that the rest of the page is
unassigned if guest configure part of the memory page as mmio.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoetraxfs_eth: correct use of ! and &
Blue Swirl [Thu, 26 Aug 2010 18:04:18 +0000 (18:04 +0000)]
etraxfs_eth: correct use of ! and &

Combining bitwise AND and logical NOT is suspicious.

Fixed by this Coccinelle script:
// From http://article.gmane.org/gmane.linux.kernel/646367
@@ expression E1,E2; @@
(
 !E1 & !E2
|
- !E1 & E2
+ !(E1 & E2)
)

Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoSparc: update OpenBIOS images to r859
Blue Swirl [Thu, 26 Aug 2010 17:57:47 +0000 (17:57 +0000)]
Sparc: update OpenBIOS images to r859

Update Sparc32 and Sparc64 OpenBIOS images to SVN revision 859.

Bring also pc-bios/README up to date including the update performed by
419ef5f1c6a9614e8ddcb0b0f826de692e7e4a43.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoppc4xx: load Bamboo kernel, initrd, and fdt at fixed addresses
Hollis Blanchard [Thu, 5 Aug 2010 00:21:37 +0000 (17:21 -0700)]
ppc4xx: load Bamboo kernel, initrd, and fdt at fixed addresses

We can't use the return value of load_uimage() for the kernel because it
can't account for BSS size, and the PowerPC kernel does not relocate
blobs before zeroing BSS.

Instead, we now load at the fixed addresses chosen by u-boot (the normal
firmware for the board).

Signed-off-by: Hollis Blanchard <hollis@penguinppc.org>
14 years agoppc4xx: don't unregister RAM at reset
Hollis Blanchard [Thu, 5 Aug 2010 00:21:36 +0000 (17:21 -0700)]
ppc4xx: don't unregister RAM at reset

The PowerPC 4xx SDRAM controller emulation unregisters RAM in its reset
callback. However, qemu_system_reset() is now called at initialization
time, so all RAM is unregistered before starting the guest (!).

Signed-off-by: Hollis Blanchard <hollis@penguinppc.org>
14 years agoppc4xx: correct SDRAM controller warning message condition
Hollis Blanchard [Thu, 5 Aug 2010 00:21:35 +0000 (17:21 -0700)]
ppc4xx: correct SDRAM controller warning message condition

The message "Truncating memory to %d MiB to fit SDRAM controller limits"
should be displayed only when a user chooses an amount of RAM which
can't be represented by the PPC 4xx SDRAM controller (e.g. 129MB, which
would only be valid if the controller supports a bank size of 1MB).

Signed-off-by: Hollis Blanchard <hollis@penguinppc.org>
14 years agoFix "make install" with a cross toolchain
Hollis Blanchard [Thu, 5 Aug 2010 00:21:34 +0000 (17:21 -0700)]
Fix "make install" with a cross toolchain

We must be able to use a non-native strip executable, but not all
versions of 'install' support the --strip-program option (e.g.
OpenBSD). Accordingly, we can't use 'install -s', and we must run strip
separately.

Signed-off-by: Hollis Blanchard <hollis@penguinppc.org>
Cc: blauwirbel@gmail.com
14 years agoPPC: Update openbios binary to r859
Alexander Graf [Thu, 26 Aug 2010 16:15:20 +0000 (18:15 +0200)]
PPC: Update openbios binary to r859

This updates the openBIOS binary to r589, adding support for PPC PV feature
pass-through in KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>
14 years agoPPC: Add PV hypercall transport through fw_cfg
Alexander Graf [Tue, 3 Aug 2010 13:22:42 +0000 (15:22 +0200)]
PPC: Add PV hypercall transport through fw_cfg

On KVM for PPC we need to tell the guest which instructions to use when
doing a hypercall. The clean way to do this is to go through an ioctl
from userspace and passing it on to the guest using the device tree.

So let's do the qemu part here: read out the hypercall and pass it on
to the guest's fw_cfg so openBIOS can read it out and expose it again.

Signed-off-by: Alexander Graf <agraf@suse.de>
14 years agoRearrange block headers
Blue Swirl [Tue, 24 Aug 2010 15:22:24 +0000 (15:22 +0000)]
Rearrange block headers

Changing block.h or blockdev.h resulted in recompiling most objects.

Move DriveInfo typedef and BlockInterfaceType enum definitions
to qemu-common.h and rearrange blockdev.h use to decrease churn.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoMerge remote branch 'qemu-kvm/uq/master' into staging
Anthony Liguori [Mon, 23 Aug 2010 20:10:12 +0000 (15:10 -0500)]
Merge remote branch 'qemu-kvm/uq/master' into staging

14 years agocompile -fsdev and -virtfs cmd line options unconditionally.
Gerd Hoffmann [Fri, 20 Aug 2010 11:52:02 +0000 (13:52 +0200)]
compile -fsdev and -virtfs cmd line options unconditionally.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQemuOpts: make most qemu_*_opts static
Gerd Hoffmann [Fri, 20 Aug 2010 11:52:01 +0000 (13:52 +0200)]
QemuOpts: make most qemu_*_opts static

Switch tree to lookup-by-name using qemu_find_opts().
Also hook up virtfs options so qemu_find_opts works for them too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQemuOpts: allow new option groups be registered at runtime.
Gerd Hoffmann [Fri, 20 Aug 2010 11:52:00 +0000 (13:52 +0200)]
QemuOpts: allow new option groups be registered at runtime.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoVGA: Don't register deprecated VBE range
Alex Williamson [Fri, 20 Aug 2010 21:34:16 +0000 (15:34 -0600)]
VGA: Don't register deprecated VBE range

Old versions of the BOCHs VGA BIOS (cira 2003) made use of VBE
registers at 0xff80/81.  In VBE API version 0xb0c2 these were
moved to 0x1ce/cf.  Unfortunately, QEMU still registers handlers
for the old range.  If a guest attempts to assign an I/O device
overlapping this region, QEMU exits with a hw_error.  Windows
guests seem to like to assign I/O devices to the high end of
the address space, so it's pretty easy to hot add an rtl8139
to a Win2k8 guest and trigger the bug.  I can't find any reason
to register these handlers, so let's remove the cruft.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: Update README file
Luiz Capitulino [Fri, 20 Aug 2010 19:42:32 +0000 (16:42 -0300)]
QMP: Update README file

A number of changes I prefer to do in one shot:

- Fix example
- Small clarifications
- Add multiple monitors example
- Add 'Development Process' section

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP doc: Add 'Stability Considerations' section
Luiz Capitulino [Fri, 20 Aug 2010 19:42:31 +0000 (16:42 -0300)]
QMP doc: Add 'Stability Considerations' section

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP/monitor: update do_info_version() to output broken down version string
Miguel Di Ciurcio Filho [Fri, 20 Aug 2010 19:42:30 +0000 (16:42 -0300)]
QMP/monitor: update do_info_version() to output broken down version string

This code was originally developed by Daniel P. Berrange <berrange@redhat.com>

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQMP: update 'query-version' documentation
Miguel Di Ciurcio Filho [Fri, 20 Aug 2010 19:42:29 +0000 (16:42 -0300)]
QMP: update 'query-version' documentation

Update the documentation of 'query-version' to output the string version broken
down.

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: check fd before calling qemu_set_fd_handler2() in vnc_client_write()
Yoshiaki Tamura [Fri, 20 Aug 2010 10:10:41 +0000 (19:10 +0900)]
vnc: check fd before calling qemu_set_fd_handler2() in vnc_client_write()

Setting fd = -1 to qemu_set_fd_handler2() causes bus error at FD_SET
in main_loop_wait().

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovirtio-serial: Cleanup on device hot-unplug
Amit Shah [Thu, 19 Aug 2010 01:21:04 +0000 (06:51 +0530)]
virtio-serial: Cleanup on device hot-unplug

Free malloc'ed memory, unregister from savevm and clean up virtio-common
bits on device hot-unplug.

This was found performing a migration after device hot-unplug.

Reported-by: <lihuang@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agotarget-i386: svm: Fix MSRPM check
Adam Lackorzynski [Sun, 15 Aug 2010 13:58:32 +0000 (15:58 +0200)]
target-i386: svm: Fix MSRPM check

Correct the calculation of the offset in the msrpm
for the MSR range 0 - 0x1fff.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoexec: remove code duplication in qemu_ram_alloc() and qemu_ram_alloc_from_ptr()
Yoshiaki Tamura [Wed, 18 Aug 2010 06:41:49 +0000 (15:41 +0900)]
exec: remove code duplication in qemu_ram_alloc() and qemu_ram_alloc_from_ptr()

Since most of the code in qemu_ram_alloc() and
qemu_ram_alloc_from_ptr() are duplicated, let
qemu_ram_alloc_from_ptr() to switch by checking void *host, and change
qemu_ram_alloc() to a wrapper.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoexec: replace tabs by spaces.
Yoshiaki Tamura [Wed, 18 Aug 2010 04:30:13 +0000 (13:30 +0900)]
exec: replace tabs by spaces.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoarch_init: replace tabs by spaces.
Yoshiaki Tamura [Wed, 18 Aug 2010 04:30:12 +0000 (13:30 +0900)]
arch_init: replace tabs by spaces.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agopckbd: support for commands 0xf0-0xff: Pulse output bit
Bernhard Kohl [Thu, 19 Aug 2010 12:52:12 +0000 (14:52 +0200)]
pckbd: support for commands 0xf0-0xff: Pulse output bit

I have a guest OS which sends the command 0xfd to the keyboard
controller during initialization. To get rid of the message
"qemu: unsupported keyboard cmd=0x%02x\n" I added support for
the pulse output bit commands.

I found the following explanation here:
http://www.win.tue.nl/~aeb/linux/kbd/scancodes-11.html#ss11.3

Command 0xf0-0xff: Pulse output bit
Bits 3-0 of the output port P2 of the keyboard controller may
be pulsed low for approximately 6 µseconds. Bits 3-0 of this
command specify the output port bits to be pulsed. 0: Bit should
be pulsed. 1: Bit should not be modified. The only useful version
of this command is Command 0xfe.
(For MCA, replace 3-0 by 1-0 in the above.)

Command 0xfe: System reset
Pulse bit 0 of the output port P2 of the keyboard controller.
This will reset the CPU.

Signed-off-by: Bernhard Kohl <bernhard.kohl@nsn.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoReplace qemu_malloc + memset with qemu_mallocz
Blue Swirl [Fri, 20 Aug 2010 21:04:37 +0000 (21:04 +0000)]
Replace qemu_malloc + memset with qemu_mallocz

Replace a qemu_malloc call, followed by a memset, with qemu_mallocz.

Found with this Coccinelle semantic patch, adapted from
Coccinelle test package rule 94:
@@
type T;
expression x;
expression E;
@@

- x = (T)qemu_malloc(E)
+ x = qemu_mallocz(E)
  ...
(
- memset(x,0,E);
|
- memset(x,0,sizeof(*x));
)

Some files (tests/*) had to be filtered out.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoUse ARRAY_SIZE macro
Blue Swirl [Fri, 20 Aug 2010 21:03:24 +0000 (21:03 +0000)]
Use ARRAY_SIZE macro

Replace array size calculations with ARRAY_SIZE macro.

Implemented with this Coccinelle semantic patch, adapted from
Linux kernel:
@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(*E))
+ ARRAY_SIZE(E)

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(E[...]))
+ ARRAY_SIZE(E)

@@
type T;
T[] E;
@@

- (sizeof(E)/sizeof(T))
+ ARRAY_SIZE(E)

Some files (*-dis.c, tests/*) had to be filtered out.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRemove useless NULL check for qemu_strdup return value
Blue Swirl [Thu, 19 Aug 2010 20:24:43 +0000 (20:24 +0000)]
Remove useless NULL check for qemu_strdup return value

Found with this Coccinelle semantic patch:
@@
expression E;
identifier ptr;
identifier fn ~= "qemu_strn?dup";
@@

-ptr = fn(E);
-if (ptr == NULL) { ... }
-
+ptr = fn(E);

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRemove useless NULL checks for qemu_malloc return value
Blue Swirl [Thu, 19 Aug 2010 20:24:39 +0000 (20:24 +0000)]
Remove useless NULL checks for qemu_malloc return value

Found with this Coccinelle semantic patch:
@@
expression E;
identifier ptr;
identifier fn ~= "qemu_mallocz*";
@@

-ptr = fn(E);
-if (ptr == NULL) { ... }
-
+ptr = fn(E);

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosavevm: Reset last block info at beginning of each save
Alex Williamson [Thu, 19 Aug 2010 13:18:42 +0000 (10:18 -0300)]
savevm: Reset last block info at beginning of each save

If we save more than once we need to reset the last block info or else
only the first save has the actual block info and each subsequent save
will only use continue flags, making them unloadable independently.

Found-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Glauber Costa <glommer@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoset proper migration status on ->write error (v5)
Marcelo Tosatti [Thu, 19 Aug 2010 13:18:39 +0000 (10:18 -0300)]
set proper migration status on ->write error (v5)

If ->write fails, declare migration status as MIG_STATE_ERROR.

Also, in buffered_file.c, ->close the object in case of an
error.

Fixes "migrate -d "exec:dd of=file", where dd fails to open file.

Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agortc: Remove TARGET_I386 from qemu-config.c, enables driftfix
Amit Shah [Wed, 23 Jun 2010 14:44:04 +0000 (20:14 +0530)]
rtc: Remove TARGET_I386 from qemu-config.c, enables driftfix

qemu-config.c doesn't contain any target-specific code, and the
TARGET_I386 conditional code didn't get compiled as a result. Removing
this enables the driftfix parameter for rtc.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoQEMUFileBuffered: indicate that we're ready when the underlying file is ready
Avi Kivity [Wed, 7 Jul 2010 16:44:22 +0000 (19:44 +0300)]
QEMUFileBuffered: indicate that we're ready when the underlying file is ready

QEMUFileBuffered stops writing when the underlying QEMUFile is not ready,
and tells its producer so.  However, when the underlying QEMUFile becomes
ready, it neglects to pass that information along, resulting in stoppage
of all data until the next tick (a tenths of a second).

Usually this doesn't matter, because most QEMUFiles used with QEMUFileBuffered
are almost always ready, but in the case of exec: migration this is not true,
due to the small pipe buffers used to connect to the target process.  The
result is very slow migration.

Fix by detecting the readiness notification and propagating it.  The detection
is a little ugly since QEMUFile overloads put_buffer() to send it, but that's
the suject for a different patch.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agosparc escc IUS improvements (SunOS 4.1.4 fix)
Artyom Tarasenko [Sun, 15 Aug 2010 14:04:41 +0000 (16:04 +0200)]
sparc escc IUS improvements (SunOS 4.1.4 fix)

According to scc_escc_um.pdf:
 - Reset Highest IUS must update irq status to allow processing
   of the next priority interrupt.
 - rx interrupt has always higher priority than tx on same channel

The documentation only explicitly says that Reset Highest IUS
command (0x38) clears IUS bits, not that it clears the corresponding
interrupt too, so don't clear interrupts on this command.

The patch allows SunOS 4.1.4 to use the serial ports

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix mingw32 build
Blue Swirl [Sun, 15 Aug 2010 09:46:24 +0000 (09:46 +0000)]
Fix mingw32 build

Don't define qemu_chr_open_eventfd() on Windows.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agowin32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined)
Stefan Weil [Thu, 1 Apr 2010 04:20:07 +0000 (04:20 +0000)]
win32: Avoid compiler warning (WIN32_LEAN_AND_MEAN redefined)

configure adds the macro WIN32_LEAN_AND_MEAN to
QEMU_CFLAGS, and SDL_syswm.h defines it, too.

This results in a compiler warning (redefinition of
WIN32_LEAN_AND_MEAN in SDL_syswm.h. That warning prevents
compilations for win32 with warning = error).

Fix this by removing the definition of WIN32_LEAN_AND_MEAN
before including SDL_syswm.h.

[blauwirbel@gmail.com: rebased]
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agowin32: Add missing function setenv
Stefan Weil [Thu, 1 Jul 2010 00:47:49 +0000 (00:47 +0000)]
win32: Add missing function setenv

Mingw32 does not provide a declaration and implementation of function
setenv (which is used in sdl.c), so this patch adds both.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoDisable build of ivshmem on non-KVM systems
Cam Macdonell [Sat, 14 Aug 2010 23:47:31 +0000 (17:47 -0600)]
Disable build of ivshmem on non-KVM systems

Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoAdd kvm_set_ioeventfd_mmio_long definition for non-KVM systems
Cam Macdonell [Sat, 14 Aug 2010 23:47:30 +0000 (17:47 -0600)]
Add kvm_set_ioeventfd_mmio_long definition for non-KVM systems

Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoTCG: Revert ppc64 tcg_out_movi32 change
Andreas Färber [Sat, 14 Aug 2010 20:52:56 +0000 (22:52 +0200)]
TCG: Revert ppc64 tcg_out_movi32 change

3b6dac34161bc0a342336072643c2f6d17e0ec45 apparently broke the ppc64 TCG target
compilation in the code path without guest base.

Reverting this line fixes the build.

Signed-off-by: Andreas F?rber <andreas.faerber@web.de>
Cc: malc <av1474@comtv.ru>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Richard Henderson <rth@twiddle.net>
Signed-off-by: malc <av1474@comtv.ru>
14 years agoTCG: Fix Darwin/ppc calling convention recognition
Andreas Färber [Sat, 14 Aug 2010 18:51:50 +0000 (20:51 +0200)]
TCG: Fix Darwin/ppc calling convention recognition

5da79c86a3744e3a901c7986c109dd06951befd2 broke compilation on Mac OS X v10.5 ppc.
Apple's GCC 4.0.1 does not define _CALL_DARWIN. Recognize __APPLE__ again as well.

Signed-off-by: Andreas F?rber <andreas.faerber@web.de>
Cc: malc <av1474@comtv.ru>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: J?rgen Lock <nox@jelal.kn-bremen.de>
Cc: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: malc <av1474@comtv.ru>
14 years agoRESEND: Inter-VM shared memory PCI device
Cam Macdonell [Tue, 27 Jul 2010 16:54:13 +0000 (10:54 -0600)]
RESEND: Inter-VM shared memory PCI device

resend for bug fix related to removal of irqfd

Support an inter-vm shared memory device that maps a shared-memory object as a
PCI device in the guest.  This patch also supports interrupts between guest by
communicating over a unix domain socket.  This patch applies to the qemu-kvm
repository.

    -device ivshmem,size=<size in format accepted by -m>[,shm=<shm name>]

Interrupts are supported between multiple VMs by using a shared memory server
by using a chardev socket.

    -device ivshmem,size=<size in format accepted by -m>[,shm=<shm name>]
           [,chardev=<id>][,msi=on][,ioeventfd=on][,vectors=n][,role=peer|master]
    -chardev socket,path=<path>,id=<id>

The shared memory server, sample programs and init scripts are in a git repo here:

    www.gitorious.org/nahanni

Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoSupport marking a device as non-migratable
Cam Macdonell [Tue, 27 Jul 2010 00:11:00 +0000 (18:11 -0600)]
Support marking a device as non-migratable

A non-migratable device should be removed before migration and re-added after.

Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd function to assign ioeventfd to MMIO.
Cam Macdonell [Tue, 27 Jul 2010 00:10:59 +0000 (18:10 -0600)]
Add function to assign ioeventfd to MMIO.

Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoDevice specification for shared memory PCI device
Cam Macdonell [Tue, 27 Jul 2010 00:10:58 +0000 (18:10 -0600)]
Device specification for shared memory PCI device

Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoAdd qemu_ram_alloc_from_ptr function
Cam Macdonell [Tue, 27 Jul 2010 00:10:57 +0000 (18:10 -0600)]
Add qemu_ram_alloc_from_ptr function

Provide a function to add an allocated region of memory to the qemu RAM.

This patch is copied from Marcelo's qemu_ram_map() in qemu-kvm and given the
clearer name qemu_ram_alloc_from_ptr().

Signed-off-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 9 Aug 2010 13:25:12 +0000 (08:25 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging

14 years agomicroblaze: Fix the target version of stat64 struct
Edgar E. Iglesias [Mon, 9 Aug 2010 08:13:33 +0000 (10:13 +0200)]
microblaze: Fix the target version of stat64 struct

MicroBlaze needs TARGET_STAT64_HAS_BROKEN_ST_INO.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
14 years agoaudio/sdl: return on error
malc [Sat, 7 Aug 2010 16:03:05 +0000 (20:03 +0400)]
audio/sdl: return on error

Signed-off-by: malc <av1474@comtv.ru>
14 years agomips: Add support for VInt and VEIC irq modes
Edgar E. Iglesias [Fri, 6 Aug 2010 10:21:16 +0000 (12:21 +0200)]
mips: Add support for VInt and VEIC irq modes

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
14 years agoaudio/sdl: be more anal about errors
malc [Fri, 6 Aug 2010 09:09:41 +0000 (13:09 +0400)]
audio/sdl: be more anal about errors

Signed-off-by: malc <av1474@comtv.ru>
14 years agoaudio: make audio_pt_init block all signals
malc [Fri, 6 Aug 2010 09:08:46 +0000 (13:08 +0400)]
audio: make audio_pt_init block all signals

Signed-off-by: malc <av1474@comtv.ru>
14 years agokvm: remove guest triggerable abort()
Gleb Natapov [Wed, 28 Jul 2010 15:13:23 +0000 (18:13 +0300)]
kvm: remove guest triggerable abort()

This abort() condition is easily triggerable by a guest if it configures
pci bar with unaligned address that overlaps main memory.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
14 years agokvm: Don't walk memory_size == 0 slots in kvm_client_migration_log
Alex Williamson [Wed, 14 Jul 2010 19:36:49 +0000 (13:36 -0600)]
kvm: Don't walk memory_size == 0 slots in kvm_client_migration_log

If we've unregistered a memory area, we should avoid calling
qemu_get_ram_ptr() on the left over phys_offset cruft in the
slot array.  Now that we support removing ramblocks, the
phys_offset ram_addr_t can go away and cause a lookup fault
and abort.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
14 years agosparc32: use FW_CFG_CMDLINE_SIZE
Blue Swirl [Tue, 3 Aug 2010 21:00:58 +0000 (21:00 +0000)]
sparc32: use FW_CFG_CMDLINE_SIZE

Add support for getting kernel command line size with
FW_CFG_CMDLINE_SIZE.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoide: Avoid canceling IDE DMA
Andrea Arcangeli [Tue, 27 Jul 2010 19:04:36 +0000 (21:04 +0200)]
ide: Avoid canceling IDE DMA

The reason for not actually canceling the I/O is because with
virtualization and lots of VM running, a guest fs may mistake a
overload of the host, as an IDE timeout. So rather than canceling the
I/O, it's safer to wait I/O completion and simulate that the I/O has
completed just before the io cancellation was requested by the
guest. This way if ntfs or an app writes data without checking for
-EIO retval, and it thinks the write has succeeded, it's less likely
to run into troubles. Similar issues for reads.

Furthermore because the DMA operation is splitted into many synchronous
aio_read/write if there's more than one entry in the SG table, without this
patch the DMA would be cancelled in the middle, something we've no idea if it
happens on real hardware too or not. Overall this seems a great risk for zero
gain.

This approach is sure safer than previous code given we can't pretend all guest
fs code out there to check for errors and reply the DMA if it was completed
partially, given a timeout would never materialize on a real harddisk unless
there are defective blocks (and defective blocks are practically only an issue
for reads never for writes in any recent hardware as writing to blocks is the
way to fix them) or the harddisk breaks as a whole.

Signed-off-by: Izik Eidus <ieidus@redhat.com>
Signed-off-by: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Change bdrv_eject() not to drop the image
Markus Armbruster [Tue, 27 Jul 2010 12:02:01 +0000 (14:02 +0200)]
block: Change bdrv_eject() not to drop the image

bdrv_eject() gets called when a device model opens or closes the tray.

If the block driver implements method bdrv_eject(), that method gets
called.  Drivers host_cdrom implements it, and it opens and closes the
physical tray, and nothing else.  When a device model opens, then
closes the tray, media changes only if the user actively changes the
physical media while the tray is open.  This is matches how physical
hardware behaves.

If the block driver doesn't implement method bdrv_eject(), we do
something quite different: opening the tray severs the connection to
the image by calling bdrv_close(), and closing the tray does nothing.
When the device model opens, then closes the tray, media is gone,
unless the user actively inserts another one while the tray is open,
with a suitable change command in the monitor.  This isn't how
physical hardware behaves.  Rather inconvenient when programs
"helpfully" eject media to give you a chance to change it.  The way
bdrv_eject() behaves here turns that chance into a must, which is not
what these programs or their users expect.

Change the default action not to call bdrv_close().  Instead, note the
tray status in new BlockDriverState member tray_open.  Use it in
bdrv_is_inserted().

Arguably, the device models should keep track of tray status
themselves.  But this is less invasive.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Fix bdrv_has_zero_init
Kevin Wolf [Wed, 28 Jul 2010 09:26:29 +0000 (11:26 +0200)]
block: Fix bdrv_has_zero_init

Assuming that any image on a block device is not properly zero-initialized is
actually wrong: Only raw images have this problem. Any other image format
shouldn't care about it, they initialize everything properly themselves.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock migration: replace tabs by spaces.
Yoshiaki Tamura [Mon, 26 Jul 2010 04:25:41 +0000 (13:25 +0900)]
block migration: replace tabs by spaces.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoloadvm: improve tests before bdrv_snapshot_goto()
Miguel Di Ciurcio Filho [Mon, 19 Jul 2010 18:25:01 +0000 (15:25 -0300)]
loadvm: improve tests before bdrv_snapshot_goto()

This patch improves the resilience of the load_vmstate() function, doing
further and better ordered tests.

In load_vmstate(), if there is any error on bdrv_snapshot_goto(), except if the
error is on VM state device, load_vmstate() will return zero and the VM will be
started with major corruption chances.

The current process:
- test if there is any writable device without snapshot support
    - if exists return -error
- get the device that saves the VM state, possible return -error but unlikely
because it was tested earlier
- flush I/O
- run bdrv_snapshot_goto() on devices
    - if fails, give an warning and goes to the next (not good!)
    - if fails on the VM state device, return zero (not good!)
- check if the requested snapshot exists on the device that saves the VM state
and the state is not zero
    - if fails return -error
- open the file with the VM state
    - if fails return -error
- load the VM state
    - if fails return -error
- return zero

New behavior:
- get the device that saves the VM state
    - if fails return -error
- check if the requested snapshot exists on the device that saves the VM state
and the state is not zero
    - if fails return -error
- test if there is any writable device without snapshot support
    - if exists return -error
- test if the devices with snapshot support have the requested snapshot
    - if anyone fails, return -error
- flush I/O
- run snapshot_goto() on devices
    - if anyone fails, return -error
- open the file with the VM state
    - if fails return -error
- load the VM state
    - if fails return -error
- return zero

do_loadvm must not call vm_start if any error has occurred in load_vmstate.

Signed-off-by: Miguel Di Ciurcio Filho <miguel.filho@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Change bdrv_commit to handle multiple sectors at once
Kevin Wolf [Fri, 16 Jul 2010 15:17:01 +0000 (17:17 +0200)]
block: Change bdrv_commit to handle multiple sectors at once

bdrv_commit copies the image to its backing file sector by sector, which
is (surprise!) relatively slow. Let's take a larger buffer and handle more
sectors at once if possible.

With a 1G qcow2 file, this brought the time bdrv_commit takes down from
5:06 min to 1:14 min for me.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agofix last cpu timer initialization
Artyom Tarasenko [Mon, 2 Aug 2010 17:58:21 +0000 (19:58 +0200)]
fix last cpu timer initialization

The timer #0 is the system timer, so the timer #num_cpu is the
timer of the last CPU, and it must be initialized in slavio_timer_reset.

Don't mark non-existing timers as running.

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoInitialize a variable in all cases
Blue Swirl [Sat, 31 Jul 2010 19:43:37 +0000 (19:43 +0000)]
Initialize a variable in all cases

Commit d167f9bc06a577d6c85b8ed6991c1efe175aae7d missed this one:
/src/qemu/ui/vnc-enc-tight.c:1483: warning: 'ret' may be used uninitialized in this function

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix uint8_t comparison with negative value
Blue Swirl [Sat, 31 Jul 2010 19:40:17 +0000 (19:40 +0000)]
Fix uint8_t comparison with negative value

Commit 7bccf57383cca60a778d5c543ac80c9f62d89ef2 missed this one:
/src/qemu/ui/vnc-enc-tight.c: In function 'send_sub_rect':
/src/qemu/ui/vnc-enc-tight.c:1527: warning: comparison is always true due to limited range of data type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix a warning on OpenSolaris
Blue Swirl [Sat, 31 Jul 2010 19:40:13 +0000 (19:40 +0000)]
Fix a warning on OpenSolaris

Add a missing #include statement to avoid a warning:
/src/qemu/net/tap-solaris.c: In function 'tap_open':
/src/qemu/net/tap-solaris.c:189: warning: implicit declaration of function 'error_report'

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoCorrectly identify multiple cpus in SMP systems
Hervé Poussineau [Sat, 31 Jul 2010 10:29:03 +0000 (12:29 +0200)]
Correctly identify multiple cpus in SMP systems

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoRemove unused constant
Hervé Poussineau [Sat, 31 Jul 2010 09:10:45 +0000 (11:10 +0200)]
Remove unused constant

Remove unused constant MIPS_FCR0

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agojazz led: Fix debug prints
Hervé Poussineau [Sat, 31 Jul 2010 09:05:28 +0000 (11:05 +0200)]
jazz led: Fix debug prints

Add a macro to easily enable/disable debug prints
Also fix wrong printf formatters

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoxilinx-s3adsp: Add support for loading u-boot images.
Edgar E. Iglesias [Fri, 30 Jul 2010 22:50:17 +0000 (00:50 +0200)]
xilinx-s3adsp: Add support for loading u-boot images.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agoxilinx-s3adsp: Fix loading of raw binaries.
Edgar E. Iglesias [Fri, 30 Jul 2010 22:42:07 +0000 (00:42 +0200)]
xilinx-s3adsp: Fix loading of raw binaries.

Set high to a word aligned address beyond loaded image.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agoRemove unused eventfd.h
Mike McCormack [Wed, 28 Jul 2010 22:50:14 +0000 (07:50 +0900)]
Remove unused eventfd.h

This header is not present on my system and causes a build
failure, but is also not used in these files, so remove it.

Signed-off-by: Mike McCormack <mikem@ring3k.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomigration: Accept 'cont' only after successful incoming migration
Amit Shah [Tue, 27 Jul 2010 10:19:19 +0000 (15:49 +0530)]
migration: Accept 'cont' only after successful incoming migration

When a 'cont' is issued on a VM that's just waiting for an incoming
migration, the VM reboots and boots into the guest, possibly corrupting
its storage since it could be shared with another VM running elsewhere.

Ensure that a VM started with '-incoming' is only run when an incoming
migration successfully completes.

A new qerror, QERR_MIGRATION_EXPECTED, is added to signal that 'cont'
failed due to no incoming migration has been attempted yet.

Reported-by: Laine Stump <laine@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomips64el: fulong: PCI_DEVFN() clean up.
Isaku Yamahata [Tue, 27 Jul 2010 06:24:47 +0000 (15:24 +0900)]
mips64el: fulong: PCI_DEVFN() clean up.

Use PCI_DEVFN() where appropriate.
The resulted stripped binary remains same
with/without thie patch.

Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoremove pointless if from vl.c
Joel Schopp [Wed, 21 Jul 2010 20:05:17 +0000 (15:05 -0500)]
remove pointless if from vl.c

We already set sockets to nonzero in the code above.
So this if statement always evaluates true.  Remove it.

Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agofix variable type in qemu-io.c
Joel Schopp [Wed, 21 Jul 2010 20:05:16 +0000 (15:05 -0500)]
fix variable type in qemu-io.c

The variable len can get a negative return value from cvtnum,
which we check for, but which is impossible with the current
unsigned variable type.  Currently the if(len < 0) check is
pointless.  This patch fixes that.

Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoremove dead code from hw/loader.c
Joel Schopp [Wed, 21 Jul 2010 20:05:15 +0000 (15:05 -0500)]
remove dead code from hw/loader.c

Removing dead code.  Above we already continued when
rom->addr + valuegreaterthan0 < addr so this condition is always false.

Signed-off-by: Joel Schopp <jschopp@austin.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agosavevm: Fix memory leak of compat struct
Alex Williamson [Wed, 21 Jul 2010 14:35:31 +0000 (08:35 -0600)]
savevm: Fix memory leak of compat struct

Forgot to check for and free these.

Found-by: Zachary Amsden <zamsden@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agovirtio-serial: Check if more max_ports specified than we can handle
Amit Shah [Wed, 21 Jul 2010 09:38:30 +0000 (15:08 +0530)]
virtio-serial: Check if more max_ports specified than we can handle

Currently virtio-serial supports a maximum of 31 ports. Specifying the
'max_ports' parameter to be > 31 on the cmd line causes badness.

Ensure we initialise virtio-serial only if max_ports is within the
supported range.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoMerge branch 'for-anthony' of git://repo.or.cz/qemu/kevin
Aurelien Jarno [Fri, 30 Jul 2010 19:12:24 +0000 (21:12 +0200)]
Merge branch 'for-anthony' of git://repo.or.cz/qemu/kevin

* 'for-anthony' of git://repo.or.cz/qemu/kevin:
  Fix -snapshot deleting images on disk change
  block: Use error codes from lower levels for error message
  block: default to 0 minimal / optiomal I/O size
  move 'unsafe' to end of caching modes in help
  virtio-blk: Create exit function to unregister savevm
  block migration: propagate return value when bdrv_write() returns < 0
  ide/atapi: add support for GET EVENT STATUS NOTIFICATION

14 years agolinux-user: fix build on hosts not using guest base
Aurelien Jarno [Fri, 30 Jul 2010 19:09:10 +0000 (21:09 +0200)]
linux-user: fix build on hosts not using guest base

Commit 68a1c816868b3e35a1da698af412b29e61b1948a broke qemu on hosts not
using guest base. It uses reserved_va unconditionally in mmap.c. To
avoid to many #ifdef #endif blocks, define RESERVED_VA as either
reserved_va or 0ul, and use it instead of reserved_va, similarly to what
has been done with guest_base/GUEST_BASE.

14 years agolinux-user: Protect against allocation failure in load_symbols.
Richard Henderson [Thu, 29 Jul 2010 16:37:01 +0000 (09:37 -0700)]
linux-user: Protect against allocation failure in load_symbols.

Cc: malc <av1474@comtv.ru>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: malc <av1474@comtv.ru>
14 years agocris: Correct settls1 testcase.
Edgar E. Iglesias [Thu, 29 Jul 2010 15:15:28 +0000 (17:15 +0200)]
cris: Correct settls1 testcase.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agocris: Correct ADDO and ADDOQ testcases.
Edgar E. Iglesias [Thu, 29 Jul 2010 13:42:06 +0000 (15:42 +0200)]
cris: Correct ADDO and ADDOQ testcases.

Verified on real HW.

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
14 years agolinux-user: Re-use load_elf_image for the main binary.
Richard Henderson [Tue, 27 Jul 2010 17:25:38 +0000 (10:25 -0700)]
linux-user: Re-use load_elf_image for the main binary.

This requires moving the PT_INTERP extraction and GUEST_BASE
handling into load_elf_image.  Key this off a non-null pointer
argument to receive the interpreter name.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agolinux-user: Extract load_elf_image from load_elf_interp.
Richard Henderson [Tue, 27 Jul 2010 17:25:37 +0000 (10:25 -0700)]
linux-user: Extract load_elf_image from load_elf_interp.

Moving toward a single copy of the elf binary loading code.
Fill in the details of the loaded image into a struct image_info.

Adjust create_elf_tables to read from such structures instead
of from a collection of passed arguments.  Don't return error
values from load_elf_interp; always exit(-1) with a message to
stderr.  Collect elf_interpreter handling in load_elf_binary
to a common spot.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agolinux-user: Remove partial support for a.out interpreters.
Richard Henderson [Tue, 27 Jul 2010 17:25:36 +0000 (10:25 -0700)]
linux-user: Remove partial support for a.out interpreters.

At the bottom of the a.out support was the unimplemented load_aout_interp
function.  There were other portions of the support that didn't look
right; when I went to look in the Linux kernel for clarification, I found
that the support for such interpreters has been removed from binfmt_elf.
There doesn't seem to be any reason to keep this broken support in qemu.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agolinux-user: Put the stack guard page at the top.
Richard Henderson [Tue, 27 Jul 2010 17:25:35 +0000 (10:25 -0700)]
linux-user: Put the stack guard page at the top.

There are no supported stack-grows-up targets.  We were putting
the guard page at the highest address, i.e. the bottom of the stack.
Use the maximum of host and guest page size for the guard size.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agolinux-user: Improve consistency checking in elf headers.
Richard Henderson [Tue, 27 Jul 2010 17:25:34 +0000 (10:25 -0700)]
linux-user: Improve consistency checking in elf headers.

Validate more fields of the elf header.  Extract those checks
into two common functions to be used in both load_elf_interp
and load_elf_binary.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>