summaryrefslogtreecommitdiff
path: root/qemu-common.h
AgeCommit message (Collapse)AuthorFilesLines
2011-07-21Introduce compiler.h header fileLuiz Capitulino1-24/+1
This moves compiler related macros from qemu-common.h to compiler.h. The reason for this change is that there are simple header files that depend only on the compiler macros, so including qemu-common.h is overkill. Besides, qemu-common.h is bloated and will benefit from some splitting. Please, also note that the QEMU_BUILD_BUG_ON() macro is being fixed to not use double underscores as a prefix and the license text was added by Vassili Karpov (malc), who is one of the authors of the new file. Signed-off-by: Luiz Capitulino <lcapitulino@gmail.com>
2011-07-12Remove unneeded setjmp.h (fix compilation on Debian "lenny")Stefan Weil1-1/+0
Some versions of png.h cannot be included after setjmp.h, even when PNG_SKIP_SETJMP_CHECK was defined. setjmp.h was included from qemu-common.h and is not needed there. Removing the include statement fixes compilation of ui/vnc-enc-tight.c with CONFIG_VNC_PNG defined. Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-06-24w32: Remove redundant definitions of PRI*64Stefan Weil1-5/+0
The PRI*64 macros are defined in MinGW's inttypes.h since 2002, so they are not needed in qemu-common.h (which includes inttypes.h). Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-06-14cocoa: Provide central qemu_main() prototypeAndreas Färber1-0/+5
This fixes a missing prototype warning in vl.c and obsoletes the prototype in cocoa.m. Adjust callers in cocoa.m to supply third argument, which is currently only used on Linux/ppc. The prototype is designed so that it could be shared with SDL and other frontends, if desired. Cc: Alexandre Raymond <cerbere@gmail.com> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
2011-06-08Fix compilation warning due to missing header for sigactionAlexandre Raymond1-0/+1
Fix the following warning by including signal.h directly in qemu-common.h ----8<---- iohandler.c: In function ‘qemu_init_child_watch’: iohandler.c:172: warning: implicit declaration of function ‘sigaction’ iohandler.c:172: warning: nested extern declaration of ‘sigaction’ ----8<---- Signed-off-by: Alexandre Raymond <cerbere@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
2011-05-18Add documentation for qemu_progress_{init,print}()Jes Sorensen1-1/+1
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-05-15w32: Fix missing declaration of ffs()Stefan Weil1-5/+0
target-ppc/cpu.h now needs ffs(), too, so ffs() must be declared before this file is included. Moving the declaration from qemu-common.h to qemu-os-win32.h (which is included in qemu-common.h early) fixes the compiler warning for w32. Cc: Aurelien Jarno <aurelien@aurel32.net> Signed-off-by: Stefan Weil <weil@mail.berlios.de> Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-04-15Move generic or OS function declarations to qemu-common.hBlue Swirl1-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>
2011-04-15enable vm_clock to "warp" in the iothread+icount casePaolo Bonzini1-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>
2011-04-07qemu-img: Initial progress printing supportJes Sorensen1-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>
2011-03-29add a service to reap zombies, use it in SLIRPPaolo Bonzini1-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>
2011-03-29extract I/O handler lists to iohandler.cPaolo Bonzini1-0/+3
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2011-03-15x86: Refine error reporting of MCE injection servicesJan Kiszka1-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>
2011-03-13Refactor thread retrieval and checkJan Kiszka1-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>
2011-03-06WIN32: Add missing include for 'struct timeval', used in vnc.hHervé Poussineau1-0/+1
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-02-16Merge remote branch 'kwolf/for-anthony' into stagingAnthony Liguori1-0/+2
2011-02-14Introduce VCPU self-signaling serviceJan Kiszka1-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>
2011-02-10QCOW2: bug fix - read base image beyond its sizeChunqiang Tang1-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>
2011-01-31blockdev: Move BlockInterfaceType from qemu-common.h to blockdev.hMarkus Armbruster1-6/+0
Signed-off-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-01-31Add documentation for STRTOSZ_DEFSUFFIX_ macrosJes Sorensen1-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>
2011-01-24Make strtosz() return int64_t instead of ssize_tJes Sorensen1-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>
2011-01-23Delete useless 'extern' qualifiers for functionsBlue Swirl1-1/+1
'extern' qualifier is useless for function declarations. Delete them. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-12-27Merge branch 'spice.v23.pull' of git://anongit.freedesktop.org/spice/qemuAurelien Jarno1-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.
2010-12-17Introduce strtosz_suffix()Jes Sorensen1-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>
2010-12-09vnc: support password expireGerd Hoffmann1-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>
2010-11-22pcie/aer: helper functions for pcie aer capabilityIsaku Yamahata1-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>
2010-11-03Introduce strtosz() library function to convert a string to a byte count.Jes Sorensen1-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>
2010-11-01Merge remote branch 'mst/for_anthony' into stagingAnthony Liguori1-0/+4
2010-10-30Consolidate oom_check() functionsJes Sorensen1-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>
2010-10-30Move qemu_gettimeofday() to OS specific filesJes Sorensen1-0/+5
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2010-10-30Add fprintf_function for function pointers to fprintf-like functionsStefan Weil1-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>
2010-10-30Mov muldiv64 to qemu-common.h (Thus unbreaking gus)malc1-0/+24
Signed-off-by: malc <av1474@comtv.ru>
2010-10-27Merge branch 'pci' into for_anthonyMichael S. Tsirkin1-0/+4
2010-10-23qemu-timer: move commonly used timer code to qemu-timer-commonBlue Swirl1-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>
2010-10-22Remove special handling of system include files (no longer needed)Stefan Weil1-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>
2010-10-20pcie port: define struct PCIEPort/PCIESlot and helper functionsIsaku Yamahata1-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>
2010-10-19pcie: helper functions for pcie capability and extended capabilityIsaku Yamahata1-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>
2010-10-03Replace most gcc format attributes by macro GCC_FMT_ATTR (format checking)Stefan Weil1-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>
2010-09-22Move macros GCC_ATTR and GCC_FMT_ATTR to common header fileStefan Weil1-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>
2010-09-21cutils: qemu_iovec_copy and qemu_iovec_memsetKevin Wolf1-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>
2010-09-07pci_bridge: introduce pci bridge library.Isaku Yamahata1-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>
2010-08-24Rearrange block headersBlue Swirl1-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>
2010-06-19apic: qdev conversion cleanupBlue Swirl1-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>
2010-06-15cow: stop using mmapChristoph Hellwig1-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>
2010-06-13Move stdbool.hPaul Brook1-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>
2010-05-11port qemu-kvm's on_vcpu codeMarcelo Tosatti1-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>
2010-04-01virtio: move typedef to qemu-commonMichael S. Tsirkin1-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>
2010-04-01notifier: event notifier implementationMichael S. Tsirkin1-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>
2010-03-29Compile qemu-timer only onceBlue Swirl1-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>
2010-03-29Move cpu_exec_init_all() declaration to qemu-common.hBlue Swirl1-0/+2
Let cpu_exec_init_all() be called from non-CPU code. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>