]> git.proxmox.com Git - qemu.git/log
qemu.git
11 years agoUpdate version for 1.1.0-rc0 release v1.1-rc1
Anthony Liguori [Wed, 9 May 2012 21:39:57 +0000 (16:39 -0500)]
Update version for 1.1.0-rc0 release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotcg/ppc: Fix CONFIG_TCG_PASS_AREG0 mode
Andreas Färber [Wed, 9 May 2012 17:26:59 +0000 (19:26 +0200)]
tcg/ppc: Fix CONFIG_TCG_PASS_AREG0 mode

Adjust the tcg_out_qemu_{ld,st}() slow paths to pass AREG0 in r3,
based on patches by malc.

Also adjust the registers clobbered, based on patch by Alex.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
[AF: Do not hardcode r3 for AREG0, requested by Alex]
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotcg/ppc: Clobber r5 for 64-bit qemu_ld
Andreas Färber [Wed, 9 May 2012 17:26:58 +0000 (19:26 +0200)]
tcg/ppc: Clobber r5 for 64-bit qemu_ld

This accounts for the additional addr_reg2 register.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotcg/ppc: Don't hardcode register numbers
Andreas Färber [Wed, 9 May 2012 17:26:57 +0000 (19:26 +0200)]
tcg/ppc: Don't hardcode register numbers

Also assure i64 alignment where necessary.

Alignment code optimization suggested by malc.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotcg/ppc: Do not overwrite lower address word on Darwin and AIX
Andreas Färber [Wed, 9 May 2012 17:26:56 +0000 (19:26 +0200)]
tcg/ppc: Do not overwrite lower address word on Darwin and AIX

For targets where TARGET_LONG_BITS != 32, i.e. 64-bit guests,
addr_reg is moved to r4. For hosts without TCG_TARGET_CALL_ALIGN_ARGS
either data_reg2 or data_reg or a masked version thereof would overwrite
r4. Place it in r5 instead, matching TCG_TARGET_CALL_ALIGN_ARGS hosts.

This fixes immediate crashes of 64-bit guests observed on Darwin/ppc but
not on Darwin/ppc64.

Signed-off-by: Andreas Färber <andreas.faerber@web.de>
Acked-by: malc <av1474@comtv.ru>
Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Tue, 8 May 2012 18:07:41 +0000 (13:07 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  hmp: fix bad value conversion for M type
  hmp: expr_unary(): check for overflow in strtoul()/strtoull()
  vl: drop is_suspended variable
  runstate: introduce suspended state
  qapi-schema.json: fix RunState enums alphabetical order
  wakeup on migration

11 years agohmp: fix bad value conversion for M type
Luiz Capitulino [Thu, 26 Apr 2012 20:34:30 +0000 (17:34 -0300)]
hmp: fix bad value conversion for M type

The M type converts from megabytes to bytes. However, the value can be
negative before the conversion, which will lead to a flawed conversion.

For example, this:

 (qemu) balloon -1000000000000011
 (qemu)

Just "works", but the value passed by the balloon command will be
something else.

This patch fixes this problem by requering a positive value before
converting. There's really no reason to accept a negative value for
the M type.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agohmp: expr_unary(): check for overflow in strtoul()/strtoull()
Luiz Capitulino [Thu, 26 Apr 2012 19:48:41 +0000 (16:48 -0300)]
hmp: expr_unary(): check for overflow in strtoul()/strtoull()

It's not checked currently, so something like:

  (qemu) balloon -100000000000001111114334234
  (qemu)

Will just "work" (in this case the balloon command will get a random
value).

Fix it by checking if strtoul()/strtoull() overflowed.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
11 years agovl: drop is_suspended variable
Luiz Capitulino [Fri, 27 Apr 2012 17:31:12 +0000 (14:31 -0300)]
vl: drop is_suspended variable

Check for the RUN_STATE_SUSPENDED state instead.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agorunstate: introduce suspended state
Luiz Capitulino [Fri, 27 Apr 2012 16:33:36 +0000 (13:33 -0300)]
runstate: introduce suspended state

QEMU enters in this state when the guest suspends to ram (S3).

This is important so that HMP users and QMP clients can know that
the guest is suspended. QMP also has an event for this, but events
are not reliable and are limited (ie. a client can connect to QEMU
after the event has been emitted).

Having a different state for S3 brings a new issue, though. Every
device that doesn't run when the VM is stopped but wants to run
when the VM is suspended has to check for RUN_STATE_SUSPENDED
explicitly. This is the case for the keyboard and mouse devices,
for example.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqapi-schema.json: fix RunState enums alphabetical order
Luiz Capitulino [Fri, 27 Apr 2012 16:16:41 +0000 (13:16 -0300)]
qapi-schema.json: fix RunState enums alphabetical order

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agowakeup on migration
Gerd Hoffmann [Wed, 7 Mar 2012 07:00:26 +0000 (08:00 +0100)]
wakeup on migration

Wakeup the guest when the live part of the migation is finished.
This avoids being in suspended state on migration, so we don't
have to save the is_suspended bit.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
11 years agouser-exec.c: Don't assert on segfaults for non-valid addresses
Peter Maydell [Thu, 3 May 2012 18:32:15 +0000 (19:32 +0100)]
user-exec.c: Don't assert on segfaults for non-valid addresses

h2g() will assert if passed an address that's not a valid guest address,
so handle_cpu_signal() needs to check before passing "data address
which caused a segfault" to it, since for a misbehaving guest
that could be anything. If the address isn't a valid guest address
then we can simply skip the attempt to unprotect a guest page
which was made read-only to catch self-modifying code.

This assertion probably fires more readily now than it used to
do because of recent changes to default to reserving guest address
space.

Acked-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoscripts/qemu-binfmt-conf.sh: Fix shell syntax
Andreas Färber [Mon, 7 May 2012 17:47:37 +0000 (19:47 +0200)]
scripts/qemu-binfmt-conf.sh: Fix shell syntax

The script is organized as a sequence of binfmt registrations, with a
check whether the to be registered architecture matches the host.

Add a missing fi for the SuperH section.

Reported-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agocpu: Update documentation and comment
Andreas Färber [Wed, 2 May 2012 20:28:58 +0000 (22:28 +0200)]
cpu: Update documentation and comment

State struct CPU had been renamed to CPUState, former CPUState to
CPUArchState.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconfigure: Assure printing "yes" or "no" for VirtFS support
Andreas Färber [Mon, 30 Apr 2012 23:12:03 +0000 (01:12 +0200)]
configure: Assure printing "yes" or "no" for VirtFS support

When auto-detecting VirtFS support, virtfs="". Set it to "no" after
checking whether it was explicitly requested through --enable-virtfs.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconfigure: Reindent VirtFS check
Andreas Färber [Mon, 30 Apr 2012 23:12:02 +0000 (01:12 +0200)]
configure: Reindent VirtFS check

Avoid tab-indention and fit in with the surrounding code.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agotci: Fix wrong macro name for debug code
Stefan Weil [Thu, 3 May 2012 16:09:45 +0000 (18:09 +0200)]
tci: Fix wrong macro name for debug code

Code which is compiled with CONFIG_TCG_DEBUG (set by configure option
--enable-debug-tcg) should not disable the assert macro by
defining NDEBUG.

With the wrong macro name CONFIG_TCG_DEBUG, all assertions in tci.c
were completely useless because NDEBUG was always defined.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoqemu-timer: Move include for __FreeBSD_version to header
Andreas Faerber [Sat, 5 May 2012 18:08:40 +0000 (20:08 +0200)]
qemu-timer: Move include for __FreeBSD_version to header

sys/param.h is needed for __FreeBSD_version.
Pointed out by Juergen, thanks.

Signed-off-by: Andreas Faerber <andreas.faerber@web.de>
Cc: Juergen Lock <nox@jelal.kn-bremen.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Tue, 8 May 2012 14:41:10 +0000 (09:41 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  rtl8139: fix regression in TxStatus/TxAddr read

11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Tue, 8 May 2012 14:38:41 +0000 (09:38 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  fdc: simplify media change handling
  qcow2: lock on prealloc
  block: make bdrv_create adopt coroutine
  qcow2: Limit COW to where it's needed
  sheepdog: switch to writethrough mode if cluster doesn't support flush

11 years agoMerge remote-tracking branch 'bonzini/scsi-next' into staging
Anthony Liguori [Tue, 8 May 2012 14:37:12 +0000 (09:37 -0500)]
Merge remote-tracking branch 'bonzini/scsi-next' into staging

* bonzini/scsi-next:
  scsi: Add assertion for use-after-free errors
  scsi: remove useless debug messages
  scsi: set VALID bit to 0 in fixed format sense data
  scsi: do not require a minimum allocation length for REQUEST SENSE
  scsi: do not require a minimum allocation length for INQUIRY
  scsi: parse 16-byte tape CDBs
  scsi: do not report bogus overruns for commands in the 0x00-0x1F range
  scsi-disk: add dpofua property
  scsi: change "removable" field to host many features
  scsi: Specify the xfer direction for UNMAP and ATA_PASSTHROUGH commands
  scsi: fix WRITE SAME transfer length and direction
  scsi: fix refcounting for reads
  scsi: prevent data transfer overflow
  ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs

11 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Tue, 8 May 2012 14:37:00 +0000 (09:37 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

* riku/linux-user-for-upstream:
  linux-user: fix emulation of /proc/self/maps
  linux-user: Clean up interim solution for exit syscall

11 years agoMerge remote-tracking branch 'spice/spice.v54' into staging
Anthony Liguori [Tue, 8 May 2012 14:36:37 +0000 (09:36 -0500)]
Merge remote-tracking branch 'spice/spice.v54' into staging

* spice/spice.v54:
  qxl: don't assert on guest create_guest_primary
  qxl: ioport_write: remove guest trigerrable abort
  qxl: qxl_add_memslot: remove guest trigerrable panics
  qxl: interface_notify_update: remove guest trigerrable abort
  qxl: cleanup s/__FUNCTION__/__func__/
  qxl: don't abort on guest trigerrable ring indices mismatch
  qxl: fix > 80 chars line
  qxl: replace panic with guest bug in qxl_track_command
  qxl: check for NULL return from qxl_phys2virt
  hw/qxl.c: qxl_phys2virt: replace panics with guest_bug
  spice_info: add mouse_mode
  spice: require spice-protocol >= 0.8.1

11 years agoMerge remote-tracking branch 'sweil/fixes' into staging
Anthony Liguori [Tue, 8 May 2012 14:36:18 +0000 (09:36 -0500)]
Merge remote-tracking branch 'sweil/fixes' into staging

* sweil/fixes:
  qemu-timer: Fix limits for w32 mmtimer
  qom: Fix memory leak in function container_get
  hw/pc_sysfw: Fix memory leak
  qdev: Fix memory leak in function set_pci_devfn
  arm-semi: Rename SYS_XXX macros to TARGET_SYS_XXX (fixes compiler warning)
  target-mips: Remove unused inline function

11 years agortl8139: fix regression in TxStatus/TxAddr read
Avi Kivity [Mon, 7 May 2012 12:00:45 +0000 (15:00 +0300)]
rtl8139: fix regression in TxStatus/TxAddr read

Commit afe0a595356192 added byte reads for TxStatus/TxAddr, but
broke 32-bit reads; the mask generation

   (1 << (8 * size)) - 1

is unspecified in C for size >= sizeof(int), and in fact returns 0
on x86.

Fix by using a larger type.

Fixes (at least) Fedora 9 i386 with -machine kernel_irqchip=on.  I
didn't see it with the qemu APIC implementation; may be due to timing
or (more likely) a tester error.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
11 years agofdc: simplify media change handling
Hervé Poussineau [Sat, 5 May 2012 17:43:28 +0000 (19:43 +0200)]
fdc: simplify media change handling

This also (partly) fixes IBM OS/2 Warp 4.0 floppy installation, where
not all floppies have the same format (2x80x18 for the first ones,
2x80x23 for the next ones).

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: lock on prealloc
Zhi Yong Wu [Mon, 7 May 2012 08:51:03 +0000 (16:51 +0800)]
qcow2: lock on prealloc

preallocate() will be locked. This is required because
qcow2_alloc_cluster_link_l2() assumes that it runs under a lock that it
can drop while COW is being performed.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: make bdrv_create adopt coroutine
Zhi Yong Wu [Mon, 7 May 2012 08:50:42 +0000 (16:50 +0800)]
block: make bdrv_create adopt coroutine

The current qemu.git introduces failure with preallocation and some
sizes:

qemu-img create -f qcow2 new.img 976563K -o preallocation=metadata
qemu-img: qemu-coroutine-lock.c:111: qemu_co_mutex_unlock: Assertion
`mutex->locked == 1' failed.

And lock needs to work in coroutine context. So to fix this issue, we
need to make bdrv_create adopt coroutine at first.

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Limit COW to where it's needed
Kevin Wolf [Thu, 26 Apr 2012 17:41:22 +0000 (19:41 +0200)]
qcow2: Limit COW to where it's needed

This fixes a regression introduced in commit 250196f1. The bug leads to
data corruption, found during an Autotest run with a Fedora 8 guest.

Consider a write request whose first part is covered by an already
allocated cluster, but additional clusters need to be newly allocated.
When counting the number of clusters to allocate, the qcow2 code would
decide to do COW for all remaining clusters of the write request, even
if some of them are already allocated.

If during this COW operation another write request is issued that touches
the same cluster, it will still refer to the old cluster. When the COW
completes, the first request will update the L2 table and the second
write request will be lost. Note that the requests need not overlap, it's
enough for them to touch the same cluster.

This patch ensures that only clusters that really require COW are
considered for allocation. In this case any other request writing to the
same cluster will be an allocating write and gets serialised.

Reported-by: Marcelo Tosatti <mtosatti@redhat.com>
Tested-by: Marcelo Tosatti <mtosatti@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agosheepdog: switch to writethrough mode if cluster doesn't support flush
MORITA Kazutaka [Wed, 2 May 2012 20:26:07 +0000 (05:26 +0900)]
sheepdog: switch to writethrough mode if cluster doesn't support flush

This is necessary for qemu to work with the older version of Sheepdog
which doesn't support SD_OP_FLUSH_VDI.

Signed-off-by: MORITA Kazutaka <morita.kazutaka@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agohw/ac97: Mask out the EAPD bit on Powerdown Ctrl/Stat writes
Hans de Goede [Mon, 7 May 2012 07:24:38 +0000 (09:24 +0200)]
hw/ac97: Mask out the EAPD bit on Powerdown Ctrl/Stat writes

The Linux AC97 driver tests this bit to decide wether or not to show
an External amplifier toggle control.

This patch was also tested with a Windows XP guest without any issues.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agohw/ac97: Mask out unused bits of volume controls
Hans de Goede [Mon, 7 May 2012 07:24:37 +0000 (09:24 +0200)]
hw/ac97: Mask out unused bits of volume controls

The Linux ac97 drivers does a number of register read/write tests to
see how much resolution a volume control actually has.

This patch takes this into account by masking out any bits written to
a volume control reg which should not be there according to the spec.

After this the Linux ac97 driver correctly uses a range of 0 - 0x1f for
the PCM out volume, as stated in the spec, and we can fix the FIXME
in update_combined_volume_out().

This patch was also tested with a Windows XP guest without any issues.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agohw/ac97: Use AC97_Record_Gain_Mute not AC97_Line_In_Volume_Mute
Hans de Goede [Mon, 7 May 2012 07:24:36 +0000 (09:24 +0200)]
hw/ac97: Use AC97_Record_Gain_Mute not AC97_Line_In_Volume_Mute

After commit 19677a380a70348134ed7650b294522617eb03fc:
"hw/ac97: add support for volume control"

We are (correctly) using AC97_Record_Gain_Mute and not AC97_Line_In_Volume_Mute
for recording volume, but various places in hw/ac97 were still assumimg that
we are using AC97_Line_In_Volume_Mute for record volume control, this patch
fixes this.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agohw/ac97: Make a bunch of mixer registers read only
Hans de Goede [Mon, 7 May 2012 07:24:35 +0000 (09:24 +0200)]
hw/ac97: Make a bunch of mixer registers read only

The Linux ac97 driver tries to see if optional things like video input
volume control are available in 2 ways:
1) See if the mute bit is set after reset, if it is no further tests are done
2) If the mute bit is not set it does a write/read test of the mute bit

This patch changes our ac97 to conform to what the Linux driver expects, it
initializes registers for things which we don't emulate to 0 (so the mute bit
is not set) and makes them read only.

This causes Linux to now longer show the following (functionless)
controls in alsamixer:

Master Mono vol + mute
3d Control toggle
PCM out pre / post 3d select
Surround toggle
CD vol + mute
Mic vol + mute
Mic boost toggle
Mic mic1 / mic2 select
Video vol + mute
Phone vol + mute
Beep mono vol + mute
Aux vol + mute
Mono "output mic" / "mix" select
Sigmatel 4 speaker stereo toggle
Sigmatel ADC 6Db att toggle
Sigmatel DAC 6Db att toggle

This patch was also tested with a Windows XP guest and there it also makes
a number of functionless mixer controls go away.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agohw/ac97: Fix log message in mixer_load
Hans de Goede [Mon, 7 May 2012 07:24:34 +0000 (09:24 +0200)]
hw/ac97: Fix log message in mixer_load

Fix a small copy and paste error in logging.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agoscsi: Add assertion for use-after-free errors
Stefan Weil [Fri, 4 May 2012 06:51:16 +0000 (08:51 +0200)]
scsi: Add assertion for use-after-free errors

The QEMU emulation which is currently used with Raspberry PI images
(qemu-system-arm -M versatilepb ...) accesses memory which was freed.

Valgrind output (extract):

==17857== Invalid write of size 4
==17857==    at 0x24EB06: scsi_req_unref (scsi-bus.c:1273)
==17857==    by 0x24FFAE: scsi_read_complete (scsi-disk.c:277)
==17857==    by 0x152ACC: bdrv_co_em_bh (block.c:3363)
==17857==    by 0x13D49C: qemu_bh_poll (async.c:71)
==17857==    by 0x211A8C: main_loop_wait (main-loop.c:503)
==17857==    by 0x207954: main_loop (vl.c:1555)
==17857==    by 0x20E9C9: main (vl.c:3653)
==17857==  Address 0x1c54383c is 12 bytes inside a block of size 260 free'd
==17857==    at 0x4824B3A: free (vg_replace_malloc.c:366)
==17857==    by 0x20ADFA: free_and_trace (vl.c:2250)
==17857==    by 0x4899FC5: g_free (in /lib/libglib-2.0.so.0.2400.1)
==17857==    by 0x24EB3B: scsi_req_unref (scsi-bus.c:1277)
==17857==    by 0x24F003: scsi_req_complete (scsi-bus.c:1383)
==17857==    by 0x25022A: scsi_read_data (scsi-disk.c:334)
==17857==    by 0x24EB9F: scsi_req_continue (scsi-bus.c:1289)
==17857==    by 0x1C7787: lsi_do_dma (lsi53c895a.c:575)
==17857==    by 0x1C8CDA: lsi_execute_script (lsi53c895a.c:1147)
==17857==    by 0x1C74EA: lsi_resume_script (lsi53c895a.c:510)
==17857==    by 0x1C7ECD: lsi_transfer_data (lsi53c895a.c:746)
==17857==    by 0x24EC90: scsi_req_data (scsi-bus.c:1307)

(There are some more similar messages.)

This patch adds an assertion which also detects those errors:

Calling scsi_req_unref is not allowed when the previous call
of that function has decremented refcount to 0, because in this
case req was freed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: remove useless debug messages
Paolo Bonzini [Thu, 3 May 2012 16:26:13 +0000 (18:26 +0200)]
scsi: remove useless debug messages

Optional inquiry information is declared obsolete in the latest versions
of the standard; invalid CDBs or unsupported VPD pages are supported
can be diagnosed with trace_scsi_inquiry.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: set VALID bit to 0 in fixed format sense data
Paolo Bonzini [Thu, 3 May 2012 15:59:27 +0000 (17:59 +0200)]
scsi: set VALID bit to 0 in fixed format sense data

The INFORMATION field (bytes 3..6) is never set by QEMU, so the VALID
bit must be 0.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: do not require a minimum allocation length for REQUEST SENSE
Paolo Bonzini [Thu, 3 May 2012 13:57:08 +0000 (15:57 +0200)]
scsi: do not require a minimum allocation length for REQUEST SENSE

The requirements on the REQUEST SENSE buffer size are not in my copy of SPC
(SPC-4 r27) and not observed by LIO.  Rip them out.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: do not require a minimum allocation length for INQUIRY
Paolo Bonzini [Thu, 3 May 2012 12:34:45 +0000 (14:34 +0200)]
scsi: do not require a minimum allocation length for INQUIRY

The requirements on the INQUIRY buffer size are not in my copy of SPC
(SPC-4 r27) and not observed by LIO.  Rip them out.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: parse 16-byte tape CDBs
Paolo Bonzini [Fri, 4 May 2012 08:28:55 +0000 (10:28 +0200)]
scsi: parse 16-byte tape CDBs

The transfer length for these commands is different from the transfer
length of the corresponding disk commands, so parse it specially.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: do not report bogus overruns for commands in the 0x00-0x1F range
Paolo Bonzini [Thu, 3 May 2012 13:28:05 +0000 (15:28 +0200)]
scsi: do not report bogus overruns for commands in the 0x00-0x1F range

Interpreting cdb[4] == 0 as a request to transfer 256 blocks is only
needed for READ_6 and WRITE_6.  No other command in that range needs
that special-casing, and the resulting overrun breaks scsi-testsuite's
attempt to use command 2 as a known-invalid command.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi-disk: add dpofua property
Paolo Bonzini [Tue, 1 May 2012 08:25:16 +0000 (10:25 +0200)]
scsi-disk: add dpofua property

Linux expects REQ_FUA to be advertised only if WRITE+FUA is faster than
WRITE+SYNCHRONIZE CACHE, so we should not set the DPOFUA bit.  However,
it is useful to have it for testing purposes, so add a qdev property to
set it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: change "removable" field to host many features
Paolo Bonzini [Tue, 1 May 2012 08:23:54 +0000 (10:23 +0200)]
scsi: change "removable" field to host many features

It is pointless to add a uint32_t field for every new feature.
Since we will need a new feature soon, convert accesses to "removable"
to look at bit 0 only.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: Specify the xfer direction for UNMAP and ATA_PASSTHROUGH commands
Ronnie Sahlberg [Sat, 28 Apr 2012 13:49:36 +0000 (23:49 +1000)]
scsi: Specify the xfer direction for UNMAP and ATA_PASSTHROUGH commands

scsi_cmd_xfer_mode() is used to specify the xfer direction for SCSI
commands that come in from the guest.  If the direction is set incorrectly
this will eventually cause QEMU to kernel-panic the guest.

Add UNMAP and ATAPASSTHROUGH as commands that send data to the device.

Without this change, recent kernels will send both UNMAP as well
as ATAPASSTHROUGH commands to any /dev/sg* device, which due to the
incorrect xfer direction very quickly causes the guest kernel to crash.

Example causing a crash without the patch applied:

./x86_64-softmmu/qemu-system-x86_64 -m 1024 -enable-kvm -cdrom linuxmint-12-gnome-dvd-64bit.iso -drive file=/dev/sg4,if=scsi,bus=0,unit=6

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: fix WRITE SAME transfer length and direction
Paolo Bonzini [Wed, 8 Feb 2012 09:40:37 +0000 (10:40 +0100)]
scsi: fix WRITE SAME transfer length and direction

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: fix refcounting for reads
Paolo Bonzini [Tue, 24 Apr 2012 06:41:04 +0000 (08:41 +0200)]
scsi: fix refcounting for reads

Recently introduced FUA support also gave us a use-after-free
of the BlockAcctCookie within a SCSIDiskReq, due to unbalanced
reference counting.

The patch fixes this by making scsi_do_read look like a combination
of scsi_*_complete + scsi_*_data.  It does both a ref (like
scsi_read_data) and an unref (like scsi_flush_complete).

Reported-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoscsi: prevent data transfer overflow
Paolo Bonzini [Wed, 8 Feb 2012 10:49:43 +0000 (11:49 +0100)]
scsi: prevent data transfer overflow

Avoid sending more than 2GB of data, as that can cause overflows
in int32_t variables.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agoISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs
Ronnie Sahlberg [Tue, 24 Apr 2012 06:29:04 +0000 (16:29 +1000)]
ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs

Update the configure test for libiscsi support to detect version 1.3
or later.  Version 1.3 of libiscsi provides both READCAPACITY16 as well
as UNMAP commands.

Update the iscsi block layer to use READCAPACITY16 to detect the size of
the LUN instead of READCAPACITY10. This allows support for LUNs larger
than 2TB.

Update to implement bdrv_aio_discard() using the UNMAP command.
This allows us to use thin-provisioned LUNs from TGTD and other iSCSI
targets that support thin-provisioning.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
[squashed in subsequent patch from Ronnie to fix off-by-one in LBA count]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 years agofix build with pulseaudio versions older than 0.9.11
Gerd Hoffmann [Thu, 3 May 2012 20:41:28 +0000 (22:41 +0200)]
fix build with pulseaudio versions older than 0.9.11

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: malc <av1474@comtv.ru>
11 years agolinux-user: fix emulation of /proc/self/maps
Alexander Graf [Tue, 1 May 2012 15:30:28 +0000 (16:30 +0100)]
linux-user: fix emulation of /proc/self/maps

Improve the emulation of /proc/self/maps by reading the underlying
host maps file and passing lines through with addresses adjusted
to be guest addresses. This is necessary to avoid false triggers
of the glibc check that a format string containing '%n' is not in
writable memory. (For an example see the bug reported in
https://bugs.launchpad.net/qemu-linaro/+bug/947888 where gpg aborts.)

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agolinux-user: Clean up interim solution for exit syscall
Andreas Färber [Tue, 1 May 2012 22:10:43 +0000 (00:10 +0200)]
linux-user: Clean up interim solution for exit syscall

After all target CPUs have been QOM'ified, we no longer need an #ifdef
to switch between object_delete() and g_free() in NPTL thread exit.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
11 years agoBail out if CONFIG_TCG_PASS_AREG0 is defined
malc [Thu, 3 May 2012 11:48:49 +0000 (15:48 +0400)]
Bail out if CONFIG_TCG_PASS_AREG0 is defined

Signed-off-by: malc <av1474@comtv.ru>
11 years agoRestore consistent formatting
malc [Thu, 3 May 2012 11:47:39 +0000 (15:47 +0400)]
Restore consistent formatting

Signed-off-by: malc <av1474@comtv.ru>
11 years agoqxl: don't assert on guest create_guest_primary
Alon Levy [Wed, 25 Apr 2012 09:43:31 +0000 (12:43 +0300)]
qxl: don't assert on guest create_guest_primary

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: ioport_write: remove guest trigerrable abort
Alon Levy [Wed, 25 Apr 2012 09:13:25 +0000 (12:13 +0300)]
qxl: ioport_write: remove guest trigerrable abort

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: qxl_add_memslot: remove guest trigerrable panics
Alon Levy [Wed, 25 Apr 2012 09:13:24 +0000 (12:13 +0300)]
qxl: qxl_add_memslot: remove guest trigerrable panics

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: interface_notify_update: remove guest trigerrable abort
Alon Levy [Wed, 25 Apr 2012 09:13:23 +0000 (12:13 +0300)]
qxl: interface_notify_update: remove guest trigerrable abort

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: cleanup s/__FUNCTION__/__func__/
Alon Levy [Wed, 25 Apr 2012 09:13:22 +0000 (12:13 +0300)]
qxl: cleanup s/__FUNCTION__/__func__/

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: don't abort on guest trigerrable ring indices mismatch
Alon Levy [Wed, 25 Apr 2012 09:13:21 +0000 (12:13 +0300)]
qxl: don't abort on guest trigerrable ring indices mismatch

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: fix > 80 chars line
Alon Levy [Wed, 25 Apr 2012 09:13:20 +0000 (12:13 +0300)]
qxl: fix > 80 chars line

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: replace panic with guest bug in qxl_track_command
Alon Levy [Wed, 25 Apr 2012 09:13:19 +0000 (12:13 +0300)]
qxl: replace panic with guest bug in qxl_track_command

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqxl: check for NULL return from qxl_phys2virt
Alon Levy [Wed, 25 Apr 2012 09:13:18 +0000 (12:13 +0300)]
qxl: check for NULL return from qxl_phys2virt

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agohw/qxl.c: qxl_phys2virt: replace panics with guest_bug
Alon Levy [Wed, 25 Apr 2012 09:13:17 +0000 (12:13 +0300)]
hw/qxl.c: qxl_phys2virt: replace panics with guest_bug

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agospice_info: add mouse_mode
Alon Levy [Thu, 29 Mar 2012 21:23:14 +0000 (23:23 +0200)]
spice_info: add mouse_mode

Add mouse_mode, either server or mouse, to qmp and hmp commands, based
on spice_server_is_server_mouse added in spice-server 0.10.3.

Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agospice: require spice-protocol >= 0.8.1
Alon Levy [Wed, 7 Mar 2012 14:19:03 +0000 (16:19 +0200)]
spice: require spice-protocol >= 0.8.1

Requiring spice-server >= 0.8.2 is not enough since spice-server.pc
doesn't require spice-protocol (any version). Until that is fixed
upstream an explicit requirement in qemu fixes compilation broken since

commit 2e1a98c9c1b90ca093278c6b43244dc46604d7b7
Author: Alon Levy <alevy@redhat.com>
Date:   Fri Feb 24 23:19:30 2012 +0200

    qxl: introduce QXLCookie

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alon Levy <alevy@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
11 years agoqemu-timer: Fix limits for w32 mmtimer
Stefan Weil [Fri, 27 Apr 2012 05:34:40 +0000 (05:34 +0000)]
qemu-timer: Fix limits for w32 mmtimer

timeSetEvent only accepts delays in the range which is returned by
timeGetDevCaps.

The lower limit is typically 1 (= 1 ms), so the constant value of 1
in the old code usually worked.

The upper limit can be as low as 10000 ms, so the latest changes in
QEMU's timer handling which introduced timeout values above that limit
could result in failures of timeSetEvent when the timer was re-armed.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
11 years agoqom: Fix memory leak in function container_get
Stefan Weil [Sat, 28 Apr 2012 02:20:19 +0000 (02:20 +0000)]
qom: Fix memory leak in function container_get

Valgrind reported this memory leak which occured very often.

Test scenario:

qemu-system-i386 (no arguments), only BIOS started, terminate with
monitor command (quit).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
11 years agohw/pc_sysfw: Fix memory leak
Stefan Weil [Sat, 28 Apr 2012 02:20:20 +0000 (02:20 +0000)]
hw/pc_sysfw: Fix memory leak

Valgrind reported this memory leak which occured a few times.

Test scenario:

qemu-system-i386 (no arguments), only BIOS started, terminate with
monitor command (quit).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
11 years agoqdev: Fix memory leak in function set_pci_devfn
Stefan Weil [Sat, 28 Apr 2012 02:32:42 +0000 (02:32 +0000)]
qdev: Fix memory leak in function set_pci_devfn

Valgrind reported this memory leak which occured very often.

Test scenario:

qemu-system-i386 (no arguments), only BIOS started, terminate with
monitor command (quit).

v2:
Use error_free instead of g_free (hint from Andreas Färber, thanks).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Andreas Färber <afaerber@suse.de>
11 years agoarm-semi: Rename SYS_XXX macros to TARGET_SYS_XXX (fixes compiler warning)
Stefan Weil [Sat, 28 Apr 2012 05:07:47 +0000 (05:07 +0000)]
arm-semi: Rename SYS_XXX macros to TARGET_SYS_XXX (fixes compiler warning)

SYS_OPEN is already defined in stdio.h of MinGW-w64,
therefore the compiler complains when building for w64.

Adding the prefix TARGET_ avoids that macro redefinition.
xtensa-semi.c also uses the same prefix (but mixed case macros
TARGET_SYS_xxx instead of TARGET_SYS_XXX).

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Acked-by: Peter Maydell <peter.maydell@linaro.org>
11 years agotarget-mips: Remove unused inline function
Stefan Weil [Sat, 17 Mar 2012 02:00:51 +0000 (02:00 +0000)]
target-mips: Remove unused inline function

Function set_HILO is not needed anywhere.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
11 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Wed, 2 May 2012 19:49:53 +0000 (14:49 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony:
  ATA: Allow WIN_SECURITY_FREEZE_LOCK as nop
  rbd: add discard support
  qcow2: fix the return value -ENOENT -> -EEXIST
  qcow2: Don't hold cache references across yield
  qcow2: Remove unused parameter in do_alloc_cluster_offset
  qemu-iotests: Many parallel allocating I/O requests
  docs: fix one issue in qcow2 specs
  block/qcow2: Add missing GCC_FMT_ATTR to function report_unsupported()
  qemu-iotests: ignore fragmentation information for qed

11 years agoATA: Allow WIN_SECURITY_FREEZE_LOCK as nop
Alexander Graf [Thu, 26 Apr 2012 10:45:07 +0000 (12:45 +0200)]
ATA: Allow WIN_SECURITY_FREEZE_LOCK as nop

When using Windows 8 with an AHCI disk drive, it issues a blue screen.
The reason is that WIN_SECURITY_FREEZE_LOCK / CFA_WEAR_LEVEL is not
supported by our ATA implementation, but Windows expects it to be there.

Since without security stuff implemented, the lock would be a nop anyway
and CFA_WEAR_LEVEL already is treated as a nop, let's just allow the cmd
for HD drives as well. That way Windows is happy.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agorbd: add discard support
Josh Durgin [Tue, 1 May 2012 06:16:45 +0000 (23:16 -0700)]
rbd: add discard support

Change the write flag to an operation type in RBDAIOCB, and make the
buffer optional since discard doesn't use it.

Discard is first included in librbd 0.1.2 (which is in Ceph 0.46).
If librbd is too old, leave out qemu_rbd_aio_discard entirely,
so the old behavior is preserved.

Signed-off-by: Josh Durgin <josh.durgin@dreamhost.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: fix the return value -ENOENT -> -EEXIST
Zhi Yong Wu [Thu, 26 Apr 2012 08:11:37 +0000 (16:11 +0800)]
qcow2: fix the return value -ENOENT -> -EEXIST

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Don't hold cache references across yield
Kevin Wolf [Tue, 24 Apr 2012 14:10:56 +0000 (16:10 +0200)]
qcow2: Don't hold cache references across yield

If cache references are held while the coroutine has yielded, the cache
may get used up and abort() when it can't find a free entry.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Remove unused parameter in do_alloc_cluster_offset
Kevin Wolf [Tue, 24 Apr 2012 14:10:03 +0000 (16:10 +0200)]
qcow2: Remove unused parameter in do_alloc_cluster_offset

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Many parallel allocating I/O requests
Kevin Wolf [Tue, 24 Apr 2012 14:30:23 +0000 (16:30 +0200)]
qemu-iotests: Many parallel allocating I/O requests

This test case manages to let qcow2 abort because its cache is used up
and it can't find free cache entries for new requests any more.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agodocs: fix one issue in qcow2 specs
Zhi Yong Wu [Tue, 24 Apr 2012 07:11:27 +0000 (15:11 +0800)]
docs: fix one issue in qcow2 specs

Signed-off-by: Zhi Yong Wu <wuzhy@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock/qcow2: Add missing GCC_FMT_ATTR to function report_unsupported()
Stefan Weil [Mon, 23 Apr 2012 20:54:38 +0000 (22:54 +0200)]
block/qcow2: Add missing GCC_FMT_ATTR to function report_unsupported()

Cc: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: ignore fragmentation information for qed
Dong Xu Wang [Mon, 23 Apr 2012 09:14:16 +0000 (17:14 +0800)]
qemu-iotests: ignore fragmentation information for qed

We added image fragmentation statistics functions to qemu-img several days
ago, those patches will cause "./check -qed" failed. This patch will ignore
fragmentation statistics information of qed format, and then "./check -qed"
will work.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoUpdate version for 1.1-rc0 release v1.1-rc0
Anthony Liguori [Wed, 2 May 2012 12:32:09 +0000 (07:32 -0500)]
Update version for 1.1-rc0 release

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kiszka/queues/slirp' into staging
Anthony Liguori [Tue, 1 May 2012 23:48:01 +0000 (18:48 -0500)]
Merge remote-tracking branch 'kiszka/queues/slirp' into staging

* kiszka/queues/slirp:
  Declare state directory in smb.conf
  slirp: don't use "smb ports = 0" option

11 years agoMerge remote-tracking branch 'stefanha/tracing' into staging
Anthony Liguori [Tue, 1 May 2012 23:46:52 +0000 (18:46 -0500)]
Merge remote-tracking branch 'stefanha/tracing' into staging

* stefanha/tracing:
  configure: check for supported Python 2.x versions
  tracetool: avoid pkgutil.iter_modules() Python 2.7 function
  tracetool: avoid str.rpartition() Python 2.5 function
  tracetool: use Python 2.4-compatible __import__() arguments
  tracetool: use Python 2.4-compatible exception handling syntax

11 years agoMerge remote-tracking branch 'agraf/s390-for-upstream' into staging
Anthony Liguori [Tue, 1 May 2012 23:46:39 +0000 (18:46 -0500)]
Merge remote-tracking branch 'agraf/s390-for-upstream' into staging

* agraf/s390-for-upstream:
  s390: reset avail and used index on reboot
  S390: dont call system_shutdown on disabled wait
  S390: remove default cdrom, sd-card and floppy support
  S390: support reboot for kvm on s390
  S390: reboot: reset device pages on reboot
  S390: fix error handling on kernel and initrd failures
  S390: fix kernel_commandline handling

11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Tue, 1 May 2012 23:46:19 +0000 (18:46 -0500)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  iohandler: Use bool for boolean struct member and remove holes
  async: Use bool for boolean struct members and remove a hole
  configure: Fix creation of symbolic links for MinGW toolchain

11 years agoMerge remote-tracking branch 'agraf/ppc-for-upstream' into staging
Anthony Liguori [Tue, 1 May 2012 23:46:05 +0000 (18:46 -0500)]
Merge remote-tracking branch 'agraf/ppc-for-upstream' into staging

* agraf/ppc-for-upstream:
  linux-user: Fix invalid TARGET_ABI_BITS usage on ppc hosts
  target-ppc: Some support for dumping TLB_EMB TLBs
  ppce500_spin: Replace assert by hw_error (fixes compiler warning)
  pseries: Fix use of global CPU state
  pseries: Use the same interrupt swizzling for host bridges as p2p bridges
  pseries: Implement automatic PAPR VIO address allocation
  PPC: Fix up e500 cache size setting
  booke:Use MMU API for creating initial mapping for secondary cpus

11 years agoMerge remote-tracking branch 'mdroth/qga-pull-4-27-12' into staging
Anthony Liguori [Tue, 1 May 2012 23:44:03 +0000 (18:44 -0500)]
Merge remote-tracking branch 'mdroth/qga-pull-4-27-12' into staging

* mdroth/qga-pull-4-27-12:
  qemu-ga: persist tracking of fsfreeze state via filesystem
  qemu-ga: add a whitelist for fsfreeze-safe commands
  qemu-ga: improve recovery options for fsfreeze

11 years agoDeclare state directory in smb.conf
Nikolaus Rath [Wed, 25 Apr 2012 13:57:19 +0000 (09:57 -0400)]
Declare state directory in smb.conf

The smb.conf generated by the userspace networking does not include a state directory
directive. Samba therefore falls back to the default value. Since the user generally
does not have write access to this path, smbd immediately crashes.

The "state directory" option was added in Samba 3.4.0 (commit
http://gitweb.samba.org/?p=samba.git;a=commit;h=7b02e05eb64f3ffd7aa1cf027d10a7343c0da757).

This patch adds the missing option.

Signed-off-by: Nikolaus Rath <Nikolaus@rath.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agoslirp: don't use "smb ports = 0" option
Nikolaus Rath [Wed, 25 Apr 2012 22:51:27 +0000 (18:51 -0400)]
slirp: don't use "smb ports = 0" option

The "smb ports = 0" option causes recent samba versions to crash. It was
introduced in commit 157777ef3e with log message "Samba 3 support".
However, a value of 0 has never been officially supported by smb and is
also not necessary: if stdin is a socket, smb does not try to listen on
any ports and uses just stdin. This is necessary to support inetd based
operation (otherwise smbd would always fail when called from inetd,
because inetd already listens on the SMB port). Since samba has
supported inetd operation since pre-3.x, it should be safe to rely on
this feature. I have tested it with Samba 3.6.4 -- communication works
fine, and smbd is not listening on any ports.

I suspect the "smb ports = 0" hack may have been introduced when someone
tested the qemu generated samba config from the command line with "smbd
-i" and found it to fail (because then stdin isn't a socket).

Signed-off-by: Nikolaus Rath <Nikolaus@rath.org>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
11 years agolinux-user: Fix invalid TARGET_ABI_BITS usage on ppc hosts
Alexander Graf [Mon, 30 Apr 2012 22:58:55 +0000 (22:58 +0000)]
linux-user: Fix invalid TARGET_ABI_BITS usage on ppc hosts

When trying to evaluate the size of the _host_ type size for olddev_t,
we need to expose the host's pointer size, not the guest pointer size.

This usage got introduced accidently in commit b754e4fc1.

Fix things by not using TARGET_.*, but rather use host sizeof()
information, which gives us the correct size.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agotarget-ppc: Some support for dumping TLB_EMB TLBs
François Revol [Tue, 24 Apr 2012 06:48:34 +0000 (06:48 +0000)]
target-ppc: Some support for dumping TLB_EMB TLBs

Add mmubooke_dump_mmu().

TODO: Add printing of individual flags.

Signed-off-by: François Revol <revol@free.fr>
[agraf: fix coding style]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoppce500_spin: Replace assert by hw_error (fixes compiler warning)
Stefan Weil [Sat, 28 Apr 2012 15:52:31 +0000 (17:52 +0200)]
ppce500_spin: Replace assert by hw_error (fixes compiler warning)

The default case in function spin_read should never be reached,
therefore the old code used assert(0) to abort QEMU.

This does not work when QEMU is compiled with macro NDEBUG defined.
In this case (and also when the compiler does not know that assert
never returns), there is a compiler warning because of the missing
return value.

Using hw_error allows an improved error message and aborts always.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
[agraf: use __func__]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Fix use of global CPU state
Peter Portante [Mon, 23 Apr 2012 07:27:56 +0000 (07:27 +0000)]
pseries: Fix use of global CPU state

Commit ed120055c7f9b26b5707d3ceabbe5a3f06aaf937 (Implement PAPR VPA
functions for pSeries shared processor partitions) introduced the
deregister_dtl() function and typo "emv" as name of its argument.
This went unnoticed because the code in that function can access the
global variable "env" so that no build failure resulted.

Fix the argument to read "env". Resolves LP#986241.

Signed-off-by: Peter Portante <peter.portante@redhat.com>
Acked-by: Andreas Färber <afaerber@suse.de>
[agraf: fixed typo in commit message]
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Use the same interrupt swizzling for host bridges as p2p bridges
David Gibson [Wed, 25 Apr 2012 17:55:42 +0000 (17:55 +0000)]
pseries: Use the same interrupt swizzling for host bridges as p2p bridges

Currently the pseries PCI code uses a somewhat strange scheme of PCI irq
allocation - one per slot up to a maximum that's greater than the usual 4.
This scheme more or less worked, because we were able to tell the guest the
irq mapping in the device tree, however it's a bit odd and may break
assumptions in the future.  Worse, the array used to construct the dev
tree interrupt map was mis-sized, we got away with it only because it
happened that our SPAPR_PCI_NUM_LSI value was greater than 7.

This patch changes the pseries PCI code to use the same interrupt swizzling
scheme as is standardized for PCI to PCI bridges.  This makes for better
consistency, deals better with any devices which use multiple interrupt
pins and will make life easier in the future when we add passthrough of
what may be either a host bridge or a PCI to PCI bridge.  This won't break
existing guests, because they don't assume a particular mapping scheme for
host bridges, but just follow what we tell them in the device tree (also
updated to match, of course).  This patch also fixes the allocation of the
irq map.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agopseries: Implement automatic PAPR VIO address allocation
David Gibson [Wed, 25 Apr 2012 17:55:41 +0000 (17:55 +0000)]
pseries: Implement automatic PAPR VIO address allocation

PAPR virtual IO (VIO) devices require a unique, but otherwise arbitrary,
"address" used as a token to the hypercalls which manipulate them.

Currently the pseries machine code does an ok job of allocating these
addresses when the legacy -net nic / -serial and so forth options are used
but will fail to allocate them properly when using -device.

Specifically, you can use -device if all addresses are explicitly assigned.
Without explicit assignment, only one VIO device of each type (network,
console, SCSI) will be assigned properly, any further ones will attempt
to take the same address leading to a fatal error.

This patch fixes the situation by adding a proper address allocator to the
VIO "bus" code.  This is used both by -device and the legacy options and
default devices.  Addresses can still be explicitly assigned with -device
options if desired.

This patch changes the (guest visible) numbering of VIO devices, but since
their addresses are discovered using the device tree and already differ
from the numbering found on existing PowerVM systems, this does not break
compatibility.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agoPPC: Fix up e500 cache size setting
Alexander Graf [Thu, 19 Apr 2012 13:34:06 +0000 (15:34 +0200)]
PPC: Fix up e500 cache size setting

When initializing the e500 code, we need to expose its
cache line size for user and system mode, while the mmu
details are only interesting for system emulation.

Split the 2 switch statements apart, allowing us to #ifdef
out the mmu parts for user mode emulation while keeping all
cache information consistent.

Signed-off-by: Alexander Graf <agraf@suse.de>
11 years agobooke:Use MMU API for creating initial mapping for secondary cpus
Bharat Bhushan [Mon, 26 Mar 2012 17:56:46 +0000 (17:56 +0000)]
booke:Use MMU API for creating initial mapping for secondary cpus

Initial Mapping creation for secondary CPU in SMP was missing new MMU API.

Signed-off-by: Bharat Bhushan <bharat.bhushan@freescale.com>
Signed-off-by: Alexander Graf <agraf@suse.de>