summaryrefslogtreecommitdiffstats
path: root/qemu-common.h
Commit message (Collapse)AuthorAgeFilesLines
* Move generic or OS function declarations to qemu-common.hBlue Swirl2011-04-151-0/+19
| | | | | | | | | | | Move generic or OS related function declarations and macro TFR to qemu-common.h. Move win32 include directives to qemu-os-win32.h. While moving, also add #include <winsock2.h> to fix a recent mingw32 build breakage. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* enable vm_clock to "warp" in the iothread+icount casePaolo Bonzini2011-04-151-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | The previous patch however is not enough, because if the virtual CPU goes to sleep waiting for a future timer interrupt to wake it up, qemu deadlocks. The timer interrupt never comes because time is driven by icount, but the vCPU doesn't run any insns. You could say that VCPUs should never go to sleep in icount mode if there is a pending vm_clock timer; rather time should just warp to the next vm_clock event with no sleep ever taking place. Even better, you can sleep for some time related to the time left until the next event, to avoid that the warps are too visible externally; for example, you could be sending network packets continously instead of every 100ms. This is what this patch implements. qemu_clock_warp is called: 1) whenever a vm_clock timer is adjusted, to ensure the warp_timer is synchronized; 2) at strategic points in the CPU thread, to make sure the insn counter is synchronized before the CPU starts running. In any case, the warp_timer is disabled while the CPU is running, because the insn counter will then be making progress on its own. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Tested-by: Edgar E. Iglesias <edgar.iglesias@gmail.com> Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
* qemu-img: Initial progress printing supportJes Sorensen2011-04-071-0/+4
| | | | | | | | | | This adds the basic infrastructure for supporting progress output on the command line, as well as progress support for qemu-img commands 'rebase' and 'convert'. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* add a service to reap zombies, use it in SLIRPPaolo Bonzini2011-03-291-0/+1
| | | | | | | | | | | | | SLIRP -smb support wants to fork a process and forget about reaping it. To please it, add a generic service to register a process id and let QEMU reap it. In the future it could be enhanced to pass a status, but this would be unused. With this in place, the SIGCHLD signal handler would not stomp on pclose anymore. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* extract I/O handler lists to iohandler.cPaolo Bonzini2011-03-291-0/+3
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* x86: Refine error reporting of MCE injection servicesJan Kiszka2011-03-151-3/+3
| | | | | | | | | | | | | | As this service is used by the human monitor, make sure that errors get reported to the right channel, and also raise the verbosity. This requires to move Monitor typedef in qemu-common.h to resolve the include dependency. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> CC: Huang Ying <ying.huang@intel.com> CC: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com> CC: Jin Dongming <jin.dongming@np.css.fujitsu.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* Refactor thread retrieval and checkJan Kiszka2011-03-131-1/+1
| | | | | | | | | | | | | We have qemu_cpu_self and qemu_thread_self. The latter is retrieving the current thread, the former is checking for equality (using CPUState). We also have qemu_thread_equal which is only used like qemu_cpu_self. This refactors the interfaces, creating qemu_cpu_is_self and qemu_thread_is_self as well ass qemu_thread_get_self. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* WIN32: Add missing include for 'struct timeval', used in vnc.hHervé Poussineau2011-03-061-0/+1
| | | | | Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori2011-02-161-0/+2
|\
| * QCOW2: bug fix - read base image beyond its sizeChunqiang Tang2011-02-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch fixes the following bug in QCOW2. For a QCOW2 image that is larger than its base image, when handling a read request straddling over the end of the base image, the QCOW2 driver attempts to read beyond the end of the base image and the request would fail. This bug was found by Fast Virtual Disk (FVD)'s fully automated testing tool. The following test triggered the bug. dd if=/dev/zero of=/var/ramdisk/truth.raw count=0 bs=1 seek=1098561536 dd if=/dev/zero of=/var/ramdisk/zero-500M.raw count=0 bs=1 seek=593099264 ./qemu-img create -f qcow2 -ocluster_size=65536,backing_fmt=blksim -b /var/ramdisk/zero-500M.raw /var/ramdisk/test.qcow2 1098561536 ./qemu-io --auto --seed=30477694 --truth=/var/ramdisk/truth.raw --format=qcow2 --test=blksim:/var/ramdisk/test.qcow2 --verify_write=true --compare_before=false --compare_after=true --round=100000 --parallel=100 --io_size=10485760 --fail_prob=0 --cancel_prob=0 --instant_qemubh=true Signed-off-by: Chunqiang Tang <ctang@us.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | Introduce VCPU self-signaling serviceJan Kiszka2011-02-141-0/+1
|/ | | | | | | | Introduce qemu_cpu_kick_self to send SIG_IPI to the calling VCPU context. First user will be kvm. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* blockdev: Move BlockInterfaceType from qemu-common.h to blockdev.hMarkus Armbruster2011-01-311-6/+0
| | | | | Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Add documentation for STRTOSZ_DEFSUFFIX_ macrosJes Sorensen2011-01-311-0/+7
| | | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Acked-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Make strtosz() return int64_t instead of ssize_tJes Sorensen2011-01-241-2/+2
| | | | | | | | | strtosz() needs to return a 64 bit type even on 32 bit architectures. Otherwise qemu-img will fail to create disk images >= 2GB Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Delete useless 'extern' qualifiers for functionsBlue Swirl2011-01-231-1/+1
| | | | | | | 'extern' qualifier is useless for function declarations. Delete them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Merge branch 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemuAurelien Jarno2010-12-271-0/+3
|\ | | | | | | | | | | | | | | | | | | | | * 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemu: vnc/spice: add set_passwd monitor command. vnc: support password expire vnc: auth reject cleanup spice: add qmp 'query-spice' and hmp 'info spice' commands. spice: connection events. spice: add qxl device spice: add qxl vgabios binary.
| * vnc: support password expireGerd Hoffmann2010-12-091-0/+3
| | | | | | | | | | | | | | | | This patch adds support for expiring passwords to vnc. It adds a new vnc_display_pw_expire() function which specifies the time when the password will expire. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | Introduce strtosz_suffix()Jes Sorensen2010-12-171-0/+7
|/ | | | | | | | | | | | This introduces strtosz_suffix() which allows the caller to specify a default suffix in case the non default of MB is wanted. strtosz() is kept as a wrapper for strtosz_suffix() which keeps it's current default of MB. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* pcie/aer: helper functions for pcie aer capabilityIsaku Yamahata2010-11-221-0/+3
| | | | | | | | This patch implements helper functions for pcie aer capability which will be used later. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* Introduce strtosz() library function to convert a string to a byte count.Jes Sorensen2010-11-031-0/+1
| | | | | | | | | | | | | | | | | strtosz() returns -1 on error. It now supports human unit formats in eg. 1.0G, with better error handling. The following suffixes are supported: B/b = bytes K/k = KB M/m = MB G/g = GB T/t = TB This patch changes -numa and -m input to use strtosz(). Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori2010-11-011-0/+4
|\
| * Merge branch 'pci' into for_anthonyMichael S. Tsirkin2010-10-271-0/+4
| |\
| | * pcie port: define struct PCIEPort/PCIESlot and helper functionsIsaku Yamahata2010-10-201-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | define struct PCIEPort which represents common part of pci express port.(root, upstream and downstream.) add a helper function for pcie port which can be used commonly by root/upstream/downstream port. define struct PCIESlot which represents common part of pcie slot.(root and downstream.) and helper functions for it. helper functions for chassis, slot -> PCIESlot conversion. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| | * pcie: helper functions for pcie capability and extended capabilityIsaku Yamahata2010-10-191-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements helper functions for pci express capability and pci express extended capability allocation. NOTE: presence detection depends on pci_qdev_init() change. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
| | * pci_bridge: introduce pci bridge library.Isaku Yamahata2010-09-071-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | introduce pci bridge library. convert apb bridge and dec p2p bridge to use new pci bridge library. save/restore is supported as a side effect. This is also preparation for pci express root/upstream/downstream port. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | | Consolidate oom_check() functionsJes Sorensen2010-10-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | This consolidates the duplicated oom_check() functions, as well as splitting them into OS dependant versions to avoid the #ifdef grossness that was present in the old osdep.c version. Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | | Move qemu_gettimeofday() to OS specific filesJes Sorensen2010-10-301-0/+5
| | | | | | | | | | | | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | | Add fprintf_function for function pointers to fprintf-like functionsStefan Weil2010-10-301-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This kind of function pointers is used very often in qemu. The new data type uses format checking with GCC_FMT_ATTR and will be used in later patches. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | | Mov muldiv64 to qemu-common.h (Thus unbreaking gus)malc2010-10-301-0/+24
|/ / | | | | | | Signed-off-by: malc <av1474@comtv.ru>
* | qemu-timer: move commonly used timer code to qemu-timer-commonBlue Swirl2010-10-231-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move timer init functions to a new file, qemu-timer-common.c. Make other critical timer functions inlined to preserve performance in qemu-timer.c, also move muldiv64() (used by the inline functions) to qemu-timer.h. Adjust block/raw-posix.c and simpletrace.c to use get_clock() directly. Remove a similar/duplicate definition in qemu-tool.c. Adjust hw/omap_clk.c to include qemu-timer.h because muldiv64() is used there. After this change, tracing can be used also for user code and simpletrace on Win32. Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | Remove special handling of system include files (no longer needed)Stefan Weil2010-10-221-7/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The formerly used dyngen code did not work with system include files like stdio.h. Tests with Linux, OSX and Win32 show that this restriction is no longer needed. So we hopefully can remove that special piece of code. This results in cleaner code and allows better use of the new GCC_FMT_ATTR macro. Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | Replace most gcc format attributes by macro GCC_FMT_ATTR (format checking)Stefan Weil2010-10-031-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since version 4.4.x, gcc supports additional format attributes. __attribute__ ((format (gnu_printf, 1, 2))) should be used instead of __attribute__ ((format (printf, 1, 2)) because QEMU always uses standard format strings (even with mingw32). The patch replaces format attribute printf / __printf__ by macro GCC_FMT_ATTR which uses gnu_printf if supported. It also removes an #ifdef __GNUC__ (not needed any longer). Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | Move macros GCC_ATTR and GCC_FMT_ATTR to common header fileStefan Weil2010-09-221-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By moving the definition of GCC_ATTR and GCC_FMT_ATTR from audio_int.h to qemu-common.h these macros are now generally available for further patches which add the gcc format attribute. Newer gcc versions support format gnu_printf which is better suited for use in QEMU than format printf (QEMU always uses standard format strings (even with mingw32)). V2: Use correct operator '==' (instead of '=') Cc: Blue Swirl <blauwirbel@gmail.com> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* | cutils: qemu_iovec_copy and qemu_iovec_memsetKevin Wolf2010-09-211-0/+3
| | | | | | | | | | | | | | This adds two functions that work on QEMUIOVectors and will be used by the next qcow2 patches. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* | Rearrange block headersBlue Swirl2010-08-241-0/+7
|/ | | | | | | | | Changing block.h or blockdev.h resulted in recompiling most objects. Move DriveInfo typedef and BlockInterfaceType enum definitions to qemu-common.h and rearrange blockdev.h use to decrease churn. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* apic: qdev conversion cleanupBlue Swirl2010-06-191-1/+1
| | | | | | | | | Make APICState completely private to apic.c by using DeviceState in external APIs. Move apic_init() to pc.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* cow: stop using mmapChristoph Hellwig2010-06-151-3/+0
| | | | | | | | | | | | | We don't have an equivalent to mmap in the qemu block API, so read and write the bitmap directly. At least in the dumb implementation added in this patch this is a lot less efficient, but it means cow can also work on windows, and over nbd or curl. And it fixes qemu-iotests testcase 012 which did not work properly due to issues with read-only mmap access. In addition we can also get rid of the now unused get_mmap_addr function. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Move stdbool.hPaul Brook2010-06-131-0/+1
| | | | | | | Move inclusion of stdbool.h to common header files, instead of including in an ad-hoc manner. Signed-off-by: Paul Brook <paul@codesourcery.com>
* port qemu-kvm's on_vcpu codeMarcelo Tosatti2010-05-111-0/+8
| | | | | | | run_on_cpu allows to execute work on a given CPUState context. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* virtio: move typedef to qemu-commonMichael S. Tsirkin2010-04-011-0/+1
| | | | | | | | make it possible to use type without header include, simplifying header dependencies. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* notifier: event notifier implementationMichael S. Tsirkin2010-04-011-0/+1
| | | | | | | | | | | | | event notifiers are slightly generalized eventfd descriptors. Current implementation depends on eventfd because vhost is the only user, and vhost depends on eventfd anyway, but a stub is provided for non-eventfd case. We'll be able to further generalize this when another user comes along and we see how to best do this. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Compile qemu-timer only onceBlue Swirl2010-03-291-4/+4
| | | | | | | | | Arrange various declarations so that also non-CPU code can access them, adjust users. Move CPU specific code to cpus.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Move cpu_exec_init_all() declaration to qemu-common.hBlue Swirl2010-03-291-0/+2
| | | | | | Let cpu_exec_init_all() be called from non-CPU code. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* rename IOCanRWHandler to IOCanReadHandlerJuan Quintela2010-03-191-1/+1
| | | | | | | It was always only used for reads Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* split out qemu-timer.cPaolo Bonzini2010-03-171-0/+1
| | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote branch 'qemu-kvm/uq/master' into stagingAnthony Liguori2010-02-221-0/+1
|\
| * use eventfd for iothreadPaolo Bonzini2010-02-171-0/+1
| | | | | | | | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Avi Kivity <avi@redhat.com>
* | Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori2010-02-191-0/+2
|\ \
| * | pci: move pcibus_t to qemu-commonMichael S. Tsirkin2010-02-141-0/+2
| |/ | | | | | | | | | | move pcibus_t to qemu-common.h to simplify header dependencies. Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* | get rid of hostregs_helper.hPaolo Bonzini2010-02-181-0/+2
|/ | | | | | | | | Since b567b38 (target-arm: remove T0 and T1, 2009-10-16) the only global register that is used is AREG0, so the complexity of hostregs_helper.h is unused. Use regular assignments and a compiler optimization barrier. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
OpenPOWER on IntegriCloud