sdk/emulator/qemu.git
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 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>
14 years agolinux-user: Load symbols from the interpreter.
Richard Henderson [Tue, 27 Jul 2010 17:25:33 +0000 (10:25 -0700)]
linux-user: Load symbols from the interpreter.

First, adjust load_symbols to accept a load_bias parameter.  At the same
time, read the entire section header table in one go, use pread instead
f lseek+read for the symbol and string tables, and properly free
allocated structures on error exit paths.

Second, adjust load_elf_interp to compute load_bias.  This requires
finding out the built-in load addresses.  Which allows us to honor a
pre-linked interpreter image when possible, and eliminate the hard-coded
INTERP_MAP_SIZE value.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agolinux-user: Clean up byte-swapping in elfload.c.
Richard Henderson [Tue, 27 Jul 2010 17:25:32 +0000 (10:25 -0700)]
linux-user: Clean up byte-swapping in elfload.c.

Remove ifdefs from code by defining empty inline functions
when byte swapping isn't needed.  Push loops over swapping
arrays of structures into the swapping functions.

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

The only consideration on this value is the target endianness.
The existing defines were incorrect for alpha and sh4eb.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agolinux-user: Reduce lseek+reads while loading elf files.
Richard Henderson [Tue, 27 Jul 2010 17:25:30 +0000 (10:25 -0700)]
linux-user: Reduce lseek+reads while loading elf files.

Define BPRM_BUF_SIZE to 1k and read that amount initially.  If the
data we want from the binary is in this buffer, use it instead of
reading from the file again.

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

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agoAdd more DT_* and AT_* constants to qemu's copy of elf.h.
Richard Henderson [Tue, 27 Jul 2010 17:25:28 +0000 (10:25 -0700)]
Add more DT_* and AT_* constants to qemu's copy of elf.h.

Moving some PPC AT_* constants from elfload.c at the same time.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agolinux-user: Handle filesz < memsz for any PT_LOAD segment.
Richard Henderson [Tue, 27 Jul 2010 17:25:27 +0000 (10:25 -0700)]
linux-user: Handle filesz < memsz for any PT_LOAD segment.

I caught padzero not properly initializing the .bss segment
on a statically linked Alpha program.  Rather than a minimal
patch, replace the gross code with a single mmap+memset.

Share more code between load_elf_interp and load_elf_binary.

Legally, an ELF program need not have just a single .bss;
and PT_LOAD segment can have memsz > filesz.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agoUpdate version for 0.13.x
Anthony Liguori [Wed, 28 Jul 2010 12:58:15 +0000 (07:58 -0500)]
Update version for 0.13.x

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoFix mingw32 build
Blue Swirl [Tue, 27 Jul 2010 17:26:08 +0000 (17:26 +0000)]
Fix mingw32 build

Fix mingw32 build errors like
/src/qemu/ui/vnc-enc-tight.c: In function 'tight_detect_smooth_image24':
/src/qemu/ui/vnc-enc-tight.c:119: error: 'uint' undeclared (first use in this function)

Replace 'uint' with proper 'unsigned int'.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoInitialize a variable in all cases
Blue Swirl [Tue, 27 Jul 2010 15:34:10 +0000 (15:34 +0000)]
Initialize a variable in all cases

Fix a warning with some GCCs:
/src/qemu/ui/vnc-enc-tight.c: In function `send_sub_rect_nojpeg':
/src/qemu/ui/vnc-enc-tight.c:1458: warning: `ret' might be used uninitialized in this function

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoFix uint8_t comparisons with negative values
Blue Swirl [Tue, 27 Jul 2010 15:32:39 +0000 (15:32 +0000)]
Fix uint8_t comparisons with negative values

Fix the following warnings:
/src/qemu/hw/ide/core.c: In function `ide_drive_pio_post_load':
/src/qemu/hw/ide/core.c:2767: warning: comparison is always false due to limited range of data type

/src/qemu/ui/vnc-enc-tight.c: In function `tight_detect_smooth_image':
/src/qemu/ui/vnc-enc-tight.c:284: warning: comparison is always true due to limited range of data type
/src/qemu/ui/vnc-enc-tight.c:297: warning: comparison is always true due to limited range of data type
/src/qemu/ui/vnc-enc-tight.c: In function `tight_encode_indexed_rect16':
/src/qemu/ui/vnc-enc-tight.c:456: warning: comparison is always false due to limited range of data type
/src/qemu/ui/vnc-enc-tight.c: In function `tight_encode_indexed_rect32':
/src/qemu/ui/vnc-enc-tight.c:457: warning: comparison is always false due to limited range of data type

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
14 years agoUpdate version for 0.13.0-rc0
Anthony Liguori [Tue, 27 Jul 2010 12:39:42 +0000 (07:39 -0500)]
Update version for 0.13.0-rc0

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: better default values for VNC options
Corentin Chary [Wed, 7 Jul 2010 18:58:06 +0000 (20:58 +0200)]
vnc: better default values for VNC options

vnc_jpeg and vnc_png are now "auto" by default, this means that
if the dependencies are installed (libjpeg or libpng), then they
will be enabled.

vnc_thread is disabled by default. It should be enabled by default
as soon as it's stable enougth.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: split send_sub_rect
Corentin Chary [Wed, 7 Jul 2010 18:58:05 +0000 (20:58 +0200)]
vnc: tight: split send_sub_rect

Split send_sub_rect in send_sub_rect_jpeg and send_sub_rect_nojpeg to
remove all these #ifdef CONFIG_JPEG.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: fix rgb_prepare_row
Corentin Chary [Wed, 7 Jul 2010 18:58:04 +0000 (20:58 +0200)]
vnc: tight: fix rgb_prepare_row

rgb_prepare_row bpp depends on the server display surface, not
the client.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: add missing lock for vnc_cursor_define()
Corentin Chary [Wed, 7 Jul 2010 18:58:03 +0000 (20:58 +0200)]
vnc: add missing lock for vnc_cursor_define()

All vnc_write() calls must be locked (except the ones present before
the protocol initialization).

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: threaded VNC server
Corentin Chary [Wed, 7 Jul 2010 18:58:02 +0000 (20:58 +0200)]
vnc: threaded VNC server

Implement a threaded VNC server using the producer-consumer model.
The main thread will push encoding jobs (a list a rectangles to update)
in a queue, and the VNC worker thread will consume that queue and send
framebuffer updates to the output buffer.

The threaded VNC server can be enabled with ./configure --enable-vnc-thread.

If you don't want it, just use ./configure --disable-vnc-thread and a syncrhonous
queue of job will be used (which as exactly the same behavior as the old queue).
If you disable the VNC thread, all thread related code will not be built and there will
be no overhead.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoqemu-thread: add qemu_mutex/cond_destroy and qemu_mutex_exit
Corentin Chary [Wed, 7 Jul 2010 18:58:01 +0000 (20:58 +0200)]
qemu-thread: add qemu_mutex/cond_destroy and qemu_mutex_exit

Add some missing functions in qemu-thread. Currently qemu-thread
is only used for io-thread but it will used by the vnc server soon
and we need those functions instead of calling pthread directly.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: fix tight png memory leak
Corentin Chary [Wed, 7 Jul 2010 18:58:00 +0000 (20:58 +0200)]
vnc: fix tight png memory leak

The tight.png buffer was never released.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: encapsulate encoding members
Corentin Chary [Wed, 7 Jul 2010 18:57:59 +0000 (20:57 +0200)]
vnc: encapsulate encoding members

This will allow to implement the threaded VNC server in a
more cleaner way.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: stop using qdict for palette stuff
Corentin Chary [Wed, 7 Jul 2010 18:57:58 +0000 (20:57 +0200)]
vnc: tight: stop using qdict for palette stuff

Profiling with callgrind seems to show that a lot of time is spent
in the palette code (mostly due to memory allocation and qdict to int
conversion).

This patch adds a VncPalette implementation. The palette is stored
in a hash table, like qdict, but which does way less memory allocations,
and doesn't suffer from the QObject overhead.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: specific zlib level and filters for each compression level
Corentin Chary [Wed, 7 Jul 2010 18:57:57 +0000 (20:57 +0200)]
vnc: tight: specific zlib level and filters for each compression level

Disable png filters for lower compression levels. This should lower
the CPU consumption and reduce encoding time.

This isn't in tight_conf because:
* tight_conf structure must not change, because it's shared with other
  tight implementations (libvncserver, etc..).
* it'd exceed the 80 col limit.
* PNG_ macros are only defined if CONFIG_VNC_PNG is defined

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight add PNG encoding
Corentin Chary [Wed, 7 Jul 2010 18:57:56 +0000 (20:57 +0200)]
vnc: tight add PNG encoding

Introduce a new encoding: VNC_ENCODING_TIGHT_PNG [1] (-269) with a new
tight filter VNC_TIGHT_PNG (0x0A). When the client tells it supports the Tight PNG
encoding, the server will use tight, but will always send encoding pixels using
PNG instead of zlib. If the client also told it support JPEG, then the server can
send JPEG, because PNG will only be used in the cases zlib was used in normal tight.

This encoding was introduced to speed up HTML5 based VNC clients like noVNC [2], but
can also be used on devices like iPhone where PNG can be rendered in hardware.

[1] http://wiki.qemu.org/VNC_Tight_PNG
[2] http://github.com/kanaka/noVNC/

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: remove a memleak in send_jpeg_rect()
Corentin Chary [Wed, 7 Jul 2010 18:57:55 +0000 (20:57 +0200)]
vnc: tight: remove a memleak in send_jpeg_rect()

buf was never freed.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: don't forget do at the last color
Corentin Chary [Wed, 7 Jul 2010 18:57:54 +0000 (20:57 +0200)]
vnc: tight: don't forget do at the last color

While using indexed colors, the last color was never added to the palette.
Triggered with ubuntu livecd.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: rename vnc-encoding-* vnc-enc-*
Corentin Chary [Wed, 7 Jul 2010 18:57:53 +0000 (20:57 +0200)]
vnc: rename vnc-encoding-* vnc-enc-*

For the same reason that we don't use vnc-authentication-sasl.c but
vnc-auth-sals.c. Because it's tooooo long.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoui: move all ui components in ui/
Corentin Chary [Wed, 7 Jul 2010 18:57:52 +0000 (20:57 +0200)]
ui: move all ui components in ui/

Move sdl, vnc, curses and cocoa UI into ui/ to cleanup
the root directory. Also remove some unnecessary explicit
targets from Makefile.

aliguori: fix build when srcdir != objdir

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: add lossy option
Corentin Chary [Wed, 7 Jul 2010 18:57:51 +0000 (20:57 +0200)]
vnc: add lossy option

The lossy option can be used to enable lossy compression
methods like gradient or jpeg. This patch disable them by
default.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: JPEG should be disabled if the client don't set tight quality
Corentin Chary [Wed, 7 Jul 2010 18:57:50 +0000 (20:57 +0200)]
vnc: JPEG should be disabled if the client don't set tight quality

Disable JPEG compression by default and only enable it if the
VNC client has sent the requested quality.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovnc: tight: add JPEG and gradient subencoding with smooth image detection
Corentin Chary [Wed, 7 Jul 2010 18:57:49 +0000 (20:57 +0200)]
vnc: tight: add JPEG and gradient subencoding with smooth image detection

Add gradient filter and JPEG compression with an heuristic to detect how
lossy the comppression will be. This code has been adapted from
libvncserver/tight.c.

JPEG support can be enabled/disabled at compile time with --enable-vnc-jpeg
and --disable-vnc-jpeg.

Signed-off-by: Corentin Chary <corentincj@iksaif.net>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoInitial documentation for migration
Juan Quintela [Mon, 26 Jul 2010 19:38:46 +0000 (21:38 +0200)]
Initial documentation for migration

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoide: fix migration in the middle of a bmdma transfer
Juan Quintela [Mon, 26 Jul 2010 19:38:45 +0000 (21:38 +0200)]
ide: fix migration in the middle of a bmdma transfer

It reintroduces
    Revert "ide save/restore pio/atapi cmd transfer fields and io buffer"

but using subsections.  Added bonus is the addition of ide_dummy_transfer_stop
to transfer_end_table, that was missing.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoide: fix migration in the middle of pio operation
Juan Quintela [Mon, 26 Jul 2010 19:38:44 +0000 (21:38 +0200)]
ide: fix migration in the middle of pio operation

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agovmstate: add subsections code
Juan Quintela [Mon, 26 Jul 2010 19:38:43 +0000 (21:38 +0200)]
vmstate: add subsections code

This commit adds subsections for each device section.
Subsections is the way to handle information that don't need to be sent
to de destination of a migration because its values are not needed.  It is
the way to handle optional information.  Notice that only the source can
decide if the information is optional or not.  The destination needs to
understand all subsections that it receives to have a sucessful load.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "ide save/restore current transfer fields"
Juan Quintela [Mon, 26 Jul 2010 19:38:42 +0000 (21:38 +0200)]
Revert "ide save/restore current transfer fields"

This reverts commit 42ee76fe82093ba914f0dc83d2decbcf68866144.

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoRevert "ide save/restore pio/atapi cmd transfer fields and io buffer"
Juan Quintela [Mon, 26 Jul 2010 19:38:41 +0000 (21:38 +0200)]
Revert "ide save/restore pio/atapi cmd transfer fields and io buffer"

This reverts commit ed487bb1d69040b9dac64a4fc076d8dd82b131d6.

The conflicts are due to commit 4fc8d6711aff7a9c11e402c3d77b481609f9f486
that is a fix to the ide_drive_pre_save() function.  It reverts both
(and both are reinstantiated later in the series)

Conflicts:

hw/ide/core.c

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
14 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Mon, 26 Jul 2010 13:05:27 +0000 (08:05 -0500)]
Merge remote branch 'mst/for_anthony' into staging

14 years agoFix -snapshot deleting images on disk change
Blue Swirl [Sun, 25 Jul 2010 20:49:34 +0000 (20:49 +0000)]
Fix -snapshot deleting images on disk change

Block device change command did not copy BDRV_O_SNAPSHOT flag. Thus
the new image did not have this flag and the file got deleted during
opening.

Fix by copying BDRV_O_SNAPSHOT flag.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: Use error codes from lower levels for error message
Stefan Weil [Wed, 21 Jul 2010 19:51:51 +0000 (21:51 +0200)]
block: Use error codes from lower levels for error message

"No such file or directory" is a misleading error message
when a user tries to open a file with wrong permissions.

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock: default to 0 minimal / optiomal I/O size
Christoph Hellwig [Fri, 23 Jul 2010 07:35:04 +0000 (09:35 +0200)]
block: default to 0 minimal / optiomal I/O size

Currently we set them to 512 bytes unless manually specified.  Unforuntaly
some brain-dead partitioning tools create unaligned partitions if they
get low enough optiomal I/O size values, so don't report any at all
unless explicitly set.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agomove 'unsafe' to end of caching modes in help
Bruce Rogers [Wed, 21 Jul 2010 20:32:28 +0000 (14:32 -0600)]
move 'unsafe' to end of caching modes in help

Libvirt parses qemu help output to determine qemu features. In particular
it probes for the following: "cache=writethrough|writeback|none". The
addition of the unsafe cache mode was inserted within this string, as
opposed to being added to the end, which impacted libvirt's probe.
Unbreak libvirt by keeping the existing cache modes intact and add
unsafe to the end.

This problem only manifests itself if a caching mode is explicitly
specified in the libvirt xml, in which case older syntax for caching is
passed to qemu, which it  no longer understands.

Signed-off-by: Bruce Rogers <brogers@novell.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agovirtio-blk: Create exit function to unregister savevm
Alex Williamson [Tue, 20 Jul 2010 17:14:22 +0000 (11:14 -0600)]
virtio-blk: Create exit function to unregister savevm

Otherwise we can't migrate after we've removed a virtio block device.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoblock migration: propagate return value when bdrv_write() returns < 0
Yoshiaki Tamura [Tue, 20 Jul 2010 09:19:00 +0000 (18:19 +0900)]
block migration: propagate return value when bdrv_write() returns < 0

Currently block_load() doesn't check return value of bdrv_write(), and
even the destination weren't prepared to execute block migration, it
proceeds and guest boots on the target.  This patch fix this issue.

Signed-off-by: Yoshiaki Tamura <tamura.yoshiaki@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoide/atapi: add support for GET EVENT STATUS NOTIFICATION
Aurelien Jarno [Mon, 19 Jul 2010 13:53:35 +0000 (15:53 +0200)]
ide/atapi: add support for GET EVENT STATUS NOTIFICATION

The GET EVENT STATUS NOTIFICATION is a mandatory command according
to MMC-3, even if event status notification is not supported.

This patch adds support for this command. It returns NEA ("No Event
Available") with an empty "Supported Event Classes" to show that it
doesn't event support status notification. If asychronous operation is
requested, which requires NCQ support, it returns an error according
to the specifications.

This fixes HAL support on FreeBSD and derivatives, which fill up the
logs every second with:

  acd0: FAILURE - unknown CMD (0x03) ILLEGAL REQUEST asc=0x20 ascq=0x00

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
14 years agoetrax: Update ethernet mgm-ctrl reg on writes
Edgar E. Iglesias [Sun, 25 Jul 2010 19:03:56 +0000 (21:03 +0200)]
etrax: Update ethernet mgm-ctrl reg on writes

Some SW drivers dont keep track of what they've written and
depend on the HW latching write contents for later
read+modify+write sequences.

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
14 years agotarget-i386: use gen_update_cc_op()
Jun Koi [Sun, 25 Jul 2010 03:30:03 +0000 (12:30 +0900)]
target-i386: use gen_update_cc_op()

This patch simplifies target-i386/translate.c a bit by replacing some
code with gen_update_cc_op()

Signed-off-by: Jun Koi <junkoi2004@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoClose socket file descriptor when qemu_accept fails
Shahar Havivi [Sat, 24 Jul 2010 10:03:07 +0000 (13:03 +0300)]
Close socket file descriptor when qemu_accept fails

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoadd cscope.* to .gitignore
Jun Koi [Fri, 23 Jul 2010 05:59:52 +0000 (14:59 +0900)]
add cscope.* to .gitignore

we have "make cscope", therefore that makes sense to have cscope.* in
.gitignore.

Signed-off-by: Jun Koi <junkoi2004@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoslirp: Remove declarations which are no longer needed
Stefan Weil [Thu, 22 Jul 2010 20:15:24 +0000 (22:15 +0200)]
slirp: Remove declarations which are no longer needed

The previous patches replaced u_int8_t, u_int16_t, u_int32_t, u_int64_t
by standard int types from stdint.h,
so we can now remove their declarations which are no longer needed.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoslirp: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types
Stefan Weil [Thu, 22 Jul 2010 20:15:23 +0000 (22:15 +0200)]
slirp: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types

There is no need to have a second set of integral types.
Replace them by the standard types from stdint.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agotests: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types
Stefan Weil [Thu, 22 Jul 2010 20:15:22 +0000 (22:15 +0200)]
tests: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types

There is no need to have a second set of integral types.
Replace them by the standard types from stdint.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoblock: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types
Stefan Weil [Thu, 22 Jul 2010 20:15:21 +0000 (22:15 +0200)]
block: Replace u_int8_t, u_int16_t, u_int32_t, u_int64_t by standard int types

There is no need to have a second set of integral types.
Replace them by the standard types from stdint.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agomips: more fixes to the MIPS interrupt glue logic
Aurelien Jarno [Sun, 25 Jul 2010 14:51:29 +0000 (16:51 +0200)]
mips: more fixes to the MIPS interrupt glue logic

Commit 36388314febad3d7675ab919287f03733a560ff6 moved most of the
interrupt logic to cpu-exec.c. Remove the remaining useless code
and fix software interrupts.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Acked-by: Edgar E. Iglesias <edgar@axis.com>
Tested-by: Edgar E. Iglesias <edgar@axis.com>
14 years agomicroblaze: Remove unused members from the disas context
Edgar E. Iglesias [Sat, 24 Jul 2010 22:09:41 +0000 (00:09 +0200)]
microblaze: Remove unused members from the disas context

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
14 years agomicroblaze: Speed up base + index addressing mode
Edgar E. Iglesias [Sat, 24 Jul 2010 21:25:49 +0000 (23:25 +0200)]
microblaze: Speed up base + index addressing mode

Speed up reg + reg addressing mode when any of the regs is r0.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
14 years agomicroblaze: Use setcond for conditional branches
Edgar E. Iglesias [Sat, 24 Jul 2010 19:51:51 +0000 (21:51 +0200)]
microblaze: Use setcond for conditional branches

Use setcond for evaluating the condition for branches.
In the future, we could do better for branches without
delay slots.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
14 years agomicroblaze: Improve branch with small immediates
Edgar E. Iglesias [Sat, 24 Jul 2010 19:24:59 +0000 (21:24 +0200)]
microblaze: Improve branch with small immediates

Slight improvements of conditional branches with small
immediate offsets.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
14 years agoremove dead code
Jun Koi [Fri, 23 Jul 2010 05:57:40 +0000 (14:57 +0900)]
remove dead code

this patch removes unused function cpu_restore_state_copy().

Signed-off-by: Jun Koi <junkoi2004@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agouse symbol for DisasContext->is_jmp
Jun Koi [Fri, 23 Jul 2010 15:17:00 +0000 (00:17 +0900)]
use symbol for DisasContext->is_jmp

This patch replaces constant value assigned for (DisasContext
*)->is_jmp with DISAS_TB_JUMP.

Signed-off-by: Jun Koi <junkoi2004@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
14 years agomips: Correct MIPS interrupt glue logic for icount
Edgar E. Iglesias [Sat, 24 Jul 2010 11:40:05 +0000 (13:40 +0200)]
mips: Correct MIPS interrupt glue logic for icount

When hw interrupt pending bits in CP0_Cause are set, the CPU should
see the hw interrupt line as active. The CPU may or may not take the
interrupt based on internal state (global irq mask etc) but the glue
logic shouldn't care.

This fixes MIPS external hw interrupts in combination with -icount.

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
14 years agomicroblaze: Pass a ucontext * as 3rd sighandler arg
Edgar E. Iglesias [Fri, 23 Jul 2010 07:30:37 +0000 (09:30 +0200)]
microblaze: Pass a ucontext * as 3rd sighandler arg

There is disagreement between microblaze glibc and the kernel
to what the third arg of signal handlers should point to.

Change QEMU linux-user to match the kernel port. glibc patches
are pending.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
14 years agoDeclare code_gen_ptr, code_gen_max_blocks 'static'
Stefan Weil [Mon, 19 Jul 2010 16:23:17 +0000 (18:23 +0200)]
Declare code_gen_ptr, code_gen_max_blocks 'static'

Both values are only used in exec.c, so there is no need
to make them globally available.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoscsi: Dequeue requests before invoking completion callback
Jan Kiszka [Tue, 13 Jul 2010 12:13:45 +0000 (14:13 +0200)]
scsi: Dequeue requests before invoking completion callback

The request completion callback of the LSI controller may start the next
request that can use the same tag as the completed one. As the latter is
still enqueued at that point, scsi_send_command will complain about the
tag reuse and cancel the completed request. That will cause a double
free later on when the completion path cleans up as well.

Fix this by dequeuing the request before invoking the callback.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoe1000: Fix wrong microwire EEPROM state initialization
Izumi Tsutsui [Sat, 10 Jul 2010 14:03:45 +0000 (23:03 +0900)]
e1000: Fix wrong microwire EEPROM state initialization

This change fixes initialization of e1000's microwire EEPROM internal
state values so that qemu's e1000 emulation works on NetBSD,
which doesn't use Intel's em driver but has its own wm driver
for the Intel i8254x Gigabit Ethernet.

Previously set_eecd() function in e1000.c clears EEPROM internal state
values on SK rising edge during CS==L, but according to FM93C06 EEPROM
(which is MicroWire compatible) data sheet, EEPROM internal status
should be cleared on CS rise edge regardless of SK input:
 "... a rising edge on this (CS) signal is required to reset the internal
  state-machine to accept a new cycle .."
and nothing should be changed during CS (chip select) is inactive.

Intel's em driver seems to explicitly raise SK output after CS is negated
in em_standby_eeprom() so many other OSes that use Intel's driver
don't have this problem even on the previous e1000.c implementation,
but I can't find any articles that say the MICROWIRE or EEPROM spec
requires such sequence, and actually hardware works fine without it
(i.e. real i82540EM has been working on NetBSD).

This fix also changes initialization to clear each state value in
struct eecd_state individually rather than using memset() against
the whole structre. The old_eecd member stores the last SK and CS
signal levels and it should be preserved even after reset of internal
EEPROM state to detect next signal edges for proper EEPROM emulation.

Signed-off-by: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoRework debug exception processing for gdb use
Jan Kiszka [Fri, 25 Jun 2010 14:56:56 +0000 (16:56 +0200)]
Rework debug exception processing for gdb use

Guest debugging is currently broken under CONFIG_IOTHREAD. The reason is
inconsistent or even lacking signaling the debug events from the source
VCPU to the main loop and the gdbstub.

This patch addresses the issue by pushing this signaling into a
CPUDebugExcpHandler: cpu_debug_handler is registered as first handler,
thus will be executed last after potential breakpoint emulation
handlers. It sets informs the gdbstub about the debug event source,
requests a debug exit of the main loop and stops the current VCPU. This
mechanism works both for TCG and KVM, with and without IO-thread.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoRename tcg_cpu_exec and tcg_has_work
Jan Kiszka [Fri, 25 Jun 2010 14:56:55 +0000 (16:56 +0200)]
Rename tcg_cpu_exec and tcg_has_work

These functions are also used for kvm under !CONFIG_IOTHREAD, having
'tcg' in their name is just misleading.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoDrop redundant global cur_cpu variable
Jan Kiszka [Fri, 25 Jun 2010 14:56:54 +0000 (16:56 +0200)]
Drop redundant global cur_cpu variable

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix qemu_wait_io_event processing in io-thread mode
Jan Kiszka [Fri, 25 Jun 2010 14:56:53 +0000 (16:56 +0200)]
Fix qemu_wait_io_event processing in io-thread mode

When checking for I/O events in the tcg CPU loop, make sure that we
call qemu_wait_io_event_common for all CPUs, not only the current one.
Otherwise pause_all_vcpus may lock up or run_on_cpu requests may starve.

Rename qemu_wait_io_event to qemu_tcg_wait_io_event at this chance and
purge its argument list as it has no use for it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoFix cpu_exit for tcp_cpu_exec
Jan Kiszka [Fri, 25 Jun 2010 14:56:52 +0000 (16:56 +0200)]
Fix cpu_exit for tcp_cpu_exec

If a cpu_exit request is pending, ensure that we leave the CPU loop
quickly. For this purpose, keep the global exit_request pending until
we are about to leave tcg_cpu_exec. Also, immediately break out of the
SMP loop if the request is set, do not run till the end of the chain.
This preserves the VCPU scheduling order in SMP mode.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
14 years agoInit qemu_system_cond
Jan Kiszka [Fri, 25 Jun 2010 14:56:51 +0000 (16:56 +0200)]
Init qemu_system_cond

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>