sdk/emulator/qemu.git
14 years agoKVM: PPC: Add level based interrupt logic
Alexander Graf [Mon, 30 Aug 2010 11:49:15 +0000 (13:49 +0200)]
KVM: PPC: Add level based interrupt logic

KVM on PowerPC used to have completely broken interrupt logic. Usually,
interrupts work by having a PIC that pulls a line up/down, so the CPU knows
that an interrupt is active. This line stays active until some action is
done to the PIC to release the line.

On KVM for PPC, we just checked if there was an interrupt pending and pulled
a line in the kernel module. We never released it though, hoping that kernel
space would just declare an interrupt as released when injected - which is
wrong.

To fix this, we need to completely redesign the interrupt injection logic.
Whenever an interrupt line gets triggered, we need to notify kernel space
that the line is up. Whenever it gets released, we do the same. This way
we can assure that the interrupt state is always known to kernel space.

This fixes random stalls in KVM guests on PowerPC that were waiting for
an interrupt while everyone else thought they received it already.

Signed-off-by: Alexander Graf <agraf@suse.de>
14 years agovnc: use bswapNN() rather than bswap_NN()
Izumi Tsutsui [Sun, 8 Aug 2010 09:54:05 +0000 (18:54 +0900)]
vnc: use bswapNN() rather than bswap_NN()

bswap_NN() variants are not always available in CONFIG_MACHINE_BSWAP_H case
and bswapNN() are public APIs in "bswap.h".

Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovnc: tight: remove unused variable
Serge Ziryukin [Sat, 28 Aug 2010 20:24:33 +0000 (23:24 +0300)]
vnc: tight: remove unused variable

Signed-off-by: Serge Ziryukin <ftrvxmtrx@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix ivshmem build on 32-bit hosts
Avi Kivity [Sun, 29 Aug 2010 09:43:15 +0000 (12:43 +0300)]
Fix ivshmem build on 32-bit hosts

stat() fields can be more or less anything depending on configuration, cast
explicitly to uint64_t to avoid printf() format mismatches.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agovirtio-9p: Make sure -virtfs option works correctly
Aneesh Kumar K.V [Thu, 2 Sep 2010 16:17:59 +0000 (21:47 +0530)]
virtio-9p: Make sure -virtfs option works correctly

When making copy of arguments we were doing partial copy

Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agohw/ivshmem.c don't check for negative values on unsigned data types
Jes Sorensen [Mon, 30 Aug 2010 10:31:33 +0000 (12:31 +0200)]
hw/ivshmem.c don't check for negative values on unsigned data types

There is no need to check for dest < 0 or vector >= 0 as both are
uint16_t.

This should fix problems with broken build with aggressive compiler
flags. Reported by Xudong Hao <xudong.hao@intel.com>

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Acked-by: Cam Macdonell <cam@cs.ualberta.ca>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoload_multiboot(): get_image_size() returns int
Jes Sorensen [Tue, 31 Aug 2010 07:30:38 +0000 (09:30 +0200)]
load_multiboot(): get_image_size() returns int

Do not store return of get_image_size() in a uint32_t as it makes it
impossible to detect error returns from get_image_size.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoChange DPRINTF() to do{}while(0) to avoid compiler warning
Jes Sorensen [Tue, 31 Aug 2010 07:30:37 +0000 (09:30 +0200)]
Change DPRINTF() to do{}while(0) to avoid compiler warning

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agosize_t is unsigned, change to ssize_t to handle errors from tight_compress_data()
Jes Sorensen [Tue, 31 Aug 2010 07:30:36 +0000 (09:30 +0200)]
size_t is unsigned, change to ssize_t to handle errors from tight_compress_data()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix repeated typo: was "end if list" instead of "end of list"
Jes Sorensen [Tue, 31 Aug 2010 07:30:35 +0000 (09:30 +0200)]
Fix repeated typo: was "end if list" instead of "end of list"

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRespect return value from nbd_client()
Jes Sorensen [Tue, 31 Aug 2010 07:30:34 +0000 (09:30 +0200)]
Respect return value from nbd_client()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoRemove unused argument for nbd_client()
Jes Sorensen [Tue, 31 Aug 2010 07:30:33 +0000 (09:30 +0200)]
Remove unused argument for nbd_client()

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix OpenBSD linker warning
Blue Swirl [Tue, 31 Aug 2010 20:16:59 +0000 (20:16 +0000)]
Fix OpenBSD linker warning

Fix a warning from OpenBSD linker:
../libhw32/vl.o(.text+0x5c3c): In function `main':
/src/qemu/vl.c:2335: warning: sprintf() is often misused, please use snprintf()

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoacpi: fix file size check with -acpitable.
Isaku Yamahata [Wed, 28 Jul 2010 23:08:42 +0000 (23:08 +0000)]
acpi: fix file size check with -acpitable.

acpi table file can be modified during load so file size check
should be more strict.
pointer calculation should be after qemu_realloc(). not before realloc().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.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>