sdk/emulator/qemu.git
12 years agoconfigure: fix double check tests with Clang
Blue Swirl [Thu, 9 Aug 2012 20:21:25 +0000 (20:21 +0000)]
configure: fix double check tests with Clang

Configuring with Clang compiler with -Werror would not work after
improved checks:
/tmp/qemu-conf--25992-.c:4:32: error: self-comparison always evaluates
to true [-Werror,-Wtautological-compare]
int main(void) { return preadv == preadv; }
/tmp/qemu-conf--25992-.c:13:26: error: self-comparison always
evaluates to true [-Werror,-Wtautological-compare]
    return epoll_create1 == epoll_create1;
/tmp/qemu-conf--25992-.c:3:13: error: explicitly assigning a variable
of type 'char **' to itself [-Werror,-Wself-assign]
    environ = environ;

Avoid the errors by adjusting the tests.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconfigure: Check for -Werror causing failures when compiling tests
Peter Maydell [Wed, 18 Jul 2012 14:10:28 +0000 (15:10 +0100)]
configure: Check for -Werror causing failures when compiling tests

Add support for checking whether test case code can compile without
warnings, by recompiling each successful test with -Werror. If the
-Werror version doesn't pass, we bail out. This gives us the same
level of visibility of warnings in test code as --enable-werror
provides for the main compile.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoexec.c: fix dirty bitmap reallocation
Igor Mitsyanko [Fri, 10 Aug 2012 14:45:11 +0000 (18:45 +0400)]
exec.c: fix dirty bitmap reallocation

For each newly created RAM block, dirty bitmap is reallocated with g_realloc, which doesn't
make any promises on initial content of new extra data in returned buffer. In theory,
we initialize this new data with cpu_physical_memory_set_dirty_range() call. The
problem is, cpu_physical_memory_set_dirty_range() has a side effect of incrementing
ram_list.dirty_pages variable, but only for pages which are not already dirty. And
page "cleanliness" is determined using the same not yet uninitialized dirty bitmap
we've just reallocated. This results in inconsistency between real dirty page number
and value in ram_list.dirty_pages variable, which in turn could (and will) result
in errors during VM migration.
Zero initialize new dirty bitmap bytes to fix this problem.

Signed-off-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMakefile: add qapi.py dependencies
Stefan Hajnoczi [Fri, 10 Aug 2012 13:08:42 +0000 (14:08 +0100)]
Makefile: add qapi.py dependencies

Commit 427a1a2cb1d35b83b6302886f46289f6d617134d ("qapi: avoid reserved
keywords") modifies qapi.py, which is used by qapi-types.py and other
Python scripts.  Because Makefile has no dependencies for qapi.py the
qapi code generator will not be rerun and the following build error is
produced:

  net/slirp.c: In function ‘net_init_slirp’:
  net/slirp.c:721:50: error: ‘NetdevUserOptions’ has no member named ‘q_restrict’

Fix this issue by adding the missing qapi.py dependencies.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add a minimal curses screen support
Guan Xuetao [Fri, 10 Aug 2012 06:42:39 +0000 (14:42 +0800)]
unicore32-softmmu: Add a minimal curses screen support

This patch adds a minimal curses screen support for unicore32-softmmu.
We assume 80*30 screen size to minimize the implementation.
Two problems are not solved, but they are innocuous.
1. curses windows will be blank when switching to monitor screen and back
2. backspace is not handled yet

v1->v2: add extra handler for '\r'

Signed-off-by: Zhang Mengchi <zhangmengchi@mprc.pku.edu.cn>
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32: Close dump-option of cpu_dump_state_ucf64 function
Guan Xuetao [Fri, 10 Aug 2012 06:42:38 +0000 (14:42 +0800)]
unicore32: Close dump-option of cpu_dump_state_ucf64 function

Since of tedious output, we close dump-option of cpu_dump_state_ucf64 function.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32: Disintegrate cpu_dump_state_ucf64 function
Guan Xuetao [Fri, 10 Aug 2012 06:42:37 +0000 (14:42 +0800)]
unicore32: Disintegrate cpu_dump_state_ucf64 function

This patch disintegrates cpu_dump_state_ucf64 function from cpu_dump_state.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32: Split UniCore-F64 instruction helpers from helper.c
Guan Xuetao [Fri, 10 Aug 2012 06:42:36 +0000 (14:42 +0800)]
unicore32: Split UniCore-F64 instruction helpers from helper.c

This patch just splits ucf64 instruction simulation helpers from
helper.c.
Also, two checkpatch warnings are solved.

v1->v2: adjust copyright information for new ucf64_helper.c

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add is_default setting for puv3 machine
Guan Xuetao [Fri, 10 Aug 2012 06:42:35 +0000 (14:42 +0800)]
unicore32-softmmu: Add is_default setting for puv3 machine

This patch sets is_default to 1 for puv3 machine, so that
find_default_machine() returns puv3 machine.
Thanks Dunrong for pointing it out.

Cc: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add maintainer information for UniCore32 machine
Guan Xuetao [Fri, 10 Aug 2012 06:42:34 +0000 (14:42 +0800)]
unicore32-softmmu: Add maintainer information for UniCore32 machine

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add ps2 support
Guan Xuetao [Fri, 10 Aug 2012 06:42:33 +0000 (14:42 +0800)]
unicore32-softmmu: Add ps2 support

This patch adds ps2/keyboard support, and enables CONFIG_PCKBD.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add puv3 dma support
Guan Xuetao [Fri, 10 Aug 2012 06:42:32 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 dma support

This patch adds puv3 dma (Direct Memory Access) support,
include dma device simulation for kernel booting.

v1->v2: Add initialization to ret in puv3_dma_read.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add puv3 pm support
Guan Xuetao [Fri, 10 Aug 2012 06:42:31 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 pm support

This patch adds puv3 pm (power management) support,
include pm device simulation for kernel booting.
Thank Blue Swirl for pointing out the missing "break".

v1->v2: Add initialization to ret in puv3_pm_read.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add puv3 gpio support
Guan Xuetao [Fri, 10 Aug 2012 06:42:30 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 gpio support

This patch adds puv3 gpio (General Purpose Input/Output) support,
include gpio device simulation and its interrupt support.

v1->v2: Add initialization to ret in puv3_gpio_read.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add puv3 ostimer support
Guan Xuetao [Fri, 10 Aug 2012 06:42:29 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 ostimer support

This patch adds puv3 ostimer support, include os timer
device simulation and ptimer support in puv3 machine.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add puv3 interrupt support
Guan Xuetao [Fri, 10 Aug 2012 06:42:28 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 interrupt support

This patch adds puv3 interrupt support, include interrupt controler
device simulation and interrupt handler in puv3 machine.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add puv3 soc/board support
Guan Xuetao [Fri, 10 Aug 2012 06:42:27 +0000 (14:42 +0800)]
unicore32-softmmu: Add puv3 soc/board support

This patch only add puv3 soc/board support, which introduces puv3
machine description, and specifies console type.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Make sure that kernel can access user space
Guan Xuetao [Fri, 10 Aug 2012 06:42:26 +0000 (14:42 +0800)]
unicore32-softmmu: Make sure that kernel can access user space

As a matter of course, we need to access user space in kernel code,
so we need to correct load/store decoders to indicate correct memory
region.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Implement softmmu specific functions
Guan Xuetao [Fri, 10 Aug 2012 06:42:25 +0000 (14:42 +0800)]
unicore32-softmmu: Implement softmmu specific functions

This patch implements softmmu specific functions, include tlb_fill,
switch_mode, do_interrupt and uc32_cpu_handle_mmu_fault.
So the full exception handlers and page table walking could work now.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-unicore32: Drop UC32_CPUID macros
Andreas Färber [Fri, 10 Aug 2012 06:42:24 +0000 (14:42 +0800)]
target-unicore32: Drop UC32_CPUID macros

Any code that depends on a particular CPU type can now go through
callbacks on the QOM UniCore32CPUClass.

Signed-off-by: Andreas Färber <afaerber@suse.de
Acked-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Make UniCore32 cpuid & exceptions correct and runable
Guan Xuetao [Fri, 10 Aug 2012 06:42:23 +0000 (14:42 +0800)]
unicore32-softmmu: Make UniCore32 cpuid & exceptions correct and runable

This patch initializes the cpuid to exactly correct value because
linux kernel will check it.
In addition, the exception types are specified in proper situations.
Then it could make exceptions generated correctly and timely.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add coprocessor 0(sysctrl) and 1(ocd) instruction support
Guan Xuetao [Fri, 10 Aug 2012 06:42:22 +0000 (14:42 +0800)]
unicore32-softmmu: Add coprocessor 0(sysctrl) and 1(ocd) instruction support

Coprocessor 0 is system control coprocessor, and we need get/set its contents.
Also, all cache/tlb ops shoule be implemented here, but just ignored with no harm.

Coprocessor 1 is OCD (on-chip-debugger), which is used for faked console,
so we could output chars to this console without graphic card.
TODO: curses display should be added lator for screen output.

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agounicore32-softmmu: Add unicore32-softmmu build support
Guan Xuetao [Fri, 10 Aug 2012 06:42:21 +0000 (14:42 +0800)]
unicore32-softmmu: Add unicore32-softmmu build support

This patch adds unicore32-softmmu build support, include configure,
makefile, arch_init, and all missing functions needed by softmmu.
Although all missing functions are empty, unicore32-softmmu could
be build successfully.
By 20120804: change QEMU_ARCH_UNICORE32 to 0x4000

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agohandle device help before accelerator set up
Bruce Rogers [Thu, 9 Aug 2012 18:47:40 +0000 (12:47 -0600)]
handle device help before accelerator set up

A command line device probe using just -device "?" gets processed
after qemu-kvm initializes the accelerator. If /dev/kvm is not
present, the accelerator check will fail (kvm is defaulted to on),
which causes libvirt to not be set up to handle qemu guests.

Moving the device help handling before the accelerator set up allows
the device probe to work in this configuration and libvirt succeeds
in setting up for a qemu hypervisor mode.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge branch 'x86cpu_qom_tcg_v2' of git://github.com/imammedo/qemu
Blue Swirl [Thu, 9 Aug 2012 18:44:49 +0000 (18:44 +0000)]
Merge branch 'x86cpu_qom_tcg_v2' of git://github.com/imammedo/qemu

* 'x86cpu_qom_tcg_v2' of git://github.com/imammedo/qemu:
  target-i386: move tcg initialization into x86_cpu_initfn()
  cleanup cpu_set_debug_excp_handler
  target-xtensa: drop usage of prev_debug_excp_handler
  target-i386: drop usage of prev_debug_excp_handler

12 years agoqemu_rearm_alarm_timer: do not call rearm if the next deadline is INT64_MAX
Stefano Stabellini [Tue, 29 May 2012 03:35:24 +0000 (03:35 +0000)]
qemu_rearm_alarm_timer: do not call rearm if the next deadline is INT64_MAX

qemu_rearm_alarm_timer partially duplicates the code in
qemu_next_alarm_deadline to figure out if it needs to rearm the timer.
If it calls qemu_next_alarm_deadline, it always rearms the timer even if
the next deadline is INT64_MAX.

This patch simplifies the behavior of qemu_rearm_alarm_timer and removes
the duplicated code, always calling qemu_next_alarm_deadline and only
rearming the timer if the deadline is less than INT64_MAX.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Tested-by: Andreas Färber <andreas.faerber@web.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: make 'sim' to be the default machine
Max Filippov [Wed, 8 Aug 2012 23:31:38 +0000 (03:31 +0400)]
target-xtensa: make 'sim' to be the default machine

This fixes the following error:

    $ qemu-system-xtensa -cpu help
    Segmentation fault

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agotarget-xtensa: make default CPU depend on target endianness
Max Filippov [Wed, 8 Aug 2012 10:07:14 +0000 (14:07 +0400)]
target-xtensa: make default CPU depend on target endianness

This makes usable default for -cpu option both for qemu-system-xtensa
and qemu-system-xtensaeb fixing the following error:

    $ qemu-system-xtensaeb -M sim
    Unable to find CPU definition

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMIPS: Correct FCR0 initialization
Nathan Froyd [Thu, 7 Jun 2012 15:04:14 +0000 (15:04 +0000)]
MIPS: Correct FCR0 initialization

 This change addresses a problem where QEMU incorrectly traps on
floating-point MADD group instructions with SIGILL, at least while
emulating MIPS32r2 processors.  These instructions use the COP1X major
opcode and include ones like:

madd.d $f2,$f4,$f2,$f6

 Here's Nathan's original analysis of the problem:

"QEMU essentially does:

  d = find_cpu (cpu_string) // get CPU definition
  fpu_init (env, d) // initialize fpu state (init FCR0, basically)
  cpu_reset (env)

...and the cpu_reset call clears all interesting state that fpu_init
setup, then proceeds to reinitialize all the CP0 registers...but not
FCR0."

 I have verified this change with system emulation running the GDB test
suite for the mips-sde-elf target (o32, big endian, 24Kf CPU emulated),
there were 55 progressions and no regressions.

Signed-off-by: Maciej W. Rozycki <macro@codesourcery.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoscsi-bus: remove overlapping entry
Blue Swirl [Mon, 30 Jul 2012 17:46:06 +0000 (17:46 +0000)]
scsi-bus: remove overlapping entry

LOAD_UNLOAD and START_STOP have same value, so the table
entry is initialized twice. Spotted by Clang compiler.

Remove LOAD_UNLOAD entry since START_STOP entry already
represents both.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoxilinx_axienet: avoid useless self-assignment
Blue Swirl [Mon, 30 Jul 2012 17:28:04 +0000 (17:28 +0000)]
xilinx_axienet: avoid useless self-assignment

Statement s=s; makes little sense, remove it. Spotted by Clang
compiler.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agouser: fix accidental AREG0 use
Blue Swirl [Mon, 30 Jul 2012 15:51:17 +0000 (15:51 +0000)]
user: fix accidental AREG0 use

Global register AREG0 was always assumed to be usable in user-exec.c,
but this is incorrect for several targets.

Fix with #ifdeffery and by using other variables.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoqapi: avoid reserved keywords
Blue Swirl [Mon, 30 Jul 2012 15:46:55 +0000 (15:46 +0000)]
qapi: avoid reserved keywords

Clang compiler complained about use of reserved word 'restrict' in SLIRP
and QAPI.

Prefix C keywords with "q_", adjust SLIRP accordingly.

Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosparc: fix expression with uninitialized initial value
Blue Swirl [Mon, 30 Jul 2012 15:29:11 +0000 (15:29 +0000)]
sparc: fix expression with uninitialized initial value

err was uninitialized, it's not OK to use |=. Spotted by Clang
compiler.

Fix by implementing the earlier statement which initializes the variable.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agosparc: fix floppy TC line setup
Blue Swirl [Mon, 30 Jul 2012 15:24:23 +0000 (15:24 +0000)]
sparc: fix floppy TC line setup

The qemu_irq for Terminal Count (TC) line between FDC and Slavio misc
device was created only after use, spotted by Clang compiler. Also,
it was not created if the FDC didn't exist.

Rearrange code to fix order. Always create the TC line.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: add Tekram DC-390 emulation (PC SCSI adapter)
Hervé Poussineau [Sat, 4 Aug 2012 19:10:06 +0000 (21:10 +0200)]
esp: add Tekram DC-390 emulation (PC SCSI adapter)

Difference with AMD PCscsi is that DC-390 contains a EEPROM,
and that a romfile is available to add INT13 support.

This has been successfully tested on:
- MS DOS 6.22 (using DC390 ASPI driver)
- MS Windows 98 SE (using DC390 driver)
- MS Windows NT 3.1 (using DC390 driver)
- MS Windows NT 4.0 (using DC390 driver)
- hard disk and cdrom boot

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoRevert "pci: add some stubs"
Hervé Poussineau [Sat, 4 Aug 2012 19:10:05 +0000 (21:10 +0200)]
Revert "pci: add some stubs"

This reverts commit 0883c5159f1df05d8761014f65451c3c3b77ebcf.

Those stubs were only used by PCI ESP emulation, which is now
not compiled on architectures which have no PCI bus support.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: move PCI emulation to a new file esp-pci.c
Hervé Poussineau [Sat, 4 Aug 2012 19:10:04 +0000 (21:10 +0200)]
esp: move PCI emulation to a new file esp-pci.c

sparc machines loose ability to instanciate PCI ESP SCSI adapter,
which is not a big loose as they don't have PCI bus support.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoesp: move some definitions to header file
Hervé Poussineau [Sat, 4 Aug 2012 19:10:03 +0000 (21:10 +0200)]
esp: move some definitions to header file

These will be used by next commits.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoMerge remote-tracking branch 'kraxel/usb.58' into staging
Anthony Liguori [Tue, 7 Aug 2012 14:46:40 +0000 (09:46 -0500)]
Merge remote-tracking branch 'kraxel/usb.58' into staging

* kraxel/usb.58:
  usb-storage: fix SYNCHRONIZE_CACHE
  usb-storage: improve debug logging

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 7 Aug 2012 14:46:24 +0000 (09:46 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  qemu-img: use QemuOpts instead of QEMUOptionParameter in resize function
  qemu-iotests: Be more flexible with image creation options
  qemu-iotests: add 039 qcow2 lazy refcounts test
  qemu-io: add "abort" command to simulate program crash
  qcow2: implement lazy refcounts
  qemu-iotests: ignore qemu-img create lazy_refcounts output
  docs: add lazy refcounts bit to qcow2 specification
  qcow2: introduce dirty bit
  docs: add dirty bit to qcow2 specification
  qemu-iotests: add qed.py image manipulation utility
  qapi: generalize documentation of streaming commands
  ide scsi: Mess with geometry only for hard disk devices

12 years agousb-storage: fix SYNCHRONIZE_CACHE
Gerd Hoffmann [Fri, 13 Jul 2012 09:38:13 +0000 (11:38 +0200)]
usb-storage: fix SYNCHRONIZE_CACHE

Commit 59310659073d85745854f2f10c4292555c5a1c51 is incomplete,
we'll arrive in the scsi command complete callback in CSW state
and must handle that case correctly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agousb-storage: improve debug logging
Gerd Hoffmann [Fri, 13 Jul 2012 09:35:51 +0000 (11:35 +0200)]
usb-storage: improve debug logging

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
12 years agoslirp: fix build on mingw32
Anthony Liguori [Tue, 7 Aug 2012 00:31:55 +0000 (19:31 -0500)]
slirp: fix build on mingw32

in_addr_t isn't available on mingw32.  Just use an unsigned long instead.  I
considered typedef'ing in_addr_t on mingw32 but this would potentially be
brittle if mingw32 did introduce the type.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoqemu-img: use QemuOpts instead of QEMUOptionParameter in resize function
Dong Xu Wang [Mon, 6 Aug 2012 02:18:42 +0000 (10:18 +0800)]
qemu-img: use QemuOpts instead of QEMUOptionParameter in resize function

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: Be more flexible with image creation options
Kevin Wolf [Fri, 27 Jul 2012 13:14:28 +0000 (15:14 +0200)]
qemu-iotests: Be more flexible with image creation options

qemu-iotests already filters out image creation options that may be
present or not in order to get the same output in both cases. However,
often it only considers the default value of the option. Cover all valid
values instead so that ./check -o name=value can be used successfull for
all of them.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: add 039 qcow2 lazy refcounts test
Stefan Hajnoczi [Fri, 27 Jul 2012 08:05:24 +0000 (09:05 +0100)]
qemu-iotests: add 039 qcow2 lazy refcounts test

This tests establishes the basic post-conditions of the qcow2 lazy
refcounts features:

  1. If the image was closed normally, it is marked clean.

  2. If an allocating write was performed and the image was not closed
     normally, then it is marked dirty.

     a. Written data can be read back successfully.
     b. The image file can be repaired and will be marked clean again.
     c. The image file is automatically repaired when opened read/write.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-io: add "abort" command to simulate program crash
Stefan Hajnoczi [Fri, 27 Jul 2012 08:05:23 +0000 (09:05 +0100)]
qemu-io: add "abort" command to simulate program crash

Avoiding data loss and corruption is the top requirement for image file
formats.  The qemu-io "abort" command makes it possible to simulate
program crashes and does not give the image format a chance to cleanly
shut down.  This command is useful for data integrity test cases.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: implement lazy refcounts
Stefan Hajnoczi [Fri, 27 Jul 2012 08:05:22 +0000 (09:05 +0100)]
qcow2: implement lazy refcounts

Lazy refcounts is a performance optimization for qcow2 that postpones
refcount metadata updates and instead marks the image dirty.  In the
case of crash or power failure the image will be left in a dirty state
and repaired next time it is opened.

Reducing metadata I/O is important for cache=writethrough and
cache=directsync because these modes guarantee that data is on disk
after each write (hence we cannot take advantage of caching updates in
RAM).  Refcount metadata is not needed for guest->file block address
translation and therefore does not need to be on-disk at the time of
write completion - this is the motivation behind the lazy refcount
optimization.

The lazy refcount optimization must be enabled at image creation time:

  qemu-img create -f qcow2 -o compat=1.1,lazy_refcounts=on a.qcow2 10G
  qemu-system-x86_64 -drive if=virtio,file=a.qcow2,cache=writethrough

Update qemu-iotests 031 and 036 since the extension header size changes
when we add feature bit table entries.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: ignore qemu-img create lazy_refcounts output
Stefan Hajnoczi [Fri, 27 Jul 2012 08:05:21 +0000 (09:05 +0100)]
qemu-iotests: ignore qemu-img create lazy_refcounts output

Hide the default lazy_refcounts=off output from qemu-img like we do with
other image creation options.  This ensures that existing golden outputs
continue to pass despite the new option that has been added.

Note that this patch applies before the one that actually introduces the
lazy_refcounts=on|off option.  This ensures git-bisect(1) continues to
work.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agodocs: add lazy refcounts bit to qcow2 specification
Stefan Hajnoczi [Fri, 27 Jul 2012 08:05:20 +0000 (09:05 +0100)]
docs: add lazy refcounts bit to qcow2 specification

The lazy refcounts bit indicates that this image can take advantage of
the dirty bit and that refcount updates can be postponed.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: introduce dirty bit
Stefan Hajnoczi [Fri, 27 Jul 2012 08:05:19 +0000 (09:05 +0100)]
qcow2: introduce dirty bit

This patch adds an incompatible feature bit to mark images that have not
been closed cleanly.  When a dirty image file is opened a consistency
check and repair is performed.

Update qemu-iotests 031 and 036 since the extension header size changes
when we add feature bit table entries.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agodocs: add dirty bit to qcow2 specification
Stefan Hajnoczi [Fri, 27 Jul 2012 08:05:18 +0000 (09:05 +0100)]
docs: add dirty bit to qcow2 specification

The dirty bit will make it possible to perform lazy refcount updates,
where the image file is not kept consistent all the time.  Upon opening
a dirty image file, it is necessary to perform a consistency check and
repair any incorrect refcounts.

Therefore the dirty bit must be an incompatible feature bit.  We don't
want old programs accessing a file with stale refcounts.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: add qed.py image manipulation utility
Stefan Hajnoczi [Fri, 27 Jul 2012 08:01:27 +0000 (09:01 +0100)]
qemu-iotests: add qed.py image manipulation utility

The qed.py utility can inspect and manipulate QED image files.  It can
be used for testing to see the state of image metadata and also to
inject corruptions into the image file.  It also has a scrubbing feature
to copy just the metadata out of an image file, allowing users to share
broken image files without revealing data in bug reports.

This has lived in my local repo for a long time but could be useful
to others.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqapi: generalize documentation of streaming commands
Paolo Bonzini [Tue, 24 Jul 2012 11:03:39 +0000 (13:03 +0200)]
qapi: generalize documentation of streaming commands

Talk about background operations in general, rather than specifically
about streaming.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide scsi: Mess with geometry only for hard disk devices
Markus Armbruster [Thu, 12 Jul 2012 16:52:31 +0000 (18:52 +0200)]
ide scsi: Mess with geometry only for hard disk devices

Legacy -drive cyls=... are now ignored completely when the drive
doesn't back a hard disk device.  Before, they were first checked
against a hard disk's limits, then ignored.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agovirtio: fix vhost handling
Paolo Bonzini [Mon, 6 Aug 2012 13:26:14 +0000 (15:26 +0200)]
virtio: fix vhost handling

Commit b1f416aa8d870fab71030abc9401cfc77b948e8e breaks vhost_net
because it always registers the virtio_pci_host_notifier_read() handler
function on the ioeventfd, even when vhost_net.ko is using the ioeventfd.
The result is both QEMU and vhost_net.ko polling on the same eventfd
and the virtio_net.ko guest driver seeing inconsistent results:

  # ifconfig eth0 192.168.0.1 netmask 255.255.255.0
  virtio_net virtio0: output:id 0 is not a head!

To fix this, proceed the same as we do for irqfd: add a parameter to
virtio_queue_set_host_notifier_fd_handler and in that case only set
the notifier, not the handler.

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Tested-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Mon, 6 Aug 2012 18:59:59 +0000 (13:59 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

* kiszka/queues/slirp:
  slirp: Handle whole 127.0.0.0/8 network as local addresses.

12 years agoMerge branch 'axp-next' of git://repo.or.cz/qemu/rth
Blue Swirl [Sat, 4 Aug 2012 17:58:23 +0000 (17:58 +0000)]
Merge branch 'axp-next' of git://repo.or.cz/qemu/rth

* 'axp-next' of git://repo.or.cz/qemu/rth:
  alpha-linux-user: Fix the getpriority syscall
  alpha-linux-user: Properly handle the non-rt sigprocmask syscall.
  alpha-linux-user: Fix a3 error return with v0 error bypass.
  linux-user: Translate pipe2 flags; add to strace
  linux-user: Allocate the right amount of space for non-fixed file maps
  linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
  linux-user: Sync fcntl.h bits with the kernel
  alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
  alpha-linux-user: Work around hosted mmap allocation problems
  alpha-linux-user: Fix signal handling

12 years agoalpha-linux-user: Fix the getpriority syscall
Richard Henderson [Thu, 7 Jun 2012 22:14:50 +0000 (15:14 -0700)]
alpha-linux-user: Fix the getpriority syscall

Alpha uses unbiased priority values in the syscall, with the a3
return value signaling error conditions.  Therefore, properly
interpret the libc getpriority as needed for the guest rather
than passing the host value through unchanged.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agoalpha-linux-user: Properly handle the non-rt sigprocmask syscall.
Richard Henderson [Thu, 7 Jun 2012 22:02:49 +0000 (15:02 -0700)]
alpha-linux-user: Properly handle the non-rt sigprocmask syscall.

Name the syscall properly for QEMU, kernel source notwithstanding.
Fix syntax errors in the code thus enabled within do_syscall.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agoalpha-linux-user: Fix a3 error return with v0 error bypass.
Richard Henderson [Thu, 7 Jun 2012 21:47:41 +0000 (14:47 -0700)]
alpha-linux-user: Fix a3 error return with v0 error bypass.

We were failing to initialize a3 for syscalls that bypass the
negative return value error check.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agolinux-user: Translate pipe2 flags; add to strace
Richard Henderson [Sat, 2 Jun 2012 01:48:39 +0000 (18:48 -0700)]
linux-user: Translate pipe2 flags; add to strace

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agolinux-user: Allocate the right amount of space for non-fixed file maps
Richard Henderson [Fri, 1 Jun 2012 23:07:52 +0000 (16:07 -0700)]
linux-user: Allocate the right amount of space for non-fixed file maps

If we let the kernel handle the implementation of mmap_find_vma,
via an anon mmap, we must use the size as indicated by the user
and not the size truncated to the filesize.

This happens often in ld.so, where we initially mmap the file to
the size of the text+data+bss to reserve an area, then mmap+fixed
over the top to properly handle data and bss.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agolinux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH
Richard Henderson [Wed, 25 Jul 2012 21:30:34 +0000 (14:30 -0700)]
linux-user: Handle O_SYNC, O_NOATIME, O_CLOEXEC, O_PATH

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agolinux-user: Sync fcntl.h bits with the kernel
Richard Henderson [Wed, 25 Jul 2012 21:29:31 +0000 (14:29 -0700)]
linux-user: Sync fcntl.h bits with the kernel

For each target, only define the bits that appear in
arch/target/include/asm/fcntl.h.  Mirror the kernel's
asm-generic layout by handling anything undefined afterward.

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agoalpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly
Richard Henderson [Fri, 1 Jun 2012 16:08:21 +0000 (09:08 -0700)]
alpha-linux-user: Handle TARGET_SSI_IEEE_RAISE_EXCEPTION properly

We weren't aggregating the exceptions, nor raising signals properly.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agoalpha-linux-user: Work around hosted mmap allocation problems
Richard Henderson [Thu, 31 May 2012 23:09:39 +0000 (16:09 -0700)]
alpha-linux-user: Work around hosted mmap allocation problems

Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agoalpha-linux-user: Fix signal handling
Richard Henderson [Thu, 31 May 2012 19:05:23 +0000 (12:05 -0700)]
alpha-linux-user: Fix signal handling

Proper signal numbers were not defined, and EXCP_INTERRUPT
was unhandled, leading to all sorts of subtle confusion.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Richard Henderson <rth@twiddle.net>
12 years agobitops: drop volatile qualifier
Blue Swirl [Sun, 8 Jul 2012 19:03:33 +0000 (19:03 +0000)]
bitops: drop volatile qualifier

Qualifier 'volatile' is not useful for applications, it's too strict
for single threaded code but does not give the real atomicity guarantees
needed for multithreaded code.

Drop them and now useless casts.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconfigure: Fix set-but-not-used warning in Xen 4.1 probe
Peter Maydell [Thu, 2 Aug 2012 17:30:27 +0000 (18:30 +0100)]
configure: Fix set-but-not-used warning in Xen 4.1 probe

The Xen 4.1 probe never uses the return value from xc_interface_open(),
so was provoking a compiler warning on newer gcc. Fix by not bothering
to put the return value anywhere.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoconfigure: Don't run Xen compile checks in subshells
Peter Maydell [Thu, 2 Aug 2012 17:30:26 +0000 (18:30 +0100)]
configure: Don't run Xen compile checks in subshells

The Xen compile checks are currently run inside subshells. This
is unnecessary and has the effect that if do_cc() exits with
an error message then this only causes the subshell to exit,
not the whole of configure, which is confusing. Remove the
subshells, changing:
  if ( cat ; compile_prog ) ; then ...
to
  if cat && compile_prog ; then ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agoFixes related to processing of qemu's -numa option
Chegu Vinod [Tue, 17 Jul 2012 04:31:30 +0000 (21:31 -0700)]
Fixes related to processing of qemu's -numa option

The -numa option to qemu is used to create [fake] numa nodes
and expose them to the guest OS instance.

There are a couple of issues with the -numa option:

a) Max VCPU's that can be specified for a guest while using
   the qemu's -numa option is 64. Due to a typecasting issue
   when the number of VCPUs is > 32 the VCPUs don't show up
   under the specified [fake] numa nodes.

b) KVM currently has support for 160VCPUs per guest. The
   qemu's -numa option has only support for upto 64VCPUs
   per guest.
This patch addresses these two issues.

Below are examples of (a) and (b)

a) >32 VCPUs are specified with the -numa option:

/usr/local/bin/qemu-system-x86_64 \
-enable-kvm \
71:01:01 \
-net tap,ifname=tap0,script=no,downscript=no \
-vnc :4

...
Upstream qemu :
--------------

QEMU 1.1.50 monitor - type 'help' for more information
(qemu) info numa
6 nodes
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 32 33 34 35 36 37 38 39 40 41
node 0 size: 131072 MB
node 1 cpus: 10 11 12 13 14 15 16 17 18 19 42 43 44 45 46 47 48 49 50 51
node 1 size: 131072 MB
node 2 cpus: 20 21 22 23 24 25 26 27 28 29 52 53 54 55 56 57 58 59
node 2 size: 131072 MB
node 3 cpus: 30
node 3 size: 131072 MB
node 4 cpus:
node 4 size: 131072 MB
node 5 cpus: 31
node 5 size: 131072 MB

With the patch applied :
-----------------------

QEMU 1.1.50 monitor - type 'help' for more information
(qemu) info numa
6 nodes
node 0 cpus: 0 1 2 3 4 5 6 7 8 9
node 0 size: 131072 MB
node 1 cpus: 10 11 12 13 14 15 16 17 18 19
node 1 size: 131072 MB
node 2 cpus: 20 21 22 23 24 25 26 27 28 29
node 2 size: 131072 MB
node 3 cpus: 30 31 32 33 34 35 36 37 38 39
node 3 size: 131072 MB
node 4 cpus: 40 41 42 43 44 45 46 47 48 49
node 4 size: 131072 MB
node 5 cpus: 50 51 52 53 54 55 56 57 58 59
node 5 size: 131072 MB

b) >64 VCPUs specified with -numa option:

/usr/local/bin/qemu-system-x86_64 \
-enable-kvm \
-cpu Westmere,+rdtscp,+pdpe1gb,+dca,+pdcm,+xtpr,+tm2,+est,+smx,+vmx,+ds_cpl,+monitor,+dtes64,+pclmuldq,+pbe,+tm,+ht,+ss,+acpi,+d-vnc :4

...

Upstream qemu :
--------------

only 63 CPUs in NUMA mode supported.
only 64 CPUs in NUMA mode supported.
QEMU 1.1.50 monitor - type 'help' for more information
(qemu) info numa
8 nodes
node 0 cpus: 6 7 8 9 38 39 40 41 70 71 72 73
node 0 size: 65536 MB
node 1 cpus: 10 11 12 13 14 15 16 17 18 19 42 43 44 45 46 47 48 49 50 51 74 75 76 77 78 79
node 1 size: 65536 MB
node 2 cpus: 20 21 22 23 24 25 26 27 28 29 52 53 54 55 56 57 58 59 60 61
node 2 size: 65536 MB
node 3 cpus: 30 62
node 3 size: 65536 MB
node 4 cpus:
node 4 size: 65536 MB
node 5 cpus:
node 5 size: 65536 MB
node 6 cpus: 31 63
node 6 size: 65536 MB
node 7 cpus: 0 1 2 3 4 5 32 33 34 35 36 37 64 65 66 67 68 69
node 7 size: 65536 MB

With the patch applied :
-----------------------

QEMU 1.1.50 monitor - type 'help' for more information
(qemu) info numa
8 nodes
node 0 cpus: 0 1 2 3 4 5 6 7 8 9
node 0 size: 65536 MB
node 1 cpus: 10 11 12 13 14 15 16 17 18 19
node 1 size: 65536 MB
node 2 cpus: 20 21 22 23 24 25 26 27 28 29
node 2 size: 65536 MB
node 3 cpus: 30 31 32 33 34 35 36 37 38 39
node 3 size: 65536 MB
node 4 cpus: 40 41 42 43 44 45 46 47 48 49
node 4 size: 65536 MB
node 5 cpus: 50 51 52 53 54 55 56 57 58 59
node 5 size: 65536 MB
node 6 cpus: 60 61 62 63 64 65 66 67 68 69
node 6 size: 65536 MB
node 7 cpus: 70 71 72 73 74 75 76 77 78 79

Signed-off-by: Chegu Vinod <chegu_vinod@hp.com>, Jim Hull <jim.hull@hp.com>, Craig Hada <craig.hada@hp.com>
Tested-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
12 years agobuild: Fix build breakage detected by buildbot
Dunrong Huang [Sat, 4 Aug 2012 11:29:55 +0000 (19:29 +0800)]
build: Fix build breakage detected by buildbot

More details:
http://buildbot.b1-systems.de/qemu/builders/xen_unstable/builds/83/steps/compile/logs/stdio

VLANState has been removed since commit a005d07, so "vlan id" should be
fetched using net_hub_id_for_client().

Signed-off-by: Dunrong Huang <riegamaths@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agofips: fix build on !Linux
Anthony Liguori [Fri, 3 Aug 2012 23:28:37 +0000 (18:28 -0500)]
fips: fix build on !Linux

Commit 0f66998 makes -enable-fips conditional on Linux hosts but then uses it
unconditionally in vl.c.

Fix this by moving the fips handling to os-posix.c and adding a condition.

Cc: Paul Moore <pmoore@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoslirp: Handle whole 127.0.0.0/8 network as local addresses.
Anders Waldenborg [Fri, 13 Jul 2012 20:54:17 +0000 (22:54 +0200)]
slirp: Handle whole 127.0.0.0/8 network as local addresses.

Changes so translation of remote address to the host's ip address in
the virtual network happens for all addresses in the 127.0.0.0/8
network, not just 127.0.0.1.

This fixes so that hostfwd bound to addresses such as 127.0.0.2 works.

Signed-off-by: Anders Waldenborg <anders@0x63.nu>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
12 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Fri, 3 Aug 2012 20:46:17 +0000 (15:46 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  scsi: add support for ATA_PASSTHROUGH_xx scsi command
  esp: add missing const on TypeInfo structures
  esp: enable for all PCI machines
  Revert "megasas: disable due to build breakage"
  megasas: static SAS addresses
  scsi-disk: fix compilation with DEBUG_SCSI
  megasas: Update function megasys_scsi_uninit
  SCSI: STARTSTOPUNIT only eject/load media if powercondition is 0
  SCSI: Update the sense code for PREVENT REMOVAL errors

12 years agoscsi: add support for ATA_PASSTHROUGH_xx scsi command
Cong Meng [Fri, 3 Aug 2012 04:02:19 +0000 (12:02 +0800)]
scsi: add support for ATA_PASSTHROUGH_xx scsi command

Correct the command names of opcode 0x85 and 0xa1, and calculate
their xfer size from CDB.

Signed-off-by: Cong Meng <mc@linux.vnet.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agovnc: disable VNC password authentication (security type 2) when in FIPS mode
Paul Moore [Fri, 3 Aug 2012 18:39:21 +0000 (14:39 -0400)]
vnc: disable VNC password authentication (security type 2) when in FIPS mode

FIPS 140-2 requires disabling certain ciphers, including DES, which is used
by VNC to obscure passwords when they are sent over the network.  The
solution for FIPS users is to disable the use of VNC password auth when the
host system is operating in FIPS compliance mode and the user has specified
'-enable-fips' on the QEMU command line.

This patch causes QEMU to emit a message to stderr when the host system is
running in FIPS mode and a VNC password was specified on the commend line.
If the system is not running in FIPS mode, or is running in FIPS mode but
VNC password authentication was not requested, QEMU operates normally.

Signed-off-by: Paul Moore <pmoore@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Fri, 3 Aug 2012 19:28:26 +0000 (14:28 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  hmp: show the backing file depth
  block: Use bdrv_get_backing_file_depth()
  block: create bdrv_get_backing_file_depth()
  qapi: qapi.py: allow the "'" character to be escaped

12 years agoMerge remote-tracking branch 'afaerber-or/qom-cpu-4' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:56:39 +0000 (13:56 -0500)]
Merge remote-tracking branch 'afaerber-or/qom-cpu-4' into staging

* afaerber-or/qom-cpu-4:
  cpu: Move thread_kicked to CPUState
  cpu: Move thread field into CPUState
  cpu: Move CPU_COMMON_THREAD into CPUState
  qemu-thread: Let qemu_thread_is_self() return bool

12 years agoMerge remote-tracking branch 'sstabellini/xen-fixes-20120801' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:54:35 +0000 (13:54 -0500)]
Merge remote-tracking branch 'sstabellini/xen-fixes-20120801' into staging

* sstabellini/xen-fixes-20120801:
  fix Xen compilation
  configure: Fix xen probe with Xen 4.2 and later

12 years agoMerge remote-tracking branch 'stefanha/net' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:54:05 +0000 (13:54 -0500)]
Merge remote-tracking branch 'stefanha/net' into staging

* stefanha/net:
  net: add the support for -netdev socket, listen
  net: fix the coding style
  hub: add the support for hub own flow control
  net: determine if packets can be sent before net queue deliver packets
  net: cleanup deliver/deliver_iov func pointers
  net: Make "info network" output more readable info
  net: Rename qemu_del_vlan_client() to qemu_del_net_client()
  net: Rename vc local variables to nc
  net: Rename VLANClientState to NetClientState
  net: Rename non_vlan_clients to net_clients
  net: Remove VLANState
  net: Remove vlan code from net.c
  net: Convert qdev_prop_vlan to peer with hub
  net: Drop vlan argument to qemu_new_net_client()
  hub: Check that hubs are configured correctly
  net: Look up 'vlan' net clients using hubs
  net: Use hubs for the vlan feature
  net: Add a hub net client
  net: Add interface to bridge when SIOCBRADDIF isn't available

12 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:51:19 +0000 (13:51 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  exec.c: Remove out of date comment
  exec.c: Use subpages for large unaligned mappings
  exec.c: Fix off-by-one error in register_subpage
  socket: clean up redundant assignment
  qom: Clean libuser object and dependency files
  usb: Clean common object and dependency files

12 years agoMerge remote-tracking branch 'aneesh/for-upstream' into staging
Anthony Liguori [Fri, 3 Aug 2012 18:50:41 +0000 (13:50 -0500)]
Merge remote-tracking branch 'aneesh/for-upstream' into staging

* aneesh/for-upstream:
  hw/9pfs: Fix assert when disabling migration
  configure: Fix build with capabilities

12 years agoexec.c: Remove out of date comment
Peter Maydell [Wed, 1 Aug 2012 13:35:47 +0000 (14:35 +0100)]
exec.c: Remove out of date comment

Remove an out of date comment: this comment used to be attached to
cpu_register_physical_memory_log(), before commit 0f0cb164 accidentally
inserted a couple of other functions between the comment and its function.
It is in any case obsolete since (a) the function arguments it refers
to have been replaced with a single MemoryRegionSection* argument and
(b) the inability to handle regions whose offset_within_address_space
and offset_within_region aren't equally aligned was fixed as part of
the rewrite of this code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoexec.c: Use subpages for large unaligned mappings
Tyler Hall [Wed, 25 Jul 2012 22:45:04 +0000 (18:45 -0400)]
exec.c: Use subpages for large unaligned mappings

Registering a multi-page memory region that is non-page-aligned results
in a subpage from the start to the page boundary, some number of full
pages, and possibly another subpage from the last page boundary to the
end. The full pages will have a value for offset_within_region that is
not a multiple of TARGET_PAGE_SIZE. Accesses through softmmu are unable
to handle this and will segfault.

Handling full pages through subpages is not optimal, but only
non-page-aligned mappings take the penalty.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoexec.c: Fix off-by-one error in register_subpage
Tyler Hall [Wed, 25 Jul 2012 22:45:03 +0000 (18:45 -0400)]
exec.c: Fix off-by-one error in register_subpage

subpage_register() expects "end" to be the last byte in the mapping.
Registering a non-page-aligned memory region that extends up to or
beyond a page boundary causes subpage_register() to silently fail
through the (end >= PAGE_SIZE) check.

This bug does not cause noticeable problems for mappings that do not
extend to a page boundary, though they do register an extra byte.

Signed-off-by: Tyler Hall <tylerwhall@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agosocket: clean up redundant assignment
Amos Kong [Fri, 3 Aug 2012 03:06:22 +0000 (11:06 +0800)]
socket: clean up redundant assignment

Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agohmp: show the backing file depth
Benoît Canet [Thu, 2 Aug 2012 08:22:49 +0000 (10:22 +0200)]
hmp: show the backing file depth

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoblock: Use bdrv_get_backing_file_depth()
Benoît Canet [Thu, 2 Aug 2012 08:22:48 +0000 (10:22 +0200)]
block: Use bdrv_get_backing_file_depth()

Use the dedicated counting function in qmp_query_block in order to
propagate the backing file depth to HMP and add backing_file_depth
to qmp-commands.hx

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoblock: create bdrv_get_backing_file_depth()
Benoît Canet [Thu, 2 Aug 2012 08:22:47 +0000 (10:22 +0200)]
block: create bdrv_get_backing_file_depth()

Create bdrv_get_backing_file_depth() in order to be able to show
in QMP and HMP how many ancestors backing an image a block device
have.

Signed-off-by: Benoit Canet <benoit@irqsave.net>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqom: Clean libuser object and dependency files
Jan Kiszka [Mon, 23 Jul 2012 11:45:01 +0000 (13:45 +0200)]
qom: Clean libuser object and dependency files

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agousb: Clean common object and dependency files
Jan Kiszka [Mon, 23 Jul 2012 11:44:35 +0000 (13:44 +0200)]
usb: Clean common object and dependency files

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
12 years agoesp: add missing const on TypeInfo structures
Hervé Poussineau [Thu, 2 Aug 2012 08:40:30 +0000 (10:40 +0200)]
esp: add missing const on TypeInfo structures

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoesp: enable for all PCI machines
Paolo Bonzini [Thu, 2 Aug 2012 13:41:47 +0000 (15:41 +0200)]
esp: enable for all PCI machines

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoRevert "megasas: disable due to build breakage"
Paolo Bonzini [Wed, 1 Aug 2012 10:56:17 +0000 (12:56 +0200)]
Revert "megasas: disable due to build breakage"

This reverts commit 92336855975805d88c7979f53bc05c2d47abab04.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomegasas: static SAS addresses
Hannes Reinecke [Wed, 1 Aug 2012 10:46:50 +0000 (12:46 +0200)]
megasas: static SAS addresses

This patch introduces a new property 'sas_address' which
allows the user to specify the SAS address for the HBA.
The default address is following the NAA locally assigned
identifier format with the locally assigned address
0x525400 as used eg for the MAC addresses.
The lower bytes are set to the pci address which
will ensure uniqueness for the local machine.

The port addresses are now calculated based on the magic
number 0x1221 (which is found in real hardware, too) plus
the device number.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Andreas Faerber <afaerber@suse.de>
Cc: Anthony Liguori <anthony@codemonkey.ws>
Cc: Alexander Graf <agraf@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoscsi-disk: fix compilation with DEBUG_SCSI
Paolo Bonzini [Tue, 31 Jul 2012 14:10:23 +0000 (16:10 +0200)]
scsi-disk: fix compilation with DEBUG_SCSI

Reported-by: Gerhard Wiesinger <lists@wiesinger.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agomegasas: Update function megasys_scsi_uninit
Stefan Weil [Tue, 31 Jul 2012 05:54:57 +0000 (07:54 +0200)]
megasas: Update function megasys_scsi_uninit

Commit f90c2bcdbc69e41e575f868b984c3e2de8f51bac changed
PCIUnregisterFunc, therefore the function prototype
needs an update.

megasas.o is currently not linked, so this bug was not
detected by the buildbots.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>