summaryrefslogtreecommitdiffstats
path: root/qemu-common.h
Commit message (Collapse)AuthorAgeFilesLines
* qemu-common: add QEMU_ALIGN_DOWN() and QEMU_ALIGN_UP() macrosStefan Hajnoczi2011-12-051-0/+6
| | | | | | | | | | | | | | Add macros for aligning a number to a multiple, for example: QEMU_ALIGN_DOWN(500, 2000) = 0 QEMU_ALIGN_UP(500, 2000) = 2000 Since ALIGN_UP() is a common macro name use the QEMU_* namespace prefix. Hopefully this will protect us from included headers that leak something with a similar name. Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* Move filedescriptor parsing code from net.c into qemu_parse_fd()Stefan Berger2011-11-011-0/+1
| | | | | | | | | | | | Move the parsing of a filedescriptor into a common function qemu_parse_fd() so others can use it as well. Have net.c call this function. v2: - moving qemu_parse_fd into cutils.c Signed-off-by: Stefan Berger <stefanb@linux.vnet.ibm.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* main-loop: create main-loop.cPaolo Bonzini2011-10-211-3/+0
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* main-loop: create main-loop.hPaolo Bonzini2011-10-211-30/+0
| | | | Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* qemu-timer: move icount to cpus.cPaolo Bonzini2011-10-211-0/+4
| | | | | | | None of this is needed by tools, and most of it can even be made static inside cpus.c. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
* core: remove qemu_service_ioFrediano Ziglio2011-09-231-3/+0
| | | | | | | | | qemu_service_io was mainly an alias to qemu_notify_event, currently used only by PPC for timer hack, so call qemu_notify_event directly. Signed-off-by: Frediano Ziglio <freddy77@gmail.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Remove qemu_malloc/qemu_freeAnthony Liguori2011-08-201-6/+0
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Make glib mandatory and fixup utils appropriatelyAnthony Liguori2011-08-201-0/+1
| | | | Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'qemu-kvm/uq/master' into stagingAnthony Liguori2011-08-081-0/+2
|\
| * qemu: Add strtosz_suffix_unit functionJoerg Roedel2011-08-051-0/+2
| | | | | | | | | | | | | | | | | | | | This function does the same as the strtosz_suffix function except that it allows to specify the unit to which the k/M/B/T suffixes apply. This function will be used later to parse the tsc-frequency from the command-line. Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>
* | Avoid allocating TCG resources in non-TCG modeJan Kiszka2011-08-051-1/+4
|/ | | | | | | | | Do not allocate TCG-only resources like the translation buffer when running over KVM or XEN. Saves a "few" bytes in the qemu address space and is also conceptually cleaner. Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Merge remote-tracking branch 'kraxel/usb.22' into stagingAnthony Liguori2011-08-041-0/+1
|\
| * move QEMUSGList typedefGerd Hoffmann2011-08-041-0/+1
| | | | | | | | | | | | | | Move the QEMUSGList typedef to qemu-common so it can easily be used. The actual struct definition stays in dma.h. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
* | async: Remove AsyncContextKevin Wolf2011-08-021-4/+0
|/ | | | | | | | | | | The purpose of AsyncContexts was to protect qcow and qcow2 against reentrancy during an emulated bdrv_read/write (which includes a qemu_aio_wait() call and can run AIO callbacks of different requests if it weren't for AsyncContexts). Now both qcow and qcow2 are protected by CoMutexes and AsyncContexts can be removed. Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* move WORDS_ALIGNED to qemu-common.hPaolo Bonzini2011-07-291-0/+4
| | | | | | | | This is not a CPU interface, and a configure test would not be too precise. So just add it to qemu-common.h. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Wrap recv to avoid warningsBlue Swirl2011-07-251-0/+6
| | | | | | | | | | | | | Avoid warnings like these by wrapping recv(): CC slirp/ip_icmp.o /src/qemu/slirp/ip_icmp.c: In function 'icmp_receive': /src/qemu/slirp/ip_icmp.c:418:5: error: passing argument 2 of 'recv' from incompatible pointer type [-Werror] /usr/local/lib/gcc/i686-mingw32msvc/4.6.0/../../../../i686-mingw32msvc/include/winsock2.h:547:32: note: expected 'char *' but argument is of type 'struct icmp *' Remove also casts used to avoid warnings. Reviewed-by: Anthony Liguori <aliguori@us.ibm.com> Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Introduce compiler.h header fileLuiz Capitulino2011-07-211-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>
* Remove unneeded setjmp.h (fix compilation on Debian "lenny")Stefan Weil2011-07-121-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>
* w32: Remove redundant definitions of PRI*64Stefan Weil2011-06-241-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>
* cocoa: Provide central qemu_main() prototypeAndreas Färber2011-06-141-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>
* Fix compilation warning due to missing header for sigactionAlexandre Raymond2011-06-081-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>
* Add documentation for qemu_progress_{init,print}()Jes Sorensen2011-05-181-1/+1
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
* w32: Fix missing declaration of ffs()Stefan Weil2011-05-151-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>
* 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>
OpenPOWER on IntegriCloud