aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2012-12-12blkdebug: Factor out remove_rule()Kevin Wolf1-2/+13
The cleanup work to remove a rule depends on the type of the rule. It's easy for the existing rules as there is no data that must be cleaned up and is specific to a type yet, but the next patch will change this. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-12blkdebug: Allow usage without config fileKevin Wolf1-0/+5
As soon as new rules can be set during runtime, as introduced by the next patch, blkdebug makes sense even without a config file. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11create new function: qemu_opt_set_numberDong Xu Wang2-0/+23
Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11use qemu_opts_create_nofailDong Xu Wang6-20/+18
We will use qemu_opts_create_nofail function, it can make code more readable. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11introduce qemu_opts_create_nofail functionDong Xu Wang2-0/+10
While id is NULL, qemu_opts_create can not fail, so ignore errors is fine. Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11qemu-option: qemu_opt_set_bool(): fix code duplicationDong Xu Wang1-18/+9
It will set opt->str in qemu_opt_set_bool, without opt->str, there will be some potential bugs. These are uses of opt->str, and what happens when it isn't set: * qemu_opt_get(): returns NULL, which means "not set". Bug can bite when value isn't the default value. * qemu_opt_parse(): passes NULL to parse_option_bool(), which treats it like "on". Wrong if the value is actually false. Bug can bite when qemu_opts_validate() runs after qemu_opt_set_bool(). * qemu_opt_del(): passes NULL to g_free(), which is just fine. * qemu_opt_foreach(): passes NULL to the callback, which is unlikely to be prepared for it. * qemu_opts_print(): prints NULL, which crashes on some systems. * qemu_opts_to_qdict(): passes NULL to qstring_from_str(), which crashes. It also makes qemu_opt_set_bool more readable by using find_desc_by_name and opts_accepts_any. It is based on Luiz's patch and uses Markus's comments. Discussions can be found at: http://lists.nongnu.org/archive/html/qemu-devel/2012-07/msg02716.html Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11qemu-option: qemu_opts_validate(): fix duplicated codeDong Xu Wang1-11/+3
Use opts_accepts_any() and find_desc_by_name(). Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11qemu-option: opt_set(): split it up into more functionsDong Xu Wang1-16/+24
The new functions are opts_accepts_any() and find_desc_by_name(), which are also going to be used by qemu_opts_validate() (see next commit). This also makes opt_set() slightly more readable. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Dong Xu Wang <wdongxu@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11Fix error code checking for SetFilePointer() callFabien Chouteau1-3/+14
An error has occurred if the return value is invalid_set_file_pointer and getlasterror doesn't return no_error. Signed-off-by: Fabien Chouteau <chouteau@adacore.com> Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11rbd: Fix race between aio completition and aio cancelStefan Priebe1-8/+12
This one fixes a race which qemu had also in iscsi block driver between cancellation and io completition. qemu_rbd_aio_cancel was not synchronously waiting for the end of the command. To archieve this it introduces a new status flag which uses -EINPROGRESS. Signed-off-by: Stefan Priebe <s.priebe@profihost.ag> Reviewed-by: Stefan Hajnoczi <stefanha@gmail.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11qemu-io: Implement write -c for compressed clustersKevin Wolf1-2/+21
This makes it easier to create images with both compressed and uncompressed clusters for testing. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11tests: Add tests for fdsetsCorey Bryant4-0/+147
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com> Reviewed-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11block: bdrv_img_create(): drop unused error handling codeLuiz Capitulino2-38/+8
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11qmp: qmp_drive_mirror(): pass Error object to bdrv_img_create()Luiz Capitulino1-8/+8
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11qmp: qmp_transaction(): pass Error object to bdrv_img_create()Luiz Capitulino1-6/+7
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11qemu-img: img_create(): drop unneeded goto and ret variableLuiz Capitulino1-10/+4
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11qemu-img: img_create(): pass Error object to bdrv_img_create()Luiz Capitulino1-2/+9
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11block: bdrv_img_create(): add Error ** argumentLuiz Capitulino4-6/+26
This commit adds an Error ** argument to bdrv_img_create() and set it appropriately on error. Callers of bdrv_img_create() pass NULL for the new argument and still rely on bdrv_img_create()'s return value. Next commits will change callers to use the Error object instead. Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11block: simplify default_driveChristian Borntraeger1-14/+6
Markus Armbruster pointed out that there is only one caller to default_drive with IF_DEFAULT as a type. Lets get rid of the block_default_type parameter and adopt the caller to do the right thing (asking the machine struct). Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11Support default block interfaces per QEMUMachineChristian Borntraeger17-57/+51
There are QEMUMachines that have neither IF_IDE nor IF_SCSI as a default/standard interface to their block devices / drives. Therefore, this patch introduces a new field default_block_type per QEMUMachine struct. The prior use_scsi field becomes thereby obsolete and is replaced through .default_block_type = IF_SCSI. This patch also changes the default for s390x to IF_VIRTIO and removes an early hack that converts IF_IDE drives. Other parties have already claimed interest (e.g. IF_SD for exynos) To create a sane default, for machines that dont specify a default_block_type, this patch makes IF_IDE = 0 and IF_NONE = 1. I checked all users of IF_NONE (blockdev.c and ww/device-hotplug.c) as well as IF_IDE and it seems that it is ok to change the defines - in other words, I found no obvious (to me) assumption in the code regarding IF_NONE==0. IF_NONE is only set if there is an explicit if=none. Without if=* the interface becomes IF_DEFAULT. I would suggest to have some additional care, e.g. by letting this patch sit some days in the block tree. Based on an initial patch from Einar Lueck <elelueck@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> CC: Igor Mitsyanko <i.mitsyanko@samsung.com> CC: Markus Armbruster <armbru@redhat.com> CC: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Alexander Graf <agraf@suse.de> Acked-by: Igor Mitsyanko <i.mitsyanko@samsung.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11raw-posix: inline paio_ioctl into hdev_aio_ioctlPaolo Bonzini1-17/+10
clang now warns about an unused function: CC block/raw-posix.o block/raw-posix.c:707:26: warning: unused function paio_ioctl [-Wunused-function] static BlockDriverAIOCB *paio_ioctl(BlockDriverState *bs, int fd, ^ 1 warning generated. because the only use of paio_ioctl() is inside a #if defined(__linux__) guard and it is static now. Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11block: vpc support for ~2 TB disksCharles Arnold1-4/+13
The VHD specification allows for up to a 2 TB disk size. The current implementation in qemu emulates EIDE and ATA-2 hardware which only allows for up to 127 GB. This disk size limitation can be overridden by allowing up to 255 heads instead of the normal 4 bit limitation of 16. Doing so allows disk images to be created of up to nearly 2 TB. This change does not violate the VHD format specification nor does it change how smaller disks (ie, <=127GB) are defined. [Charles Arnold also writes: "In analyzing a 160 GB VHD fixed disk image created on Windows 2008 R2, it appears that MS is also ignoring the CHS values in the footer geometry field in whatever driver they use for accessing the image. The CHS values are set at 65535,16,255 which obviously doesn't represent an image size of 160 GB." -- Stefan] Signed-off-by: Charles Arnold <carnold@suse.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11block: vpc initialize the uuid footer fieldCharles Arnold1-1/+6
Initialize the uuid field in the footer with a generated uuid. Signed-off-by: Charles Arnold <carnold@suse.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11virtio-blk: Remove duplicate property definitionDavid Gibson2-2/+0
For the virtio-blk device (via virtio-pci) the property "config-wce" is defined in two places. First, it's defined from the DEFINE_VIRTIO_BLK_FEATURES macro, second it's defined directly in virtio-pci, just two lines above the call to that macro. The direct definition in virtio-pci.c is broken, since it operates on the 'config_wce' field of VirtIOBlkConf, which is never used anywhere else. Therefore, this patch removes both the extra property definition and the redundant field it works on. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Anthony Liguori <aliguori@us.ibm.com> Cc: Paul 'Rusty' Russell <rusty@rustcorp.com.au> Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2012-12-11block: Avoid second open for format probingKevin Wolf1-28/+38
This fixes problems that are caused by the additional open/close cycle of the existing format probing, for example related to qemu-nbd without -t option or file descriptor passing. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11block: Factor out bdrv_open_flagsKevin Wolf1-14/+21
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11aio: Get rid of qemu_aio_flush()Kevin Wolf6-20/+5
There are no remaining users, and new users should probably be using bdrv_drain_all() in the first place. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11block: Improve bdrv_aio_co_cancel_emKevin Wolf1-1/+18
Instead of waiting for all requests to complete, wait just for the specific request that should be cancelled. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11tests: avoid qemu_aio_flush() in test-thread-pool.cStefan Hajnoczi1-6/+14
We need to eliminate calls to qemu_aio_flush() since the function is being removed. Most callers will use bdrv_drain_all() instead but test-thread-pool.c is lower level. Since the test uses the global AioContext we can loop on qemu_aio_wait() to wait for aio and bh activity to complete. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-11tests: use aio_poll() instead of aio_flush() in test-aio.cStefan Hajnoczi1-16/+15
There has been confusion between various aio wait and flush functions. It's time to get rid of qemu_aio_flush() but in the aio test cases we really do want this low-level functionality. Therefore declare a local wait_for_aio() helper for the test cases. Drop the aio_flush() test case. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2012-12-10Merge remote-tracking branch 'afaerber/qom-cpu' into stagingAnthony Liguori16-132/+149
* afaerber/qom-cpu: target-i386: Postpone cpuid_level update to realize time target-i386: Use define for cpuid vendor string size target-i386: Separate feature string parsing from CPU model lookup target-i386/cpu.c: Coding style fixes qdev: qdev_create(): use error_report() instead of hw_error() sysemu.h: Include qemu-types.h instead of qemu-common.h Create qemu-types.h for struct typedefs qlist.h: Do not include qemu-common.h qga/channel-posix.c: Include headers it needs qapi/qmp-registry.c: Include headers it needs ui/vnc-palette.c: Include headers it needs user: Rename qemu-types.h to qemu-user-types.h user: Move *-user/qemu-types.h to main directory Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-10Merge remote-tracking branch 'stefanha/trivial-patches' into stagingAnthony Liguori19-48/+32
* stefanha/trivial-patches: pc_sysfw: Plug memory leak on pc_fw_add_pflash_drv() error path qemu-options: Fix space at EOL Fix spelling in comments and documentation Clean up pci_drive_hot_add()'s use of BlockInterfaceType arm: a9mpcore: remove un-used ptimer_iomem field target-sparc: Remove t0, t1 from CPUSPARCState target-m68k: Remove t1 from CPUM68KState target-alpha: Remove t0, t1 from CPUAlphaState s390x: Spelling fixes (endianess -> endianness, occured -> occurred) Fix comments (adress -> address, layed -> laid, wierd -> weird) Fix spelling (prefered -> preferred) configure: Remove stray debug output sd: Send debug printfery to stderr not stdout Conflicts: configure Resolve spelling conflict in configure. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-10Merge remote-tracking branch 'kraxel/acpi.1' into stagingAnthony Liguori11-415/+317
* kraxel/acpi.1: acpi: drop debug port q35: update lpc pci config space according to configured devices apci: switch piix4 pci hotplug to memory api acpi: remove acpi_gpe_blk apci: switch piix4 gpe to memory api acpi: fix piix4 smbus mapping acpi: switch smbus to memory api acpi: cleanup ich9 memory region apci: switch ich9 smi to memory api apci: switch ich9 gpe to memory api acpi: cleanup vt82c686 memory region acpi: cleanup piix4 memory region apci: switch evt to memory api apci: switch cnt to memory api apci: switch timer to memory api apci: switch vt82c686 to memory api apci: switch ich9 to memory api apci: switch piix4 to memory api Conflicts: hw/lpc_ich9.c Resolved merge conflict due to apm_init adding an argument. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-10Merge remote-tracking branch 'aneesh/for-upstream' into stagingAnthony Liguori1-29/+64
* aneesh/for-upstream: virtfs-proxy-helper: use setresuid and setresgid Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-10Merge remote-tracking branch 'kraxel/usb.74' into stagingAnthony Liguori13-9/+168
* kraxel/usb.74: usb-tablet: Allow connecting to ehci ehci: Lower timer freq when the periodic schedule is idle usb: Allow overriding of usb_desc at the device level usb: Don't allow USB_RET_ASYNC for interrupt packets usb: Call wakeup when data becomes available for all devices with int eps add pc-1.4 Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-12-08configure: Default to 'cc', not 'gcc'Peter Maydell1-2/+11
Default to 'cc' as our compiler, rather than 'gcc'. We used to have to insist on gcc when we still kept the CPU env in a fixed global register, but this is no longer necessary and we will now compile OK on clang as well as gcc. Using 'cc' should generally result in us using the most standard and maintained system compiler for the platform. (For instance on newer MacOS X 'gcc' exists but is an elderly compiler provided mostly for legacy reasons, and 'cc' (which is clang) is definitely the better choice.) On Linux there will generally be no user-visible change since cc will be gcc. This changeover necessitates a slight reworking of how we set the 'cc' variable, because GNU cross toolchains generally provide a '${cross_prefix}gcc' but not a '${cross_prefix}cc'. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08linux-user: Merge pread/pwrite into pread64/pwrite64Peter Maydell6-32/+8
The Linux syscalls underlying pread() and pwrite() take a 64 bit offset on all architectures, even if some of them name the syscall "pread/pwrite" rather than "pread64/pwrite64" for historical reasons. So move the four QEMU target architectures (arm, i386, sparc, unicore32) which were defining TARGET_NR_pread/pwrite to define TARGET_NR_pread64/pwrite64 instead, and drop the TARGET_NR_pread/pwrite implementation code completely. (Based on examination of the kernel sources for the four architectures this patch affects.) Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08target-xtensa: use movcond where possibleMax Filippov1-50/+42
Use movcond for all sorts of conditional moves, ABS, CLAMPS, MIN/MAX opcodes. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08target-xtensa: add s32c1i unit testsMax Filippov2-0/+40
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08target-xtensa: add SR accessibility unit testsMax Filippov3-1/+92
Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08target-xtensa: implement MISC SRMax Filippov3-0/+6
The Miscellaneous Special Registers Option provides zero to four scratch registers within the processor readable and writable by RSR, WSR, and XSR. These registers are privileged. They may be useful for some application-specific exception and interrupt processing tasks in the kernel. The MISC registers are undefined after reset. See ISA, 4.7.3 for details. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08target-xtensa: better control rsr/wsr/xsr access to SRsMax Filippov1-19/+30
There are read-only (DEBUGCAUSE, PRID) and write-only (INTCLEAR) SRs, and INTERRUPT/INTSET SR allows rsr/wsr, but not xsr. Raise illeagal opcode exception on illegal access to these SRs. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08target-xtensa: restrict available SRs by enabled optionsMax Filippov3-105/+130
Beginning with the RA-2004.1 release, SR access instructions (rsr, wsr, xsr) are associated with their corresponding SR and raise illegal opcode exception in case the register is not configured for the core. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08target-xtensa: implement CACHEATTR SRMax Filippov5-1/+25
In XEA1, the Options for Memory Protection and Translation and the corresponding TLB management instructions are not available. Instead, functionality similar to the Region Protection Option is available through the cache attribute register. See ISA, A.2.14 for details. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08target-xtensa: implement ATOMCTL SRMax Filippov7-14/+131
ATOMCTL SR controls s32c1i opcode behavior depending on targeted memory type. See ISA, 4.3.12.4 for details. Signed-off-by: Max Filippov <jcmvbkbc@gmail.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08Merge branch 'master' of git.qemu-project.org:/pub/git/qemuBlue Swirl6-15/+55
* 'master' of git.qemu-project.org:/pub/git/qemu: target-mips: Fix incorrect shift for SHILO and SHILOV target-mips: Fix incorrect code and test for INSV xilinx_uartlite: Accept input after rx FIFO pop xilinx_uartlite: suppress "cannot receive message" xilinx_axienet: Implement R_IS behaviour
2012-12-08finally kill cpudef config section supportEduardo Habkost1-49/+0
The external CPU models were removed on QEMU 1.2, and the support for the "cpudef" config sections was documented as deprecated, but the actual removal of the config section was pending. Now that QEMU 1.3 was released, we can finally kill the support for cpudef config sections, and support only the built-in CPU models from target-i386/cpu.c. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08Merge branch 'memory-ioport' of git://github.com/afaerber/qemu-cpuBlue Swirl13-78/+178
* 'memory-ioport' of git://github.com/afaerber/qemu-cpu: hw/dma.c: Replace register_ioport_* hw/pc.c: Replace register_ioport_* serial: Replace register_ioport_* hw/cirrus_vga.c: Replace register_ioport_* hw/apm.c: Replace register_ioport_* isa: Add isa_address_space_io()
2012-12-08HACKING: List areas where we may rely on impdef C behaviourPeter Maydell1-0/+20
Add a section to HACKING saying which version of the C spec we use and describing the bits of implementation defined C compiler behaviour which C code in QEMU is allowed to rely on. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-12-08pixman: require 0.18.4 or newerGerd Hoffmann1-2/+2
When older versions are found the internal pixman version is prefered. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>