aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2014-10-24target-arm: add missing PSCI constants needed for PSCI emulationArd Biesheuvel1-0/+40
This adds some PSCI function IDs and symbolic return codes that are needed to implement PSCI emulation in TCG mode. Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1412865028-17725-4-git-send-email-peter.maydell@linaro.org
2014-10-24target-arm: do not set do_interrupt handlers for ARM and AArch64 user modesRob Herring4-6/+6
User mode emulation should never get interrupts and thus should not use the system emulation exception handler function. Remove the reference, and '#ifndef USER_MODE_ONLY' the function itself as well, so that we can add system mode only functionality to it. Signed-off-by: Rob Herring <rob.herring@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1412865028-17725-3-git-send-email-peter.maydell@linaro.org
2014-10-24target-arm: add powered off cpu stateRob Herring3-3/+12
Add tracking of cpu power state in order to support powering off of cores in system emuluation. The initial state is determined by the start-powered-off QOM property. Signed-off-by: Rob Herring <rob.herring@linaro.org> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1412865028-17725-2-git-send-email-peter.maydell@linaro.org
2014-10-24omap_gpmc.c: Remove duplicate assignmentDr. David Alan Gilbert1-2/+0
This looks like an old merge error and should have no effect. (Build tested only) Found by Coccinelle using Julia Lawall's script: https://lkml.org/lkml/2014/8/23/128 Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com> Message-id: 1414055855-6688-1-git-send-email-dgilbert@redhat.com Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-24disas/libvixl/a64/instructions-a64.h: Remove unused constantsChen Gang1-24/+0
The instructions-a64.h header defines a number of floating point constants whose initializers are function calls. gcc 5 will warn if these constants are not used by the C or C++ file which includes the header, because they imply a runtime cost. Since for the files QEMU uses from libvixl we don't use these constants at all, just remove them. Upstream intend to fix these by shifting to an 'extern const' in the header plus definition in a suitable source file, so we can drop this patch when we sync with the upcoming libvixl 1.7. The related compiling error: CXX disas/arm-a64.o In file included from /upstream/qemu/disas/libvixl/a64/disasm-a64.h:32:0, from disas/arm-a64.cc:20: disas/libvixl/a64/instructions-a64.h:98:13: error: 'vixl::kFP32PositiveInfinity' defined but not used [-Werror=unused-variable] const float kFP32PositiveInfinity = rawbits_to_float(0x7f800000); ^ disas/libvixl/a64/instructions-a64.h:99:13: error: 'vixl::kFP32NegativeInfinity' defined but not used [-Werror=unused-variable] const float kFP32NegativeInfinity = rawbits_to_float(0xff800000); ^ disas/libvixl/a64/instructions-a64.h:100:14: error: 'vixl::kFP64PositiveInfinity' defined but not used [-Werror=unused-variable] const double kFP64PositiveInfinity = ^ disas/libvixl/a64/instructions-a64.h:102:14: error: 'vixl::kFP64NegativeInfinity' defined but not used [-Werror=unused-variable] const double kFP64NegativeInfinity = ^ disas/libvixl/a64/instructions-a64.h:107:21: error: 'vixl::kFP64SignallingNaN' defined but not used [-Werror=unused-variable] static const double kFP64SignallingNaN = ^ disas/libvixl/a64/instructions-a64.h:109:20: error: 'vixl::kFP32SignallingNaN' defined but not used [-Werror=unused-variable] static const float kFP32SignallingNaN = rawbits_to_float(0x7f800001); ^ disas/libvixl/a64/instructions-a64.h:112:21: error: 'vixl::kFP64QuietNaN' defined but not used [-Werror=unused-variable] static const double kFP64QuietNaN = ^ disas/libvixl/a64/instructions-a64.h:114:20: error: 'vixl::kFP32QuietNaN' defined but not used [-Werror=unused-variable] static const float kFP32QuietNaN = rawbits_to_float(0x7fc00001); ^ disas/libvixl/a64/instructions-a64.h:117:21: error: 'vixl::kFP64DefaultNaN' defined but not used [-Werror=unused-variable] static const double kFP64DefaultNaN = ^ disas/libvixl/a64/instructions-a64.h:119:20: error: 'vixl::kFP32DefaultNaN' defined but not used [-Werror=unused-variable] static const float kFP32DefaultNaN = rawbits_to_float(0x7fc00000); ^ cc1plus: all warnings being treated as errors make: *** [disas/arm-a64.o] Error 1 Signed-off-by: Chen Gang <gang.chen.5i5j@gmail.com> [PMM: Rewrote the commit message a little] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-24arm_gic: remove unused parameter.KONRAD Frederic3-4/+4
This removes num_irq parameter from gic_init_irqs_and_distributor as it is not used. Signed-off-by: KONRAD Frederic <fred.konrad@greensocs.com> Message-id: 1412859651-15060-1-git-send-email-fred.konrad@greensocs.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-24disas/libvixl: Update to libvixl 1.6Peter Maydell12-332/+715
Update our copy of libvixl to upstream 1.6. There are no changes of any particular interest to QEMU, so this is simply keeping up with current upstream. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Message-id: 1412091418-25744-1-git-send-email-peter.maydell@linaro.org
2014-10-24hw/arm/boot: register cpu reset handlers if using -biosArd Biesheuvel1-5/+12
Move the registering of CPU reset handlers to before the point where we leave the function in the -bios (not -kernel) case, so CPU reset works correctly with -bios as well. Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-24hw/arm/virt: mark timer in fdt as v8-compatibleClaudio Fontana1-3/+12
check if the first cpu is an armv8 cpu, and if so, put arm,armv8-timer in the compatible string list. Note that due to this check, this patch moves the creation of the timer fdt node to after the cpu creation loop. Signed-off-by: Claudio Fontana <claudio.fontana@huawei.com> Message-id: 1411736960-24206-1-git-send-email-hw.claudio@gmail.com [PMM: updated to list arm,armv8-timer first] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-24hmp: Remove "info pcmcia"Markus Armbruster6-82/+0
This command lists PCMCIA sockets and cards. Only a few ARM boards have sockets (akita, borzoi, connex, mainstone, spitz, terrier, tosa, verdex, z2), the only card is the DSCM-1xxxx Hitachi Microdrive (qdev "microdrive"), and it is only inserted during machine init, if ever. So this command doesn't really tell anybody anything new so far. Moreover, pcmcia_socket_unregister() has a use-after-free bug, flagged by Coverity. Has never been used, because there has never been code to eject a PCMCIA card. Not worth fixing & converting to QMP. Remove it. Signed-off-by: Markus Armbruster <armbru@redhat.com> Acked-by: Luiz Capitulino <lcapitulino@redhat.com> Acked-by: Andreas Färber <afaerber@suse.de> Message-id: 1411144812-22958-1-git-send-email-armbru@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-24Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell35-306/+1148
Block patches # gpg: Signature made Thu 23 Oct 2014 18:56:05 BST using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: (32 commits) qemu-img: Print error if check failed block: char devices on FreeBSD are not behind a pager iotests: Add test for qcow2 L1 table update qcow2: Do not overflow when writing an L1 sector iotests: Add test for map commands qemu-io: Respect early image end for map block: Respect underlying file's EOF docs/qcow2: Limit refcount_order to [0, 6] docs/qcow2: Correct refcount_block_entries qcow2: Drop REFCOUNT_SHIFT iotests: Add test for potentially damaging repairs iotests: Fix test outputs qcow2: Clean up after refcount rebuild qcow2: Rebuild refcount structure during check qcow2: Do not perform potentially damaging repairs qcow2: Fix refcount blocks beyond image end qcow2: Reuse refcount table in calculate_refcounts() qcow2: Let inc_refcounts() resize the reftable qcow2: Let inc_refcounts() return -errno qcow2: Split fail code in L1 and L2 checks ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-23Merge remote-tracking branch 'mreitz/block' into queue-blockKevin Wolf2-12/+35
* mreitz/block: qemu-img: Print error if check failed block: char devices on FreeBSD are not behind a pager
2014-10-23qemu-img: Print error if check failedMax Reitz1-7/+14
Currently, if bdrv_check() fails either by returning -errno or having check_errors set, qemu-img check just exits with 1 after having told the user that there were no errors on the image. This is bad. Instead of printing the check result if there were internal errors which were so bad that bdrv_check() could not even complete with 0 as a return value, qemu-img check should inform the user about the error. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com>
2014-10-23Merge remote-tracking branch 'remotes/qmp-unstable/tags/for-upstream' into ↵Peter Maydell6-218/+216
staging QMP patches # gpg: Signature made Thu 23 Oct 2014 16:05:52 BST using RSA key ID E24ED5A7 # gpg: Good signature from "Luiz Capitulino <lcapitulino@gmail.com>" * remotes/qmp-unstable/tags/for-upstream: monitor: delete device_del_bus_completion monitor: add del completion for peripheral device qdev: add qdev_build_hotpluggable_device_list helper MAINTAINERS: add entry for qobject files dump: Turn some functions to void to make code cleaner dump: Propagate errors into qmp_dump_guest_memory() virtio-balloon: Tweak recent fix for integer overflow Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2014-10-23block: char devices on FreeBSD are not behind a pagerRoger Pau Monne1-5/+21
Introduce a new flag to mark devices that require requests to be aligned and replace the usage of BDRV_O_NOCACHE and O_DIRECT with this flag when appropriate. If a character device is used as a backend on a FreeBSD host set this flag unconditionally. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com>
2014-10-23get_maintainer.pl: restrict cases where it falls back to --gitPaolo Bonzini1-0/+9
The list emitted by --git-fallback often leads inexperienced contributors to add pointless CCs. While not discouraging usage of --git-fallback, we want to: 1) disable the fallback if only some files lack a maintainer $ scripts/get_maintainer.pl -f util/cutils.c hw/ide/core.c Kevin Wolf <kwolf@redhat.com> (odd fixer:IDE) Stefan Hajnoczi <stefanha@redhat.com> (odd fixer:IDE) This behavior is taken even if --git-fallback is specified. 2) warn the contributors about what we're doing, asking them to use their common sense: $ scripts/get_maintainer.pl -f util/cutils.c get_maintainer.pl: No maintainers found, printing recent contributors. get_maintainer.pl: Do not blindly cc: them on patches! Use common sense. Luiz Capitulino <lcapitulino@redhat.com> (commit_signer:1/2=50%) ... $ Explicitly disabling the fallback will not result in the warning message: $ scripts/get_maintainer.pl -f util/cutils.c --no-git-fallback $ echo $? 0 (Returning 1 would break usage of scripts/get_maintainer.pl as a cccmd for git-send-email). Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23get_maintainer.pl: move git loop under "if ($email) {"Paolo Bonzini1-10/+9
All checks in the loop are guarded by that condition, and there is a handy "if" just below. Simplify the code. Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qtest: fix qtest log fd should be initialized before qtest chardevLi Liu1-5/+4
qtest_log_fp should be inited before qemu_chr_add_handlers. If not the log dumped from callback functions may be lost. easy to reproduce it by command: "QTEST_LOG=1 QTEST_QEMU_BINARY=x86_64-softmmu/qemu-system-x86_64 gtester -k --verbose -m=quick tests/qdev-monitor-test" The log "[I xxxxxx] OPENED" should be printed out by qtest_event, but does not. Signed-off-by: Li Liu <john.liuli@huawei.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23MAINTAINERS: avoid M entries that point to mailing listsPaolo Bonzini1-7/+6
"L" entries that point to qemu-devel are not much better either, but at least the get_maintainer.pl output is clearer. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23MAINTAINERS: add some tests directoriesPaolo Bonzini1-0/+7
Low-hanging fruit... Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23MAINTAINERS: Add more TCG filesPaolo Bonzini1-0/+17
Unfortunately, TCG files do not really have a maintainer yet. But at least there will be fewer unmaintained files. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23MAINTAINERS: add myself for X86Paolo Bonzini1-1/+3
Still not moving it beyond "Odd fixes". Richard Henderson also has reviewed a bunch of X86 TCG patches, so add him as well. All we want is to avoid that patches fall on the floor. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23MAINTAINERS: add Samuel Thibault as usb-serial.c and baum.c maintainerPaolo Bonzini1-1/+11
He wrote "I've written mostly all of usb-serial.c and baum.c, and keep maintaining them, since I use them regularly." Cc: Samuel Thibault <samuel.thibault@ens-lyon.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23MAINTAINERS: grab more files from Anthony's pilePaolo Bonzini1-1/+9
I am picking up character devices and the main loop, as agreed during QEMU Summit. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23target-i386: warns users when CPU threads>1 for non-Intel CPUsWei Huang1-3/+23
Only Intel CPUs support hyperthreading. When users select threads>1 in -smp option, QEMU fixes it by adjusting CPUID_0000_0001_EBX and CPUID_8000_0008_ECX based on inputs (sockets, cores, threads); so guest VM can boot correctly. However it is still better to gives users a warning when such case happens. Signed-off-by: Wei Huang <wei@redhat.com> [As suggested by Eduardo, check for !IS_INTEL instead of AMD. - Paolo] Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23sysbus: Use TYPE_DEVICE GPIO functionalityPeter Crosthwaite2-21/+6
Re-implement the Sysbus GPIOs to use the existing TYPE_DEVICE GPIO named framework. A constant string name is chosen to avoid conflicts with existing unnamed GPIOs. This unifies GPIOs are IRQs for sysbus devices and allows removal of all Sysbus state for GPIOs. Any existing and future-added functionality for GPIOs is now also available for sysbus IRQs. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qdev: gpio: Define qdev_pass_gpios()Peter Crosthwaite2-0/+29
Allows a container to take ownership of GPIOs in a contained device and automatically connect them as GPIOs to the container. This prepares for deprecation of the SYSBUS IRQ functionality, which has this feature. We push it up to the device level instead of sysbus level. There's nothing sysbus specific about passing GPIOs to containers so its a legitimate device-level generic feature. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qdev: gpio: Remove qdev_init_gpio_out x1 restrictionPeter Crosthwaite1-2/+1
Previously this was restricted to a single call per-dev/per-name. With the conversion of the GPIO output state to QOM the implementation can now handle repeated calls. Remove the restriction. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qdev: gpio: delete NamedGPIOList::outPeter Crosthwaite2-2/+0
All users of GPIO outputs are fully QOMified, using QOM properties to access the GPIO data. Delete. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23irq: Remove qemu_irq_intercept_outPeter Crosthwaite2-7/+0
No more users left and obsoleted by qdev_intercept_gpio_out. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qtest/irq: Rework IRQ interceptionPeter Crosthwaite2-5/+12
Change the qtest intercept handler to accept just the individual IRQ being intercepted as opaque. n is still expected to be correctly set as for the original intercepted irq. qemu_intercept_irq_in is updated accordingly. Then covert the qemu_irq_intercept_out call to use qdev intercept version. This stops qtest from having to mess with the raw IRQ pointers (still has to mess with names and counts but a step in the right direction). Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qdev: gpio: Add API for intercepting a GPIOPeter Crosthwaite2-0/+27
To replace the old qemu_irq intercept API (which had users reaching into qdev private state for GPIOs). Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qdev: gpio: Re-implement qdev_connect_gpio QOM stylePeter Crosthwaite1-4/+13
Re-implement as a link setter. This should allow the QOM framework to keep track of ref counts properly etc. We need to add a default parent for the connecting input incase it's coming from a non-qdev source. We simply parent the IRQ to the machine in this case. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qom: Demote already-has-a-parent to a regular errorPeter Crosthwaite1-1/+5
Rather than an abort(). This allows callers to decide whether parenting an already-parented object is a fatal error condition. Useful for providing a default value for an object's parent in the case where you want to set one iff it doesn't already have one. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23qom: Allow clearing of a Link propertyPeter Crosthwaite1-3/+7
By passing in "" to object_property_set_link. The lead user of this is the QDEV GPIO framework which will implement GPIO disconnects via an "unlink". GPIO disconnection is used by qtest's irq_intercept_out command. Reviewed-by: Alexander Graf <agraf@suse.de> Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23virtio-scsi: dataplane: stop trying on notifier errorCornelia Huck2-0/+9
There's no use to constantly trying to enable dataplane if we failed to set up guest or host notifiers, so fence it off in that case. We'll try again if the device is reinitialized. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23virtio-scsi: dataplane: fail setup gracefullyCornelia Huck1-9/+70
The dataplane code is currently doing a hard exit on various setup failures. In practice, this may mean that a guest suddenly dies after a dataplane device failed to come up (e.g., when a file descriptor limit is hit for the nth device). Let's just try to unwind the setup instead and return. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23virtio-scsi: dataplane: print why starting failedCornelia Huck1-4/+7
Setting up guest or host notifiers may fail, but the user will have no idea why: Let's print the error returned by the callback. Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23virtio-scsi-dataplane: Add op blockerFam Zheng3-2/+22
We need this to protect dataplane thread from race conditions with block jobs until the latter is made dataplane-safe. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2014-10-23iotests: Add test for qcow2 L1 table updateMax Reitz3-0/+72
Updating the L1 table should not result in random data being written. This adds a test for that. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23qcow2: Do not overflow when writing an L1 sectorMax Reitz1-2/+4
While writing an L1 table sector, qcow2_write_l1_entry() copies the respective range from s->l1_table to the local "buf" array. The size of s->l1_table does not have to be a multiple of L1_ENTRIES_PER_SECTOR; thus, limit the index which is used for copying all entries to the L1 size. Cc: qemu-stable@nongnu.org Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23iotests: Add test for map commandsMax Reitz3-0/+75
Add a test for qemu-img map and qemu-io -c map on truncated files. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23qemu-io: Respect early image end for mapMax Reitz1-1/+4
bdrv_is_allocated() may report zero clusters which most probably means the image (file) is shorter than expected. Respect this case in order to avoid an infinite loop. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Benoît Canet <benoit.canet@nodalink.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23block: Respect underlying file's EOFMax Reitz1-2/+13
When falling through to the underlying file in bdrv_co_get_block_status(), if it returns that the query offset is beyond the file end (by setting *pnum to 0), return the range to be zero and do not let the number of sectors for which information could be obtained be overwritten. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23docs/qcow2: Limit refcount_order to [0, 6]Max Reitz1-0/+1
Specify the upper limit of refcount_order to be 6 (that is, refcount_bits = 64). Any larger value does not make much sense when all offsets, sizes, cluster counts etc. "only" have a width of 64 bit as well, and very large values would be very difficult to support. Therefore, just cap it at the largest reasonable value. Suggested-by: Eric Blake <eblake@redhat.com> Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23docs/qcow2: Correct refcount_block_entriesMax Reitz1-1/+1
A refblock entry may have a different size than 16 bits, it may even be smaller than a byte. Correct the refcount_block_entries calculation accordingly. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23qcow2: Drop REFCOUNT_SHIFTMax Reitz3-21/+15
With BDRVQcowState.refcount_block_bits, we don't need REFCOUNT_SHIFT anymore. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23iotests: Add test for potentially damaging repairsMax Reitz3-0/+252
There are certain cases where repairing a qcow2 image might actually damage it further (or rather, where repairing it has in fact damaged it further with the old qcow2 check implementation). This should not happen, so add a test for these cases. Furthermore, the repair function now repairs refblocks beyond the image end by resizing the image accordingly. Add several tests for this as well. Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23iotests: Fix test outputsMax Reitz3-10/+28
039, 060 and 061 all create images with referenced clusters having a refcount of 0. Because previous commits changed handling of such errors, these tests now have a different output. Fix it. Furthermore, 060 created a refblock with a refcount greater than one which now results in having to rebuild the refcount structure as well. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-10-23qcow2: Clean up after refcount rebuildMax Reitz1-0/+45
Because the old refcount structure will be leaked after having rebuilt it, we need to recalculate the refcounts and run a leak-fixing operation afterwards (if leaks should be fixed at all). Signed-off-by: Max Reitz <mreitz@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>