]> git.proxmox.com Git - qemu.git/log
qemu.git
12 years agotarget-arm: convert cp15 crn=7 registers
Peter Maydell [Wed, 20 Jun 2012 11:57:17 +0000 (11:57 +0000)]
target-arm: convert cp15 crn=7 registers

Convert the cp15 crn=7 registers to the new scheme.
Note that to do this we have to distinguish some registers
used on the ARM9 and ARM10 from some which are ARM1176
only. This is because the old code returned a value of 0
but always set the Z flag (by clearing env->ZF, since we
store the Z flag in CPUState inverted). This is inconsistent
with actual ARM CPU behaviour, which only sets flags for
reads to r15 and sets them based on the top bits of the result.
However it happened to work for the two common use cases for
cp15 crn=7 reads:
 * On ARM9 and ARM10 the cache clean-and-test operations are
typically done with a destination of r15 so that you can do
a "loop: mrc ... ; bne loop" to keep cleaning until the cache
is finally clean; always setting the Z flag means this loop
terminates immediately
 * on ARM1176 the Cache Dirty Status Register reads as zero
if the cache is dirty; returning 0 means this is correctly
implemented for QEMU

Since the new coprocessor register framework does the right
thing of always setting flags based on the returned result
for reads to r15, we need to split these up so that we can
return (1<<30) for the ARM9/ARM10 registers but 0 for the
ARM1176 one.

This allows us to remove the nasty hack which always sets Z.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert cp15 VA-PA translation registers
Peter Maydell [Wed, 20 Jun 2012 11:57:16 +0000 (11:57 +0000)]
target-arm: Convert cp15 VA-PA translation registers

Convert the cp15 VA-PA translation registers (a subset of
the crn=7 regs) to the new scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert cp15 MMU TLB control
Peter Maydell [Wed, 20 Jun 2012 11:57:16 +0000 (11:57 +0000)]
target-arm: Convert cp15 MMU TLB control

Convert cp15 MMU TLB control (crn=8) to new scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert cp15 crn=15 registers
Peter Maydell [Wed, 20 Jun 2012 11:57:15 +0000 (11:57 +0000)]
target-arm: Convert cp15 crn=15 registers

Convert the cp15 crn=15 (implementation specific) registers
to the new scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert cp15 crn=10 registers
Peter Maydell [Wed, 20 Jun 2012 11:57:15 +0000 (11:57 +0000)]
target-arm: Convert cp15 crn=10 registers

We RAZ/WI the entire block of crn=10 registers. Note that this
actually covers not just the implementation-defined TLB
lockdown registers but also a number of v7 VMSA memory
attribute registers which we would need to implement to
support TEX remap. We retain the previous QEMU behaviour
in this conversion, though.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert cp15 crn=13 registers
Peter Maydell [Wed, 20 Jun 2012 11:57:14 +0000 (11:57 +0000)]
target-arm: Convert cp15 crn=13 registers

Convert the cp15 crn=13 registers (FCSEIDR, CONTEXTIDR,
and the ARM946 Trace Process Identifier Register).

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert cp15 crn=2 registers
Peter Maydell [Wed, 20 Jun 2012 11:57:14 +0000 (11:57 +0000)]
target-arm: Convert cp15 crn=2 registers

Convert the cp15 crn=2 registers (MMU page table control,
MPU cache control) to the new scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert MMU fault status cp15 registers
Peter Maydell [Wed, 20 Jun 2012 11:57:13 +0000 (11:57 +0000)]
target-arm: Convert MMU fault status cp15 registers

Convert the MMU fault status and MPU access permission cp15
registers to the new scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert cp15 c3 register
Peter Maydell [Wed, 20 Jun 2012 11:57:13 +0000 (11:57 +0000)]
target-arm: Convert cp15 c3 register

Convert the cp15 c3 register (MMU domain access control
or MPU write buffer control). NB that this is horribly
underdecoded for modern cores (should be crn=3,crm=0,
opc1=0,opc2=0) but this change preserves the existing
QEMU behaviour.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert generic timer cp15 regs
Peter Maydell [Wed, 20 Jun 2012 11:57:12 +0000 (11:57 +0000)]
target-arm: Convert generic timer cp15 regs

Convert the (dummy) generic timer cp15 implementation.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert performance monitor registers
Peter Maydell [Wed, 20 Jun 2012 11:57:12 +0000 (11:57 +0000)]
target-arm: Convert performance monitor registers

Convert the v7 performance monitor cp15 registers to
the new scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert TLS registers
Peter Maydell [Wed, 20 Jun 2012 11:57:11 +0000 (11:57 +0000)]
target-arm: Convert TLS registers

Convert TLS registers to the new cp15 framework

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert WFI/barriers special cases to cp_reginfo
Peter Maydell [Wed, 20 Jun 2012 11:57:11 +0000 (11:57 +0000)]
target-arm: Convert WFI/barriers special cases to cp_reginfo

Convert the various WFI and barrier instruction special cases to use
cp_reginfo infrastructure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert TEECR, TEEHBR to new scheme
Peter Maydell [Wed, 20 Jun 2012 11:57:10 +0000 (11:57 +0000)]
target-arm: Convert TEECR, TEEHBR to new scheme

Convert the THUMB2EE cp14 registers TEECR and TEEHBR to
use arm_cp_reginfo.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Convert debug registers to cp_reginfo
Peter Maydell [Wed, 20 Jun 2012 11:57:09 +0000 (11:57 +0000)]
target-arm: Convert debug registers to cp_reginfo

Convert the cp14 debug registers (DBGDIDR, DBGDRAR, DBGDSAR) to the
cp_reginfo scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Add register_cp_regs_for_features()
Peter Maydell [Wed, 20 Jun 2012 11:57:09 +0000 (11:57 +0000)]
target-arm: Add register_cp_regs_for_features()

Add new function register_cp_regs_for_features() as a place to
register coprocessor registers dependent on feature flags.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Remove old cpu_arm_set_cp_io infrastructure
Peter Maydell [Wed, 20 Jun 2012 11:57:08 +0000 (11:57 +0000)]
target-arm: Remove old cpu_arm_set_cp_io infrastructure

All the users of cpu_arm_set_cp_io have been converted, so we
can remove it and the infrastructure it used.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/pxa2xx_pic: Convert coprocessor registers to new scheme
Peter Maydell [Wed, 20 Jun 2012 11:57:08 +0000 (11:57 +0000)]
hw/pxa2xx_pic: Convert coprocessor registers to new scheme

Convert the coprocessor access functions for the pxa2xx PIC to the
arm_cp_reginfo scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/pxa2xx.c: Convert CLKCFG and PWRMODE cp14 regs
Peter Maydell [Wed, 20 Jun 2012 11:57:07 +0000 (11:57 +0000)]
hw/pxa2xx.c: Convert CLKCFG and PWRMODE cp14 regs

Convert the PXA2xx CLKCFG and PWRMODE cp14 registers to the
new arm_cp_reginfo scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/pxa2xx: Convert cp14 perf registers to new scheme
Peter Maydell [Wed, 20 Jun 2012 11:57:07 +0000 (11:57 +0000)]
hw/pxa2xx: Convert cp14 perf registers to new scheme

Convert the PXA2xx cp14 perf registers from old-style
coprocessor hooks to the new scheme.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: initial coprocessor register framework
Peter Maydell [Wed, 20 Jun 2012 11:57:06 +0000 (11:57 +0000)]
target-arm: initial coprocessor register framework

Initial infrastructure for data-driven registration of
coprocessor register implementations.

We still fall back to the old-style switch statements pending
complete conversion of all existing registers.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agotarget-arm: Fix 11MPCore cache type register value
Peter Maydell [Wed, 20 Jun 2012 11:57:06 +0000 (11:57 +0000)]
target-arm: Fix 11MPCore cache type register value

Make the 11MPCore report a valid value in its cache type register
(the previous value appears to have been incorrectly copied from
the 1136/1176). In particular, do not report that we have an
aliasing VIPT cache, because this causes Linux to attempt to use
the v6 block cache ops which the 11MPCore doesn't actually have.
(This causes no problems currently because we over-broadly provide
those ops on all cores, but prevents us correctly narrowing the
block ops down to those cores which actually implement them.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoAllow machines to configure the QEMU_VERSION that's exposed via hardware
Crístian Viana [Wed, 30 May 2012 03:35:51 +0000 (00:35 -0300)]
Allow machines to configure the QEMU_VERSION that's exposed via hardware

QEMU exposes its version to the guest's hardware and in some cases that is wrong
(e.g. Windows prints messages about driver updates when you switch
the QEMU version).
There is a new field now on the struct QEmuMachine, hw_version, which may
contain the version that the specific machine should report. If that field is
set, then that machine will report that version to the guest.

Signed-off-by: Crístian Viana <vianac@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoAdd PIIX4 properties to control PM system states.
Gleb Natapov [Mon, 4 Jun 2012 11:31:55 +0000 (14:31 +0300)]
Add PIIX4 properties to control PM system states.

This patch adds two things. First it allows QEMU to distinguish between
regular powerdown and S4 powerdown. Later separate QMP notification will
be added for S4 powerdown. Second it allows S3/S4 states to be disabled
from QEMU command line. Some guests known to be broken with regards to
power management, but allow to use it anyway. Using new properties
management will be able to disable S3/S4 for such guests.

Supported system state are passed to a firmware using new fw_cfg file.
The file contains  6 byte array. Each byte represents one system
state. If byte at offset X has its MSB set it means that system state
X is supported and to enter it guest should use the value from lowest 3
bits.

Signed-off-by: Gleb Natapov <gleb@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agomake: automatically include dependencies in recursive subdir rules (v2)
Anthony Liguori [Mon, 18 Jun 2012 00:01:32 +0000 (19:01 -0500)]
make: automatically include dependencies in recursive subdir rules (v2)

I think I understand enough of what's going on in these rules to ensure this is
right.  But I could certainly use a second or third opinion...

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoconfigure: fix -enable-debug with newer toolchains
Avi Kivity [Wed, 6 Jun 2012 09:03:18 +0000 (12:03 +0300)]
configure: fix -enable-debug with newer toolchains

Fedora 17's toolchain wants optimization enabled for _FORTIFY_SOURCE;
so disable _FORTIFY_SOURCE when debugging.

Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
12 years agoarm_boot: Conditionalised DTB command line update
Peter A. G. Crosthwaite [Sun, 17 Jun 2012 15:35:36 +0000 (15:35 +0000)]
arm_boot: Conditionalised DTB command line update

The DTB command line should only be overwritten if the user provides a command
line with -append. Otherwise whatever command line was in the DTB should stay
unchanged.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agocadence_ttc: changed master clock frequency
Peter A. G. Crosthwaite [Mon, 28 May 2012 17:16:28 +0000 (17:16 +0000)]
cadence_ttc: changed master clock frequency

Change the timer clock frequency to 133MHz which is correct. the old 2.5MHz
value was for the pre-silicon emulation platform.

Signed-off-by: Peter A. G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agocadence_gem: avoid stack-writing buffer-overrun
Jim Meyering [Thu, 10 May 2012 06:19:48 +0000 (06:19 +0000)]
cadence_gem: avoid stack-writing buffer-overrun

Use sizeof(rxbuf)-size (not sizeof(rxbuf-size)) as the number
of bytes to clear.  The latter would always clear 4 or 8
bytes, possibly writing beyond the end of that stack buffer.
Alternatively, depending on the value of the "size" parameter,
it could fail to initialize the end of "rxbuf".
Spotted by coverity.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Reviewed-by: Peter A.G. Crosthwaite <peter.crosthwaite@petalogix.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/a9mpcore: Fix compilation failure if physaddrs are 64 bit
Peter Maydell [Tue, 22 May 2012 14:29:52 +0000 (14:29 +0000)]
hw/a9mpcore: Fix compilation failure if physaddrs are 64 bit

Add a cast to a logging printf to avoid a compilation failure
if target_phys_addr_t is a 64 bit type. (This is better than
using TARGET_FMT_plx because we really don't need a full
16 digit hex string to print the offset into a device.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
12 years agohw/omap.h: Drop broken MEM_VERBOSE tracing
Peter Maydell [Tue, 15 May 2012 16:46:26 +0000 (16:46 +0000)]
hw/omap.h: Drop broken MEM_VERBOSE tracing

Remove the MEM_VERBOSE tracing option from omap.h. This worked by
intercepting cpu_register_io_memory() calls; it has been broken
since cpu_register_io_memory() was removed in favour of the
MemoryRegion API.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/armv7m_nvic: Make the NVIC a freestanding class
Peter Maydell [Wed, 2 May 2012 16:49:42 +0000 (16:49 +0000)]
hw/armv7m_nvic: Make the NVIC a freestanding class

Rearrange the GIC and NVIC so both are straightforward
subclasses of a common class, rather than having the NVIC
source file textually include arm_gic.c.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Move CPU interface memory region setup into arm_gic_init
Peter Maydell [Wed, 2 May 2012 16:49:41 +0000 (16:49 +0000)]
hw/arm_gic: Move CPU interface memory region setup into arm_gic_init

Remove more NVIC ifdefs by moving the code to setup the CPU interface
memory regions into the GIC specific arm_gic_init() function rather
than the gic_init() function. Rename the latter to more closely
reflect what it's now actually doing.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic.c: Make NVIC interrupt numbering a runtime setting
Peter Maydell [Wed, 2 May 2012 16:49:41 +0000 (16:49 +0000)]
hw/arm_gic.c: Make NVIC interrupt numbering a runtime setting

Make the minor tweaks to interrupt numbering used by the NVIC
a runtime setting rather than a compile time one, so we can
drop more NVIC ifdefs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Make CPU target registers RAZ/WI on uniprocessor
Peter Maydell [Wed, 2 May 2012 16:49:40 +0000 (16:49 +0000)]
hw/arm_gic: Make CPU target registers RAZ/WI on uniprocessor

The GIC spec says that the CPU target registers should RAZ/WI
for uniprocessor implementations. Implement this, which also
conveniently lets us drop an NVIC ifdef.

Annoyingly, the 11MPCore's GIC is the odd one out, since
it always has these registers, even in uniprocessor configs.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Add qdev property for GIC revision
Peter Maydell [Wed, 2 May 2012 16:49:40 +0000 (16:49 +0000)]
hw/arm_gic: Add qdev property for GIC revision

GIC behaviour can be different between revision 1 and
2 of the architectural GIC specification; we also have
to handle the legacy 11MPCore GIC, which is different
again in some places. Introduce a qdev property so we
can behave appropriately.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/armv7m_nvic: Use MemoryRegions for NVIC specific registers
Peter Maydell [Wed, 2 May 2012 16:49:39 +0000 (16:49 +0000)]
hw/armv7m_nvic: Use MemoryRegions for NVIC specific registers

Implement the NVIC specific register areas using a set of
overlaid MemoryRegions in a container, rather than by having
the arm_gic read/write functions use special purpose callbacks.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Move NVIC specific reset to armv7m_nvic_reset
Peter Maydell [Wed, 2 May 2012 16:49:39 +0000 (16:49 +0000)]
hw/arm_gic: Move NVIC specific reset to armv7m_nvic_reset

Move the NVIC specific bits of reset to the NVIC's own
reset function, rather than using ifdefs in the common
arm_gic reset.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Remove the special casing of NCPU for the NVIC
Peter Maydell [Wed, 2 May 2012 16:49:39 +0000 (16:49 +0000)]
hw/arm_gic: Remove the special casing of NCPU for the NVIC

Drop the special casing of NCPU=1 for the NVIC. This slightly
increases the amount of memory used by its state structure,
but removes some ifdeffery and means we can safely move the
GIC state into a common subclass structure.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agohw/arm_gic: Remove NVIC ifdefs from gic_state struct
Peter Maydell [Wed, 2 May 2012 16:49:38 +0000 (16:49 +0000)]
hw/arm_gic: Remove NVIC ifdefs from gic_state struct

Remove some NVIC ifdefs from the gic_state struct and its
state save/load functions. This means there are some fields
in it which are present for the NVIC but not used, but means
it always has the same layout and can be pulled out into a
common subclass.

Note that the addition of irq_target[] to the save/load
struct for the NVIC requires a vmstate version bump.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andreas Färber <afaerber@suse.de>
12 years agoarm_boot: Fix typos in comment
Andreas Färber [Mon, 28 May 2012 04:11:49 +0000 (04:11 +0000)]
arm_boot: Fix typos in comment

mimicing -> mimicking
thei -> the

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoARM: Exynos4210 IRQ: Introduce new IRQ gate functionality.
Evgeny Voevodin [Mon, 28 May 2012 04:11:49 +0000 (04:11 +0000)]
ARM: Exynos4210 IRQ: Introduce new IRQ gate functionality.

New IRQ gate consists of n_in input qdev gpio lines and one
output sysbus IRQ line. The output IRQ level is formed as OR
between all gpio inputs.

Signed-off-by: Evgeny Voevodin <e.voevodin@samsung.com>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
12 years agoMerge remote-tracking branch 'afaerber-or/qom-next-2' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:35:16 +0000 (10:35 -0500)]
Merge remote-tracking branch 'afaerber-or/qom-next-2' into staging

* afaerber-or/qom-next-2: (22 commits)
  qom: Push error reporting to object_property_find()
  qdev: Remove qdev_prop_exists()
  qbus: Initialize in standard way
  qbus: Make child devices links
  qdev: Connect busses with their parent devices
  qdev: Convert busses to QEMU Object Model
  qdev: Move SysBus initialization to sysbus.c
  qdev: Use wrapper for qdev_get_path
  qdev: Remove qdev_prop_set_defaults
  qdev: Clean up global properties
  qdev: Move bus properties to abstract superclasses
  qdev: Move bus properties to a separate global
  qdev: Push "type" property up to Object
  arm_l2x0: Rename "type" property to "cache-type"
  m48t59: Rename "type" property to "model"
  qom: Assert that public types have a non-NULL parent field
  qom: Drop type_register_static_alias() macro
  qom: Make Object a type
  qom: Add class_base_init
  qom: Add object_child_foreach()
  ...

12 years agoMerge remote-tracking branch 'qmp/queue/qmp' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:35:13 +0000 (10:35 -0500)]
Merge remote-tracking branch 'qmp/queue/qmp' into staging

* qmp/queue/qmp:
  build: install qmp-commands.txt
  Add rate limiting of RTC_CHANGE, BALLOON_CHANGE & WATCHDOG events
  Add event notification for guest balloon changes
  Fix some more license versions (GPL2+ instead of GPL2)
  monitor: Fix memory leak with readline completion
  qmp: do not include monitor.h from qapi-types-core.h
  qmp: include monitor.h when needed
  kvm: add missing include files

12 years agoMerge remote-tracking branch 'kwolf/for-anthony' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:34:59 +0000 (10:34 -0500)]
Merge remote-tracking branch 'kwolf/for-anthony' into staging

* kwolf/for-anthony: (39 commits)
  qemu-iotests: add 036 autoclear feature bit test
  qemu-iotests: add qcow2.py set-feature-bit command
  fdc-test: introduced qtest read_without_media
  fdc: fix implied seek while there is no media in drive
  qcow2: fix autoclear image header update
  xen: Don't peek behind the BlockDriverState abstraction
  xen: Don't change -drive if=xen device name during machine init
  block: Replace bdrv_get_format() by bdrv_get_format_name()
  qemu-img: document qed format on qemu-img man page
  qemu-iotests: COW with many AIO requests on the same cluster
  qemu-iotests: Some backing file COW tests
  qcow2: Fix avail_sectors in cluster allocation code
  qcow2: Simplify calculation for COW area at the end
  qcow2: always operate caches in writeback mode
  ide: support enable/disable write cache
  block: always open drivers in writeback mode
  block: add bdrv_set_enable_write_cache
  block: copy enable_write_cache in bdrv_append
  savevm: flush after saving vm state
  block: flush in writethrough mode after writes
  ...

12 years agoMerge remote-tracking branch 'mst/tags/for_anthony' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:18:44 +0000 (10:18 -0500)]
Merge remote-tracking branch 'mst/tags/for_anthony' into staging

* mst/tags/for_anthony:
  pci_bridge_dev: fix error path in pci_bridge_dev_initfn()
  qdev: release parent properties on dc->init failure
  msi: Use msi/msix_present more consistently
  msi: Invoke msi/msix_write_config from PCI core
  msi: Guard msi/msix_write_config with msi_present
  msi: Invoke msi/msix_reset from PCI core
  msi: Guard msi_reset with msi_present
  ahci: Clean up reset functions
  intel-hda: Fix reset of MSI function
  ahci: Fix reset of MSI function
  rtl8139: honor RxOverflow flag in can_receive method
  shpc: unparent device before free

12 years agoMerge remote-tracking branch 'sweil/for-anthony' into staging
Anthony Liguori [Mon, 18 Jun 2012 15:18:26 +0000 (10:18 -0500)]
Merge remote-tracking branch 'sweil/for-anthony' into staging

* sweil/for-anthony:
  Fix some more license versions (GPL2+ instead of GPL2)
  dump: Fix license version (GPL2+ instead of GPL2)
  configure: Fix build for some versions of glibc (9pfs)
  monitor: Fix memory leak with readline completion

12 years agos390: stop target cpu on sigp initial reset
Christian Borntraeger [Wed, 6 Jun 2012 02:05:19 +0000 (02:05 +0000)]
s390: stop target cpu on sigp initial reset

We must not run the target cpu after an initial reset. This makes
system_reset more reliable for smp guests.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agos390: make kvm_stat work on s390
Jens Freimann [Wed, 6 Jun 2012 02:05:18 +0000 (02:05 +0000)]
s390: make kvm_stat work on s390

Add s390_exit_reasons so kvm_stat doesn't crash when called on s390.
Look for 'vendor_id' in /proc/cpuinfo as well, instead of just for
'flags', so we can determine if we run on S390.

Signed-off-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agokvm: Update kernel headers
Alexander Graf [Tue, 12 Jun 2012 09:15:23 +0000 (11:15 +0200)]
kvm: Update kernel headers

Corresponding kvm.git hash: 4e3c8a1b1c

Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agos390x: fix s390 virtio aliases
Alexander Graf [Fri, 18 May 2012 00:36:26 +0000 (02:36 +0200)]
s390x: fix s390 virtio aliases

Some of the virtio devices have the same frontend name, but actually
implement different devices behind the scenes through aliases.

The indicator which device type to use is the architecture. On s390, we
want s390 virtio devices. On everything else, we want PCI devices.

Reflect this in the alias selection code. This way we fix commands like
-device virtio-blk on s390x which with this patch applied select the
correct virtio-blk-s390 device rather than virtio-blk-pci.

Reported-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
12 years agoqom: Push error reporting to object_property_find()
Paolo Bonzini [Thu, 12 Apr 2012 16:00:18 +0000 (18:00 +0200)]
qom: Push error reporting to object_property_find()

Avoids duplicated error_set().

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Also drop error_set() in object_property_del().]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Remove qdev_prop_exists()
Paolo Bonzini [Fri, 30 Mar 2012 12:54:31 +0000 (14:54 +0200)]
qdev: Remove qdev_prop_exists()

Can be replaced everywhere with object_property_find().

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqbus: Initialize in standard way
Anthony Liguori [Fri, 3 Feb 2012 19:32:19 +0000 (13:32 -0600)]
qbus: Initialize in standard way

Move code to an initfn and finalizer.
Replace do_qbus_create_inplace() with qbus_realize().

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqbus: Make child devices links
Anthony Liguori [Fri, 23 Dec 2011 21:34:39 +0000 (15:34 -0600)]
qbus: Make child devices links

Make qbus children show up as link<> properties.  There is no stable
addressing for qbus children so we use an unstable naming convention.

This is okay in QOM though because the composition name is expected to
be what's stable.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Connect busses with their parent devices
Anthony Liguori [Wed, 2 May 2012 08:39:01 +0000 (10:39 +0200)]
qdev: Connect busses with their parent devices

This makes SysBus part of the root hierarchy and all busses children of
their respective parent DeviceState.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Convert busses to QEMU Object Model
Anthony Liguori [Wed, 2 May 2012 07:00:20 +0000 (09:00 +0200)]
qdev: Convert busses to QEMU Object Model

This is far less interesting than it sounds.  We simply add an Object to each
BusState and then register the types appropriately.  Most of the interesting
refactoring will follow in the next patches.

Since we're changing fundamental type names (BusInfo -> BusClass), it all needs
to convert at once.  Fortunately, not a lot of code is affected.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Made all new bus TypeInfos static const.]
[AF: Made qbus_free() call object_delete(), required {qom,glib}_allocated]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Move SysBus initialization to sysbus.c
Paolo Bonzini [Wed, 2 May 2012 10:06:55 +0000 (12:06 +0200)]
qdev: Move SysBus initialization to sysbus.c

TYPE_SYSTEM_BUS will be local to hw/sysbus.c, so move existing references
to main_system_bus and system_bus_info there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Use wrapper for qdev_get_path
Anthony Liguori [Fri, 3 Feb 2012 18:28:43 +0000 (12:28 -0600)]
qdev: Use wrapper for qdev_get_path

This makes it easier to remove it from BusInfo.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Drop now unnecessary NULL initialization in scsibus_get_dev_path()]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Remove qdev_prop_set_defaults
Paolo Bonzini [Mon, 2 Apr 2012 20:40:26 +0000 (22:40 +0200)]
qdev: Remove qdev_prop_set_defaults

Instead, qdev_property_add_static can set the default.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Clean up global properties
Paolo Bonzini [Tue, 3 Apr 2012 08:05:07 +0000 (10:05 +0200)]
qdev: Clean up global properties

Now that global properties do not depend on buses anymore, set
them directly in the device instance_init function.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Move bus properties to abstract superclasses
Paolo Bonzini [Wed, 28 Mar 2012 16:12:47 +0000 (18:12 +0200)]
qdev: Move bus properties to abstract superclasses

In qdev, each bus in practice identified an abstract superclass, but
this was mostly hidden.  In QOM, instead, these abstract classes are
explicit so we can move bus properties there.

All bus property walks are removed, and all device property walks
are changed to look along the class hierarchy instead.

We would have duplicates if class A defines some properties and its
subclass B does not define any, because class_b->props will be
left equal to class_a->props.

The solution here is to reintroduce the class_base_init TypeInfo
callback, that was present in one of the early QOM versions but
removed (on my request...) before committing.

This breaks global bus properties, an obscure feature when used
with the command-line which is actually useful and used when used by
backwards-compatible machine types.  So this patch also adjusts the
global bus properties in hw/pc_piix.c to refer to the abstract class.

Globals and other properties must be modified in the same patch to
avoid complications related to initialization ordering.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Move bus properties to a separate global
Paolo Bonzini [Wed, 28 Mar 2012 16:01:36 +0000 (18:01 +0200)]
qdev: Move bus properties to a separate global

Simple code movement in order to simplify future refactoring.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqdev: Push "type" property up to Object
Paolo Bonzini [Mon, 2 Apr 2012 15:33:51 +0000 (17:33 +0200)]
qdev: Push "type" property up to Object

Now that Object is a type, add an instance_init function and push
the "type" property from qdev to there.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoarm_l2x0: Rename "type" property to "cache-type"
Andreas Färber [Thu, 7 Jun 2012 14:32:53 +0000 (16:32 +0200)]
arm_l2x0: Rename "type" property to "cache-type"

Resolves a name conflict with the qdev "type" property that is about to
be moved to Object.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Acked-by: Mark Langsdorf <mark.langsdorf@calxeda.com>
12 years agom48t59: Rename "type" property to "model"
Paolo Bonzini [Wed, 23 May 2012 17:25:34 +0000 (19:25 +0200)]
m48t59: Rename "type" property to "model"

This resolves a name conflict with the qdev "type" property that is
about to move into Object.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
[AF: Add braces missing in original code.]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Assert that public types have a non-NULL parent field
Paolo Bonzini [Wed, 4 Apr 2012 13:58:40 +0000 (15:58 +0200)]
qom: Assert that public types have a non-NULL parent field

This protects against unwanted effects of changing TYPE_OBJECT from
NULL to a string.

Suggested-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Drop type_register_static_alias() macro
Paolo Bonzini [Wed, 23 May 2012 16:58:15 +0000 (18:58 +0200)]
qom: Drop type_register_static_alias() macro

It's unused.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Make Object a type
Paolo Bonzini [Sat, 31 Mar 2012 14:45:54 +0000 (16:45 +0200)]
qom: Make Object a type

Right now the base Object class has a special NULL type.  Change this so
that we will be able to add class_init and class_base_init callbacks.
To do this, remove some special casing of ObjectClass that is not really
necessary.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Add class_base_init
Paolo Bonzini [Wed, 2 May 2012 11:30:55 +0000 (13:30 +0200)]
qom: Add class_base_init

The class_base_init TypeInfo callback was present in one of the early
QOM versions but removed (on my request...) before committing.  We
will need it soon, add it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Add object_child_foreach()
Paolo Bonzini [Wed, 11 Apr 2012 21:30:20 +0000 (23:30 +0200)]
qom: Add object_child_foreach()

A utility function that will be used to implement hierarchical realization.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
[AF: Drop unrelated whitespace change, add Returns: in documentation]
[AF: Use new object_property_is_child() helper.]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoqom: Introduce object_property_is_{child,link}()
Andreas Färber [Sat, 26 May 2012 22:32:40 +0000 (00:32 +0200)]
qom: Introduce object_property_is_{child,link}()

Avoids hardcoding partial string comparisons.

Signed-off-by: Alexander Barabash <alexander_barabash@mentor.com>
Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqom: Add object_class_get_parent()
Paolo Bonzini [Wed, 2 May 2012 11:30:54 +0000 (13:30 +0200)]
qom: Add object_class_get_parent()

This simple bit of functionality was missing and we'll need it soon,
so add it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
[AF: Document possible NULL return value]
Signed-off-by: Andreas Färber <afaerber@suse.de>
12 years agoaudio/winwave: Fix typo
malc [Fri, 15 Jun 2012 16:58:54 +0000 (20:58 +0400)]
audio/winwave: Fix typo

Signed-off-by: malc <av1474@comtv.ru>
12 years agobuild: install qmp-commands.txt
Bruce Rogers [Wed, 13 Jun 2012 22:29:17 +0000 (16:29 -0600)]
build: install qmp-commands.txt

File is targeted for install, but is never installed.

Signed-off-by: Bruce Rogers <brogers@suse.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoAdd rate limiting of RTC_CHANGE, BALLOON_CHANGE & WATCHDOG events
Daniel P. Berrange [Thu, 14 Jun 2012 17:12:57 +0000 (18:12 +0100)]
Add rate limiting of RTC_CHANGE, BALLOON_CHANGE & WATCHDOG events

Allow certain event types to be rate limited to avoid flooding
monitor clients. The monitor_protocol_event() method is changed
such that instead of immediately emitting the event to Monitor
instances, it will call a new monitor_protocol_event_queue()
method.

This will check to see if the rate limit for the event has been
exceeded, and if so schedule a timer to wakeup at the end of the
rate limit period. If further events arrive before the timer fires,
the previously queued event will be discarded in favour of the new
event. The event will eventually be emitted when the timer fires.

This logic is applied to RTC_CHANGE, BALLOON_CHANGE & WATCHDOG
events, since the data associated with these events is stateless

 * monitor.c: Add support for rate limiting
 * monitor.h: Define monitor_global_init for one-time setup tasks
 * vl.c: Invoke monitor_global_init
 * trace-events: Add hooks for monitor event tracing

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoAdd event notification for guest balloon changes
Daniel P. Berrange [Thu, 14 Jun 2012 17:12:56 +0000 (18:12 +0100)]
Add event notification for guest balloon changes

After setting a balloon target value, applications have to
continually poll 'query-balloon' to determine whether the
guest has reacted to this request. The virtio-balloon backend
knows exactly when the guest has reacted though, and thus it
is possible to emit a JSON event to tell the mgmt application
whenever the guest balloon changes.

This introduces a new 'qemu_balloon_changed()' API which is
to be called by balloon driver backends, whenever they have
a change in balloon value. This takes the 'actual' balloon
value, as would be found in the BalloonInfo struct.

The qemu_balloon_change API emits a JSON monitor event which
looks like:

  {"timestamp": {"seconds": 1337162462, "microseconds": 814521},
   "event": "BALLOON_CHANGE", "data": {"actual": 944766976}}

* balloon.c, balloon.h: Introduce qemu_balloon_changed() for
  emitting balloon change events on the monitor
* hw/virtio-balloon.c: Invoke qemu_balloon_changed() whenever
  the guest changes the balloon actual value
* monitor.c, monitor.h: Define QEVENT_BALLOON_CHANGE

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
Acked-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoFix some more license versions (GPL2+ instead of GPL2)
Stefan Weil [Mon, 11 Jun 2012 05:49:18 +0000 (07:49 +0200)]
Fix some more license versions (GPL2+ instead of GPL2)

Cc: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Wen Congyang <wency@cn.fujitsu.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agomonitor: Fix memory leak with readline completion
Stefan Weil [Mon, 14 May 2012 19:47:20 +0000 (21:47 +0200)]
monitor: Fix memory leak with readline completion

Each string which is shown during readline completion in the QEMU monitor
is allocated dynamically but currently never deallocated.

Add the missing loop which calls g_free for the allocated strings.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqmp: do not include monitor.h from qapi-types-core.h
Paolo Bonzini [Thu, 7 Jun 2012 02:02:22 +0000 (04:02 +0200)]
qmp: do not include monitor.h from qapi-types-core.h

The comment is stale, monitor.h is not needed anymore (only qerror.h
is, because it contains the schema for errors).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqmp: include monitor.h when needed
Paolo Bonzini [Thu, 7 Jun 2012 02:02:21 +0000 (04:02 +0200)]
qmp: include monitor.h when needed

This is needed to get file descriptors from SCM_RIGHTS.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agokvm: add missing include files
Paolo Bonzini [Thu, 7 Jun 2012 02:02:20 +0000 (04:02 +0200)]
kvm: add missing include files

These are included via monitor.h right now, add them explicitly.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
12 years agoqemu-iotests: add 036 autoclear feature bit test
Stefan Hajnoczi [Thu, 14 Jun 2012 12:58:18 +0000 (13:58 +0100)]
qemu-iotests: add 036 autoclear feature bit test

This new test validates the autoclear feature bit behavior.  When QEMU
opens a qcow2v3 image file with an unknown autoclear feature bit the bit
should be cleared in the image file header.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: add qcow2.py set-feature-bit command
Stefan Hajnoczi [Thu, 14 Jun 2012 12:58:17 +0000 (13:58 +0100)]
qemu-iotests: add qcow2.py set-feature-bit command

This new command sets feature bits in the image file header:

  qcow2.py set-feature-bit incompatible|compatible|autoclear <bit>

The bit number must be in the range [0, 64).

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc-test: introduced qtest read_without_media
Pavel Hrdina [Wed, 13 Jun 2012 13:43:12 +0000 (15:43 +0200)]
fdc-test: introduced qtest read_without_media

If you try to read from a floppy drive without a media, you should get
an abnormal termination error.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agofdc: fix implied seek while there is no media in drive
Pavel Hrdina [Wed, 13 Jun 2012 13:43:11 +0000 (15:43 +0200)]
fdc: fix implied seek while there is no media in drive

The Windows uses 'READ' command at the start of an instalation
without checking the 'dir' register. We have to abort the transfer
with an abnormal termination if there is no media in the drive.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: fix autoclear image header update
Stefan Hajnoczi [Thu, 14 Jun 2012 10:42:23 +0000 (11:42 +0100)]
qcow2: fix autoclear image header update

The autoclear feature bits can be used for qcow2 file format features
that are safe to "drop" by old programs that do not understand the
feature.  Upon opening the image file unknown autoclear feature bits are
cleared and the image file header is rewritten, but this was happening
too early in the code when critical header fields were not yet loaded.

Process autoclear feature bits after all necessary header information
has been loaded.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoxen: Don't peek behind the BlockDriverState abstraction
Markus Armbruster [Wed, 13 Jun 2012 08:11:50 +0000 (10:11 +0200)]
xen: Don't peek behind the BlockDriverState abstraction

First offender is xen_config_dev_blk()'s use of disk->bdrv->filename.
Get the filename from disk->opts instead.  Same result, except for
snapshots: there, we now get the filename specified by the user
instead of the name of the temporary image created by bdrv_open().
Should be an improvement.

Second offender is blk_init()'s use of blkdev->bs->drv->format_name.
Simply use the appropriate interface to get the format name.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoxen: Don't change -drive if=xen device name during machine init
Markus Armbruster [Wed, 13 Jun 2012 08:11:49 +0000 (10:11 +0200)]
xen: Don't change -drive if=xen device name during machine init

A "top" BlockDriverState has a non-empty device_name.  If the user
doesn't specify one with -drive parameter id, the system supplies a
default name.

xen_config_dev_blk() changes this name, during machine initialization.
Naughty.  Don't do that.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: Replace bdrv_get_format() by bdrv_get_format_name()
Markus Armbruster [Wed, 13 Jun 2012 08:11:48 +0000 (10:11 +0200)]
block: Replace bdrv_get_format() by bdrv_get_format_name()

So callers don't need to know anything about maximum name length.
Returning a pointer is safe, because the name string lives as long as
the block driver it names, and block drivers don't die.

Requested by Peter Maydell.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-img: document qed format on qemu-img man page
Stefan Hajnoczi [Wed, 13 Jun 2012 13:29:15 +0000 (14:29 +0100)]
qemu-img: document qed format on qemu-img man page

The qemu-img.1 man page is missing the qed format from its list of
supported formats.  Document the image creation options for qed.

Suggested-by: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqemu-iotests: COW with many AIO requests on the same cluster
Kevin Wolf [Wed, 13 Jun 2012 15:15:14 +0000 (17:15 +0200)]
qemu-iotests: COW with many AIO requests on the same cluster

This one is a bit more interesting. The COW operation isn't performed
completely synchronously, and therefore dependencies must be handled
correctly when multiple requests write to the same unallocated cluster.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqemu-iotests: Some backing file COW tests
Kevin Wolf [Wed, 13 Jun 2012 14:01:31 +0000 (16:01 +0200)]
qemu-iotests: Some backing file COW tests

Looks like we're still missing these very basic tests for backing file
handling.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
12 years agoqcow2: Fix avail_sectors in cluster allocation code
Kevin Wolf [Tue, 22 May 2012 15:01:20 +0000 (17:01 +0200)]
qcow2: Fix avail_sectors in cluster allocation code

avail_sectors should really be the number of sectors from the start of
the allocation, not from the start of the write request.

We're lucky enough that this mistake didn't cause any real bug.
avail_sectors is only used in the intialiser of QCowL2Meta:

  .nb_available   = MIN(requested_sectors, avail_sectors),

m->nb_available in turn is only used for COW at the end of the
allocation. A COW occurs only if the request wasn't cluster aligned,
which in turn would imply that requested_sectors was less than
avail_sectors (both in the original and in the fixed version). In this
case avail_sectors is ignored and therefore the mistake doesn't cause
any misbehaviour.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: Simplify calculation for COW area at the end
Kevin Wolf [Tue, 22 May 2012 14:58:48 +0000 (16:58 +0200)]
qcow2: Simplify calculation for COW area at the end

copy_sectors() always uses the sum (cluster_offset + n_start) or
(start_sect + n_start), so if some value is added to both cluster_offset
and start_sect, and subtracted from n_start, it's cancelled out anyway.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoqcow2: always operate caches in writeback mode
Paolo Bonzini [Tue, 5 Jun 2012 22:04:55 +0000 (00:04 +0200)]
qcow2: always operate caches in writeback mode

Writethrough does not need special-casing anymore in the qcow2 caches.
The block layer adds flushes after every guest-initiated data write,
and these will also flush the qcow2 caches to the OS.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoide: support enable/disable write cache
Paolo Bonzini [Tue, 5 Jun 2012 22:04:54 +0000 (00:04 +0200)]
ide: support enable/disable write cache

Enabling or disabling the write cache is done with the SET FEATURES
command.  The command can be issued with sg_sat_set_features from
sg3-utils.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: always open drivers in writeback mode
Paolo Bonzini [Tue, 5 Jun 2012 22:04:53 +0000 (00:04 +0200)]
block: always open drivers in writeback mode

Formats are entirely in charge of flushes for metadata writes.  For
guest-initiated writes, a writethrough cache is faked in the block layer.
So we can always open in writeback mode.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: add bdrv_set_enable_write_cache
Paolo Bonzini [Tue, 5 Jun 2012 22:04:52 +0000 (00:04 +0200)]
block: add bdrv_set_enable_write_cache

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
12 years agoblock: copy enable_write_cache in bdrv_append
Paolo Bonzini [Tue, 5 Jun 2012 22:04:51 +0000 (00:04 +0200)]
block: copy enable_write_cache in bdrv_append

Because the guest will be able to flip enable_write_cache, the actual
state may not match what is used to open the new snapshot.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>