summaryrefslogtreecommitdiffstats
path: root/qemu-common.h
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* block: avoid creating too large iovecs in multiwrite_mergeChristoph Hellwig2010-01-261-0/+4
| | | | | | | | | | | | | If we go over the maximum number of iovecs support by syscall we get back EINVAL from the kernel which translate to I/O errors for the guest. Add a MAX_IOV defintion for platforms that don't have it. For now we use the same 1024 define that's used on Linux and various other platforms, but until the windows block backend implements some kind of vectored I/O it doesn't matter. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* force to test result for qemu_write_full()Juan Quintela2010-01-261-1/+2
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Introduce qemu_write_full()Kirill A. Shutemov2010-01-261-0/+1
| | | | | | | | A variant of write(2) which handles partial write. Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name> Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Fix QEMU_WARN_UNUSED_RESULTKevin Wolf2010-01-191-1/+2
| | | | | | | | | | | | Since commit 747bbdf7 QEMU_WARN_UNUSED_RESULT is never defined as it is conditional on a define from config-host.h which is included only later. Include that file earlier to get the warnings back. Reactivating it unfortunately leads to some warnings about unused qdev_init results. These calls are changed to qdev_init_nofail to avoid build failures. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Don't leak file descriptorsKevin Wolf2009-12-031-0/+7
| | | | | | | | We're leaking file descriptors to child processes. Set FD_CLOEXEC on file descriptors that don't need to be passed to children to stop this misbehaviour. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* pci: move typedef, PCIHostState, PCIExpressHost to qemu-common.h.Isaku Yamahata2009-12-011-0/+2
| | | | | | | | | This patch moves two typedefs, PCIHostState and PCIExpressHost to qemu-common.h for consistency as PCIBus and PCIDevice are typedefed in qemu-common.h. Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
* BCD cleanupPaul Brook2009-11-221-0/+11
| | | | | | Combine multiple BCD implementations. Signed-off-by: Paul Brook <paul@codesourcery.com>
* Introduce contexts for asynchronous callbacksKevin Wolf2009-10-271-0/+4
| | | | | | | | | Add the possibility to use AIO and BHs without allowing foreign callbacks to be run. Basically, you put your own AIOs and BHs in a separate context. For details see the comments in the source. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Split out bottom halvesKevin Wolf2009-10-271-0/+1
| | | | | | | | Instead of putting more and more stuff into vl.c, let's have the generic functions that deal with asynchronous callbacks in their own file. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* net: add macaddr type.Gerd Hoffmann2009-10-271-0/+1
| | | | | | | | | | Add new type for mac addresses. Add function which sets the qemu default mac address if it finds the mac address uninitialized (i.e. all zeros). Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Suppress warnings about 'warn_unused_result' attribute directiveBlue Swirl2009-10-181-0/+5
| | | | Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* net: refactor packet queueing codeMark McLoughlin2009-10-151-0/+1
| | | | | | | | | | The packet queue code is fairly standalone, has some complex details and easily reusable. It makes sense to split it out on its own. This patch doesn't contain any functional changes. Patchworks-ID: 35511 Signed-off-by: Mark McLoughlin <markmc@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* unlock iothread mutex before running kvm ioctlGlauber Costa2009-10-121-0/+3
| | | | | | | | | Without this, kvm will hold the mutex while it issues its run ioctl, and never be able to step out of it, causing a deadlock. Patchworks-ID: 35359 Signed-off-by: Glauber Costa <glommer@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* block: use fdatasync instead of fsync if possibleChristoph Hellwig2009-09-111-0/+1
| | | | | | | | | | | | | | If we are flushing the caches for our image files we only care about the data (including the metadata required for accessing it) but not things like timestamp updates. So try to use fdatasync instead of fsync to implement the flush operations. Unfortunately many operating systems still do not support fdatasync, so we add a qemu_fdatasync wrapper that uses fdatasync if available as per the _POSIX_SYNCHRONIZED_IO feature macro or fsync otherwise. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* Add bdrv_aio_multiwriteKevin Wolf2009-09-111-0/+1
| | | | | | | | | | | | | | | | | One performance problem of qcow2 during the initial image growth are sequential writes that are not cluster aligned. In this case, when a first requests requires to allocate a new cluster but writes only to the first couple of sectors in that cluster, the rest of the cluster is zeroed - just to be overwritten by the following second request that fills up the cluster. Let's try to merge sequential write requests to the same cluster, so we can avoid to write the zero padding to the disk in the first place. As a nice side effect, also other formats take advantage of dealing with less and larger requests. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* user: compile path.c only onceBlue Swirl2009-08-151-0/+4
| | | | | | Also merge bsd-user/path.c and linux-user/path.c. Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
* Define ENOTSUP anywhere it isn't definedAnthony Liguori2009-07-281-1/+1
| | | | | | I confused ENOTSUP with ENOTSUPP. Juan's original patch was correct. Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* define ENOTSUP the same that the other errorsJuan Quintela2009-07-271-2/+3
| | | | | | | aliguori: ENOTSUP is not 4096 universally, only on OpenBSD Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
* rename HAVE_IOVEC to CONFIG_IOVECJuan Quintela2009-07-271-2/+2
| | | | | Signed-off-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
OpenPOWER on IntegriCloud