Commit Graph

18309 Commits

Author SHA1 Message Date
Corey Bryant 7b93fadf3a Add basic version of bridge helper
This patch adds a helper that can be used to create a tap device attached to
a bridge device.  Since this helper is minimal in what it does, it can be
given CAP_NET_ADMIN which allows qemu to avoid running as root while still
satisfying the majority of what users tend to want to do with tap devices.

The way this all works is that qemu launches this helper passing a bridge
name and the name of an inherited file descriptor.  The descriptor is one
end of a socketpair() of domain sockets.  This domain socket is used to
transmit a file descriptor of the opened tap device from the helper to qemu.

The helper can then exit and let qemu use the tap device.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Richa Marwaha <rmarwah@linux.vnet.ibm.com>
Signed-off-by: Corey Bryant <coreyb@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 16:24:38 -06:00
Gerhard Wiesinger 069ab0eb8a hw/vmmouse.c: Disable vmmouse after reboot
Bugfix after reboot when vmmouse was enabled and another OS which uses e.g. PS/2
mouse.

Details:
When a guest activated the vmmouse followed by a reboot the vmmouse was still
enabled and the PS/2 mouse was therefore unsusable. When another guest is then
booted without vmmouse support (e.g. PS/2 mouse) the mouse is not working.

Reason is that VMMouse has priority and disables all other mouse entities
and therefore must be disabled on reset.

Testscenario:
1.) Boot e.g. OS with VMMouse support (e.g. Windows with VMMouse tools)
2.) reboot
3.) Boot e.g. OS without VMMouse support (e.g. DOS) => PS/2 mouse doesn't work
     any more. Fixes that issue.

Testscenario 2 by Jan Kiszka <jan.kiszka@siemens.com>:
Confirm that this patch fixes a real issue. Setup: qemu.git,
opensuse 11.4 guest, SDL graphic, system_reset while guest is using the
vmmouse. Without the patch, the vmmouse become unusable after the
reboot. Also, the mouse stays in absolute mode even before X starts again.

Fixed by:
Disabling the vmmouse in its reset handler.

Tested-by: Andreas F=E4rber <afaerber@suse.de>
Signed-off-by: Gerhard Wiesinger <lists@wiesinger.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 16:24:38 -06:00
Laszlo Ersek 93dd748b78 keep the PID file locked for the lifetime of the process
The lockf() call in qemu_create_pidfile() aims at ensuring mutual
exclusion. We shouldn't close the pidfile on success (as introduced by
commit 1bbd1592), because that drops the lock as well [1]:

    "File locks shall be released on first close by the locking process
    of any file descriptor for the file."

Coverity may complain again about the leaked file descriptor; let's
worry about that later.

v1->v2:
- add reference to 1bbd1592
- explain the intentional fd leak in the source

[1] http://pubs.opengroup.org/onlinepubs/9699919799/functions/lockf.html

Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 16:23:57 -06:00
Michael Roth d34e8f6e9d main-loop: For tools, initialize timers as part of qemu_init_main_loop()
In some cases initializing the alarm timers can lead to non-negligable
overhead from programs that link against qemu-tool.o. At least,
setting a max-resolution WinMM alarm timer via mm_start_timer() (the
current default for Windows) can increase the "tick rate" on Windows
OSs and affect frequency scaling, and in the case of tools that run
in guest OSs such has qemu-ga, the impact can be fairly dramatic
(+20%/20% user/sys time on a core 2 processor was observed from an idle
Windows XP guest).

This patch doesn't address the issue directly (not sure what a good
solution would be for Windows, or what other situations it might be
noticeable), but it at least limits the scope of the issue to programs
that "opt-in" to using the main-loop.c functions by only enabling alarm
timers when qemu_init_main_loop() is called, which is already required
to make use of those facilities, so existing users shouldn't be
affected.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:02 -06:00
Michael Roth ee77dfb26a main-loop: Fix SetEvent() on uninitialized handle on win32
The __attribute__((constructor)) init_main_loop() automatically get
called if qemu-tool.o is linked in. On win32, this leads to
a qemu_notify_event() call which attempts to SetEvent() on a HANDLE that
won't be initialized until qemu_init_main_loop() is manually called,
breaking qemu-tools.o programs on Windows at runtime.

This patch checks for an initialized event handle before attempting to
set it, which is analoguous to how we deal with an unitialized
io_thread_fd in the posix implementation.

Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:02 -06:00
Jan Kiszka 6fbcef296a optionroms: Silence intermediate file removal
The build process of optionroms spits out an "rm ..." line. Moreover, it
removes all .o files that can be handy for debugging purposes. So
disable automatic intermediate removal.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:02 -06:00
Jan Kiszka 02df4d6fb4 sdl: Limit sdl_grab_end in handle_activation to Windows hosts
There are scenarios on Linux with some SDL versions where
handle_activation is continuous invoked with state = SDL_APPINPUTFOCUS
and gain = 0 while we grabbed the input. This causes a ping-pong when we
grab the input after an absolute mouse entered the window.

As this sdl_grab_end was once introduced to work around a Windows-only
issue (0294ffb9c8), limit it to that platform.

CC: Erik Rull <erik.rull@rdsoftware.de>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:02 -06:00
Jan Kiszka 822f98d2a5 sdl: Grab input on end of non-absolute mouse click
By grabbing the input already on button down, we leave the button in
that state for the host GUI. Thus it takes another click after releasing
the input again to synchronize the mouse button state.

Avoid this by grabbing on button up.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:02 -06:00
Jan Kiszka eaa2e027b7 Revert "Handle SDL grabs failing (Mark McLoughlin)"
This reverts commit 6bb816031f.

SDL_WM_GrabInput does not reliably bail out if grabbing is impossible.
So if we get here, we already lost and will block. But this can no
longer happen due to the check in sdl_grab_start. So this patch became
obsolete.

Conflicts:

	sdl.c

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:02 -06:00
Jan Kiszka 85f94f868f sdl: Fix block prevention of SDL_WM_GrabInput
Consistently check for SDL_APPINPUTFOCUS before trying to grab the input
focus. Just checking for SDL_APPACTIVE doesn't work. Moving the check to
sdl_grab_start allows for some consolidation.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:02 -06:00
Jan Kiszka 6659635619 sdl: Do not grab mouse on mode switch while in background
When the mouse mode changes to absolute while the SDL windows is not in
focus, refrain from grabbing the input. It would steal from some other
window.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:01 -06:00
Jan Kiszka 25de593506 Improve default machine options usability
So far we overwrite the machine options completely with defaults if no
accel=value is provided. More user friendly is to fill in only
unspecified options. The new qemu_opts_set_defaults enables this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:01 -06:00
Jan Kiszka 433acf0dac mc146818rtc: Use lost_tick_policy property
Allow to configure the MC146818 RTC via the new lost tick policy
property and replace rtc_td_hack with this mechanism.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:01 -06:00
Jan Kiszka 4f6dd9af9c qemu-option: Introduce default mechanism
This adds qemu_opts_set_defaults, an interface provide default values
for a QemuOpts set. Default options are parsed from a string and then
prepended to the list of existing options, or they serve as the sole
QemuOpts set.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:01 -06:00
Jan Kiszka 4e4fa398db qdev: Introduce lost tick policy property
Potentially tick-generating timer devices will gain a common property:
lock_tick_policy. It allows to encode 4 different ways how to deal with
tick events the guest did not process in time:

discard - ignore lost ticks (e.g. if the guest compensates for them
          already)
delay   - replay all lost ticks in a row once the guest accepts them
          again
merge   - if multiple ticks are lost, all of them are merged into one
          which is replayed once the guest accepts it again
slew    - lost ticks are gradually replayed at a higher frequency than
          the original tick

Not all timer device will need to support all modes. However, all need
to accept the configuration via this common property.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:01 -06:00
Peter Maydell 67ed96f9f2 Makefile: Remove linux-headers/asm symlink on distclean
configure creates a linux-headers/asm symlink. Remove this when
doing a distclean.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:01 -06:00
Peter Maydell 771124e1a6 exec.c: Clarify comment about tlb_flush() flush_global parameter
Clarify the comment about tlb_flush()'s flush_global parameter,
so it is clearer what it does and why it is OK that the implementation
currently ignores it.

Reviewed-by: Andreas F=C3=A4rber <afaerber@suse.de>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:45:01 -06:00
Aneesh Kumar K.V 23704102ba hw/9pfs: Update MAINTAINERS file
Acked-by: Venkateswararao Jujjuri <jvrao@linux.vnet.ibm.com>
Signed-off-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:42:03 -06:00
Stefan Weil 1bdd687454 MAINTAINERS: Add a section for the host OS and a W32 maintainer
Up to now, there was no special section for the different
host operating systems used with QEMU.

scripts/get_maintainer.pl did not show a maintainer for
OS specific files and patches.

Therefore I added three hosts systems:

* POSIX for the majority of host systems which are supported.
  This includes BSD and Linux host systems.

* LINUX is a special case of POSIX needed for some Linux specific
  files and directories.

* W32, W64 for a well known family of closed source operating systems.

I also added myself as a maintainer for W32, W64.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:42:03 -06:00
Sergei Trofimovich 5f01e06f1f ./configure: add link check for nss-smartcard
Current './configure --static && make' fails for me:

    LINK  qemu-nbd
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lssl3
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lsmime3
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lnssutil3
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lnss3
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lplds4
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lplc4
    /usr/lib/gcc/x86_64-pc-linux-gnu/4.5.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lnspr4

My system does not provide static libraries for nss, so
fix autoconfiguration by link checking.

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
CC: qemu-trivial <qemu-trivial@nongnu.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:42:03 -06:00
Sergei Trofimovich 17884d7b64 ./configure: request pkg-config to provide private libs when static linking
Added wrapper around pkg-config to allow:
- safe options injection via ${QEMU_PKG_CONFIG_FLAGS}
- spaces in path to pkg-config

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
CC: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-02-01 14:42:03 -06:00
Paolo Bonzini 1d84950234 m48t59: use rtc_clock for alarm timer
This lets the RTC get adjustments from the host NTP client.
The watchdog still uses the vm_clock.  The previous behavior is
available with "-rtc clock=vm".

Cc: Andreas Färber <afaerber@suse.de>
Reviewed-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-30 19:14:59 +00:00
Fabien Chouteau 0c685d2827 GRLIB UART: Add RX channel
This patch implements the RX channel of GRLIB UART with a FIFO to
improve data rate.

Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-30 19:13:21 +00:00
Avi Kivity fd39941ac7 Fix off-by-one in dirty bitmap functions
Reported-by: Stefan Berger <stefanb@linux.vnet.ibm.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2012-01-29 14:53:55 +00:00
Blue Swirl 9ec032d2ac Merge branch 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
* 'target-arm.for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  Add Cortex-A15 CPU definition
  Add dummy implementation of generic timer cp15 registers
  arm: store the config_base_register during cpu_reset
  target-arm/helper.c: Don't assume softfloat int32 is 32 bits only
  target-arm: Fix implementation of TLB invalidate operations
2012-01-28 13:11:20 +00:00
Andreas Färber 0f36036c5c unin_pci: Fix typos in device names
Commit 999e12bbe8 (sysbus: apic: ioapic:
convert to QEMU Object Model) introduced two typos, one of which broke
the mac99 machine.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 14:55:36 -06:00
Anthony Liguori 7309335441 qdev: change ambiguous qdev names
Reported-by: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:55 -06:00
Anthony Liguori 19b6914a00 virtio-s390: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:55 -06:00
Anthony Liguori 999e12bbe8 sysbus: apic: ioapic: convert to QEMU Object Model
This converts three devices because apic and ioapic are subclasses of sysbus.
Converting subclasses independently of their base class is prohibitively hard.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:50 -06:00
Anthony Liguori 40021f0888 pci: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:50 -06:00
Andreas Färber 6e4ec3f9bb unin_pci: Drop unused reset handler
Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-27 10:50:50 -06:00
Andreas Färber ff452aceaf unin_pci: Drop duplicate busdev
PCIHostState already has a busdev.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-27 10:50:49 -06:00
Andreas Färber 70f9c98744 unin_pci: Clean up qdev names
Add -pcihost to SysBus devices to resolve name conflicts,
and clarify PCI vs. Internal PCI.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Signed-off-by: Alexander Graf <agraf@suse.de>
2012-01-27 10:50:49 -06:00
Anthony Liguori f82e35e38c virtio-serial: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:49 -06:00
Anthony Liguori 3954d33ab7 spapr: convert to QEMU Object Model (v2)
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
v1 -> v2
 - use QOM to check for the default console
2012-01-27 10:50:49 -06:00
Anthony Liguori b9eea3e6a4 scsi: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:49 -06:00
Anthony Liguori d148211c6d ide: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:49 -06:00
Anthony Liguori dbaa790451 hda-codec: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:48 -06:00
Anthony Liguori b5ea932781 i2c: smbus: convert to QEMU Object Model
This converts two types because smbus is implemented as a subclass of i2c.  It's
extremely difficult to convert these two independently.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:47 -06:00
Anthony Liguori 9e07bdf816 i2c: rename i2c_slave -> I2CSlave
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:47 -06:00
Anthony Liguori cd6c4cf28b ssi: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:47 -06:00
Anthony Liguori ba7c05205c ccid: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:47 -06:00
Anthony Liguori 62aed76583 usb: convert to QEMU Object Model
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:47 -06:00
Anthony Liguori 8f04ee0882 isa: pic: convert to QEMU Object Model
This converts two devices at once because PIC subclasses ISA and converting
subclasses independently is extremely hard.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:47 -06:00
Anthony Liguori e855761ca8 qdev: prepare source tree for code conversion
These are various small stylistic changes which help make things more
consistent such that the automated conversion script can be simpler.

It's not necessary to agree or disagree with these style changes because all
of this code is going to be rewritten by the patch monkey script anyway.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:47 -06:00
Anthony Liguori 3dde52d2fe qdev: add class_init to DeviceInfo
Since we are still dynamically creating TypeInfo, we need to chain the
class_init function in order to be able to make use of it within subclasses of
TYPE_DEVICE.

This will disappear once we register TypeInfos directly.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:46 -06:00
Anthony Liguori 3cc90eb2b7 qdev: add a interface to register subclasses
In order to introduce inheritance while still using the qdev registration
interfaces, we need to be able to use a parent other than TYPE_DEVICE.  Add a
new interface that allows this.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:46 -06:00
Anthony Liguori 94afdadcb3 qdev: use a wrapper to access reset and promote reset to a class method
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:46 -06:00
Anthony Liguori f79f2bfc6a qdev: don't access name through info
We already have a QOM interface for this so let's use it.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:39 -06:00
Anthony Liguori 30fbb9fc7c qdev: move qdev->info to class
Right now, DeviceInfo acts as the class for qdev.  In order to switch to a
proper ObjectClass derivative, we need to ween all of the callers off of
interacting directly with the info pointer.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
2012-01-27 10:50:34 -06:00