]> git.proxmox.com Git - qemu.git/log
qemu.git
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 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>
13 years agoFix cpu_unlink_tb race
Jan Kiszka [Fri, 25 Jun 2010 14:56:50 +0000 (16:56 +0200)]
Fix cpu_unlink_tb race

If a signal hit after the env->exit_request check but before cpu_exec
updated env->current_tb, cpu_unlink_tb called from the signal hander
will not unlink the current TB. This may leave us stuck in a guest loop
if no further unlink is invoked.

Fix this by reordering current_tb update and exit_request check,
additionally enforcing the correct order via a compiler barrier.

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>
13 years agoIntroduce proper compiler barrier
Jan Kiszka [Fri, 25 Jun 2010 14:56:49 +0000 (16:56 +0200)]
Introduce proper compiler barrier

Define barrier() as optimization barrier and replace (potentially
unreliable) asm("") fences.

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>
13 years agovirtio-serial: Fix compat property name
Amit Shah [Wed, 23 Jun 2010 17:19:20 +0000 (22:49 +0530)]
virtio-serial: Fix compat property name

Starting with qemu -M pc-0.12 -device virtio-serial

results in

-device virtio-serial: Property 'virtio-serial-pci.max_nr_ports' not found

The property name 'max_ports' is incorrectly named 'max_nr_ports'. Fix
that.

Also fix the ppc440 machine type bamboo-0.12 which has this typo.

Reported-by: Daniel P. Berrange <berrange@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agolinux-user: display cpu list.
Laurent Vivier [Sun, 23 May 2010 22:35:20 +0000 (00:35 +0200)]
linux-user: display cpu list.

As it is done for qemu-system with "-cpu ?", when cpu_list_id() is missing
for a target, call cpu_list() instead.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoSparc32: reserve addresses for unimplemented devices on SS-20
Bob Breuer [Tue, 13 Jul 2010 16:05:24 +0000 (11:05 -0500)]
Sparc32: reserve addresses for unimplemented devices on SS-20

Use empty_slot to reserve addresses for several unimplemented devices so they won't fault.
 - BPP (parallel port), DBRI (audio), SX (pixel processor), and vsimms (framebuffer)
OBP for SS-20 either assumes these devices exist or probes without expecting faults.

Signed-off-by: Bob Breuer <breuerr@mc.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-ppc: fix power mode checking on 7400/7410
Aurelien Jarno [Sun, 18 Jul 2010 22:33:29 +0000 (00:33 +0200)]
target-ppc: fix power mode checking on 7400/7410

Only the PowerPC 7440/7450 family don't support DOZE mode. PowerPC
7400 and 7410 support it.

13 years agotarget-mips: fix xtlb exception for loongson
Aurelien Jarno [Thu, 15 Jul 2010 21:13:11 +0000 (23:13 +0200)]
target-mips: fix xtlb exception for loongson

Loongson 2E and 2F use the same entry for xtlb and tlb exception, at
offset 0x000.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoMerge remote branch 'origin/master' into staging
Anthony Liguori [Fri, 16 Jul 2010 13:01:16 +0000 (08:01 -0500)]
Merge remote branch 'origin/master' into staging

13 years agomicroblaze: Correct signal frame setup.
Edgar E. Iglesias [Thu, 15 Jul 2010 13:32:51 +0000 (15:32 +0200)]
microblaze: Correct signal frame setup.

Pass the context in r7.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoMerge remote branch 'origin/master' into staging
Anthony Liguori [Thu, 15 Jul 2010 13:19:53 +0000 (08:19 -0500)]
Merge remote branch 'origin/master' into staging

13 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Thu, 15 Jul 2010 13:17:57 +0000 (08:17 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging

13 years agoMake default invocation of block drivers safer (v3)
Anthony Liguori [Wed, 14 Jul 2010 15:58:00 +0000 (10:58 -0500)]
Make default invocation of block drivers safer (v3)

CVE-2008-2004 described a vulnerability in QEMU whereas a malicious user could
trick the block probing code into accessing arbitrary files in a guest.  To
mitigate this, we added an explicit format parameter to -drive which disabling
block probing.

Fast forward to today, and the vast majority of users do not use this parameter.
libvirt does not use this by default nor does virt-manager.

Most users want block probing so we should try to make it safer.

This patch adds some logic to the raw device which attempts to detect a write
operation to the beginning of a raw device.  If the first 4 bytes happen to
match an image file that has a backing file that we support, it scrubs the
signature to all zeros.  If a user specifies an explicit format parameter, this
behavior is disabled.

I contend that while a legitimate guest could write such a signature to the
header, we would behave incorrectly anyway upon the next invocation of QEMU.
This simply changes the incorrect behavior to not involve a security
vulnerability.

I've tested this pretty extensively both in the positive and negative case.  I'm
not 100% confident in the block layer's ability to deal with zero sized writes
particularly with respect to the aio functions so some additional eyes would be
appreciated.

Even in the case of a single sector write, we have to make sure to invoked the
completion from a bottom half so just removing the zero sized write is not an
option.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agohw/bonito: remove incorrect pci_mem_base setting
Huacai Chen [Wed, 14 Jul 2010 11:51:49 +0000 (19:51 +0800)]
hw/bonito: remove incorrect pci_mem_base setting

This mistake makes PCI devices can't work correctly.

Signed-off-by: Huacai Chen <zltjiangshi@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoqemu-options: add documentation for stdio signal=on|off
Aurelien Jarno [Tue, 13 Jul 2010 19:13:12 +0000 (21:13 +0200)]
qemu-options: add documentation for stdio signal=on|off

Commit 5989020bc11f8ba448d6fb79f4562f882a693d89 introduced a chardev
option to disable signals on stdio. Add the corresponding documentation.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoUpdate OpenBIOS images
Aurelien Jarno [Tue, 13 Jul 2010 18:09:24 +0000 (20:09 +0200)]
Update OpenBIOS images

Update PPC, Sparc32 and Sparc64 OpenBIOS images to r821.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-ppc: add vexptefp instruction
Aurelien Jarno [Mon, 9 Feb 2009 11:20:50 +0000 (12:20 +0100)]
target-ppc: add vexptefp instruction

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: add float32_exp2()
Aurelien Jarno [Thu, 5 Feb 2009 11:04:05 +0000 (12:04 +0100)]
softfloat: add float32_exp2()

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoide scsi virtio-blk: Reject empty drives unless media is removable
Markus Armbruster [Tue, 6 Jul 2010 12:37:44 +0000 (14:37 +0200)]
ide scsi virtio-blk: Reject empty drives unless media is removable

Disks without media make no sense.  For SCSI, a Linux guest kernel
complains during boot.  I didn't try other combinations.

scsi-generic doesn't need the additional check, because it already
requires bdrv_is_sg(), which fails without media.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovirtio-blk: Fix virtio-blk-s390 to require drive
Markus Armbruster [Tue, 6 Jul 2010 12:37:43 +0000 (14:37 +0200)]
virtio-blk: Fix virtio-blk-s390 to require drive

Move the check from virtio_blk_init_pci(), where it protects only
virtio-blk-pci, to virtio_blk_init().  Without that, virtio-blk-s390
initializes without a drive.  I figure that can lead to null pointer
dereferences.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovirtio-pci: Check for virtio_blk_init() failure
Markus Armbruster [Tue, 6 Jul 2010 12:37:42 +0000 (14:37 +0200)]
virtio-pci: Check for virtio_blk_init() failure

It can't actually fail now, but the next commit will change that.

s390_virtio_blk_init() already checks for failure, but
virtio_blk_init_pci() doesn't.  Fix that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoBlock migration fail, ignore error from bdrv_getlength
Shahar Havivi [Sat, 10 Jul 2010 15:59:06 +0000 (18:59 +0300)]
Block migration fail, ignore error from bdrv_getlength

When there is no block driver associate with BlockDriverState bdrv_getlength
returns -ENOMEDIUM that cause block migration to fail

Signed-off-by: Shahar Havivi <shaharh@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img: Fix copy+paste bug in documentation
Stefan Weil [Fri, 9 Jul 2010 18:30:07 +0000 (20:30 +0200)]
qemu-img: Fix copy+paste bug in documentation

Replace rebase by resize in documentation of resize command.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovirtio-serial: Assert for virtio queue ready before virtqueue operations
Amit Shah [Thu, 1 Jul 2010 09:28:17 +0000 (14:58 +0530)]
virtio-serial: Assert for virtio queue ready before virtqueue operations

In addition to the previous fix for calling do_flush_queued_data() only
when the virtqueue is ready, ensure do_flush_queued_data() gets a vq
that's suitably initialised.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovirtio-serial: Check if virtio queue is ready before consuming data
Amit Shah [Thu, 1 Jul 2010 09:28:16 +0000 (14:58 +0530)]
virtio-serial: Check if virtio queue is ready before consuming data

If a virtio-serial port is removed before the guest comes up and
initialises the virtqueues, qemu exits with the message

Guest moved used index from 0 to 61440

This happens because we try to clear any pending buffers from the
virtqueue.

Ensure the virtqueue is initialised before calling any virtqueue
operations.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovirtio-9p: Avoid SEGV when log file couldn't be opened
Sripathi Kodi [Wed, 30 Jun 2010 11:02:00 +0000 (16:32 +0530)]
virtio-9p: Avoid SEGV when log file couldn't be opened

While running in debug mode if 9P server is unable to open the log file
it results in a SEGV deep down in glibc:

Program received signal SIGSEGV, Segmentation fault.
0x008fca8c in fwrite () from /lib/libc.so.6
(gdb) bt
#0  0x008fca8c in fwrite () from /lib/libc.so.6
#1  0x081eb87e in pprint_pdu (pdu=0x89a52e1c)
    at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-9p-debug.c:380
#2  0x0806dad8 in submit_pdu (s=0x897dc008, pdu=0x89a52e1c)
    at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-9p.c:3092
#3  0x0806dc63 in handle_9p_output (vdev=0x897dc008, vq=0x86d8218)
    at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-9p.c:3122
#4  0x081ac728 in virtio_queue_notify (vdev=0x897dc008, n=0)
    at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio.c:563
#5  0x08063876 in virtio_ioport_write (opaque=0x86d7b98, addr=16, val=0)
    at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-pci.c:222
#6  0x08063e26 in virtio_pci_config_writew (opaque=0x86d7b98, addr=16, val=0)
    at /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-pci.c:357
#7  0x080c881a in ioport_write (index=1, address=49296, data=0) at ioport.c:80
#8  0x080c8d4c in cpu_outw (addr=49296, val=0) at ioport.c:204
#9  0x08073010 in kvm_handle_io (port=49296, data=0xab393000, direction=1, size=2, count=1)
    at /data/sripathi/code/qemu/new/qemu-next-upstream/kvm-all.c:735
...
...

This is ugly and misleading. The following patch adds a BUG_ON to catch this
error. With this patch we get an abort message like the following, which makes
it easier to analyze:

f12-kvm login: qemu: /data/sripathi/code/qemu/new/qemu-next-upstream/hw/virtio-9p-debug.c:353: pprint_pdu: Assertion `!(!llogfile)' failed.

Signed-off-by: Sripathi Kodi <sripathik@in.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopc: Avoid registering zero sized memory
Alex Williamson [Tue, 6 Jul 2010 16:37:17 +0000 (10:37 -0600)]
pc: Avoid registering zero sized memory

No need to call cpu_register_physical_memory() for a zero sized area.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Tue, 13 Jul 2010 13:56:27 +0000 (08:56 -0500)]
Merge remote branch 'mst/for_anthony' into staging

13 years agoUpdate SeaBIOS
Anthony Liguori [Tue, 13 Jul 2010 13:55:04 +0000 (08:55 -0500)]
Update SeaBIOS

 - 17d3e46 smbios: Allow all fields to be set via qemu_cfg_smbios_load_field()
 - 0d6b8d5 seabios: pciinit: use pci device initializer helper function.
 - 968d3a8 seabios: pci: introduce helper function to initialize a given device.
 - 4e0daae virtio: Clear interrupt status register in virtio-blk
 - af0963d seabios: pciinit: initialize pci bridge filtering registers.
 - f441666 seabios: pciinit: pci bridge bus initialization.
 - 5d0de15 seabios: pciinit: make bar offset calculation pci bridge aware.
 - a65821d seabios: pciinit: factor out bar offset calculation.
 - 0a8eada seabios: pciinit: make pci bar assigner preferchable memory aware.
 - dfd94fa seabios: pciinit: make pci memory space assignment 64bit aware.
 - b9e4721 seabios: pciinit: factor out pci bar region allocation logic.
 - edd9911 seabios: pci: introduce foreachpci_in_bus() helper macro.
 - f79a462 Add romfile_size() wrapper for accessing cbfs/qemu_cfg files.
 - afbed1b Initial bootsplash support.
 - 83d6ed6 Update TODO
 - 1d7d893 Fix bvprintf() to respect padding for hex printing.
 - e230426 Unify optionrom cbfs/qemu_cfg rom pulling code.
 - 8cb8ba5 SeaBIOS VGA hooks
 - 203f6f3 SeaBIOS CD/DVD abbreviations
 - 12cbb43 seabios: remove iasl output file when error.
 - d5d02b6 Allocate cdemu buffer in low mem instead of ebda.
 - 8f59aa3 Introduce memcpy_fl - a memcpy on "flat" pointers.
 - 42a1d4c Rework malloc to use a "first fit" algorithm.
 - 34e9cc5 Minor mptable changes.
 - 0f3783b virtio: clean up memory barrier usage
 - bfe4d60 virtio: remove NO_NOTIFY optimization
 - bb68591 Don't use RTC to time boot menu delay.
 - b5cc2ca Generalize timer based delay code.
 - 144817b Rename check_time() to check_tsc().
 - 9c447c3 Allow wait_irq to be called in 32bit code.
 - 49cc72b Improve optionrom debugging statements.
 - c65a4a6 Minor - compile out usb-msc code if CONFIG_USB_MSC not set.
 - 456479e Minor ata cleanups.
 - 2515a72 Make sure virtio-blk is fully compiled out if not wanted.
 - c4fe135 Minor - split up virtio_blk_setup().
 - 4030db0 fix two issues with virtio-blk
 - ea8ac63 Minor improvements to virtio (allow irqs, allocate page aligned).

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopci/multi function bit: fix vt82c686.c.
Isaku Yamahata [Mon, 12 Jul 2010 11:53:57 +0000 (20:53 +0900)]
pci/multi function bit: fix vt82c686.c.

The file, vt82c686.c, was added after the change set of
b80d4a9887fa4b6cc63f8c3a13ab2a45054d3e5c and
fecb93c45c749a4c994d8d12bdee17ce2012de9e
are created, but before the patch series was commit.
So similar fix is needed to vt82c686.c.

Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: Add support for ldc & stc with sgr
Alexandre Courbot [Mon, 12 Jul 2010 05:05:32 +0000 (14:05 +0900)]
target-sh4: Add support for ldc & stc with sgr

Add support for the following missing priviledged intructions:

For SH4:
- stc sgr, Rn
- stc.l sgr, @-Rn

For SH4A:
- ldc Rm, sgr
- ldc.l @Rm+, sgr

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: Split the LDST macro into 2 sub-macros
Alexandre Courbot [Mon, 12 Jul 2010 05:05:31 +0000 (14:05 +0900)]
target-sh4: Split the LDST macro into 2 sub-macros

The LDST macro is used to generate ldc and stc instructions that work with a
specific register. However, the SGR register only supports stc up to SH4A,
which supports both stc and ldc. This patch creates two sub-macros named LD
and ST that handle generating ldc and stc instructions separately, and
redeclares LDST to use these sub-macro.

Signed-off-by: Alexandre Courbot <gnurou@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agopci: fix bridge update
Michael S. Tsirkin [Tue, 6 Jul 2010 11:17:51 +0000 (14:17 +0300)]
pci: fix bridge update

bridge config write should trigger updates
on the secondary bus. never on the primary bus.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agovirtio-net: correct packet length math
Michael S. Tsirkin [Tue, 22 Jun 2010 13:22:49 +0000 (16:22 +0300)]
virtio-net: correct packet length math

We were requesting too much when checking buffer
length: size already includes host header length.

Further, we should not exit if we get a packet that
is too long, since this might not be under control
of the guest. Just drop the packet.

Red Hat bz 591494

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci hotplug: make pci hotplug return value to caller
Isaku Yamahata [Tue, 22 Jun 2010 02:55:35 +0000 (11:55 +0900)]
pci hotplug: make pci hotplug return value to caller

make pci hotplug callback return value to caller.
And when returning error, allocated resources are freed.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agovmware_vga: fix reset value for command register
Michael S. Tsirkin [Thu, 17 Jun 2010 11:01:38 +0000 (14:01 +0300)]
vmware_vga: fix reset value for command register

Make init value for this register match the spec.
BAR address is 0 at init, so enabling it
only works by chance.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agortl8139: address TODOs
Michael S. Tsirkin [Thu, 17 Jun 2010 11:17:59 +0000 (14:17 +0300)]
rtl8139: address TODOs

Make rtl8139 spec compliant, fixing reset values
for command register.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci hotplug: make pci_device_hot_remove() static
Isaku Yamahata [Tue, 15 Jun 2010 03:48:36 +0000 (12:48 +0900)]
pci hotplug: make pci_device_hot_remove() static

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopcnet: address TODOs
Michael S. Tsirkin [Thu, 17 Jun 2010 11:08:24 +0000 (14:08 +0300)]
pcnet: address TODOs

pcnet enables memory/io on init, which
does not make sense as BAR values are wrong.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: Jan Kiszka <jan.kiszka@siemens.com>
13 years agopci: fix pci_device_reset
Isaku Yamahata [Thu, 17 Jun 2010 06:15:45 +0000 (15:15 +0900)]
pci: fix pci_device_reset

Clear interrupt disable bit on reset, according to PCI spec.
Fix pci_device_reset() with 64bit BAR.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoAppleSMC device emulation
Alexander Graf [Wed, 30 Jun 2010 08:41:12 +0000 (10:41 +0200)]
AppleSMC device emulation

Intel Macs have a chip called the "AppleSMC" which they use to control
certain Apple specific parts of the hardware, like the keyboard background
light.

That chip is also used to store a key that Mac OS X uses to decrypt binaries.

This patch adds emulation for that chip, so we're getting one step further
to having Mac OS X run natively on Qemu.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoDocumentation: Fix spelling bugs
Stefan Weil [Sun, 11 Jul 2010 16:34:28 +0000 (18:34 +0200)]
Documentation: Fix spelling bugs

rewuired -> required
ths      -> this

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMakefile: Not every shell support {}
Hidetoshi Seto [Thu, 8 Jul 2010 05:26:18 +0000 (14:26 +0900)]
Makefile: Not every shell support {}

So interpret it by hand.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMakefile: add fsdev/*.{o,d} to clean
Hidetoshi Seto [Thu, 8 Jul 2010 05:26:00 +0000 (14:26 +0900)]
Makefile: add fsdev/*.{o,d} to clean

There were fsdev/qemu-fsdev.{o,d} not removed at "make clean".

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopci: set PCI multi-function bit appropriately.
Isaku Yamahata [Wed, 23 Jun 2010 07:15:33 +0000 (16:15 +0900)]
pci: set PCI multi-function bit appropriately.

Set PCI multi-function bit according to multifunction property.
PCI address, devfn ,is exported to users as addr property,
so users can populate pci function(PCIDevice in qemu)
at arbitrary devfn.
It means each function(PCIDevice) don't know whether pci device
(PCIDevice[8]) is multi function or not.
So this patch allows user to set multifunction bit via property
and checks whether multifunction bit is set correctly.

Cc: Juan Quintela <quintela@redhat.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopci_bridge: make pci bridge aware of pci multi function bit.
Isaku Yamahata [Wed, 23 Jun 2010 07:15:32 +0000 (16:15 +0900)]
pci_bridge: make pci bridge aware of pci multi function bit.

make pci bridge aware of pci multi function property and let pci generic
code to set the bit.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopci: set multifunction property for normal device.
Isaku Yamahata [Wed, 23 Jun 2010 07:15:31 +0000 (16:15 +0900)]
pci: set multifunction property for normal device.

use pci_create_simple_multifunction() for normal device which sets
multifunction bit.
At the moment, only pc_piix.c and mips_malta.c uses multifunction
devices with piix3/4 pci-isa bridge.
And other boards don't populate those devices.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopci: introduce multifunction property.
Isaku Yamahata [Wed, 23 Jun 2010 07:15:30 +0000 (16:15 +0900)]
pci: introduce multifunction property.

introduce multifunction property.
Also introduce new convenient device creation function which
will be used later.

For bisectability this patch doesn't do anything, but sets the property
resulting in no functional changes.
Actual changes will be introduced by later patch.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoqdev: implement qdev_prop_set_bit().
Isaku Yamahata [Wed, 23 Jun 2010 07:15:29 +0000 (16:15 +0900)]
qdev: implement qdev_prop_set_bit().

implement qdev_prop_set_bit().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopci: remove PCIDeviceInfo::header_type
Isaku Yamahata [Wed, 23 Jun 2010 07:15:28 +0000 (16:15 +0900)]
pci: remove PCIDeviceInfo::header_type

replace PCIDeviceInfo::header_type with is_bridge
as suggested by Michael S. Tsirkin <mst@redhat.com>

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopci: don't overwrite multi functio bit in pci header type.
Isaku Yamahata [Wed, 23 Jun 2010 07:15:27 +0000 (16:15 +0900)]
pci: don't overwrite multi functio bit in pci header type.

Don't overwrite pci header type.
Otherwise, multi function bit which pci_init_header_type() sets
appropriately is lost.
Anyway PCI_HEADER_TYPE_NORMAL is zero, so it is unnecessary to zero
which is already zero cleared.

how to test:
run qemu and issue info pci to see whether a device in question is
normal device, not pci-to-pci bridge.
This is handy because guest os isn't required.

tested changes:
The following files are covered by using following commands.
sparc64-softmmu
  apb_pci.c, vga-pci.c, cmd646.c, ne2k_pci.c, sun4u.c
ppc-softmmu
  grackle_pci.c, cmd646.c, ne2k_pci.c, vga-pci.c, macio.c
ppc-softmmu -M mac99
  unin_pci.c(uni-north, uni-north-agp)
ppc64-softmmu
  pci-ohci, ne2k_pci, vga-pci, unin_pci.c(u3-agp)
x86_64-softmmu
  acpi_piix4.c, ide/piix.c, piix_pci.c
  -vga vmware vmware_vga.c
  -watchdog i6300esb wdt_i6300esb.c
  -usb usb-uhci.c
  -sound ac97 ac97.c
  -nic model=rtl8139 rtl8139.c
  -nic model=pcnet pcnet.c
  -balloon virtio virtio-pci.c:

untested changes:
The following changes aren't tested.
prep_pci.c: ppc-softmmu -M prep should cover, but core dumped.
unin_pci.c(uni-north-pci): the caller is commented out.
openpic.c: the caller is commented out in ppc_prep.c

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopci: insert assert that auto-assigned-address function is single function device.
Isaku Yamahata [Wed, 23 Jun 2010 07:15:26 +0000 (16:15 +0900)]
pci: insert assert that auto-assigned-address function is single function device.

Auto-assigned-address pci function (passing devfn = -1) is always
single function.
This patch adds assert() to guarantee that auto-assigned-address function
is always single function device at function = 0.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopci: use PCI_DEVFN() where appropriate.
Isaku Yamahata [Wed, 23 Jun 2010 07:15:25 +0000 (16:15 +0900)]
pci: use PCI_DEVFN() where appropriate.

Use PCI_DEVFN() and PCI_FUNC_MAX where appropriate.
This patch make it clear that func = 0.

test:
The following object files with/without this patch are stripped and compared.
They remains same.
  arm-softmmu/versatile_pci.o
  libhw32/ppce500_pci.o
  libhw32/unin_pci.o
  libhw64/ppce500_pci.o
  libhw64/unin_pci.o
  mips-softmmu/gt64xxx.o
  mips64-softmmu/gt64xxx.o
  mips64el-softmmu/gt64xxx.o
  mipsel-softmmu/gt64xxx.o

Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Yu Liu <yu.liu@freescale.com>
Cc: Paul Brook <paul@codesourcery.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-mips: add loongson 2E & 2F integer instructions
Aurelien Jarno [Fri, 18 Jun 2010 17:32:43 +0000 (19:32 +0200)]
target-mips: add loongson 2E & 2F integer instructions

This patch adds support for loongson 2E & 2F instructions. They are the
same instructions, but differ by the opcode encoding.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoFix warning about uninitialized variable
Blue Swirl [Wed, 7 Jul 2010 19:37:53 +0000 (19:37 +0000)]
Fix warning about uninitialized variable

With gcc 4.2.1-sjlj (mingw32-2) I get this warning:
/src/qemu/exec.c: In function 'qemu_ram_alloc':
/src/qemu/exec.c:2777: warning: 'offset' may be used uninitialized in this function

Fix by initializing the variable.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agosheepdog: fix compile error on systems without TCP_CORK
MORITA Kazutaka [Wed, 7 Jul 2010 06:25:30 +0000 (15:25 +0900)]
sheepdog: fix compile error on systems without TCP_CORK

WIN32 is not only the system which doesn't have TCP_CORK (e.g. OS X).

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 6 Jul 2010 15:48:01 +0000 (10:48 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging

13 years agoramblocks: No more being lazy about duplicate names
Alex Williamson [Fri, 2 Jul 2010 17:13:29 +0000 (11:13 -0600)]
ramblocks: No more being lazy about duplicate names

Now that we have a working qemu_ram_free() and the primary runtime
user of it has been updated, don't be lenient about duplicate id strings.
We also shouldn't need to create them ondemand at the target.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopci: Free the space allocated for the option rom on removal
Alex Williamson [Fri, 25 Jun 2010 17:10:19 +0000 (11:10 -0600)]
pci: Free the space allocated for the option rom on removal

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoqemu_ram_free: Implement it
Alex Williamson [Fri, 2 Jul 2010 17:13:17 +0000 (11:13 -0600)]
qemu_ram_free: Implement it

Now that we can support a ram_addr_t space with holes, we can implement
qemu_ram_free().

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosavevm: Create a new continue flag to avoid resending block name
Alex Williamson [Fri, 25 Jun 2010 17:10:05 +0000 (11:10 -0600)]
savevm: Create a new continue flag to avoid resending block name

Allows us to compress the protocol a bit by setting a flag on the
offset which indicates we're still working within the same block
as last time.  That way we can avoid sending the block name for
every page.  Suggested by Anthony Liguori.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosavevm: Use RAM blocks for basis of migration
Alex Williamson [Fri, 25 Jun 2010 17:09:57 +0000 (11:09 -0600)]
savevm: Use RAM blocks for basis of migration

We don't want to assume a contiguous address space, so migrate based
on RAM blocks instead of a fixed linear address map.  This will allow
us to have holes in the ram_addr_t namespace, so we can implement
qemu_ram_free().

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosavevm: Migrate RAM based on name/offset
Alex Williamson [Fri, 25 Jun 2010 17:09:50 +0000 (11:09 -0600)]
savevm: Migrate RAM based on name/offset

Synchronize RAM blocks with the target and migrate using name/offset
pairs.  This ensures both source and target have the same view of
RAM and that we get the right bits into the right slot.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoramblocks: Make use of DeviceState pointer and BusInfo.get_dev_path
Alex Williamson [Fri, 25 Jun 2010 17:09:43 +0000 (11:09 -0600)]
ramblocks: Make use of DeviceState pointer and BusInfo.get_dev_path

With these two pieces in place, we can start naming ramblocks.  When
the device is present and it lives on a bus that provides a device
path, we concatenate the path and the provided name.  Otherwise we
just use name.  The resulting id string must be unique.  For now we
assume an allocation for the same name and size is a device that has
been removed and reinserted and return the same block.  This will go
away once qemu_ram_free() is implemented.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoqemu_ram_alloc: Add DeviceState and name parameters
Alex Williamson [Fri, 25 Jun 2010 17:09:35 +0000 (11:09 -0600)]
qemu_ram_alloc: Add DeviceState and name parameters

These will be used to generate unique id strings for ramblocks.  The name
field is required, the device pointer is optional as most callers don't
have a device.  When there's no device or the device isn't a child of
a bus implementing BusInfo.get_dev_path, the name should be unique for
the platform.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agovirtio-net: Incorporate a DeviceState pointer and let savevm track instances
Alex Williamson [Fri, 25 Jun 2010 17:09:28 +0000 (11:09 -0600)]
virtio-net: Incorporate a DeviceState pointer and let savevm track instances

Stuff a pointer to the DeviceState into the VirtIONet structure so that
we can easily remove the vmstate entry later.  Also, let vmstate track
the instance number (it should always be zero internally since the
device path should now be unique).

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoeepro100: Add a dev field to eeprom new/free functions
Alex Williamson [Fri, 25 Jun 2010 17:09:21 +0000 (11:09 -0600)]
eepro100: Add a dev field to eeprom new/free functions

This allows us to create a more meaningful savevm string.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosavevm: Make use of DeviceState
Alex Williamson [Fri, 25 Jun 2010 17:09:14 +0000 (11:09 -0600)]
savevm: Make use of DeviceState

For callers that pass a device we can traverse up the qdev tree and
make use of the BusInfo.get_dev_path information for creating unique
savevm id strings.  This avoids needing to rely on the instance number,
which can cause problems with device initialization order and hotplug.

For compatibility, we also store away the old id string and instance
so we can accept migrations from VMs as we add new get_dev_path
implementations.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agosavevm: Add DeviceState param
Alex Williamson [Fri, 25 Jun 2010 17:09:07 +0000 (11:09 -0600)]
savevm: Add DeviceState param

When available, we'd like to be able to access the DeviceState
when registering a savevm.  For buses with a get_dev_path()
function, this will allow us to create more unique savevm
id strings.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopci: Implement BusInfo.get_dev_path()
Alex Williamson [Fri, 25 Jun 2010 17:08:59 +0000 (11:08 -0600)]
pci: Implement BusInfo.get_dev_path()

This works great for PCI since a <segment>:<bus>:<dev>.<fn> uniquely
describes a global address.  No need to traverse up the qdev tree.
PCI segment support is a placeholder for compatibility once we
support multiple segments.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoqdev: Add a get_dev_path() function to BusInfo
Alex Williamson [Fri, 25 Jun 2010 17:08:52 +0000 (11:08 -0600)]
qdev: Add a get_dev_path() function to BusInfo

This function is meant to provide a stable device path for buses
which are able to implement it.  If a bus has a globally unique
addresses scheme, one address level may be sufficient to provide
a path.  Other buses may need to recursively traverse up the
qdev tree.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agopc: Allocate all ram in a single qemu_ram_alloc()
Alex Williamson [Fri, 25 Jun 2010 17:08:45 +0000 (11:08 -0600)]
pc: Allocate all ram in a single qemu_ram_alloc()

This will benefit us when we migrate based on ramblock name since
we won't be bouncing between separate blocks.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoRemove uses of ram.last_offset (aka last_ram_offset)
Alex Williamson [Fri, 25 Jun 2010 17:08:38 +0000 (11:08 -0600)]
Remove uses of ram.last_offset (aka last_ram_offset)

We currently need this either to allocate the next ram_addr_t for a
new block, or for total memory to be migrated.  Both of which we can
calculate without need of this to keep us in a contiguous address space.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agomake rtc alatm work
Gleb Natapov [Mon, 5 Jul 2010 08:36:34 +0000 (11:36 +0300)]
make rtc alatm work

Convert alarm time from BCD if needed before comparing with current
time.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoscsi: Fix SCSI bus reset
Jan Kiszka [Tue, 6 Jul 2010 08:58:03 +0000 (10:58 +0200)]
scsi: Fix SCSI bus reset

When the controller raises the SCSI reset line, we have to perform the
requested reset on all disks attached to the controller's bus. Moreover,
reset is edge triggered, so avoid repeating it if the line was already
high.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoFix io-thread build breakage of a88790a14f
Jan Kiszka [Tue, 6 Jul 2010 08:49:57 +0000 (10:49 +0200)]
Fix io-thread build breakage of a88790a14f

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
13 years agoblock: add sheepdog driver for distributed storage support
MORITA Kazutaka [Sun, 20 Jun 2010 20:01:00 +0000 (05:01 +0900)]
block: add sheepdog driver for distributed storage support

Sheepdog is a distributed storage system for QEMU. It provides highly
available block level storage volumes to VMs like Amazon EBS.  This
patch adds a qemu block driver for Sheepdog.

Sheepdog features are:
- No node in the cluster is special (no metadata node, no control
  node, etc)
- Linear scalability in performance and capacity
- No single point of failure
- Autonomous management (zero configuration)
- Useful volume management support such as snapshot and cloning
- Thin provisioning
- Autonomous load balancing

The more details are available at the project site:
    http://www.osrg.net/sheepdog/

Signed-off-by: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>