VFIO is always little endian so do byte swapping of our mask on the
way in and byte swapping of the size on the way out.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reported-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Just to be sure we don't jump off any NULL pointer cliffs.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reported-by: Paolo Bonzini <pbonzini@redhat.com>
Memory regions can easily be 2^64 byte long and therefore overflow
for just a bit but that is enough for int128_get64() to assert.
This takes care of debug printing of huge section sizes.
Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Now that VFIO has a PCI hot reset interface, take advantage of it.
There are two modes that we need to consider. The first is when only
one device within the set of devices affected is actually assigned to
the guest. In this case the other devices are are just held by VFIO
for isolation and we can pretend they're not there, doing an entire
bus reset whenever the device reset callback is triggered. Supporting
this case separately allows us to do the best reset we can do of the
device even if the device is hotplugged.
The second mode is when multiple affected devices are all exposed to
the guest. In this case we can only do a hot reset when the entire
system is being reset. However, this also allows us to track which
individual devices are affected by a reset and only do them once.
We split our reset function into pre- and post-reset helper functions
prioritize the types of device resets available to us, and create
separate _one vs _multi reset interfaces to handle the distinct cases
above.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
During vfio-pci initfn, the device is not always in a state where the
option ROM can be read. In the case of graphics cards, there's often
no per function reset, which means we have host driver state affecting
whether the option ROM is usable. Ideally we want to move reading the
option ROM past any co-assigned device resets to the point where the
guest first tries to read the ROM itself.
To accomplish this, we switch the memory region for the option rom to
an I/O region rather than a memory mapped region. This has the side
benefit that we don't waste KVM memory slots for a BAR where we don't
care about performance. This also allows us to delay loading the ROM
from the device until the first read by the guest. We then use the
PCI config space size of the ROM BAR when setting up the BAR through
QEMU PCI.
Another benefit of this approach is that previously when a user set
the ROM to a file using the romfile= option, we still probed VFIO for
the parameters of the ROM, which can result in dmesg errors about an
invalid ROM. We now only probe VFIO to get the ROM contents if the
guest actually tries to read the ROM.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Not all resets are created equal. PM reset is not very reliable,
especially for GPUs, so we might want to opt for a bus reset if a
standard reset will only do a D3hot->D0 transition. We can also
use this to tell if the standard reset will do a bus reset (if
neither has_pm_reset or has_flr is probed, but the device still
supports reset).
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
When MSI is accelerated through KVM the vectors are only programmed
when the guest first enables MSI support. Subsequent writes to the
vector address or data fields are ignored. Unfortunately that means
we're ignore updates done to adjust SMP affinity of the vectors.
MSI SMP affinity already works in non-KVM mode because the address
and data fields are read from their backing store on each interrupt.
This patch stores the MSIMessage programmed into KVM so that we can
determine when changes are made and update the routes.
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
This includes pc and pci cleanups and enhancements,
and a virtio-net bugfix related to softmac programming.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.14 (GNU/Linux)
iQEcBAABAgAGBQJSR83kAAoJECgfDbjSjVRpX08H/jKgYBNJaChev1TROIVHEGbu
IzvkjfocvKO+6wmhOf5x+xwFmzrijUMa1CPvOkCp8c2A3Iek7rmnedknlhXYh7dM
z5mXcvFGjnu7ST38ydF/Emk9+Z6rRg5Y/hkmlDyr+9lNcoiCDLXXcUrKjeIHNoWl
e8w3yiPCJ528QyrLwQ890XetJphv67pMlsjMgLQ2betMk++Ac/ctUf1D2p1X4NeQ
Q2drbo5Z4yDk0i6QMA3iLq1Bh/AhE10bCDq9rCzfZGIKVyncL6ne2pSi/xDvpLrF
dmxoiJ5QrK6xLnagCcn5T6SB9DkwbEPdL7qCqlxZ8USr7cVyPdzYtHtGSBWdeXY=
=xF01
-----END PGP SIGNATURE-----
Merge remote-tracking branch 'mst/tags/for_anthony' into staging
pc,pci,virtio fixes and cleanups
This includes pc and pci cleanups and enhancements,
and a virtio-net bugfix related to softmac programming.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Sun 29 Sep 2013 01:51:16 AM CDT using RSA key ID D28D5469
# gpg: Can't check signature: public key not found
# By Michael S. Tsirkin (8) and others
# Via Michael S. Tsirkin
* mst/tags/for_anthony:
smbios: Factor out smbios_maybe_add_str()
smbios: Make multiple -smbios type= accumulate sanely
smbios: Improve diagnostics for conflicting entries
smbios: Convert to QemuOpts
smbios: Normalize smbios_entry_add()'s error handling to exit(1)
virtio-net: fix up HMP NIC info string on reset
pci: remove explicit check to 64K ioport size
piix4: disable io on reset
piix: use 64 bit window programmed by guest
q35: use 64 bit window programmed by guest
pci: add helper to retrieve the 64-bit range
range: add min/max operations on ranges
range: add Range to typedefs
q35: make pci window address/size match guest cfg
Message-id: 1380437951-21788-1-git-send-email-mst@redhat.com
# By Max Reitz (10) and others
# Via Kevin Wolf
* kwolf/for-anthony: (30 commits)
qcow2: Remove useless count_contiguous_clusters() parameter
qcow2: COMPRESSED on count_contiguous_clusters
qcow2: count_contiguous_clusters and compression
qcow2: Free only newly allocated clusters on error
qcow2: Always use error path in l2_allocate
qcow2: Don't put invalid L2 table into cache
qemu-iotests: Preallocated zero clusters in 061
qcow2: Correct bitmap size in zero expansion
qemu-iotests: Quote $TEST_IMG* and $TEST_DIR usage
qemu-iotests: Add basic ability to use binary sample images
qemu-iotests: fix qmp.py search path
block: use DIV_ROUND_UP in bdrv_co_do_readv
qcow2: Assert against currently impossible overflow
block: qed - use QEMU_PACKED for on-disk structures
block: qcow2 - used QEMU_PACKED for on-disk structures
block: vpc - use QEMU_PACKED for on-disk structures
block: vdi - use QEMU_PACKED for on-disk structures
rbd: avoid qemu_rbd_snap_list() memory leaks
qdict: Extract qdict_extract_subqdict
block: Fix compiler warning (-Werror=uninitialized)
...
Message-id: 1380296370-14523-1-git-send-email-kwolf@redhat.com
# By Richard Henderson (19) and Paolo Bonzini (2)
# Via Richard Henderson
* rth/tcg-ppc-pull: (21 commits)
tcg-ppc64: Implement CONFIG_QEMU_LDST_OPTIMIZATION
tcg-ppc64: Add _noaddr functions for emitting forward branches
tcg-ppc64: Streamline tcg_out_tlb_read
tcg-ppc64: Implement tcg_register_jit
tcg-ppc64: Handle long offsets better
tcg-ppc64: Tidy register allocation order
tcg-ppc64: Look through a constant function descriptor
tcg-ppc64: Fold constant call address into descriptor load
tcg-ppc64: Don't load the static chain from TCG
tcg-ppc64: Avoid code for nop move
tcg-ppc64: Use tcg_out64
tcg-ppc64: Use TCG_REG_Rn constants
tcg-ppc64: More use of TAI and SAI helper macros
tcg-ppc64: Reformat tcg-target.c
tcg-ppc: Fix and cleanup tcg_out_tlb_check
tcg-ppc: Use conditional branch and link to slow path
tcg-ppc: Cleanup tcg_out_qemu_ld/st_slow_path
tcg-ppc: Avoid code for nop move
tcg-ppc: use new return-argument ld/st helpers
tcg-ppc: fix qemu_ld/qemu_st for AIX ABI
...
Message-id: 1380126458-3247-1-git-send-email-rth@twiddle.net
# By Isaku Yamahata (4) and others
# Via Juan Quintela
* quintela/migration.next:
migration: ram_handle_compressed
arch_init: make is_zero_page accept size
migration: Fix debug print type
migration: add version supporting macros for struct pointer
rdma: constify ram_chunk_{index, start, end}
rdma: clean up of qemu_rdma_cleanup()
arch_init: right return for ram_save_iterate
savevm: fix wrong initialization by ram_control_load_hook
savevm: add comments for qemu_file_get_error()
Message-id: 1380024203-25897-1-git-send-email-quintela@redhat.com
# By Bandan Das (3) and Gerd Hoffmann (1)
# Via Gerd Hoffmann
* kraxel/audio.1:
audio: remove CONFIG_MIXEMU configure option
hda-codec: make mixemu selectable at runtime
hda-codec: refactor common definitions into a header file
audio maintainers update
Message-id: 1380011943-15083-1-git-send-email-kraxel@redhat.com
contains the fixes from the previous pull request, which did not make
it yet.
Overall it contains
- a fix for kexec without kdump (which uses diag308 subcode 0 instead of 1)
- several sclp related fixes
- some initial sclp migration code
- the sclp line mode console
- A fix for a boot problem with the virtio ccw ipl bios
- zeroed out padding bytes for the notes section of dump-guest-memory
- some cleanups
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iQIcBAABAgAGBQJSQTzUAAoJEBF7vIC1phx8hR8P/R2DsdjnNhDbfVxr/1JVj8Ad
v/IOoqSPA8Nf5nGpFe2pmFokHJ88Jzv/8DGlPQfBNH95SBmU6qarHTUG9l6/BWTL
yTx7kzYfy4FGQE6zdoTHByScnzPSJh2hTAiPyXCo7L2QjGPfZgZmxZZVvQUbRoRo
uKslsWSHaSBYs4cYvvZMiUdSA0q4FSIcUNTewMZDoILcIExSvES/dll12q1iRgSF
r8HSK7WppES5nXeJQAZEjJsDXah8Fl71ngcqi+d96if5KrYexkG91Rxz8qavhsFO
2UbXcMIal1Iuq8dEryjymxuKHcfpqKIqmielMjyg4icTS0WXf+Z7uH7jfEmrkYnP
wZbfSZ2AcGd6chRptXsXTxbXYeSKfUxj8VFYg8765DlU+9ACwMZeXwaK0PrtBkl8
WEIyi4XNa2KQ6T+ZoRcl5lqaaGcZZAyJlZzcOeZq4EhbtcLymHTNIVY9gbGloWR8
FLgEcfvx71N2LPH0AapUNfrl5DlLGOHX9gR58ZlRCupULc86NniOsH0y2mcVjjoT
Tbc+4NV3Es0qUIwB44HVRKo+WpRqM7/bMOhDDsfONcKyozuxbySaCcfn8CnoR5LD
C/HqyU3OClg9P785wVvgf7GPT03Zf0KrHKMqQYjsrPu1rX319asgOAz8W5IxnjAw
2d8ZzMX9CZfJDCr7I8hO
=4rT1
-----END PGP SIGNATURE-----
Merge remote-tracking branch 'borntraeger/tags/s390-next-20130924' into staging
This is a bunch of fixes/changes for the s390 architecture. It also
contains the fixes from the previous pull request, which did not make
it yet.
Overall it contains
- a fix for kexec without kdump (which uses diag308 subcode 0 instead of 1)
- several sclp related fixes
- some initial sclp migration code
- the sclp line mode console
- A fix for a boot problem with the virtio ccw ipl bios
- zeroed out padding bytes for the notes section of dump-guest-memory
- some cleanups
# gpg: Signature made Tue 24 Sep 2013 02:18:44 AM CDT using RSA key ID B5A61C7C
# gpg: Can't check signature: public key not found
# By Christian Borntraeger (6) and others
# Via Christian Borntraeger
* borntraeger/tags/s390-next-20130924:
s390/sclplmconsole: Add support for SCLP line-mode console
s390/ebcdic: Move conversion tables to header file
s390/eventfacility: allow childs to handle more than 1 event type
s390/eventfacility: remove unused event_type variable
s390/eventfacility: Fix receive/send masks
s390/eventfacility: fix multiple Read Event Data sources
s390/sclp: add reset() functions
s390/sclpquiesce: Add code to support live migration
s390/sclpconsole: Add code to support live migration for sclpconsole
s390/sclpconsole: modify definition of input buffer
s390/kexec: Implement diag308 subcode 0
s390/ioinst: Moved the CC setting to the IO instruction handlers
s390/cpu: Make setcc() function available to other files
s390/ipl: Update the s390-ccw.img rom
s390/ipl: Fix waiting for virtio processing
s390/dump: zero out padding bytes in notes sections
s390/kvm: Add check for priviledged SCLP handler
Message-id: 1380007671-18976-1-git-send-email-borntraeger@de.ibm.com
'git shortlog d4f7d90f..ece025f5' says:
Alex Williamson (4):
seabios q35: Enable all PIRQn IRQs at startup
seabios q35: Add new PCI slot to irq routing function
seabios: Add a dummy PCI slot to irq mapping function
pciinit: Enable default VGA device
Asias He (2):
virtio-scsi: Set _DRIVER_OK flag before scsi target scanning
virtio-scsi: Pack struct virtio_scsi_{req_cmd,resp_cmd}
Avik Sil (1):
USB-EHCI: Fix null pointer assignment
Christian Gmeiner (5):
geodevga: fix errors in geode_fp_* functions
geodevga: move framebuffer setup
geodevga: move output setup to own function
geodevga: add debug to msr functions
geodevga: fix wrong define name
David Woodhouse (26):
Add macros for pushing and popping struct bregs
Clean up #if in pirtable.c. CONFIG_PIRTABLE can't be set if CONFIG_COREBOOT is
post: Export functions which will be used individually by CSM
Export callrom() for CSM to use
Export copy_smbios() from biostables.c
Import LegacyBios.h from OVMF
Complete and checksum EFI_COMPATIBILITY16_TABLE at build time
Add pic_save_mask() and pic_restore_mask() functions
Add CSM support
Add README.CSM
Add find_pmtimer() function
Enable PMTIMER for CSM build
Fix rom_reserve()/rom_confirm() for CSM oprom dispatch
Don't calibrate TSC if PMTIMER is already set up
Move find_pmtimer() to ACPI table setup where it logically belongs
Use find_pmtimer() after copying Xen ACPI tables
Use find_pmtimer() after copying coreboot ACPI tables
Unify return path for CSM to go via csm_return()
Make CONFIG_OPTIONROMS_DEPLOYED depend on CONFIG_QEMU
Implement !CONFIG_OPTIONROMS support for CSM
Implement !CONFIG_BOOT for CSM
Enable VGA output when settings bochs-specific mode
Disable CONFIG_THREAD_OPTIONROMS for CSM build
Fix return type of le64_to_cpu() and be64_to_cpu()
Rename find_pmtimer() to find_acpi_features()
Add acpi_reboot() reset method using RESET_REG
Gerd Hoffmann (6):
config: allow DEBUG_IO for !QEMU
coreboot: add qemu detection
tweak coreboot qemu detection
apm: fix shutdown
ahci: add missing check for allocation failure
fix buildversion.sh
Hu Tao (1):
Add pvpanic device driver
Kevin O'Connor (101):
pmm: Use 'struct segoff_s' in pmm header.
Minor: Update README - variable changes are now reset on soft-reboots.
Normalize POST initialization function name suffixes.
POST: Reorganize post init functions for better grouping and reusability.
Fix rebase error in commit 8a0a972f that broke LOWMEM variables.
Support calling a function other than maininit() from reloc_preinit().
Ensure exported symbols are visible in the final link
POST: Move QEMU specific ramsize and BIOS table setup to paravirt.c.
POST: Reorganize post entry and "preinit" functions.
POST: Move cpu caching and dma setup to platform_hardware_setup().
Undo incorrect assumptions about Xen in commit 6ca0460f.
Determine century during init and store in VARLOW mem during runtime.
No need to check both CONFIG_THREADS and CONFIG_THREAD_OPTIONROMS.
Add runningOnQEMU() and runningOnXen() for runtime platform detection.
Consistently use CONFIG_COREBOOT, CONFIG_QEMU, and runningOnXen().
Convert kvm_para_available() to runningOnKVM().
Minor - move definitions to paravirt.c from paravirt.h.
Only perform SMP setup on QEMU.
Start device_hardware_setup in mainint even with CONFIG_THREAD_OPTIONROMS.
The mathcp setup touches the PIC and thus move to the "setup" phase.
Update tools/acpi_extract.py to handle iasl 20130117 release.
Support skipping content when reading from QEMU fw_cfg romfile entries.
Convert fw_cfg ACPI entries into romfile entries.
Convert fw_cfg SMBIOS entries into romfile entries.
Convert basic integer fw_cfg entries into romfile entries.
Convert fw_cfg NUMA entries into a romfile entry.
Process fw_cfg e820 entries during the fw_cfg setup stage.
Integrate qemu_cfg_preinit() into qemu_romfile_init().
Group QEMU platform setup together and move to paravirt.c.
vgabios: Bochs/QEMU vgabios support should depend on CONFIG_QEMU.
Warn on unaligned PCI ROM structure in option roms.
Fix Makefile - don't reference "out/" directly, instead use "$(OUT)".
build: Don't require $(OUT) to be a sub-directory of the main directory.
Rename rom_get_top() to rom_get_max().
Report on f-segment UMB ram also.
Clarify build generated "zone low" values.
Verify CC is valid during build tests.
Disable handle_post() on CSM builds.
Remove unnecessary "export" declarations from assembler functions.
Minor assembler enhancements to __csm_return.
Introduce VARFSEG for variables that will reside in the f-segment.
Convert VAR16VISIBLE, VAR16EXPORT, and VAR32VISIBLE to VARFSEG.
Don't relocate "varlow" variable references at runtime.
Move malloc's ZoneFSeg and ZoneLow setup to malloc_init.
Calculate "RamSize" needed by 16bit interface dynamically.
Eliminate separate BiosTableSpace[] space for f-segment allocations.
Use CONFIG_ prefix for Kconfig variables; use BUILD_ for others.
Try to detect an unsuccessful hard-reboot to prevent soft-reboot loops.
Minor - fix confusing final_sec32low_start name in layoutrom.py.
Minor - introduce numeric defines for the IVT offset of hw irqs.
Separate out 16bit PCI-BIOS entry point from regular int 0x1a entry point.
Support using the "extra stack" for all 16bit irq entry points.
Minor - improve comments and grouping of handle_08().
floppy: Introduce 'struct floppy_pio_s' for floppy PIO ops.
floppy: Cleanup floppy irq wait handling.
floppy: Clean up Check Interrupt Status code.
floppy: Move recalibration and results parsing to floppy_cmd().
floppy: Improve floppy_pio() error checking.
floppy: Implement media format sensing.
floppy: Actually do controller reset in floppy_reset().
Minor - note that passing QEMU config via cmos is deprecated.
Cache boot-fail-wait to avoid romfile access after POST.
Rename src/ssdt-susp.dsl to src/ssdt-misc.dsl.
acpi: Eliminate BDAT parameter passing to DSDT code.
Add additional dependency checks to Makefile.
Don't use __FILE__ in virtio-ring.c.
shadow: Don't use PCIDevices list in make_bios_readonly().
smm: Don't use PCIDevices list in smm_setup().
Add VARVERIFY32INIT attribute for variables only available during "init".
Use VARVERIFY32INIT on global variables that point to "tmp" memory.
vgabios: Fix stdvga_perform_gray_scale_summing().
vgabios: Fix cirrus memory clear on mode switch.
Minor - add missing newline to floppy debug statement.
Fix bug in NUMA node setup - don't create SRAT if NUMA not present.
Update README - copy *.aml files for QEMU.
Add dependencies to vgafixup.py and buildversion.sh scripts.
Set ZF prior to keyboard read call in check_for_keystroke().
mptable: Don't describe pci-to-pci bridges.
mptable: Use same PCI irqs as ACPI code.
Cleanup QEMU_CFG_NUMA fw_cfg processing - split into two romfile entries.
Use container_of on romfile entries.
acpi: Move ACPI table definitions from acpi.c to acpi.h.
acpi: Remove dead code with descriptions of bit flags.
acpi: Use cpu_to_leXX() consistently.
Minor - explicitly close files in buildrom.py.
Minor - move "tracked memory alloc" code in pmm.c.
Introduce and convert pmm code to use standard list helpers.
Minor - relocate code in stacks.c to keep low-level thread code together.
Introduce helper function have_threads() in stacks.c.
Convert stacks.c to use standard list manipulation code.
Convert boot.c to use standard list manipulation code.
Convert pciinit.c to use standard list manipulation code.
Convert PCIDevices list to use standard list manipultion code.
Revert "Convert pciinit.c to use standard list manipulation code."
Fix error in hlist_for_each_entry_safe macro.
Convert pciinit.c to use standard list manipulation code.
make qemu_cfg_init depend on QEMU_HARDWARE instead of QEMU
Another fix for hlist_for_each_entry_safe.
Minor - remove debugging dprintf added to pciinit.c.
Fix USB EHCI detection that was broken in hlist conversion of PCIDevices.
Fix bug in CBFS file walking with compressed files.
Laszlo Ersek (1):
Enable VGA output when setting Cirrus-specific mode
Michael S. Tsirkin (2):
acpi: make default DSDT optional
acpi: sync FADT flags from PIIX4 to Q35
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Add some logic to detect cross compilers. Add support for "make slof",
which should JustWork[tm] if you are on a ppx64 machine or have a ppc64
cross compiler installed somewhere in your path.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Enable parallel ipxe builds. Reduce the recursive make calls. Call
recursive make properly using $(MAKE) $(MAKEFLAGS).
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Recurse into vgabios once, adjust dependencies, call make using
$(MAKE) $(MAKEFLAGS) so jobserver mode works.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Currently, -smbios type=T,NAME=VAL,... adds one field (T,NAME) with
value VAL to fw_cfg for each unique NAME. If NAME occurs multiple
times, the last one's VAL is used (before the QemuOpts conversion, the
first one was used).
Multiple -smbios can add multiple fields with the same (T, NAME).
SeaBIOS reads all of them from fw_cfg, but uses only the first field
(T, NAME). The others are ignored.
"First one wins, subsequent ones get ignored silently" isn't nice. We
commonly let the last option win. Useful, because it lets you
-readconfig first, then selectively override with command line
options.
Clean up -smbios to work the common way. Accumulate the settings,
with later ones overwriting earlier ones. Put the result into fw_cfg
(no more useless duplicates).
Bonus cleanup: qemu_uuid_parse() no longer sets SMBIOS system uuid by
side effect.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
We allow either tables or fields for the same type. Makes sense,
because SeaBIOS uses fields only when no tables are present.
We do this by searching the SMBIOS blob for a previously added table
or field. Error messages look like this:
qemu-system-x86_64: -smbios type=1,serial=42: SMBIOS type 1 table already defined, cannot add field
User needs to know that "table" is defined by -smbios file=..., and
"field" by -smbios type=...
Instead of searching the blob, record additions of interest, and check
that. Simpler, and makes better error messages possible:
qemu-system-x86_64: -smbios file=smbios_type_1.bin: Can't mix file= and type= for same type
qemu-system-x86_64: -smbios type=1,serial=42,serial=99: This is the conflicting setting
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
So that it can be set in config file for -readconfig.
This tightens parsing of -smbios, and makes it more consistent with
other options: unknown parameters are rejected, numbers with trailing
junk are rejected, when a parameter is given multiple times, last
rather than first wins, ...
MST: drop one chunk to fix build errors
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
It exits on all error conditions but one, where it returns -1.
Normalize, and return void.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
All callers pass start = 0, and it's doubtful if any other value would
actually do what you expect. Remove the parameter.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Compressed clusters can never be contiguous, therefore the corresponding
flag does not need to be given explicitly to count_contiguous_clusters.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
The function is not intended to be used on compressed clusters and will
not work correctly, if used anyway, since L2E_OFFSET_MASK is not the
right mask for determining the offset of compressed clusters. Therefore,
assert that the first cluster is not compressed and always include the
compression flag in the mask of significant flags, i.e., stop the search
as soon as a compressed cluster occurs.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
In expand_zero_clusters_in_l1, a new cluster is only allocated if it was
not already preallocated. On error, such preallocated clusters should
not be freed, but only the newly allocated ones.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Just returning -errno in some cases prevents
trace_qcow2_l2_allocate_done from being executed (and, in one case, also
the unused allocated L2 table from being freed). Always going down the
error path fixes this.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
In l2_allocate, the fail path is executed if qcow2_cache_flush fails.
However, the L2 table has not yet been fetched from the L2 table cache.
The qcow2_cache_put in the fail path therefore basically gives an
undefined argument as the L2 table address (in this case).
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Add a test case for zero cluster expansion on an image completely filled
with preallocated zero clusters to test 061.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Since the expanded_clusters bitmap is addressed using host offsets in
the underlying image file, the correct size to use for allocating the
bitmap is not determined by the guest disk image but by the underlying
host image file.
Furthermore, this size may change during the expansion due to cluster
allocations on growable image files. In this case, the bitmap needs to
be resized as well to reflect the growth.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
A lot of image filename and paths are used unquoted. Quote these to
make sure that directories / filenames with spaces are not problematic.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
For image formats that are not "QEMU native", but supported for
compatibility, it is useful to verify that an image created with
the 'gold standard' native tool can be read / written to successfully
by QEMU.
In addition to testing non-native images, this could also be useful to
test against image files created by older versions of QEMU.
This provides a directory to store small sample images, for use by
scripts in tests/qemu-iotests.
Image files should be compressed with bzip2.
To use a sample image from a bash script, the _use_sample_img function
will copy and decompress the image into $TEST_DIR, and set $TEST_IMG to
be the decompressed sample image copy. To cleanup, call
_cleanup_test_img as normal.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
QMP/qmp.py is renamed to scripts/qmp/qmp.py, fix the search path in iotests.py.
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
If qcow2_alloc_cluster_link_l2 is called with a QCowL2Meta describing a
request crossing L2 boundaries, a buffer overflow will occur. This is
impossible right now since such requests are never generated (every
request is shortened to L2 boundaries before) and probably also
completely unintended (considering the name "QCowL2Meta"), however, it
is still worth an assertion.
Signed-off-by: Max Reitz <mreitz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
QEDHeader is read, and written, directly from on-disk images
via bdrv_pread()/write(). To avoid any unintentional padding,
these structs should be packed.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
QCowHeader and QCowExtension are structs that reside in the on-disk
image format, and are read and written directly via bdrv_pread()/write(),
and as such should be packed to avoid any unintentional struct padding.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
The VHD footer and header structs (vhd_footer and vhd_dyndisk_header)
are on-disk structures for the image format, and as such should be
packed.
Go ahead and make these typedefs as well, with the preferred QEMU
naming convention, so that the packed attribute is used consistently
with the struct.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
The header struct VdiHeader is an on-disk structure for the image
format, and as such should be packed.
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>