sdk/emulator/qemu.git
13 years agounicore32: add target-unicore32 directory for unicore32-linux-user support
Guan Xuetao [Tue, 12 Apr 2011 08:25:59 +0000 (16:25 +0800)]
unicore32: add target-unicore32 directory for unicore32-linux-user support

Signed-off-by: Guan Xuetao <gxt@mprc.pku.edu.cn>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomicroblaze: Add partial decoding of stream insns
Edgar E. Iglesias [Mon, 11 Apr 2011 22:48:33 +0000 (00:48 +0200)]
microblaze: Add partial decoding of stream insns

Based on a patch from: Alejandro Cabrera <aldaya@gmail.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Add stream-insn related constants
Edgar E. Iglesias [Mon, 11 Apr 2011 22:42:28 +0000 (00:42 +0200)]
microblaze: Add stream-insn related constants

Based on a patch from: Alejandro Cabrera <aldaya@gmail.com>

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Correct ec mask in debug print
Edgar E. Iglesias [Mon, 11 Apr 2011 21:57:07 +0000 (23:57 +0200)]
microblaze: Correct ec mask in debug print

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Add constant for exception-code mask
Edgar E. Iglesias [Mon, 11 Apr 2011 21:55:42 +0000 (23:55 +0200)]
microblaze: Add constant for exception-code mask

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agomicroblaze: Correct MMU_ZONES mask
Alejandro Cabrera [Mon, 11 Apr 2011 21:07:58 +0000 (23:07 +0200)]
microblaze: Correct MMU_ZONES mask

Signed-off-by: Alejandro Cabrera <aldaya@gmail.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoppc: remove a write-only variable
Blue Swirl [Sat, 9 Apr 2011 14:25:25 +0000 (14:25 +0000)]
ppc: remove a write-only variable

Remove a write-only variable, spotted by GCC 4.6.0:
/src/qemu/hw/ppc.c: In function 'power7_set_irq':
/src/qemu/hw/ppc.c:255:9: error: variable 'cur_level' set but not used [-Werror=unused-but-set-variable]

Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agos390x: fix virtio feature bitmap
Alexander Graf [Mon, 4 Apr 2011 14:32:10 +0000 (16:32 +0200)]
s390x: fix virtio feature bitmap

The feature bitmap in the s390 virtio machine is little endian. To
address for that, we need to bswap the values after reading them out.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: set alignment for long to 8
Alexander Graf [Mon, 4 Apr 2011 14:32:11 +0000 (16:32 +0200)]
s390x: set alignment for long to 8

The alignment for longs on s390x is 8. That's the only place where it differs
from the default alignments found in configure already. The example alignment
program from Laurent printed the following on a real s390x:

  alignof(short) 2
  alignof(int) 4
  alignof(long) 8
  alignof(long long) 8

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agomusicpal: Fix registration of MMIO-less sysbus devices
Jan Kiszka [Sun, 10 Apr 2011 07:35:42 +0000 (09:35 +0200)]
musicpal: Fix registration of MMIO-less sysbus devices

The proper way to signal that a sysbus devices need no MMIO region is to
pass -1 to sysbus_create_simple.

Signed-off-by: Jan Kiszka <jan.kiszka@web.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoacpi, acpi_piix: factor out GPE logic
Isaku Yamahata [Fri, 25 Mar 2011 10:54:41 +0000 (19:54 +0900)]
acpi, acpi_piix: factor out GPE logic

factor out ACPI GPE logic. Later it will be used by ICH9 ACPI.

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoarm: basic support for ARMv4/ARMv4T emulation
Dmitry Eremin-Solenikov [Mon, 4 Apr 2011 13:38:44 +0000 (17:38 +0400)]
arm: basic support for ARMv4/ARMv4T emulation

Currently target-arm/ assumes at least ARMv5 core. Add support for
handling also ARMv4/ARMv4T. This changes the following instructions:

BX(v4T and later)

BKPT, BLX, CDP2, CLZ, LDC2, LDRD, MCRR, MCRR2, MRRC, MCRR, MRC2, MRRC,
MRRC2, PLD QADD, QDADD, QDSUB, QSUB, STRD, SMLAxy, SMLALxy, SMLAWxy,
SMULxy, SMULWxy, STC2 (v5 and later)

All instructions that are "v5TE and later" are also bound to just v5, as
that's how it was before.

This patch doesn _not_ include disabling of cp15 access and base-updated
data abort model (that will be required to emulate chips based on a
ARM7TDMI), because:
* no ARM7TDMI chips are currently emulated (or planned)
* those features aren't strictly necessary for my purposes (SA-1 core
  emulation).

All v5 models are handled as they are v5T. Internally we still have a
check if the model is a v5(T) or v5TE, but as all emulated cores are
v5TE, those two cases are simply aliased (for now).

Patch is heavily based on patch by Filip Navara <filip.navara@gmail.com>
which in turn is based on work by Ulrich Hecht <uli@suse.de> and Vincent
Sanders <vince@kyllikki.org>.

Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoFix conversions from pointer to tcg_target_long
Stefan Weil [Sat, 2 Apr 2011 11:36:31 +0000 (13:36 +0200)]
Fix conversions from pointer to tcg_target_long

tcg_gen_exit_tb takes a parameter of type tcg_target_long,
so the type casts of pointer to long should be replaced by
type casts of pointer to tcg_target_long (suggested by Blue Swirl).

These changes are needed for build environments where
sizeof(long) != sizeof(void *), especially for w64.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovnc: tight: Fix crash after 2GB of output
Michael Tokarev [Mon, 21 Mar 2011 08:34:35 +0000 (09:34 +0100)]
vnc: tight: Fix crash after 2GB of output

fix 2Gb integer overflow in in VNC tight and zlib encodings

As found by Roland Dreier <roland@purestorage.com> (excellent
catch!), when amount of VNC compressed data produced by zlib
and sent to client exceeds 2Gb, integer overflow occurs because
currently, we calculate amount of data produced at each step by
comparing saved total_out with new total_out, and total_out is
something which grows without bounds.  Compare it with previous
avail_out instead of total_out, and leave total_out alone.

The same code is used in vnc-enc-tight.c and vnc-enc-zlib.c,
so fix both cases.

There, there's no actual need to save previous_out value, since
capacity-offset (which is how that value is calculated) stays
the same so it can be recalculated again after call to deflate(),
but whole thing becomes less readable this way.

Reported-by: Roland Dreier <roland@purestorage.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Corentin Chary <corentin.chary@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosmbus_eeprom: consolidate smbus eeprom creation oc pc_piix, mips_mapta, mips_fulong
Isaku Yamahata [Tue, 5 Apr 2011 02:07:06 +0000 (11:07 +0900)]
smbus_eeprom: consolidate smbus eeprom creation oc pc_piix, mips_mapta, mips_fulong

consolidate smbus initialization for pc_piix, mips_malta and mips_fulong.

Cc: Aurelien Jarno <aurelien@aurel32.net>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agolan9118: Ignore write to MAC_VLAN1 register
Atsushi Nemoto [Tue, 5 Apr 2011 14:34:04 +0000 (23:34 +0900)]
lan9118: Ignore write to MAC_VLAN1 register

On Mon, 4 Apr 2011 20:15:30 +0200, Aurelien Jarno <aurelien@aurel32.net> wrote:
> Is it really safe ignoring write to this register? If yes, it's probably
> a good idea to explain why in a comment. In any case, if supporting this
> register is easy to do, it would be the best option.

I think it is safe.  Please see an updated comment below.

And though implementing this register might be possible, I suppose it
is not worth to supporting FrameTooLong detection, for now at least.

Thank you for comments.

>8---------------------------------------------------------------------
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Tue, 5 Apr 2011 23:12:07 +0900
Subject: [PATCH] lan9118: Ignore write to MAC_VLAN1 register

Since linux 2.6.38, smsc911x driver writes to VLAN1 registger.
Since this register only affects FrameTooLong detection, ignoring
write to this register should be safe.

Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoacpi, acpi_piix, vt82c686: factor out PM1_CNT logic
Isaku Yamahata [Fri, 25 Mar 2011 10:54:40 +0000 (19:54 +0900)]
acpi, acpi_piix, vt82c686: factor out PM1_CNT logic

factor out ACPI PM1_CNT logic. This will be used by ich9 acpi.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoacpi, acpi_piix, vt82c686: factor out PM1a EVT logic
Isaku Yamahata [Fri, 25 Mar 2011 10:54:39 +0000 (19:54 +0900)]
acpi, acpi_piix, vt82c686: factor out PM1a EVT logic

factor out ACPI PM1a EVT logic.
Later this will be used by ich9 acpi.

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoacpi, acpi_piix, vt82c686: factor out PM_TMR logic
Isaku Yamahata [Fri, 25 Mar 2011 10:54:38 +0000 (19:54 +0900)]
acpi, acpi_piix, vt82c686: factor out PM_TMR logic

factor out PM_TMR logic. Later This will be used by ich9 acpi.
Also fixes the same bug in vt82c686.c that was fixed by the following
commits.

> commit 055479feab63607b8042bb8ebb2e0523f17cbc4e
> Author: aliguori <aliguori@c046a42c-6fe2-441c-8c8c-71466251a162>
> Date:   Wed Jan 21 16:31:20 2009 +0000
>
>     Always return latest pmsts instead of the old one (Xiantao Zhang)
>
>     It may lead to the issue when booting windows guests with acpi=1
>     if return the old pmsts.
>
>     Signed-off-by: Xiantao Zhang <xiantao.zhang@intel.com>
>     Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>

Cc: Blue Swirl <blauwirbel@gmail.com>
Cc: Huacai Chen <zltjiangshi@gmail.com>
Cc: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agohw/pflash_cfi02: Fix lazy reset of ROMD mode
Jordan Justen [Sun, 3 Apr 2011 20:16:26 +0000 (13:16 -0700)]
hw/pflash_cfi02: Fix lazy reset of ROMD mode

When checking pfl->rom_mode for when to lazily reenter ROMD mode,
the value was check was the opposite of what it should have been.
This prevent the part from returning to ROMD mode after a write
was made to the CFI rom region.

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoconfigure: avoid basename usage message
Scott Wood [Fri, 8 Apr 2011 19:15:50 +0000 (14:15 -0500)]
configure: avoid basename usage message

basename prints a missing-argument error when sdlconfig is empty
and we're cross-compiling.

Signed-off-by: Scott Wood <scottwood@freescale.com>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agompc85xx_pci_map_irq: change "unknow" to "unknown"
Scott Wood [Fri, 8 Apr 2011 22:06:37 +0000 (17:06 -0500)]
mpc85xx_pci_map_irq: change "unknow" to "unknown"

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoevent: trivial coding style fixes
Brad Hards [Sat, 9 Apr 2011 02:11:36 +0000 (12:11 +1000)]
event: trivial coding style fixes

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agomultiboot: Quote filename in error message
Adam Lackorzynski [Fri, 8 Apr 2011 06:48:42 +0000 (08:48 +0200)]
multiboot: Quote filename in error message

Quote filename in error message to spot possible whitespace character in
the filename and make error message more meaningful.

Signed-off-by: Adam Lackorzynski <adam@os.inf.tu-dresden.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoppce500_mpc8544ds: Fix compile with --enable-debug and --disable-kvm
David Gibson [Fri, 8 Apr 2011 10:08:25 +0000 (20:08 +1000)]
ppce500_mpc8544ds: Fix compile with --enable-debug and --disable-kvm

When configured with --enable-debug, we compile without optimization.
This means that the function mpc8544_copy_soc_cell() in ppce500_mpc8544ds.c
is not optimized out, even though it is never called without kvm.  That in
turn causes a link failure, because it calls the function
kvmppc_read_host_property() which is in kvm_ppc.o and therefore not
included in a --disable-kvm build.

This patch fixes the problem by providing a dummy stub for
kvmppc_read_host_property() in kvm_ppc.h when !CONFIG_KVM.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoUse existing helper function to implement popcntd instruction
David Gibson [Tue, 5 Apr 2011 05:12:11 +0000 (15:12 +1000)]
Use existing helper function to implement popcntd instruction

The recent patches adding partial support for POWER7 cpu emulation included
implementing the popcntd instruction.  The support for this was open coded,
but host-utils.h already included a function implementing an equivalent
population count function, which uses a gcc builtin (which can use special
host instructions) if available.

This patch makes the popcntd implementation use the existing, potentially
faster, implementation.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoDelay creation of pseries device tree until reset
David Gibson [Tue, 5 Apr 2011 05:12:10 +0000 (15:12 +1000)]
Delay creation of pseries device tree until reset

At present, the 'pseries' machine creates a flattened device tree in the
machine->init function to pass to either the guest kernel or to firmware.

However, the machine->init function runs before processing of -device
command line options, which means that the device tree so created will
be (incorrectly) missing devices specified that way.

Supplying a correct device tree is, in any case, part of the required
platform entry conditions.  Therefore, this patch moves the creation and
loading of the device tree from machine->init to a reset callback.  The
setup of entry point address and initial register state moves with it,
which leads to a slight cleanup.

This is not, alas, quite enough to make a fully working reset for pseries.
For that we would need to reload the firmware images, which on this
machine are loaded into RAM.  It's a step in the right direction, though.

Signed-off-by: David Gibson <dwg@au1.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agopseries: Abolish envs array
David Gibson [Tue, 5 Apr 2011 05:12:09 +0000 (15:12 +1000)]
pseries: Abolish envs array

Currently the pseries machine init code builds up an array, envs, of
CPUState pointers for all the cpus in the system.  This is kind of
pointless, given the generic code already has a perfectly good linked list
of the cpus.

In addition, there are a number of places which assume that the cpu's
cpu_index field is equal to its index in this array.  This is true in
practice, because cpu_index values are just assigned sequentially, but
it's conceptually incorrect and may not always be true.

Therefore, this patch abolishes the envs array, and explicitly uses the
generic cpu linked list and cpu_index values throughout.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agospapr_vscsi: Set uninitialized variable
Stefan Weil [Sun, 3 Apr 2011 16:21:24 +0000 (18:21 +0200)]
spapr_vscsi: Set uninitialized variable

cppcheck reports this error:

hw/spapr_vscsi.c:274: error: Uninitialized variable: rc

If llen == 0, rc was indeed used without being initialized.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoDon't call cpu_synchronize_state() from machine init.
Scott Wood [Mon, 4 Oct 2010 11:15:58 +0000 (11:15 +0000)]
Don't call cpu_synchronize_state() from machine init.

This will deadlock when the I/O thread is used, since the
CPU thread is blocked waiting for qemu_system_ready.

The synchronization is unnecessary since this is before
cpu_synchronize_all_post_init().

Signed-off-by: Scott Wood <scottwood@freescale.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoMerge remote branch 'kwolf/for-anthony' into staging
Anthony Liguori [Thu, 7 Apr 2011 14:56:09 +0000 (09:56 -0500)]
Merge remote branch 'kwolf/for-anthony' into staging

13 years agovirtio-blk: fail unaligned requests
Christoph Hellwig [Wed, 6 Apr 2011 18:28:34 +0000 (20:28 +0200)]
virtio-blk: fail unaligned requests

Like all block drivers virtio-blk should not allow small than block size
granularity access.  But given that the protocol specifies a
byte unit length field we currently accept such requests, which cause
qemu to abort() in lower layers.  Add checks to the main read and
write handlers to catch them early.

Reported-by: Conor Murphy <conor_murphy_virt@hotmail.com>
Tested-by: Conor Murphy <conor_murphy_virt@hotmail.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agovirtio-balloon: fixed endianness bug in the config space
Alexey Kardashevskiy [Thu, 7 Apr 2011 03:02:04 +0000 (13:02 +1000)]
virtio-balloon: fixed endianness bug in the config space

The specification for the virtio balloon device requres that the values
in the config space be encoded little-endian.  This differs from most
virtio things, where guest-native endian is the norm.

Currently, the qemu virtio-balloon code correctly makes the conversion
on get_config(), but doesn't on set_config for the 'actual' field.  The
kernel driver, on the other hand, correctly converts when setting the
actual field, but does not convert when reading the config space.  The
upshot is that virtio-balloon will only work correctly if both host and
guest are LE, making all the conversions nops.

This patch corrects the qemu side, correctly doing host-native <-> LE
conversions when accessing the config space.  This won't break any setups
that aren't already broken, and fixes the case of BE host, LE guest.
Fixing the BE guest case will require kernel fixes as well.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agovirtio-9p: fixed LE-to-host conversion bug when QEMU is called from guest
Alexey Kardashevskiy [Thu, 7 Apr 2011 03:02:03 +0000 (13:02 +1000)]
virtio-9p: fixed LE-to-host conversion bug when QEMU is called from guest

The 9p code already contains an attempt at the necessary endian
conversions, but it's broken.

The code which does conversion from host to guest does it correctly
and this code was copied to the function which does guest to host
conversion.  However the copied code hasn't been correctly updated, so
it first endian converts some garbage on the stack and then overwrites
it with a field from incoming packet without conversion.

The patch fixes the mistakes.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agospapr_llan: Fix warning when compiled with -dDEBUG
Alexey Kardashevskiy [Thu, 7 Apr 2011 03:02:02 +0000 (13:02 +1000)]
spapr_llan: Fix warning when compiled with -dDEBUG

Compiling with the DEBUG macro causes leaves hw/spapr_llan.c with an
unused variable, which is treated as an error in the qemu build.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoqdev: Fix comment around qdev_init_nofail()
Michael Tokarev [Wed, 6 Apr 2011 13:51:59 +0000 (17:51 +0400)]
qdev: Fix comment around qdev_init_nofail()

In previous life qdev_init_nofail() used to call hw_error() which
did register dump and other scary things.  Now it calls
error_report() and does a regular exit(1).  Fix the comment
to match reality.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agousb-ccid: Spelling fixes
Brad Hards [Mon, 4 Apr 2011 21:54:04 +0000 (07:54 +1000)]
usb-ccid: Spelling fixes

While looking at David Gibson's build-fix for hw/usb-ccid.c, I noticed a spello
in a comment on the following (unchanged) line.

Signed-off-by: Brad Hards <bradh@frogmouth.net>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoFix integer overflow in block migration bandwidth calculation
Avishay Traeger [Wed, 6 Apr 2011 07:45:36 +0000 (10:45 +0300)]
Fix integer overflow in block migration bandwidth calculation

block_mig_state.reads is an int, and multiplying by BLOCK_SIZE yielded a
negative number, resulting in a negative bandwidth (running on a 32-bit
machine).  Change order to avoid.

Signed-off-by: Avishay Traeger <avishay@il.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agofloppy: save and restore DIR register
Jason Wang [Wed, 6 Apr 2011 10:34:31 +0000 (18:34 +0800)]
floppy: save and restore DIR register

We need to keep DIR register unchanged across migration, but currently it
depends on the media_changed flags from block layer. Since we do not
save/restore it and the bdrv_open() called in dest node may set the
media_changed flag when trying to open floppy image, guest driver may think the
floppy have changed after migration. To fix this, a new filed media_changed in
FDrive strcutre was introduced in order to save and restore the it from block
layer through pre_save/post_load callbacks.

Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoNBD device: Separate out parsing configuration and opening sockets.
Nick Thomas [Tue, 22 Feb 2011 15:44:54 +0000 (15:44 +0000)]
NBD device: Separate out parsing configuration and opening sockets.

We also change the way the file parameter is parsed so IPv6 IP
addresses can be used, e.g.: "drive=nbd:[::1]:5000"

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoNBD: Use qemu_socket functions to open TCP and UNIX sockets
Nick Thomas [Tue, 22 Feb 2011 15:44:53 +0000 (15:44 +0000)]
NBD: Use qemu_socket functions to open TCP and UNIX sockets

This commit has the side-effect of making the qemu-nbd binary
capable of binding to IPv6 addresses. ("-b ::1", for instance).
block/nbd.c fails to parse IPv6 IP addresses correctly at this
point, but will work over IPv6 when given a hostname. It still
works over IPv4 as before.

We move the qemu-sockets object from the 'common' to the 'block'
list in the Makefile. The common list includes the block list,
so this is effectively a no-op for the rest of the code.

We also add 32-bit 'magic' attributes to nbd_(request|reply) to
facilitate calculating maximum request/response sizes later.

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoSet errno=ENOTSUP for attempts to use UNIX sockets on Windows platforms
Nick Thomas [Tue, 22 Feb 2011 15:44:52 +0000 (15:44 +0000)]
Set errno=ENOTSUP for attempts to use UNIX sockets on Windows platforms

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoNBD library: whitespace changes
Nick Thomas [Tue, 22 Feb 2011 15:44:51 +0000 (15:44 +0000)]
NBD library: whitespace changes

Signed-off-by: Nick Thomas <nick@bytemark.co.uk>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoide: consolidate drive_get(IF_IDE)
Isaku Yamahata [Sun, 3 Apr 2011 11:32:46 +0000 (20:32 +0900)]
ide: consolidate drive_get(IF_IDE)

factor out ide initialization to call drive_get(IF_IDE)

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoexit if -drive specified is invalid instead of ignoring the "wrong" -drive
Michael Tokarev [Wed, 30 Mar 2011 12:31:05 +0000 (16:31 +0400)]
exit if -drive specified is invalid instead of ignoring the "wrong" -drive

This fixes the problem when qemu continues even if -drive specification
is somehow invalid, resulting in a mess.  Applicable for both current
master and for stable-0.14 (and the same issue exist 0.13 and 0.12 too).

The prob can actually be seriuos: when you start guest with two drives
and make an error in the specification of one of them, and the guest
has something like a raid array on the two drives, guest may start failing
that array or kick "missing" drives which may result in a mess - this is
what actually happened to me, I did't want a resync at all, and a resync
resulted in re-writing (and allocating) a 4TB virtual drive I used for
testing, which in turn resulted in my filesystem filling up and whole
thing failing badly.  Yes it was just testing VM, I experimented with
larger raid arrays, but the end result was quite, well, unexpected.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
Acked-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoqemu-img rebase: Fix segfault if backing file can't be opened
Kevin Wolf [Thu, 31 Mar 2011 10:39:51 +0000 (12:39 +0200)]
qemu-img rebase: Fix segfault if backing file can't be opened

bdrv_delete must not be called for a NULL BlockDriverState.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agoqemu-img: Initial progress printing support
Jes Sorensen [Wed, 30 Mar 2011 12:16:25 +0000 (14:16 +0200)]
qemu-img: Initial progress printing support

This adds the basic infrastructure for supporting progress output
on the command line, as well as progress support for qemu-img commands
'rebase' and 'convert'.

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoblock: Do not cache device size for removable media
Stefan Hajnoczi [Tue, 29 Mar 2011 19:04:41 +0000 (20:04 +0100)]
block: Do not cache device size for removable media

The block layer caches the device size to avoid doing lseek(fd, 0,
SEEK_END) every time this value is needed.  For removable media the
device size becomes stale if a new medium is inserted.  This patch
simply prevents device size caching for removable media.

A smarter solution is to update the cached device size when a new medium
is inserted.  Given that there are currently bugs with CD-ROM media
change I do not want to implement that approach until we've gotten
things correct first.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agotrace: Trace bdrv_set_locked()
Stefan Hajnoczi [Tue, 29 Mar 2011 19:04:40 +0000 (20:04 +0100)]
trace: Trace bdrv_set_locked()

It can be handy to know when the guest locks/unlocks the CD-ROM tray.
This trace event makes that possible.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoDo not delete BlockDriverState when deleting the drive
Ryan Harper [Wed, 30 Mar 2011 01:51:47 +0000 (20:51 -0500)]
Do not delete BlockDriverState when deleting the drive

When removing a drive from the host-side via drive_del we currently have
the following path:

drive_del
qemu_aio_flush()
bdrv_close()    // zaps bs->drv, which makes any subsequent I/O get
                // dropped.  Works as designed
drive_uninit()
bdrv_delete()   // frees the bs.  Since the device is still connected to
                // bs, any subsequent I/O is a use-after-free.

The value of bs->drv becomes unpredictable on free.  As long as it
remains null, I/O still gets dropped, however it could become non-null
at any point after the free resulting SEGVs or other QEMU state
corruption.

To resolve this issue as simply as possible, we can chose to not
actually delete the BlockDriverState pointer.  Since bdrv_close()
handles setting the drv pointer to NULL, we just need to remove the
BlockDriverState from the QLIST that is used to enumerate the block
devices.  This is currently handled within bdrv_delete, so move this
into its own function, bdrv_make_anon().

The result is that we can now invoke drive_del, this closes the file
descriptors and sets BlockDriverState->drv to NULL which prevents futher
IO to the device, and since we do not free BlockDriverState, we don't
have to worry about the copy retained in the block devices.

We also don't attempt to remove the qdev property since we are no longer
deleting the BlockDriverState on drives with associated drives.  This
also allows for removing Drives with no devices associated either.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
Acked-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agohw/xen_disk: ioreq not finished on error
Feiran Zheng [Tue, 29 Mar 2011 01:00:15 +0000 (09:00 +0800)]
hw/xen_disk: ioreq not finished on error

Bug fix: routines 'ioreq_runio_qemu_sync' and 'ioreq_runio_qemu_aio'
won't call 'ioreq_unmap' or 'ioreq_finish' on errors, leaving ioreq in
the blkdev->inflight list and a leak.

Signed-off-by: Feiran Zheng <famcool@gmail.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
13 years agoexec: Handle registrations of the entire address space
Edgar E. Iglesias [Tue, 5 Apr 2011 11:00:36 +0000 (13:00 +0200)]
exec: Handle registrations of the entire address space

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoconfigure: add --version flag
Mike Frysinger [Thu, 7 Apr 2011 05:12:28 +0000 (01:12 -0400)]
configure: add --version flag

Standard autoconf scripts include a --version flag so people can easily
query things.  Add this to qemu's configure so it too can integrate with
build systems that have standard autotool helpers.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agocpu-all.h: Remove unnecessary target-specific ifdef for CPU_QuadU
Peter Maydell [Mon, 4 Apr 2011 11:09:22 +0000 (12:09 +0100)]
cpu-all.h: Remove unnecessary target-specific ifdef for CPU_QuadU

CPU_QuadU isn't used on all targets, but there's no harm in defining the
typedef anyway. It only needs to be guarded by CONFIG_SOFTFLOAT, because
softfloat-native doesn't have a float128 type. This avoids the need for
every new target which uses CPU_QuadU to add itself to an #ifdef in
what ought to be target-agnostic code.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Make Neon helper routines use correct FP status
Peter Maydell [Mon, 4 Apr 2011 10:46:35 +0000 (11:46 +0100)]
target-arm: Make Neon helper routines use correct FP status

Make the Neon helper routines use the correct FP status from
the CPUEnv rather than using a dummy static one. This means
they will correctly handle denormals and NaNs and will set
FPSCR exception bits properly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Use global env in iwmmxt_helper.c helpers
Peter Maydell [Mon, 4 Apr 2011 10:46:34 +0000 (11:46 +0100)]
target-arm: Use global env in iwmmxt_helper.c helpers

Use the global 'env' variable in the helper functions in iwmmxt_helper.c.
This means we don't need to pass env as an argument to them any more.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Use global env in neon_helper.c helpers
Peter Maydell [Mon, 4 Apr 2011 10:46:33 +0000 (11:46 +0100)]
target-arm: Use global env in neon_helper.c helpers

Use the global 'env' variable in the helper functions in neon_helper.c.
This means we don't need to pass env as an argument to them any more.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoMakefile.target: Allow target helpers to be in any *_helper.c file
Peter Maydell [Mon, 4 Apr 2011 10:46:32 +0000 (11:46 +0100)]
Makefile.target: Allow target helpers to be in any *_helper.c file

Build all files matching *_helper.c with HELPER_CFLAGS, not just
op_helper.c. This allows you to put target helper functions which
use the global 'env' variable in multiple source files.

This only affects the ARM target as all the other targets currently only
have op_helper.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoFix non-portable format string in usb-ccid.c
David Gibson [Mon, 4 Apr 2011 04:48:08 +0000 (14:48 +1000)]
Fix non-portable format string in usb-ccid.c

At one point, usb-ccid.c attempts to use a %lX format specifier to print
a uint64_t, which is only correct on some host platforms.  This patch
corrects the statement to use the stdint specified PRIX64 constant instead.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoMAINTAINERS: add Milkymist board
Michael Walle [Mon, 7 Mar 2011 22:32:45 +0000 (23:32 +0100)]
MAINTAINERS: add Milkymist board

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add support for the Milkymist board
Michael Walle [Mon, 7 Mar 2011 22:32:44 +0000 (23:32 +0100)]
lm32: add support for the Milkymist board

This patch adds almost complete support for the Milkymist system-on-chip
(http://www.milkymist.org).

Additional to running bare metal applications, booting a linux kernel with
initrd is supported.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add milkymist hw support functions
Michael Walle [Mon, 7 Mar 2011 22:32:43 +0000 (23:32 +0100)]
lm32: add milkymist hw support functions

This patch adds wrappers for easy creation of the qdev devices.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist VGAFB support
Michael Walle [Mon, 7 Mar 2011 22:32:42 +0000 (23:32 +0100)]
lm32: add Milkymist VGAFB support

This patch adds support for Milkymist's VGA framebuffer.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist UART support
Michael Walle [Mon, 7 Mar 2011 22:32:41 +0000 (23:32 +0100)]
lm32: add Milkymist UART support

This patch adds support for Milkymist's simple UART.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist TMU2 support
Michael Walle [Mon, 7 Mar 2011 22:32:40 +0000 (23:32 +0100)]
lm32: add Milkymist TMU2 support

This patch adds support for Milkymist's texture mapping unit. For fast
computation this model needs hardware accelerated 3D graphics support
(OpenGL). There is no graphical output, all computations belong to internal
framebuffers only.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoconfigure: add opengl detection
Michael Walle [Mon, 7 Mar 2011 22:32:39 +0000 (23:32 +0100)]
configure: add opengl detection

This patch introduce a new config option CONFIG_OPENGL.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist System Controller support
Michael Walle [Mon, 7 Mar 2011 22:32:38 +0000 (23:32 +0100)]
lm32: add Milkymist System Controller support

This patch adds support for Milkymist's System Controller core. The model
has the following features:
 - support for shutting down and restarting the board
 - provide two timers and GPIO
 - provide registers for system identification and reading the boards
   capabilities

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist SoftUSB support
Michael Walle [Mon, 7 Mar 2011 22:32:37 +0000 (23:32 +0100)]
lm32: add Milkymist SoftUSB support

This patch adds support for Milkymist's SoftUSB core. This model differ
from the real hardware in its functionality. The real hardware consits of a
tiny freely programmable microcontroller which controls the USB ports. For
simplicity reasons, this model emulates only keyboard and mouse input
devices, eg. input events translates directly to the corresponding expected
messages.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist PFPU support
Michael Walle [Mon, 7 Mar 2011 22:32:36 +0000 (23:32 +0100)]
lm32: add Milkymist PFPU support

This patch adds support for Milkymist's Programmable FPU.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist Minimac support
Michael Walle [Mon, 7 Mar 2011 22:32:35 +0000 (23:32 +0100)]
lm32: add Milkymist Minimac support

This patch adds support for Milkymist's minimal Ethernet MAC.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist memory card support
Michael Walle [Mon, 7 Mar 2011 22:32:34 +0000 (23:32 +0100)]
lm32: add Milkymist memory card support

This patch adds support for Milkymist's memory card core.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist HPDMC support
Michael Walle [Mon, 7 Mar 2011 22:32:33 +0000 (23:32 +0100)]
lm32: add Milkymist HPDMC support

This patch adds support for the Milkymist's High Performance Dynamic Memory
Controller. This is just a dumb model without any functionality. While the
real hardware acts for example as a bridge between software and hardware
for sending SDRAM commans, this model will only eat up these commands and
always returns the expected hardware states, eg. PLL locked etc.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agolm32: add Milkymist AC97 support
Michael Walle [Mon, 7 Mar 2011 22:32:32 +0000 (23:32 +0100)]
lm32: add Milkymist AC97 support

This patch adds support for the Milkymist AC97 compatible sound output and
input core.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoRevert "ioapic: when switches to level trigger mode, interrupts raised repeatedly."
Aurelien Jarno [Mon, 4 Apr 2011 05:14:03 +0000 (07:14 +0200)]
Revert "ioapic: when switches to level trigger mode, interrupts raised repeatedly."

This reverts commit 9bcfc7daabb138b0fe3d64d74892942d482e5bbd.

13 years agos390x: enable CPU_QuadU
Ulrich Hecht [Tue, 29 Mar 2011 13:29:34 +0000 (15:29 +0200)]
s390x: enable CPU_QuadU

S390x uses the QuadU type, so let's enable it.

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: Enable nptl for s390x
Ulrich Hecht [Tue, 29 Mar 2011 13:29:33 +0000 (15:29 +0200)]
s390x: Enable nptl for s390x

S390x user emulation can do nptl. Reflect this in the configure script.

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: Enable disassembler for s390x
Ulrich Hecht [Tue, 29 Mar 2011 13:29:32 +0000 (15:29 +0200)]
s390x: Enable disassembler for s390x

This patch enables the instruction disassembler when using an
S390x target.

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: fix s390-virtio-serial
Alexander Graf [Tue, 29 Mar 2011 13:29:31 +0000 (15:29 +0200)]
s390x: fix s390-virtio-serial

Commit 6b331efb733a0f913ddc0b7762a1307dec304061 broke the s390 proxy version
of virtio-serial by only taking its PCI brother into account.

So let's adjust s390-virtio-serial the same way as its PCI counterpart, making
it compile and work again.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agos390x: fix KVM target
Alexander Graf [Tue, 29 Mar 2011 13:29:30 +0000 (15:29 +0200)]
s390x: fix KVM target

During Jan's rework of the generic KVM layer, he added some more error checks
and actually aborted if something went wrong. Unfortunately, one of the s390
internal error codes slipped through, aborting the VM without needing to.

This patch fixes booting of S390x virtual machines in KVM.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovirtio: use generic name when possible
Alexander Graf [Tue, 29 Mar 2011 13:29:29 +0000 (15:29 +0200)]
virtio: use generic name when possible

We have two different virtio buses: pci and s390. The abstraction path
taken in qemu is to have generic aliases for each device type in the
architecture specific qdev devices.

So let's make use of these aliases whenever we can and define them
whenever we can.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoOnly build ivshmem when CONFIG_PCI && CONFIG_KVM
Alexander Graf [Tue, 29 Mar 2011 13:29:28 +0000 (15:29 +0200)]
Only build ivshmem when CONFIG_PCI && CONFIG_KVM

The ivshmem depends on PCI and KVM, not only KVM. Reflect this
in the Makefile, so we don't get build errors on s390x.

Signed-off-by: Alexander Graf <agraf@suse.de>
CC: Cam Macdonell <cam@cs.ualberta.ca>
CC: Juan Quintela <quintela@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agow32: Fix compilation (wrong include file)
Stefan Weil [Sun, 3 Apr 2011 06:55:35 +0000 (08:55 +0200)]
w32: Fix compilation (wrong include file)

arpa/inet.h is not available for w32, so commit
edbb21363fbfe40e050f583df921484cbc31c79d breaks
w32 compilations.

This is fixed by using qemu_socket.h.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Reviewed-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoregister signal handler after initializing SDL.
Gleb Natapov [Thu, 31 Mar 2011 09:27:23 +0000 (11:27 +0200)]
register signal handler after initializing SDL.

SDL library initialization mangles signal handlers, so QEMU should
register them after initializing SDL. This was the case before and code
even have a comment about that. Fix it to be so again.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agovl.c: Tidy up message printed when we exit on a signal
Peter Maydell [Wed, 30 Mar 2011 21:03:38 +0000 (22:03 +0100)]
vl.c: Tidy up message printed when we exit on a signal

Tidy up the message printed when qemu exits due to a signal, so that
it's clearer where the message is coming from and that it's not just
stray debug output.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agonet: Remove unused net-checksum.c file
Stefan Hajnoczi [Mon, 28 Mar 2011 21:00:30 +0000 (22:00 +0100)]
net: Remove unused net-checksum.c file

The common checksum functions were moved to net/checksum.c in commit
7200ac3c7c8eefe574193b49eeff09f120e11ec7 but the original net-checksum.c
was never deleted from the source tree.  Remove it now since all users
of the checksum functions link against net/checksum.o and net-checksum.c
is not even compiled anymore.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoe1000: Mask out lower bits of RDBAL/TDBAL
Kevin Wolf [Sat, 26 Mar 2011 18:37:56 +0000 (19:37 +0100)]
e1000: Mask out lower bits of RDBAL/TDBAL

Rx and Tx descriptors are 16 byte aligned, so the lower bits are
ignored by real hardware. In fact, they always read back as zero on real
hardware, but probably nobody relies on that.

Signed-off-by: Kevin Wolf <mail@kevin-wolf.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agogdbstub: Catch and report more vmstop reasons
Jan Kiszka [Tue, 22 Mar 2011 10:02:09 +0000 (11:02 +0100)]
gdbstub: Catch and report more vmstop reasons

When the VM goes into stop state while there is a gdb frontend attached,
it makes sense to inform gdb about this fact and at least a bit about
the stop reason. Basically, all stops are interesting except for the
temporary VMSTOP_SAVE/LOADVM.

The patch maps the relevant VMSTOP reasons on unique and more or less
associatable signals that gdb understands.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotests/cris: Fix some errors and potential crashes
Stefan Weil [Sun, 3 Apr 2011 19:36:36 +0000 (21:36 +0200)]
tests/cris: Fix some errors and potential crashes

These errors were reported by cppcheck:

tests/cris/check_openpf1.c:30: error:
Mismatching allocation and deallocation: f

tests/cris/check_openpf2.c:13: error:
Mismatching allocation and deallocation: f

tests/cris/check_stat3.c:16: error:
Buffer overrun possible for long cmd-line args

tests/cris/check_stat4.c:18: error:
Buffer overrun possible for long cmd-line args

The first two are obvious coding errors (fopen needs fclose, not close).

The last two may seem less important (nobody will start test code
with an argument of more than 1022 characters which raises a buffer
overrun). Fixing them nevertheless helps with static code checks
like those done by cppcheck.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
13 years agoioapic: when switches to level trigger mode, interrupts raised repeatedly.
Isaku Yamahata [Wed, 16 Mar 2011 09:05:01 +0000 (18:05 +0900)]
ioapic: when switches to level trigger mode, interrupts raised repeatedly.

- the trigger mode is edge at first
- During initializatoin, the interrupt is raised as edge which is masked.
  The corresponding bit of irr is set.
- Then the mode is switched to level and it's unmasked.
- the bit of irr is set, so the interrupt is raised repeatedly by
  ioapic_service().
- OS considers that the irq line is broken and falls back to polling mode.

This patch fixes the issues.
After raising edige, clear the bit of irr.

> Bringing up interface eth0:
> Determining IP information for eth0...irq 18: nobody cared (try booting with the "irqpoll" option)
> Pid: 4126, comm: ip Not tainted 2.6.38-rc7 #1
> Call Trace:
>  <IRQ>  [<ffffffff8105b009>] ? __report_bad_irq+0x38/0x87
>  [<ffffffff8105b177>] ? note_interrupt+0x11f/0x188
>  [<ffffffff8105bacf>] ? handle_fasteoi_irq+0xa7/0xd1
>  [<ffffffff810046ff>] ? handle_irq+0x83/0x8c
>  [<ffffffff81003eb9>] ? do_IRQ+0x48/0xaf
>  [<ffffffff81300513>] ? ret_from_intr+0x0/0xe
>  [<ffffffff81031ab8>] ? __do_softirq+0x4f/0x114
>  [<ffffffff81002d6c>] ? call_softirq+0x1c/0x28
>  [<ffffffff81004647>] ? do_softirq+0x33/0x68
>  [<ffffffff810316fb>] ? irq_exit+0x36/0x38
>  [<ffffffff81015f2c>] ? smp_apic_timer_interrupt+0x88/0x96
>  [<ffffffff81002853>] ? apic_timer_interrupt+0x13/0x20
>  <EOI>  [<ffffffff810177ed>] ? __ioapic_set_affinity+0x68/0x7c
>  [<ffffffff813000f0>] ? _raw_spin_unlock_irqrestore+0x8/0xa
>  [<ffffffff8105a84f>] ? __setup_irq+0x224/0x2cb
>  [<ffffffff8120e3c5>] ? e1000_intr+0x0/0x103
>  [<ffffffff8105a9c7>] ? request_threaded_irq+0xd1/0x114
>  [<ffffffff8120e396>] ? e1000_request_irq+0x34/0x63
>  [<ffffffff8121237d>] ? e1000_open+0x81/0x11f
>  [<ffffffff8129097c>] ? call_netdevice_notifiers+0x45/0x4a
>  [<ffffffff81290d8d>] ? __dev_open+0x97/0xc4
>  [<ffffffff8128e9c5>] ? __dev_change_flags+0xb9/0x13d
>  [<ffffffff81290cc1>] ? dev_change_flags+0x1c/0x51
>  [<ffffffff812d0542>] ? devinet_ioctl+0x26e/0x594
>  [<ffffffff812d174c>] ? inet_ioctl+0x92/0xaa
>  [<ffffffff81281d75>] ? T.1003+0x13/0x32
>  [<ffffffff81282152>] ? sock_ioctl+0x1f2/0x1ff
>  [<ffffffff810ae2d3>] ? do_vfs_ioctl+0x498/0x4e7
>  [<ffffffff81281203>] ? sock_alloc_file+0xb3/0x115
>  [<ffffffff8109f79f>] ? fd_install+0x31/0x5d
>  [<ffffffff810ae364>] ? sys_ioctl+0x42/0x65
>  [<ffffffff81001f3b>] ? system_call_fastpath+0x16/0x1b
> handlers:
> [<ffffffff8120e3c5>] (e1000_intr+0x0/0x103)
> Disabling IRQ #18

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoFix trivial "endianness bugs"
Stefan Weil [Sun, 13 Mar 2011 14:44:02 +0000 (15:44 +0100)]
Fix trivial "endianness bugs"

Replace endianess -> endianness.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agohw/vexpress.c: Add model of ARM Versatile Express board
Peter Maydell [Mon, 7 Mar 2011 11:10:32 +0000 (11:10 +0000)]
hw/vexpress.c: Add model of ARM Versatile Express board

Add a model of the ARM Versatile Express board (with A9MPx4
daughterboard).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm/helper.c: For float-int conversion helpers pass ints as ints
Peter Maydell [Mon, 14 Mar 2011 07:23:11 +0000 (07:23 +0000)]
target-arm/helper.c: For float-int conversion helpers pass ints as ints

Correct the argument and return types for the float<->int conversion helper
functions so that integer arguments and return values are declared as
uint32_t/uint64_t, not float32/float64. This allows us to remove the
hand-rolled functions which were doing bitwise copies between the types
via unions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Use new softfloat min/max functions for VMAX, VMIN
Peter Maydell [Fri, 11 Mar 2011 08:12:26 +0000 (08:12 +0000)]
target-arm: Use new softfloat min/max functions for VMAX, VMIN

Use the new softfloat min/max functions to implement the Neon VMAX
and VMIN instructions. This allows us to get the right behaviour
for NaN and negative zero.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: Add float*_min() and float*_max() functions
Peter Maydell [Fri, 11 Mar 2011 08:12:25 +0000 (08:12 +0000)]
softfloat: Add float*_min() and float*_max() functions

Add min and max operations to softfloat. This allows us to implement
propagation of NaNs and handling of negative zero correctly (unlike
the approach of having target helper routines return one of the operands
based on the result of a comparison op).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Correct ABD's handling of negative zeroes
Peter Maydell [Fri, 11 Mar 2011 08:12:24 +0000 (08:12 +0000)]
target-arm: Correct ABD's handling of negative zeroes

Implement ABD by taking the absolute value of the difference
of the operands (as the ARM ARM specifies) rather than by
flipping the order of the operands to the subtract based
on the results of a comparison. The latter approch gives
the wrong answers for some edge cases like negative zero.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Fix VCLE.F32 #0, VCLT.F32 #0 NaN handling
Peter Maydell [Fri, 11 Mar 2011 08:12:23 +0000 (08:12 +0000)]
target-arm: Fix VCLE.F32 #0, VCLT.F32 #0 NaN handling

Implementing the floating-point versions of VCLE #0 and VCLT #0 by
doing a GT comparison and inverting the result gives the wrong
result if the input is a NaN. Implement as a GT comparison with the
operands swapped instead.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm: Return right result for Neon comparison with NaNs
Peter Maydell [Fri, 11 Mar 2011 08:12:22 +0000 (08:12 +0000)]
target-arm: Return right result for Neon comparison with NaNs

Fix the helper functions implementing the Neon floating point comparison
ops (VCGE, VCGT, VCEQ, VACGT, VACGE) to return the right answer when
one of the values being compared is a NaN.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-arm/neon_helper.c: Use make_float32/float32_val macros
Peter Maydell [Fri, 11 Mar 2011 08:12:21 +0000 (08:12 +0000)]
target-arm/neon_helper.c: Use make_float32/float32_val macros

Use the softfloat make_float32 and float32_val macros to convert between
softfloat's float32 type and raw uint32_t types, rather than private
conversion functions.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoccid: add docs
Alon Levy [Sun, 12 Dec 2010 16:13:34 +0000 (18:13 +0200)]
ccid: add docs

Add documentation for the usb-ccid device and accompanying two card
devices, ccid-card-emulated and ccid-card-passthru.

Signed-off-by: Alon Levy <alevy@redhat.com>
13 years agoccid: add ccid-card-emulated device
Alon Levy [Sun, 24 Oct 2010 10:09:18 +0000 (12:09 +0200)]
ccid: add ccid-card-emulated device

This devices uses libcacard (internal) to emulate a smartcard conforming
to the CAC standard. It attaches to the usb-ccid bus. Usage instructions
(example command lines) are in the following patch in docs/ccid.txt. It
uses libcacard which uses nss, so it can work with both hw cards and
certificates (files).

Signed-off-by: Alon Levy <alevy@redhat.com>
---

changes from v20->v21: (Jes Sorenson review)
 * cosmetics
 * use qemu-thread and qemu_malloc/qemu_free

changes from v19->v20:
 * checkpatch.pl

changes from v18->v19:
 * add qdev.desc
 * backend: drop the enumeration property, back to using a string one.

changes from v16->v17:
 * use PROP_TYPE_ENUM for backend

changes from v15->v16:
 * fix error reporting in initfn
 * bump copyright year
 * update copyright license

changes from v1:
 * remove stale comments, use only c-style comments
 * bugfix, forgot to set recv_len
 * change reader name to 'Virtual Reader'