]> git.proxmox.com Git - mirror_qemu.git/log
mirror_qemu.git
11 years agoqcow2: Allocate l2meta only for cluster allocations
Kevin Wolf [Fri, 7 Dec 2012 17:08:46 +0000 (18:08 +0100)]
qcow2: Allocate l2meta only for cluster allocations

Even for writes to already allocated clusters, an l2meta is allocated,
though it stays effectively unused. After this patch, only allocating
requests still have one. Each l2meta now describes an in-flight request
that writes to clusters that are not yet hooked up in the L2 table.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Drop l2meta.cluster_offset
Kevin Wolf [Fri, 7 Dec 2012 17:08:45 +0000 (18:08 +0100)]
qcow2: Drop l2meta.cluster_offset

There's no real reason to have an l2meta for normal requests that don't
allocate anything. Before we can get rid of it, we must return the host
cluster offset in a different way.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Allocate l2meta dynamically
Kevin Wolf [Fri, 7 Dec 2012 17:08:44 +0000 (18:08 +0100)]
qcow2: Allocate l2meta dynamically

As soon as delayed COW is introduced, the l2meta struct is needed even
after completion of the request, so it can't live on the stack.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Introduce Qcow2COWRegion
Kevin Wolf [Fri, 7 Dec 2012 17:08:43 +0000 (18:08 +0100)]
qcow2: Introduce Qcow2COWRegion

This makes it easier to address the areas for which a COW must be
performed. As a nice side effect, the COW code in
qcow2_alloc_cluster_link_l2 becomes really trivial.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Round QCowL2Meta.offset down to cluster boundary
Kevin Wolf [Fri, 7 Dec 2012 17:08:42 +0000 (18:08 +0100)]
qcow2: Round QCowL2Meta.offset down to cluster boundary

The offset within the cluster is already present as n_start and this is
what the code uses. QCowL2Meta.offset is only needed at a cluster
granularity.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoatapi: reset cdrom tray statuses on ide_reset
Pavel Hrdina [Tue, 11 Dec 2012 07:55:48 +0000 (08:55 +0100)]
atapi: reset cdrom tray statuses on ide_reset

Tray statuses should be also reseted. Some guests may lock the tray
and after reset before any kernel is loaded the tray should be unlocked.

Also if you reset the real computer the tray is closed. We should
do the same in qemu.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-iotests: Test concurrent cluster allocations
Kevin Wolf [Thu, 6 Dec 2012 13:33:00 +0000 (14:33 +0100)]
qemu-iotests: Test concurrent cluster allocations

This adds some first tests for qcow2's dependency handling when two
parallel write requests access the same cluster.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqcow2: Move BLKDBG_EVENT out of the lock
Kevin Wolf [Thu, 6 Dec 2012 13:32:59 +0000 (14:32 +0100)]
qcow2: Move BLKDBG_EVENT out of the lock

We want to use these events to suspend requests for testing concurrent
AIO requests. Suspending requests while they are holding the CoMutex is
rather boring for this purpose.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-io: Add AIO debugging commands
Kevin Wolf [Thu, 6 Dec 2012 13:32:58 +0000 (14:32 +0100)]
qemu-io: Add AIO debugging commands

This makes the blkdebug suspend/resume functionality available in
qemu-io. Use it like this:

  $ ./qemu-io blkdebug::/tmp/test.qcow2
  qemu-io> break write_aio req_a
  qemu-io> aio_write 0 4k
  qemu-io> blkdebug: Suspended request 'req_a'
  qemu-io> resume req_a
  blkdebug: Resuming request 'req_a'
  qemu-io> wrote 4096/4096 bytes at offset 0
  4 KiB, 1 ops; 0:00:30.71 (133.359788 bytes/sec and 0.0326 ops/sec)

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: Implement suspend/resume of AIO requests
Kevin Wolf [Thu, 6 Dec 2012 13:32:57 +0000 (14:32 +0100)]
blkdebug: Implement suspend/resume of AIO requests

This allows more systematic AIO testing. The patch adds three new
operations to blkdebug:

 * Setting a "breakpoint" on a blkdebug event. The next request that
   triggers this breakpoint is suspended and is tagged with a name.
   The breakpoint is removed after a request has triggered it.

 * A suspended request (identified by it's tag) can be resumed

 * It's possible to check whether a suspended request with a given
   tag exists. This can be used for waiting for an event.

Ideally, we would instead tag requests right when they are created and
set breakpoints for individual requests. However, at this point the
block layer doesn't allow this easily, and breakpoints that trigger for
any request already allow a lot of useful testing.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: Factor out remove_rule()
Kevin Wolf [Thu, 6 Dec 2012 13:32:56 +0000 (14:32 +0100)]
blkdebug: Factor out remove_rule()

The cleanup work to remove a rule depends on the type of the rule. It's
easy for the existing rules as there is no data that must be cleaned up
and is specific to a type yet, but the next patch will change this.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblkdebug: Allow usage without config file
Kevin Wolf [Thu, 6 Dec 2012 13:32:55 +0000 (14:32 +0100)]
blkdebug: Allow usage without config file

As soon as new rules can be set during runtime, as introduced by the
next patch, blkdebug makes sense even without a config file.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agocreate new function: qemu_opt_set_number
Dong Xu Wang [Thu, 6 Dec 2012 06:47:23 +0000 (14:47 +0800)]
create new function: qemu_opt_set_number

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agouse qemu_opts_create_nofail
Dong Xu Wang [Thu, 6 Dec 2012 06:47:22 +0000 (14:47 +0800)]
use qemu_opts_create_nofail

We will use qemu_opts_create_nofail function, it can make code
more readable.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agointroduce qemu_opts_create_nofail function
Dong Xu Wang [Thu, 6 Dec 2012 06:47:21 +0000 (14:47 +0800)]
introduce qemu_opts_create_nofail function

While id is NULL, qemu_opts_create can not fail, so ignore
errors is fine.

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-option: qemu_opt_set_bool(): fix code duplication
Dong Xu Wang [Thu, 6 Dec 2012 06:47:20 +0000 (14:47 +0800)]
qemu-option: qemu_opt_set_bool(): fix code duplication

It will set opt->str in qemu_opt_set_bool, without opt->str, there
will be some potential bugs.

These are uses of opt->str, and what happens when it isn't set:

* qemu_opt_get(): returns NULL, which means "not set".  Bug can bite
  when value isn't the default value.

* qemu_opt_parse(): passes NULL to parse_option_bool(), which treats it
  like "on".  Wrong if the value is actually false.  Bug can bite when
  qemu_opts_validate() runs after qemu_opt_set_bool().

* qemu_opt_del(): passes NULL to g_free(), which is just fine.

* qemu_opt_foreach(): passes NULL to the callback, which is unlikely to
  be prepared for it.

* qemu_opts_print(): prints NULL, which crashes on some systems.

* qemu_opts_to_qdict(): passes NULL to qstring_from_str(), which
  crashes.

It also makes qemu_opt_set_bool more readable by using find_desc_by_name
and opts_accepts_any.

It is based on Luiz's patch and uses Markus's comments. Discussions can
be found at:
http://lists.nongnu.org/archive/html/qemu-devel/2012-07/msg02716.html

Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-option: qemu_opts_validate(): fix duplicated code
Dong Xu Wang [Thu, 6 Dec 2012 06:47:19 +0000 (14:47 +0800)]
qemu-option: qemu_opts_validate(): fix duplicated code

Use opts_accepts_any() and find_desc_by_name().

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-option: opt_set(): split it up into more functions
Dong Xu Wang [Thu, 6 Dec 2012 06:47:18 +0000 (14:47 +0800)]
qemu-option: opt_set(): split it up into more functions

The new functions are opts_accepts_any() and find_desc_by_name(), which
are also going to be used by qemu_opts_validate() (see next commit).

This also makes opt_set() slightly more readable.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoFix error code checking for SetFilePointer() call
Fabien Chouteau [Mon, 10 Dec 2012 11:56:22 +0000 (12:56 +0100)]
Fix error code checking for SetFilePointer() call

An error has occurred if the return value is invalid_set_file_pointer
and getlasterror doesn't return no_error.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agorbd: Fix race between aio completition and aio cancel
Stefan Priebe [Fri, 30 Nov 2012 08:55:46 +0000 (09:55 +0100)]
rbd: Fix race between aio completition and aio cancel

This one fixes a race which qemu had also in iscsi block driver
between cancellation and io completition.

qemu_rbd_aio_cancel was not synchronously waiting for the end of
the command.

To archieve this it introduces a new status flag which uses
-EINPROGRESS.

Signed-off-by: Stefan Priebe <s.priebe@profihost.ag>
Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-io: Implement write -c for compressed clusters
Kevin Wolf [Tue, 4 Dec 2012 15:35:12 +0000 (16:35 +0100)]
qemu-io: Implement write -c for compressed clusters

This makes it easier to create images with both compressed and
uncompressed clusters for testing.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotests: Add tests for fdsets
Corey Bryant [Wed, 14 Nov 2012 22:53:16 +0000 (17:53 -0500)]
tests: Add tests for fdsets

Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: bdrv_img_create(): drop unused error handling code
Luiz Capitulino [Fri, 30 Nov 2012 12:52:09 +0000 (10:52 -0200)]
block: bdrv_img_create(): drop unused error handling code

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqmp: qmp_drive_mirror(): pass Error object to bdrv_img_create()
Luiz Capitulino [Fri, 30 Nov 2012 12:52:08 +0000 (10:52 -0200)]
qmp: qmp_drive_mirror(): pass Error object to bdrv_img_create()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqmp: qmp_transaction(): pass Error object to bdrv_img_create()
Luiz Capitulino [Fri, 30 Nov 2012 12:52:07 +0000 (10:52 -0200)]
qmp: qmp_transaction(): pass Error object to bdrv_img_create()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-img: img_create(): drop unneeded goto and ret variable
Luiz Capitulino [Fri, 30 Nov 2012 12:52:06 +0000 (10:52 -0200)]
qemu-img: img_create(): drop unneeded goto and ret variable

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoqemu-img: img_create(): pass Error object to bdrv_img_create()
Luiz Capitulino [Fri, 30 Nov 2012 12:52:05 +0000 (10:52 -0200)]
qemu-img: img_create(): pass Error object to bdrv_img_create()

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: bdrv_img_create(): add Error ** argument
Luiz Capitulino [Fri, 30 Nov 2012 12:52:04 +0000 (10:52 -0200)]
block: bdrv_img_create(): add Error ** argument

This commit adds an Error ** argument to bdrv_img_create() and set it
appropriately on error.

Callers of bdrv_img_create() pass NULL for the new argument and still
rely on bdrv_img_create()'s return value. Next commits will change
callers to use the Error object instead.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: simplify default_drive
Christian Borntraeger [Thu, 22 Nov 2012 20:02:55 +0000 (21:02 +0100)]
block: simplify default_drive

Markus Armbruster pointed out that there is only one caller
to default_drive with IF_DEFAULT as a type. Lets get rid
of the block_default_type parameter and adopt the caller
to do the right thing (asking the machine struct).

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoSupport default block interfaces per QEMUMachine
Christian Borntraeger [Tue, 20 Nov 2012 14:30:34 +0000 (15:30 +0100)]
Support default block interfaces per QEMUMachine

There are QEMUMachines that have neither IF_IDE nor IF_SCSI as a
default/standard interface to their block devices / drives. Therefore,
this patch introduces a new field default_block_type per QEMUMachine
struct. The prior use_scsi field becomes thereby obsolete and is
replaced through .default_block_type = IF_SCSI.

This patch also changes the default for s390x to IF_VIRTIO and
removes an early hack that converts IF_IDE drives.
Other parties have already claimed interest (e.g. IF_SD for exynos)

To create a sane default, for machines that dont specify a
default_block_type, this patch makes IF_IDE = 0 and IF_NONE = 1.
I checked all users of IF_NONE (blockdev.c and ww/device-hotplug.c)
as well as IF_IDE and it seems that it is ok to change the defines -
in other words, I found no obvious (to me) assumption in the code
regarding IF_NONE==0. IF_NONE is only set if there is an
explicit if=none. Without if=* the interface becomes IF_DEFAULT.

I would suggest to have some additional care, e.g. by letting
this patch sit some days in the block tree.

Based on an initial patch from Einar Lueck <elelueck@de.ibm.com>

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
CC: Igor Mitsyanko <i.mitsyanko@samsung.com>
CC: Markus Armbruster <armbru@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Alexander Graf <agraf@suse.de>
Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoraw-posix: inline paio_ioctl into hdev_aio_ioctl
Paolo Bonzini [Fri, 2 Nov 2012 15:14:20 +0000 (16:14 +0100)]
raw-posix: inline paio_ioctl into hdev_aio_ioctl

clang now warns about an unused function:
  CC    block/raw-posix.o
block/raw-posix.c:707:26: warning: unused function paio_ioctl
[-Wunused-function]
static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd,
                         ^
1 warning generated.

because the only use of paio_ioctl() is inside a #if defined(__linux__)
guard and it is static now.

Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: vpc support for ~2 TB disks
Charles Arnold [Wed, 31 Oct 2012 02:59:32 +0000 (20:59 -0600)]
block: vpc support for ~2 TB disks

The VHD specification allows for up to a 2 TB disk size. The current
implementation in qemu emulates EIDE and ATA-2 hardware which only allows
for up to 127 GB.  This disk size limitation can be overridden by allowing
up to 255 heads instead of the normal 4 bit limitation of 16.  Doing so
allows disk images to be created of up to nearly 2 TB.  This change does
not violate the VHD format specification nor does it change how smaller
disks (ie, <=127GB) are defined.

[Charles Arnold also writes: "In analyzing a 160 GB VHD fixed disk image
created on Windows 2008 R2, it appears that MS is also ignoring the CHS
values in the footer geometry field in whatever driver they use for
accessing the image.  The CHS values are set at 65535,16,255 which
obviously doesn't represent an image size of 160 GB." -- Stefan]

Signed-off-by: Charles Arnold <carnold@suse.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: vpc initialize the uuid footer field
Charles Arnold [Fri, 2 Nov 2012 15:54:24 +0000 (09:54 -0600)]
block: vpc initialize the uuid footer field

Initialize the uuid field in the footer with a generated uuid.

Signed-off-by: Charles Arnold <carnold@suse.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agovirtio-blk: Remove duplicate property definition
David Gibson [Thu, 15 Nov 2012 02:12:14 +0000 (13:12 +1100)]
virtio-blk: Remove duplicate property definition

For the virtio-blk device (via virtio-pci) the property "config-wce" is
defined in two places.  First, it's defined from the
DEFINE_VIRTIO_BLK_FEATURES macro, second it's defined directly in
virtio-pci, just two lines above the call to that macro.

The direct definition in virtio-pci.c is broken, since it operates on the
'config_wce' field of VirtIOBlkConf, which is never used anywhere else.
Therefore, this patch removes both the extra property definition and the
redundant field it works on.

Cc: Kevin Wolf <kwolf@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Cc: Paul 'Rusty' Russell <rusty@rustcorp.com.au>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoblock: Avoid second open for format probing
Kevin Wolf [Mon, 12 Nov 2012 16:35:27 +0000 (17:35 +0100)]
block: Avoid second open for format probing

This fixes problems that are caused by the additional open/close cycle
of the existing format probing, for example related to qemu-nbd without
-t option or file descriptor passing.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: Factor out bdrv_open_flags
Kevin Wolf [Mon, 12 Nov 2012 16:05:39 +0000 (17:05 +0100)]
block: Factor out bdrv_open_flags

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoaio: Get rid of qemu_aio_flush()
Kevin Wolf [Tue, 13 Nov 2012 15:35:13 +0000 (16:35 +0100)]
aio: Get rid of qemu_aio_flush()

There are no remaining users, and new users should probably be
using bdrv_drain_all() in the first place.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoblock: Improve bdrv_aio_co_cancel_em
Kevin Wolf [Tue, 13 Nov 2012 15:35:08 +0000 (16:35 +0100)]
block: Improve bdrv_aio_co_cancel_em

Instead of waiting for all requests to complete, wait just for the
specific request that should be cancelled.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agotests: avoid qemu_aio_flush() in test-thread-pool.c
Stefan Hajnoczi [Tue, 4 Dec 2012 15:12:19 +0000 (16:12 +0100)]
tests: avoid qemu_aio_flush() in test-thread-pool.c

We need to eliminate calls to qemu_aio_flush() since the function is
being removed.  Most callers will use bdrv_drain_all() instead but
test-thread-pool.c is lower level.

Since the test uses the global AioContext we can loop on qemu_aio_wait()
to wait for aio and bh activity to complete.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agotests: use aio_poll() instead of aio_flush() in test-aio.c
Stefan Hajnoczi [Tue, 4 Dec 2012 15:12:18 +0000 (16:12 +0100)]
tests: use aio_poll() instead of aio_flush() in test-aio.c

There has been confusion between various aio wait and flush functions.
It's time to get rid of qemu_aio_flush() but in the aio test cases we
really do want this low-level functionality.

Therefore declare a local wait_for_aio() helper for the test cases.
Drop the aio_flush() test case.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
11 years agoMerge remote-tracking branch 'afaerber/qom-cpu' into staging
Anthony Liguori [Mon, 10 Dec 2012 14:35:15 +0000 (08:35 -0600)]
Merge remote-tracking branch 'afaerber/qom-cpu' into staging

* afaerber/qom-cpu:
  target-i386: Postpone cpuid_level update to realize time
  target-i386: Use define for cpuid vendor string size
  target-i386: Separate feature string parsing from CPU model lookup
  target-i386/cpu.c: Coding style fixes
  qdev: qdev_create(): use error_report() instead of hw_error()
  sysemu.h: Include qemu-types.h instead of qemu-common.h
  Create qemu-types.h for struct typedefs
  qlist.h: Do not include qemu-common.h
  qga/channel-posix.c: Include headers it needs
  qapi/qmp-registry.c: Include headers it needs
  ui/vnc-palette.c: Include headers it needs
  user: Rename qemu-types.h to qemu-user-types.h
  user: Move *-user/qemu-types.h to main directory

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'stefanha/trivial-patches' into staging
Anthony Liguori [Mon, 10 Dec 2012 14:34:29 +0000 (08:34 -0600)]
Merge remote-tracking branch 'stefanha/trivial-patches' into staging

* stefanha/trivial-patches:
  pc_sysfw: Plug memory leak on pc_fw_add_pflash_drv() error path
  qemu-options: Fix space at EOL
  Fix spelling in comments and documentation
  Clean up pci_drive_hot_add()'s use of BlockInterfaceType
  arm: a9mpcore: remove un-used ptimer_iomem field
  target-sparc: Remove t0, t1 from CPUSPARCState
  target-m68k: Remove t1 from CPUM68KState
  target-alpha: Remove t0, t1 from CPUAlphaState
  s390x: Spelling fixes (endianess -> endianness, occured -> occurred)
  Fix comments (adress -> address, layed -> laid, wierd -> weird)
  Fix spelling (prefered -> preferred)
  configure: Remove stray debug output
  sd: Send debug printfery to stderr not stdout

Conflicts:
configure

Resolve spelling conflict in configure.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/acpi.1' into staging
Anthony Liguori [Mon, 10 Dec 2012 14:33:11 +0000 (08:33 -0600)]
Merge remote-tracking branch 'kraxel/acpi.1' into staging

* kraxel/acpi.1:
  acpi: drop debug port
  q35: update lpc pci config space according to configured devices
  apci: switch piix4 pci hotplug to memory api
  acpi: remove acpi_gpe_blk
  apci: switch piix4 gpe to memory api
  acpi: fix piix4 smbus mapping
  acpi: switch smbus to memory api
  acpi: cleanup ich9 memory region
  apci: switch ich9 smi to memory api
  apci: switch ich9 gpe to memory api
  acpi: cleanup vt82c686 memory region
  acpi: cleanup piix4 memory region
  apci: switch evt to memory api
  apci: switch cnt to memory api
  apci: switch timer to memory api
  apci: switch vt82c686 to memory api
  apci: switch ich9 to memory api
  apci: switch piix4 to memory api

Conflicts:
hw/lpc_ich9.c

Resolved merge conflict due to apm_init adding an argument.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'aneesh/for-upstream' into staging
Anthony Liguori [Mon, 10 Dec 2012 14:32:15 +0000 (08:32 -0600)]
Merge remote-tracking branch 'aneesh/for-upstream' into staging

* aneesh/for-upstream:
  virtfs-proxy-helper: use setresuid and setresgid

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoMerge remote-tracking branch 'kraxel/usb.74' into staging
Anthony Liguori [Mon, 10 Dec 2012 14:31:19 +0000 (08:31 -0600)]
Merge remote-tracking branch 'kraxel/usb.74' into staging

* kraxel/usb.74:
  usb-tablet: Allow connecting to ehci
  ehci: Lower timer freq when the periodic schedule is idle
  usb: Allow overriding of usb_desc at the device level
  usb: Don't allow USB_RET_ASYNC for interrupt packets
  usb: Call wakeup when data becomes available for all devices with int eps
  add pc-1.4

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
11 years agoconfigure: Default to 'cc', not 'gcc'
Peter Maydell [Fri, 7 Dec 2012 15:39:13 +0000 (15:39 +0000)]
configure: Default to 'cc', not 'gcc'

Default to 'cc' as our compiler, rather than 'gcc'. We used to have
to insist on gcc when we still kept the CPU env in a fixed global
register, but this is no longer necessary and we will now compile OK
on clang as well as gcc.  Using 'cc' should generally result in us
using the most standard and maintained system compiler for the
platform.  (For instance on newer MacOS X 'gcc' exists but is an
elderly compiler provided mostly for legacy reasons, and 'cc'
(which is clang) is definitely the better choice.) On Linux there
will generally be no user-visible change since cc will be gcc.

This changeover necessitates a slight reworking of how we set the
'cc' variable, because GNU cross toolchains generally provide a
'${cross_prefix}gcc' but not a '${cross_prefix}cc'.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agolinux-user: Merge pread/pwrite into pread64/pwrite64
Peter Maydell [Fri, 12 Oct 2012 03:55:51 +0000 (03:55 +0000)]
linux-user: Merge pread/pwrite into pread64/pwrite64

The Linux syscalls underlying pread() and pwrite() take a 64 bit
offset on all architectures, even if some of them name the syscall
"pread/pwrite" rather than "pread64/pwrite64" for historical reasons.
So move the four QEMU target architectures (arm, i386, sparc,
unicore32) which were defining TARGET_NR_pread/pwrite to define
TARGET_NR_pread64/pwrite64 instead, and drop the TARGET_NR_pread/pwrite
implementation code completely.

(Based on examination of the kernel sources for the four architectures
this patch affects.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: use movcond where possible
Max Filippov [Wed, 5 Dec 2012 03:15:27 +0000 (07:15 +0400)]
target-xtensa: use movcond where possible

Use movcond for all sorts of conditional moves, ABS, CLAMPS, MIN/MAX
opcodes.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: add s32c1i unit tests
Max Filippov [Wed, 5 Dec 2012 03:15:26 +0000 (07:15 +0400)]
target-xtensa: add s32c1i unit tests

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: add SR accessibility unit tests
Max Filippov [Wed, 5 Dec 2012 03:15:25 +0000 (07:15 +0400)]
target-xtensa: add SR accessibility unit tests

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: implement MISC SR
Max Filippov [Wed, 5 Dec 2012 03:15:24 +0000 (07:15 +0400)]
target-xtensa: implement MISC SR

The Miscellaneous Special Registers Option provides zero to four scratch
registers within the processor readable and writable by RSR, WSR, and
XSR. These registers are privileged. They may be useful for some
application-specific exception and interrupt processing tasks in the
kernel. The MISC registers are undefined after reset.
See ISA, 4.7.3 for details.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: better control rsr/wsr/xsr access to SRs
Max Filippov [Wed, 5 Dec 2012 03:15:23 +0000 (07:15 +0400)]
target-xtensa: better control rsr/wsr/xsr access to SRs

There are read-only (DEBUGCAUSE, PRID) and write-only (INTCLEAR) SRs,
and INTERRUPT/INTSET SR allows rsr/wsr, but not xsr. Raise illeagal
opcode exception on illegal access to these SRs.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: restrict available SRs by enabled options
Max Filippov [Wed, 5 Dec 2012 03:15:22 +0000 (07:15 +0400)]
target-xtensa: restrict available SRs by enabled options

Beginning with the RA-2004.1 release, SR access instructions (rsr, wsr,
xsr) are associated with their corresponding SR and raise illegal opcode
exception in case the register is not configured for the core.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: implement CACHEATTR SR
Max Filippov [Wed, 5 Dec 2012 03:15:21 +0000 (07:15 +0400)]
target-xtensa: implement CACHEATTR SR

In XEA1, the Options for Memory Protection and Translation and the
corresponding TLB management instructions are not available. Instead,
functionality similar to the Region Protection Option is available
through the cache attribute register. See ISA, A.2.14 for details.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-xtensa: implement ATOMCTL SR
Max Filippov [Wed, 5 Dec 2012 03:15:20 +0000 (07:15 +0400)]
target-xtensa: implement ATOMCTL SR

ATOMCTL SR controls s32c1i opcode behavior depending on targeted memory
type. See ISA, 4.3.12.4 for details.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'master' of git.qemu-project.org:/pub/git/qemu
Blue Swirl [Sat, 8 Dec 2012 17:50:57 +0000 (17:50 +0000)]
Merge branch 'master' of git.qemu-project.org:/pub/git/qemu

* 'master' of git.qemu-project.org:/pub/git/qemu:
  target-mips: Fix incorrect shift for SHILO and SHILOV
  target-mips: Fix incorrect code and test for INSV
  xilinx_uartlite: Accept input after rx FIFO pop
  xilinx_uartlite: suppress "cannot receive message"
  xilinx_axienet: Implement R_IS behaviour

11 years agofinally kill cpudef config section support
Eduardo Habkost [Tue, 4 Dec 2012 18:32:58 +0000 (16:32 -0200)]
finally kill cpudef config section support

The external CPU models were removed on QEMU 1.2, and the support for
the "cpudef" config sections was documented as deprecated, but the
actual removal of the config section was pending.

Now that QEMU 1.3 was released, we can finally kill the support for
cpudef config sections, and support only the built-in CPU models from
target-i386/cpu.c.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoMerge branch 'memory-ioport' of git://github.com/afaerber/qemu-cpu
Blue Swirl [Sat, 8 Dec 2012 14:28:13 +0000 (14:28 +0000)]
Merge branch 'memory-ioport' of git://github.com/afaerber/qemu-cpu

* 'memory-ioport' of git://github.com/afaerber/qemu-cpu:
  hw/dma.c: Replace register_ioport_*
  hw/pc.c: Replace register_ioport_*
  serial: Replace register_ioport_*
  hw/cirrus_vga.c: Replace register_ioport_*
  hw/apm.c: Replace register_ioport_*
  isa: Add isa_address_space_io()

11 years agoHACKING: List areas where we may rely on impdef C behaviour
Peter Maydell [Wed, 31 Oct 2012 09:30:47 +0000 (09:30 +0000)]
HACKING: List areas where we may rely on impdef C behaviour

Add a section to HACKING saying which version of the C spec
we use and describing the bits of implementation defined C
compiler behaviour which C code in QEMU is allowed to rely on.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agopixman: require 0.18.4 or newer
Gerd Hoffmann [Tue, 27 Nov 2012 12:19:40 +0000 (13:19 +0100)]
pixman: require 0.18.4 or newer

When older versions are found the internal pixman version is prefered.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTCG: Remove unused global gen_opc_ arrays.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:07 +0000 (11:43 +0400)]
TCG: Remove unused global gen_opc_ arrays.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTCG: Use gen_opc_instr_start from context instead of global variable.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:06 +0000 (11:43 +0400)]
TCG: Use gen_opc_instr_start from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTCG: Use gen_opc_icount from context instead of global variable.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:05 +0000 (11:43 +0400)]
TCG: Use gen_opc_icount from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoTCG: Use gen_opc_pc from context instead of global variable.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:04 +0000 (11:43 +0400)]
TCG: Use gen_opc_pc from context instead of global variable.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.
Evgeny Voevodin [Wed, 21 Nov 2012 07:43:03 +0000 (11:43 +0400)]
tcg/tcg.h: Duplicate global TCG gen_opc_ arrays into TCGContext.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agocurses: Remove OpenBSD workaround
Brad Smith [Mon, 19 Nov 2012 09:22:12 +0000 (04:22 -0500)]
curses: Remove OpenBSD workaround

I removed the same sort of workaround for OpenBSD within the
configure script with commit 4dcc3f5876fa638d5c35bd47be3b717ea74cc2e7
but didn't bother to grep further to come across this same chunk
of code in the curses code itself. So the following diff removes
the same workaround chunk within the curses code.

Signed-off-by: Brad Smith <brad@comstyle.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agoexec: Advise huge pages for the TCG code gen buffer
Richard Henderson [Thu, 1 Nov 2012 22:20:46 +0000 (09:20 +1100)]
exec: Advise huge pages for the TCG code gen buffer

After allocating 32MB or more contiguous memory, huge pages
would seem to be ideal.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
11 years agotarget-i386: Postpone cpuid_level update to realize time
Igor Mammedov [Mon, 22 Oct 2012 15:03:00 +0000 (17:03 +0200)]
target-i386: Postpone cpuid_level update to realize time

Delay capping cpuid_level to 7 to realize time so property setters
for cpuid_7_0_ebx_features and "level" could be used in any order/time
between x86_cpu_initfn() and x86_cpu_realize().

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agopc_sysfw: Plug memory leak on pc_fw_add_pflash_drv() error path
Markus Armbruster [Fri, 23 Nov 2012 18:12:18 +0000 (19:12 +0100)]
pc_sysfw: Plug memory leak on pc_fw_add_pflash_drv() error path

Harmless, because we the error inevitably leads to another, fatal one
in pc_system_flash_init(): PC system firmware (pflash) not available.
Fix it anyway.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoqemu-options: Fix space at EOL
Michal Privoznik [Fri, 23 Nov 2012 08:52:39 +0000 (09:52 +0100)]
qemu-options: Fix space at EOL

There's no need to add a space at the end of line.
Moreover, it can make problems in some projects that
store the help output into a file (and run couple of
tests based on that) and have space at EOL forbidden.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoFix spelling in comments and documentation
Stefan Weil [Fri, 23 Nov 2012 06:26:04 +0000 (07:26 +0100)]
Fix spelling in comments and documentation

These spelling bugs were found by codespell:

supressing -> suppressing
transfered -> transferred

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoClean up pci_drive_hot_add()'s use of BlockInterfaceType
Markus Armbruster [Thu, 22 Nov 2012 14:16:36 +0000 (15:16 +0100)]
Clean up pci_drive_hot_add()'s use of BlockInterfaceType

pci_drive_hot_add() parameter type has the wrong type: int instead of
BlockInterfaceType.  It's actually redundant, so we can just drop it.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoarm: a9mpcore: remove un-used ptimer_iomem field
Peter Crosthwaite [Mon, 19 Nov 2012 05:13:49 +0000 (15:13 +1000)]
arm: a9mpcore: remove un-used ptimer_iomem field

I'm guessing this is a hangover from a previous coreification of the mptimer
sub-module. This field is completely unused - removed.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotarget-sparc: Remove t0, t1 from CPUSPARCState
Richard Henderson [Thu, 1 Nov 2012 21:36:37 +0000 (08:36 +1100)]
target-sparc: Remove t0, t1 from CPUSPARCState

These fields are no longer used.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotarget-m68k: Remove t1 from CPUM68KState
Richard Henderson [Thu, 1 Nov 2012 21:36:36 +0000 (08:36 +1100)]
target-m68k: Remove t1 from CPUM68KState

This field is no longer used.

Cc: Paul Brook <paul@codesourcery.com>
Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotarget-alpha: Remove t0, t1 from CPUAlphaState
Richard Henderson [Thu, 1 Nov 2012 21:36:35 +0000 (08:36 +1100)]
target-alpha: Remove t0, t1 from CPUAlphaState

These fields are no longer (or were never?) used.

Signed-off-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agos390x: Spelling fixes (endianess -> endianness, occured -> occurred)
Stefan Weil [Fri, 2 Nov 2012 07:35:54 +0000 (08:35 +0100)]
s390x: Spelling fixes (endianess -> endianness, occured -> occurred)

Replace also "write into" by "write to".

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoFix comments (adress -> address, layed -> laid, wierd -> weird)
Stefan Weil [Fri, 2 Nov 2012 07:29:53 +0000 (08:29 +0100)]
Fix comments (adress -> address, layed -> laid, wierd -> weird)

Remove also a duplicated 'the'.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoFix spelling (prefered -> preferred)
Stefan Weil [Fri, 2 Nov 2012 07:14:12 +0000 (08:14 +0100)]
Fix spelling (prefered -> preferred)

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agoconfigure: Remove stray debug output
Peter Maydell [Sat, 20 Oct 2012 19:37:04 +0000 (20:37 +0100)]
configure: Remove stray debug output

Rather than printing a message saying we're silently falling
back to gthread coroutines when running on MacOS, actually
do it silently.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agosd: Send debug printfery to stderr not stdout
Peter Crosthwaite [Thu, 15 Nov 2012 06:32:53 +0000 (16:32 +1000)]
sd: Send debug printfery to stderr not stdout

Some debug printfs for SD are coming up in stdout. Redirected them to stderr
instead.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
11 years agotarget-i386: Use define for cpuid vendor string size
Igor Mammedov [Mon, 22 Oct 2012 15:03:10 +0000 (17:03 +0200)]
target-i386: Use define for cpuid vendor string size

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386: Separate feature string parsing from CPU model lookup
Eduardo Habkost [Tue, 4 Dec 2012 19:34:39 +0000 (17:34 -0200)]
target-i386: Separate feature string parsing from CPU model lookup

Instead of parsing the whole cpu_model string inside
cpu_x86_find_by_name(), first split it into the CPU model name and the
full feature string, then parse the feature string into pieces.

When using CPU model classes, those two pieces of information will be
used at different moments (CPU model name will be used to find CPU
class, feature string will be used after CPU object was created), so
making the split in two steps will make it easier to refactor the code
later.

This should also help on the CPU properties work, that will just need to
replace the cpu_x86_parse_featurestr() logic (and can keep the CPU model
lookup code as-is).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-i386/cpu.c: Coding style fixes
Eduardo Habkost [Tue, 4 Dec 2012 19:34:38 +0000 (17:34 -0200)]
target-i386/cpu.c: Coding style fixes

- Use spaces instead of tabs on cpu_x86_cpuid().
- Use braces on 'if' statement cpu_x86_find_by_name().

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqdev: qdev_create(): use error_report() instead of hw_error()
Eduardo Habkost [Tue, 4 Dec 2012 13:19:34 +0000 (11:19 -0200)]
qdev: qdev_create(): use error_report() instead of hw_error()

hw_error() is specific for fatal hardware emulation errors, not for
internal errors related to the qdev object/class abstraction or object
initialization.

Replace it with an error_report() call, followed by abort().

This will also help reduce dependencies of the qdev code (as hw_error()
is from cpus.o, and depends on the CPU list from exec.o).

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agosysemu.h: Include qemu-types.h instead of qemu-common.h
Eduardo Habkost [Tue, 23 Oct 2012 23:44:08 +0000 (21:44 -0200)]
sysemu.h: Include qemu-types.h instead of qemu-common.h

It just needs the Monitor and DeviceState typedefs, so it doesn't need
all of qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoCreate qemu-types.h for struct typedefs
Eduardo Habkost [Tue, 23 Oct 2012 23:41:52 +0000 (21:41 -0200)]
Create qemu-types.h for struct typedefs

Instead of keeping all those struct typedefs in qemu-common.h, move it
to a header that can be safely included by other headers, containing
only the struct typedefs and not pulling in other dependencies.

Also, move some of the qdev-core.h typedefs to the new file, too, so
other headers don't need to include qdev-core.h only because of
DeviceState and other typedefs.

This will help us remove qemu-common.h dependencies from some headers
later.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqlist.h: Do not include qemu-common.h
Eduardo Habkost [Tue, 23 Oct 2012 23:55:19 +0000 (21:55 -0200)]
qlist.h: Do not include qemu-common.h

I don't know why it was including it, as I don't see any code that
depends on anything from qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqga/channel-posix.c: Include headers it needs
Eduardo Habkost [Tue, 23 Oct 2012 23:37:20 +0000 (21:37 -0200)]
qga/channel-posix.c: Include headers it needs

Include:
 - <errno.h> for errno
 - <unistd.h> & <fcntl.h> for fcntl()
 - <stdlib.h> for exit()
 - "osdep.h" for qemu_open()

Some of those headers were probably being included by accident because
some other headers were including qemu-common.h, but those headers
should eventually stop including qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoqapi/qmp-registry.c: Include headers it needs
Eduardo Habkost [Tue, 23 Oct 2012 23:35:44 +0000 (21:35 -0200)]
qapi/qmp-registry.c: Include headers it needs

Include:
- <glib.h> for g_malloc0()
- <string.h> for strcmp()

Some of those headers were probably being included by accident because
some other headers were including qemu-common.h, but those headers
should eventually stop including qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agoui/vnc-palette.c: Include headers it needs
Eduardo Habkost [Tue, 23 Oct 2012 23:19:18 +0000 (21:19 -0200)]
ui/vnc-palette.c: Include headers it needs

Include:
 - <glib.h> for g_malloc0()
 - <string.h> for memset()

Some of those headers were probably being included by accident because
some other headers were including qemu-common.h, but those headers
should eventually stop including qemu-common.h.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agouser: Rename qemu-types.h to qemu-user-types.h
Eduardo Habkost [Wed, 24 Oct 2012 00:54:34 +0000 (22:54 -0200)]
user: Rename qemu-types.h to qemu-user-types.h

The header file is specific for *-user, but I plan to introduce a more
generic qemu-types.h file, so I'm renaming it.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agouser: Move *-user/qemu-types.h to main directory
Eduardo Habkost [Tue, 23 Oct 2012 22:42:56 +0000 (20:42 -0200)]
user: Move *-user/qemu-types.h to main directory

The bsd-user/qemu-types.h and linux-user/qemu-types.h files are almost
the same, but linux-user has the additional definitions of tswapal().

This moves the linux-user file to the main directory, so the same file
can be used by linux-user and bsd-user.

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
11 years agotarget-mips: Fix incorrect shift for SHILO and SHILOV
Petar Jovanovic [Tue, 4 Dec 2012 23:29:10 +0000 (00:29 +0100)]
target-mips: Fix incorrect shift for SHILO and SHILOV

helper_shilo has not been shifting an accumulator value correctly for negative
values in 'shift' field. Minor optimization for shift=0 case.
This change also adds tests that will trigger issue and check for regressions.

Signed-off-by: Petar Jovanovic <petarj@mips.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agotarget-mips: Fix incorrect code and test for INSV
Petar Jovanovic [Mon, 26 Nov 2012 15:13:21 +0000 (16:13 +0100)]
target-mips: Fix incorrect code and test for INSV

Content of register rs should be shifted for pos before applying a mask.
This change contains both fix for the instruction and to the existing test.

Signed-off-by: Petar Jovanovic <petarj@mips.com>
Reviewed-by: Eric Johnson <ericj@mips.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
11 years agovirtfs-proxy-helper: use setresuid and setresgid
Paolo Bonzini [Thu, 11 Oct 2012 12:20:23 +0000 (14:20 +0200)]
virtfs-proxy-helper: use setresuid and setresgid

The setfsuid and setfsgid system calls are obscure and they complicate
the error checking (that glibc's warn_unused_result "feature" forces
us to do).  Switch to the standard setresuid and setresgid functions.

Signed-off-by: Paolo Bonzini <pbonini@redhat.com
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
11 years agoxilinx_uartlite: Accept input after rx FIFO pop
Peter Crosthwaite [Wed, 5 Dec 2012 06:53:44 +0000 (16:53 +1000)]
xilinx_uartlite: Accept input after rx FIFO pop

The device return false from the can receive function when the FIFO is
full. This mean the device should check for buffered input whenever a byte is
popped from the FIFO.

Reported-by: Jason Wu <huanyu@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoxilinx_uartlite: suppress "cannot receive message"
Peter Crosthwaite [Wed, 5 Dec 2012 06:53:43 +0000 (16:53 +1000)]
xilinx_uartlite: suppress "cannot receive message"

This message is not an error condition, its just informing the user that
the device is corking the uart traffic to not drop characters.

Reported-by: Jason Wu <huanyu@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agoxilinx_axienet: Implement R_IS behaviour
Peter Crosthwaite [Wed, 5 Dec 2012 06:53:42 +0000 (16:53 +1000)]
xilinx_axienet: Implement R_IS behaviour

The interrupt status register R_IS is the standard clear-on-write behaviour.
This was unimplemented and defaulting to updating the register to the written
value. Implemented clear-on-write.

Reported-by: Jason Wu <huanyu@xilinx.com>
Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
11 years agohw/dma.c: Replace register_ioport_*
Julien Grall [Wed, 19 Sep 2012 11:50:09 +0000 (12:50 +0100)]
hw/dma.c: Replace register_ioport_*

Replace all register_ioport_*() with the new Memory API functions.
This permits to use the new Memory stuff like listeners.

Signed-off-by: Julien Grall <julien.grall@citrix.com>
Acked-by: Avi Kivity <avi@redhat.com>
[AF: Rebased onto hwaddr]
Signed-off-by: Andreas Färber <afaerber@suse.de>