aboutsummaryrefslogtreecommitdiff
path: root/hw/block
AgeCommit message (Collapse)AuthorFilesLines
2016-03-11fdc: add function to determine drive chs limitsRoman Kagan1-0/+23
When populating ACPI objects for floppy drives one needs to provide the maximum values for cylinder, sector, and head number the drive supports. This patch adds a function that iterates through the array of predefined floppy drive formats and returns the maximum values of c, h, s, out of those matching the given floppy drive type. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com> Cc: Igor Mammedov <imammedo@redhat.com> Cc: "Michael S. Tsirkin" <mst@redhat.com> Cc: Marcel Apfelbaum <marcel@redhat.com> Cc: John Snow <jsnow@redhat.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Kevin O'Connor <kevin@koconnor.net> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: John Snow <jsnow@redhat.com>
2016-02-25virtio-blk: do not use vring in dataplanePaolo Bonzini3-143/+19
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-25virtio-blk: fix "disabled data plane" modePaolo Bonzini2-13/+10
In disabled mode, virtio-blk dataplane seems to be enabled, but flow actually goes through the normal virtio path. This patch simplifies a bit the handling of disabled mode. In disabled mode, virtio_blk_handle_output might be called even if s->dataplane is not NULL. This is a bit tricky, because the current check for s->dataplane will always trigger, causing a continuous stream of calls to virtio_blk_data_plane_start. Unfortunately, these calls will not do anything. To fix this, set the "started" flag even in disabled mode, and skip virtio_blk_data_plane_start if the started flag is true. The resulting changes also prepare the code for the next patch, were virtio-blk dataplane will reuse the same virtio_blk_handle_output function as "regular" virtio-blk. Because struct VirtIOBlockDataPlane is opaque in virtio-blk.c, we have to move s->dataplane->started inside struct VirtIOBlock. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Fam Zheng <famz@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-25vring: make vring_enable_notification return voidPaolo Bonzini1-1/+2
Make the API more similar to the regular virtqueue API. This will help when modifying the code to not use vring.c anymore. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: Fam Zheng <famz@redhat.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
2016-02-16hw/block/nand.c: Include osdep.h firstPeter Maydell1-2/+3
Include osdep.h as the first header in nand.c; this has to be done manually because coccinelle gets confused by the way that this C file includes itself. We fix some odd spacing in #includes while we are in the area. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-02-10fdc: always compile-check debug printsJohn Snow1-7/+8
Coverity noticed that some variables are only used by debug prints, and called them unused. Always compile the print statements. While we're here, print to stderr as well. Bonus: Fix a debug printf I broke in f31937aa8 Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> [Touched up commit message. --js] Message-id: 1454971529-14830-1-git-send-email-jsnow@redhat.com
2016-02-08Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into stagingPeter Maydell2-21/+13
pc and misc cleanups and fixes, virtio optimizations Included here: Refactoring and bugfix patches in PC/ACPI. New commands for ipmi. Virtio optimizations. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Sat 06 Feb 2016 18:44:26 GMT using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: (45 commits) net: set endianness on all backend devices fix MSI injection on Xen intel_iommu: large page support dimm: Correct type of MemoryHotplugState->base pc: set the OEM fields in the RSDT and the FADT from the SLIC acpi: add function to extract oem_id and oem_table_id from the user's SLIC acpi: expose oem_id and oem_table_id in build_rsdt() acpi: take oem_id in build_header(), optionally pc: Eliminate PcGuestInfo struct pc: Move APIC and NUMA data from PcGuestInfo to PCMachineState pc: Move PcGuestInfo.fw_cfg to PCMachineState pc: Remove PcGuestInfo.isapc_ram_fw field pc: Remove RAM size fields from PcGuestInfo pc: Remove compat fields from PcGuestInfo acpi: Don't save PcGuestInfo on AcpiBuildState acpi: Remove guest_info parameters from functions pc: Simplify xen_load_linux() signature pc: Simplify pc_memory_init() signature pc: Eliminate struct PcGuestInfoState pc: Move PcGuestInfo declaration to top of file ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-02-06virtio: introduce qemu_get/put_virtqueue_elementPaolo Bonzini1-7/+3
Move allocation to virtio functions also when loading/saving a VirtQueueElement. This will also let the load/save functions keep backwards compatibility when the VirtQueueElement layout is changed. Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2016-02-06virtio: move allocation to virtqueue_pop/vring_popPaolo Bonzini2-15/+11
The return code of virtqueue_pop/vring_pop is unused except to check for errors or 0. We can thus easily move allocation inside the functions and just return a pointer to the VirtQueueElement. The advantage is that we will be able to allocate only the space that is needed for the actual size of the s/g list instead of the full VIRTQUEUE_MAX_SIZE items. Currently VirtQueueElement takes about 48K of memory, and this kind of allocation puts a lot of stress on malloc. By cutting the size by two or three orders of magnitude, malloc can use much more efficient algorithms. The patch is pretty large, but changes to each device are testable more or less independently. Splitting it would mostly add churn. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
2016-02-03fdc: use IsaDma interface instead of global DMA_* functionsHervé Poussineau1-17/+46
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1453843944-26833-16-git-send-email-hpoussin@reactos.org Signed-off-by: John Snow <jsnow@redhat.com>
2016-02-03sparc: disable floppy DMAHervé Poussineau1-0/+2
All functions relative to DMA (DMA_*() functions) are stubs on sparc platform. Disable the DMA in the floppy controller, instead of calling these stubs. Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Message-id: 1453843944-26833-14-git-send-email-hpoussin@reactos.org Signed-off-by: John Snow <jsnow@redhat.com>
2016-02-03fdc: fix detection under LinuxJohn Snow1-0/+16
Accidentally, I removed a "feature" where empty drives had geometry values applied to them, which allows seek on empty drives to work "by accident," as QEMU actually tries to disallow that. Seeks on empty drives should work, though, but the easiest thing is to restore the misfeature where empty drives have non-zero geometries applied. Document the hack accordingly. [Maintainer edit] This fix corrects a regression introduced in d5d47efc, where pick_geometry was modified such that it would not operate on empty drives, and as a result if there is no diskette inserted, QEMU no longer populates it with geometry bounds. As a result, seek fails when QEMU denies to move the current track, but reports success anyway. This can confuse the guest, leading to kernel panics in the guest. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1454106932-17236-1-git-send-email-jsnow@redhat.com
2016-02-02virtio-blk: Functions for op blocker managementMax Reitz1-18/+59
Put the code for setting up and removing op blockers into an own function, respectively. Then, we can invoke those functions whenever a BDS is removed from an virtio-blk BB or inserted into it. Signed-off-by: Max Reitz <mreitz@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-02-02Revert "hw/block/fdc: Implement tray status"Max Reitz1-16/+7
This reverts the changes that commit 2e1280e8ff95b3145bc6262accc9d447718e5318 applied to hw/block/fdc.c; also, an additional case of drv->media_inserted use has crept in since, which is replaced by a call to blk_is_inserted(). That commit changed tests/fdc-test.c, too, because after it, one less TRAY_MOVED event would be emitted when executing 'change' on an empty drive. However, now, no TRAY_MOVED events will be emitted at all, and the tray_open status returned by query-block will always be false, necessitating (different) changes to tests/fdc-test.c and iotest 118, which is why this patch is not a pure revert of said commit. Signed-off-by: Max Reitz <mreitz@redhat.com> Message-id: 1454096953-31773-4-git-send-email-mreitz@redhat.com Reviewed-by: Eric Blake <eblake@redhat.com>
2016-02-02nvme: generate OpenFirmware device path in the "bootorder" fw_cfg fileLaszlo Ersek1-36/+4
Background on QEMU boot indices ------------------------------- Normally, the "bootindex" property is configured for bootable devices with: DEVICE_instance_init() device_add_bootindex_property(..., "bootindex", ...) object_property_add(..., device_get_bootindex, device_set_bootindex, ...) and when the bootindex is set on the QEMU command line, with -device DEVICE,...,bootindex=N the setter that was configured above is invoked: device_set_bootindex() /* parse boot index */ visit_type_int32() /* verify unicity */ check_boot_index() /* store parsed boot index */ ... /* insert device path to boot order */ add_boot_device_path() In the last step, add_boot_device_path() ensures that an OpenFirmware device path will show up in the "bootorder" fw_cfg file, at a position corresponding to the device's boot index. Thus guest firmware (SeaBIOS and OVMF) can try to boot off the device with the right priority. NVMe boot index --------------- In QEMU commit 33739c712982, nvma: ide: add bootindex to qom property the following generic setters / getters: - device_set_bootindex() - device_get_bootindex() were open-coded for NVMe, under the names - nvme_set_bootindex() - nvme_get_bootindex() Plus nvme_instance_init() was added to configure the "bootindex" property manually, designating the open-coded getter & setter, rather than calling device_add_bootindex_property(). Crucially, nvme_set_bootindex() avoided the final add_boot_device_path() call. This fact is spelled out in the message of commit 33739c712982, and it was presumably the entire reason for all of the code duplication. Now, Vladislav filed an RFE for OVMF <https://github.com/tianocore/edk2/issues/48>; OVMF should boot off NVMe devices. It is simple to build edk2's existent NvmExpressDxe driver into OVMF, but the boot order matching logic in OVMF can only handle NVMe if the "bootorder" fw_cfg file includes such devices. Therefore this patch converts the NVMe device model to device_set_bootindex() all the way. Device paths ------------ device_set_bootindex() accepts an optional parameter called "suffix". When present, it is expected to take the form of an OpenFirmware device path node, and it gets appended as last node to the otherwise auto-generated OFW path. For NVMe, the auto-generated part is /pci@i0cf8/pci8086,5845@6[,1] ^ ^ ^ ^ | | PCI slot and (present when nonzero) | | function of the NVMe controller, both hex | "driver name" component, built from PCI vendor & device IDs PCI root at system bus port, PIO to which here we append the suffix /namespace@1,0 ^ ^ | big endian (MSB at lowest address) numeric interpretation | of the 64-bit IEEE Extended Unique Identifier, aka EUI-64, | hex 32-bit NVMe namespace identifier, aka NSID, hex resulting in the OFW device path /pci@i0cf8/pci8086,5845@6[,1]/namespace@1,0 The reason for including the NSID and the EUI-64 is that an NVMe device can in theory produce several different namespaces (distinguished by NSID). Additionally, each of those may (optionally) have an EUI-64 value. For now, QEMU only provides namespace 1. Furthermore, QEMU doesn't even represent the EUI-64 as a standalone field; it is embedded (and left unused) inside the "NvmeIdNs.res30" array, at the last eight bytes. (Which is fine, since EUI-64 can be left zero-filled if unsupported by the device.) Based on the above, we set the "unit address" part of the last ("namespace") node to fixed "1,0". OVMF will then map the above OFW device path to the following UEFI device path fragment, for boot order processing: PciRoot(0x0)/Pci(0x6,0x1)/NVMe(0x1,00-00-00-00-00-00-00-00) ^ ^ ^ ^ ^ ^ | | | | | octets of the EUI-64 in address order | | | | NSID | | | NVMe namespace messaging device path node | PCI slot and function PCI root bridge Cc: Keith Busch <keith.busch@intel.com> (supporter:nvme) Cc: Kevin Wolf <kwolf@redhat.com> (supporter:Block layer core) Cc: qemu-block@nongnu.org (open list:nvme) Cc: Gonglei <arei.gonglei@huawei.com> Cc: Vladislav Vovchenko <vladislav.vovchenko@sk.com> Cc: Feng Tian <feng.tian@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Kevin O'Connor <kevin@koconnor.net> Signed-off-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Gonglei <arei.gonglei@huawei.com> Acked-by: Keith Busch <keith.busch@intel.com> Tested-by: Vladislav Vovchenko <vladislav.vovchenko@sk.com> Message-id: 1453850483-27511-1-git-send-email-lersek@redhat.com Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2016-01-26xen: Switch to libxengnttab interface for compat shims.Ian Campbell1-18/+20
In Xen 4.7 we are refactoring parts libxenctrl into a number of separate libraries which will provide backward and forward API and ABI compatiblity. One such library will be libxengnttab which provides access to grant tables. In preparation for this switch the compatibility layer in xen_common.h (which support building with older versions of Xen) to use what will be the new library API. This means that the gnttab shim will disappear for versions of Xen which include libxengnttab. To simplify things for the <= 4.0.0 support we wrap the int fd in a malloc(sizeof int) such that the handle is always a pointer. This leads to less typedef headaches and the need for XC_HANDLER_INITIAL_VALUE etc for these interfaces. Note that this patch does not add any support for actually using libxengnttab, it just adjusts the existing shims. Signed-off-by: Ian Campbell <ian.campbell@citrix.com> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2016-01-25fdc: change auto fallback drive for ISA FDC to 288John Snow1-1/+1
The 2.88 drive is more suitable as a default because it can still read 1.44 images correctly, but the reverse is not true. Since there exist virtio-win drivers that are shipped on 2.88 floppy images, this patch will allow VMs booted without a floppy disk inserted to later insert a 2.88MB floppy and have that work. This patch has been tested with msdos, freedos, fedora, windows 8 and windows 10 without issue: if problems do arise for certain guests being unable to cope with 2.88MB drives as the default, they are in the minority and can use type=144 as needed (or insert a proper boot medium and omit type=144/288 or use type=auto) to obtain different drive types. As icing, the default will remain auto/144 for any pre-2.6 machine types, hopefully minimizing the impact of this change in legacy hw to basically zero. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-13-git-send-email-jsnow@redhat.com
2016-01-25fdc: rework pick_geometryJohn Snow1-20/+52
This one is the crazy one. fd_revalidate currently uses pick_geometry to tell if the diskette geometry has changed upon an eject/insert event, but it won't allow us to insert a 1.44MB diskette into a 2.88MB drive. This is inflexible. The new algorithm applies a new heuristic to guessing disk geometries that allows us to switch diskette types as long as the physical size matches before falling back to the old heuristic. The old one is roughly: - If the size (sectors) and type matches, choose it. - Fall back to the first geometry that matched our type. The new one is: - If the size (sectors) and type matches, choose it. - If the size (sectors) and physical size match, choose it. - Fall back to the first geometry that matched our type. Signed-off-by: John Snow <jsnow@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-id: 1453495865-9649-11-git-send-email-jsnow@redhat.com
2016-01-25fdc: add physical disk sizesJohn Snow1-8/+32
2.88MB capable drives can accept 1.44MB floppies, for instance. To rework the pick_geometry function, we need to know if our current drive can even accept the type of disks we're considering. NB: This allows us to distinguish between all of the "total sectors" collisions between 1.20MB and 1.44MB diskette types, by using the physical drive size as a differentiator. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-10-git-send-email-jsnow@redhat.com
2016-01-25fdc: add drive type optionJohn Snow1-3/+23
This patch adds a new explicit Floppy Drive Type option. The existing behavior in QEMU is to automatically guess a drive type based on the media inserted, or if a diskette is not present, arbitrarily assign one. This behavior can be described as "auto." This patch adds the option to pick an explicit behavior: 120, 144, 288 or none. The new "auto" option is intended to mimic current behavior, while the other types pick one explicitly. Set the type given by the CLI during fd_init. If the type remains the default (auto), we'll attempt to scan an inserted diskette if present to determine a type. If auto is selected but no diskette is present, we fall back to a predetermined default (currently 1.44MB to match legacy QEMU behavior.) Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-9-git-send-email-jsnow@redhat.com
2016-01-25fdc: Add fallback optionJohn Snow1-2/+23
Currently, QEMU chooses a drive type automatically based on the inserted media. If there is no disk inserted, it chooses a 1.44MB drive type. Change this behavior to be configurable, but leave it defaulted to 1.44. This is not earnestly intended to be used by a user or a management library, but rather exists so that pre-2.6 board types can configure it to be a legacy value. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-8-git-send-email-jsnow@redhat.com
2016-01-25fdc: add pick_driveJohn Snow1-10/+46
Split apart pick_geometry by creating a pick_drive routine that will only ever called during device bring-up instead of relying on pick_geometry to be used in both cases. With this change, the drive field is changed to be 'write once'. It is not altered after the initialization routines exit. media_validated does not need to be migrated. The target VM will just revalidate the media on post_load anyway. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-7-git-send-email-jsnow@redhat.com
2016-01-25fdc: Throw an assertion on misconfigured fd_formats tableJohn Snow1-1/+3
pick_geometry is a convoluted function that makes it difficult to tell at a glance what QEMU's current behavior for choosing a floppy drive type is when it can't quite identify the diskette. The code iterates over all entries in the candidate geometry table ("fd_formats") and if our specific drive type matches a row in the table, then either "match" is set to that entry (an exact match) and the loop exits, or "first_match" will be non-negative (the first such entry that shares the same drive type), and the loop continues. If our specific drive type is NONE, then all drive types in the candidate geometry table are considered. After iteration, if "match" was not set, we fall back to "first match". This means that either "match" was set, or we exited the loop without an exact match, in which case: - If drive type is NONE, the default is truly fd_formats[0], a 1.44MB type, because "first_match" will always get set to the first item. - If drive type is not NONE, pick_geometry's iteration was fussier and only looked at rows that matched our drive type. However, since all possible drive types are represented in the table, we still know that "first match" was set. - If drive type is not NONE and the fd_formats table lists no options for our drive type, we choose fd_formats[1], an incomprehensibly bizarre choice that can never happen anyway. Correct this: If first_match is -1, it can ONLY mean we didn't edit our fd_formats table correctly. Throw an assertion instead. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-6-git-send-email-jsnow@redhat.com
2016-01-25fdc: add disk fieldJohn Snow1-0/+3
Currently, 'drive' is used both to represent the current diskette type as well as the current drive type. This patch adds a 'disk' field that is updated explicitly to match the type of the disk. As of this patch, disk and drive are always the same, but forthcoming patches to change the behavior of pick_geometry will invalidate this assumption. disk does not need to be migrated because it is not user-visible state nor is it currently used for any calculations. It is purely informative, and will be rebuilt automatically via fd_revalidate on the new host. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-5-git-send-email-jsnow@redhat.com
2016-01-25fdc: add drive type qapi enumJohn Snow1-40/+40
Change the floppy drive type to a QAPI enum type, to allow us to specify the floppy drive type from the CLI in a forthcoming patch. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-4-git-send-email-jsnow@redhat.com
2016-01-25fdc: reduce number of pick_geometry argumentsJohn Snow1-30/+20
Modify this function to operate directly on FDrive objects instead of unpacking and passing all of those parameters manually. Reduces the complexity in the caller and reduces the number of args to just one. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-3-git-send-email-jsnow@redhat.com
2016-01-25fdc: move pick_geometryJohn Snow1-45/+45
Code motion: I want to refactor this function to work with FDrive directly, so shuffle it below that definition. Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: John Snow <jsnow@redhat.com> Message-id: 1453495865-9649-2-git-send-email-jsnow@redhat.com
2016-01-21ssi: Move ssi.h into a separate directoryAlistair Francis1-1/+1
Move the ssi.h include file into the ssi directory. While touching the code also fix the typdef lines as checkpatch complains. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-21m25p80.c: Add sst25wf080 SPI flash deviceAlistair Francis1-0/+1
Add the sst25wf080 SPI flash device. Signed-off-by: Alistair Francis <alistair.francis@xilinx.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-20block: Clean up includesPeter Maydell14-11/+14
Clean up includes so that osdep.h is included first and headers which it implies are not included manually. This commit was created with scripts/clean-includes. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2016-01-13error: Use error_prepend() where it makes obvious senseMarkus Armbruster1-6/+2
Done with this Coccinelle semantic patch @@ expression FMT, E1, E2; expression list ARGS; @@ - error_setg(E1, FMT, ARGS, error_get_pretty(E2)); + error_propagate(E1, E2);/*###*/ + error_prepend(E1, FMT/*@@@*/, ARGS); followed by manual cleanup, first because I can't figure out how to make Coccinelle transform strings, and second to get rid of now superfluous error_propagate(). We now use or propagate the original error whole instead of just its message obtained with error_get_pretty(). This avoids suppressing its hint (see commit 50b7b00), but I can't see how the errors touched in this commit could come with hints. It also improves the message printed with &error_abort when we screw up (see commit 1e9b65b). Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com>
2016-01-13hw: Inline the qdev_prop_set_drive_nofail() wrapperMarkus Armbruster2-6/+11
Signed-off-by: Markus Armbruster <armbru@redhat.com> Message-Id: <1449764955-10741-3-git-send-email-armbru@redhat.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
2016-01-07block: Rename BLOCK_OP_TYPE_MIRROR to BLOCK_OP_TYPE_MIRROR_SOURCEFam Zheng1-1/+1
It's necessary to distinguish source and target before we can add blockdev-mirror, because we would want a concrete type of operation to check on target bs before starting. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Max Reitz <mreitz@redhat.com> Message-id: 1450932306-13717-2-git-send-email-famz@redhat.com Signed-off-by: Max Reitz <mreitz@redhat.com>
2015-12-23Merge remote-tracking branch 'remotes/sstabellini/tags/xen-2015-12-22' into ↵Peter Maydell1-0/+3
staging Xen 2015/12/22 # gpg: Signature made Tue 22 Dec 2015 16:17:57 GMT using RSA key ID 70E1AE90 # gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>" * remotes/sstabellini/tags/xen-2015-12-22: xen_disk: treat "vhd" as "vpc" xen/pass-through: correctly deal with RW1C bits xen/MSI-X: really enforce alignment xen/MSI-X: latch MSI-X table writes Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-12-22block: replace IOV_MAX with BlockLimits.max_iovStefan Hajnoczi1-1/+1
Request merging must not result in a huge request that exceeds the maximum number of iovec elements. Use BlockLimits.max_iov instead of hardcoding IOV_MAX. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-12-22virtio-blk: trivial code optimizationGonglei1-18/+10
1. avoid possible superflous checking 2. make code more robustness ["make code more robustness" refers to avoiding integer underflows/overflows. --Stefan] Signed-off-by: Gonglei <arei.gonglei@huawei.com> Message-id: 1447207166-12612-1-git-send-email-arei.gonglei@huawei.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-12-18xen/blkif: Avoid double access to src->nr_segmentsStefano Stabellini1-4/+8
src is stored in shared memory and src->nr_segments is dereferenced twice at the end of the function. If a compiler decides to compile this into two separate memory accesses then the size limitation could be bypassed. Fix it by removing the double access to src->nr_segments. This is part of XSA-155. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-12-11xen_disk: treat "vhd" as "vpc"Stefano Stabellini1-0/+3
The Xen toolstack uses "vhd" to specify a disk in VHD format, however the name of the driver in QEMU is "vpc". Replace "vhd" with "vpc", so that QEMU can find the right driver to use for it. Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-12-07virtio-blk: Drop x-data-plane optionFam Zheng2-14/+2
The official way of enabling dataplane is through the "iothread" property that references an iothread object created by "-object iothread". Since the old "x-data-plane=on" way now even crashes, it's probably easier to just drop it: $ qemu-system-x86_64 -drive file=null-co://,id=d0,if=none \ -device virtio-blk-pci,drive=d0,x-data-plane=on ERROR:/home/fam/work/qemu/qom/object.c:1515: object_get_canonical_path_component: assertion failed: (obj->parent != NULL) Aborted Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1449485967-19240-1-git-send-email-famz@redhat.com Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-25Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into stagingPeter Maydell1-1/+1
Block layer patches # gpg: Signature made Wed 25 Nov 2015 13:33:14 GMT using RSA key ID C88F2FD6 # gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>" * remotes/kevin/tags/for-upstream: qemu-iotests: Add -nographic when starting QEMU in 119 and 120 block/qapi: Plug memory leak on query-block error path raw-posix.c: Make GetBSDPath() handle caching options nand: fix flash erase when oob is in memory test-aio: Fix event notifier cleanup tests/Makefile: Add more dependencies for test-timed-average Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-25nand: fix flash erase when oob is in memoryRicard Wanderlof1-1/+1
For the "main area on file, oob in memory" case, fix the shifts so that we erase the correct number of pages. Signed-off-by: Ricard Wanderlöf <ricardw@axis.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-25Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20151125' into ↵Peter Maydell1-8/+0
staging Xen 2015/11/25 # gpg: Signature made Wed 25 Nov 2015 11:19:26 GMT using RSA key ID 70E1AE90 # gpg: Good signature from "Stefano Stabellini <stefano.stabellini@eu.citrix.com>" * remotes/sstabellini/tags/xen-20151125: xen_disk: Remove ioreq.postsync xen: fix usage of xc_domain_create in domain builder Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2015-11-25xen_disk: Remove ioreq.postsyncAlberto Garcia1-8/+0
This code has been dead for three years (since commit 7e7b7cba1). Signed-off-by: Alberto Garcia <berto@igalia.com> Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com> Reviewed-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
2015-11-24virtio-blk: Move resetting of req->mr_next to virtio_blk_handle_rw_errorFam Zheng1-4/+3
"werror=report" would free the req in virtio_blk_handle_rw_error, we mustn't write to it in that case. Reported-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Message-id: 1448239280-15025-1-git-send-email-famz@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-11-18nand: fix address overflowRabin Vincent1-2/+2
The shifts of the address mask and value shift beyond 32 bits when there are 5 address cycles. Cc: qemu-stable@nongnu.org Signed-off-by: Rabin Vincent <rabin.vincent@axis.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Peter Crosthwaite <crosthwaite.peter@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-17virtio-blk: Fix double completion for werror=stopFam Zheng1-0/+4
When a request R is absorbed by request M, it is appended to the "mr_next" queue led by M, and is completed together with the completion of M, in virtio_blk_rw_complete. During DMA restart in virtio_blk_dma_restart_bh, requests in s->rq are parsed and submitted again, possibly with a stale req->mr_next. It could be a problem if the request merging in virtio_blk_handle_request hasn't refreshed every mr_next pointer, in which case, virtio_blk_rw_complete could walk through unexpected requests following the stale pointers. Fix this by unsetting the pointer in virtio_blk_rw_complete. It is safe because this req is either completed and freed right away, or it will be restarted and parsed from scratch out of the vq later. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2015-11-12xen_disk: Account for failed and invalid operationsAlberto Garcia1-1/+22
Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: e0cbb96cb0e1f86c37c7ce332efdf02b57b9d365.1446044838.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-12virtio-blk: Account for failed and invalid operationsAlberto Garcia1-1/+3
Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: 4f623ce52c9d673d35a043fc2959526b41b685c6.1446044838.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-12nvme: Account for failed and invalid operationsAlberto Garcia1-3/+8
Signed-off-by: Alberto Garcia <berto@igalia.com> Message-id: 678dc67da229759d404b44f7cc2bf5ed8bf8ad14.1446044838.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2015-11-12xen_disk: Account for flush operationsAlberto Garcia1-1/+3
Currently both BLKIF_OP_WRITE and BLKIF_OP_FLUSH_DISKCACHE are being accounted as write operations. Signed-off-by: Alberto Garcia <berto@igalia.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Message-id: 7a2a14e3ac62027aa6267a6c02abc70717be9c0a.1446044837.git.berto@igalia.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>