sdk/emulator/qemu.git
15 years agoconfigure: detect xen with --extra-cflags / --extra-ldflags
Christoph Egger [Tue, 30 Jun 2009 12:59:38 +0000 (14:59 +0200)]
configure: detect xen with --extra-cflags / --extra-ldflags

Attached patch lets configure find xen headers and xen libs
when called with --extra-cflags and --extra-ldflags options.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoQEMU: MCE: Add MCE simulation to qemu/tcg
Huang Ying [Tue, 23 Jun 2009 02:05:14 +0000 (10:05 +0800)]
QEMU: MCE: Add MCE simulation to qemu/tcg

- MCE features are initialized when VCPU is intialized according to CPUID.
- A monitor command "mce" is added to inject a MCE.
- A new interrupt mask: CPU_INTERRUPT_MCE is added to inject the MCE.

aliguori: fix build for linux-user

Signed-off-by: Huang Ying <ying.huang@intel.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMerge commit 'linux-user/linux-user-for-upstream' into tmp-staging
Anthony Liguori [Thu, 9 Jul 2009 20:09:27 +0000 (15:09 -0500)]
Merge commit 'linux-user/linux-user-for-upstream' into tmp-staging

15 years agoMIPS signal handling fix
Paul Brook [Thu, 9 Jul 2009 17:40:15 +0000 (18:40 +0100)]
MIPS signal handling fix

Add explicit padding to MIPS signal frame structures.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoEnable MIPS NPTL
Paul Brook [Thu, 9 Jul 2009 16:56:24 +0000 (17:56 +0100)]
Enable MIPS NPTL

Enable NPTL support for MIPS usermode emulation.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoMIPS atomic instructions
Paul Brook [Thu, 9 Jul 2009 16:45:17 +0000 (17:45 +0100)]
MIPS atomic instructions

Implement MIPS ll/sc instructions using atomic compare+exchange.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoMIPS usermode TLS register
Paul Brook [Thu, 9 Jul 2009 14:07:57 +0000 (15:07 +0100)]
MIPS usermode TLS register

Implement cpu_set_tls for MIPS.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoFix MIPS sys_clone
Paul Brook [Thu, 9 Jul 2009 12:11:52 +0000 (13:11 +0100)]
Fix MIPS sys_clone

The clone syscall takes 6 args.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoqdev: convert ac97.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:13 +0000 (14:12 +0200)]
qdev: convert ac97.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqdev: convert es1370.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:12 +0000 (14:12 +0200)]
qdev: convert es1370.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqdev/pci: misc fixes.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:11 +0000 (14:12 +0200)]
qdev/pci: misc fixes.

* fix secondary bus setup.
 * use base->name instead of "FIXME" for device name.
   Yes, the device name is redundant.  Only for drivers converted
   to qdev already though.  Once all drivers are converted we can
   and should kill it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqdev: remove DeviceType
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:09 +0000 (14:12 +0200)]
qdev: remove DeviceType

The only purpose DeviceType serves is creating a linked list of
DeviceInfo structs.  This removes DeviceType and add a next field to
DeviceInfo instead, so the DeviceInfo structs can be changed that way.
Elimitates a pointless extra level of indirection.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoqdev: replace bus_type enum with bus_info struct.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:08 +0000 (14:12 +0200)]
qdev: replace bus_type enum with bus_info struct.

BusInfo is filled with name and size (pretty much like I did for
DeviceInfo as well).  There is also a function pointer to print
bus-specific device information to the monitor.  sysbus is hooked
up there, I've also added a print function for PCI.

Device creation is slightly modified as well:  The device type search
loop now also checks the bus type while scanning the list instead of
complaining thereafter in case of a mismatch.  This effectively gives
each bus a private namespace for device names.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoqdev: update pci device registration.
Gerd Hoffmann [Tue, 30 Jun 2009 12:12:07 +0000 (14:12 +0200)]
qdev: update pci device registration.

Makes pci_qdev_register take a PCIDeviceInfo struct instead of a bunch
of parameters.  Also adds config_read and config_write callbacks to
PCIDeviceInfo, so drivers needing these can be converted to the qdev
device API too.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
15 years agoRemove SDL/ prefix
malc [Wed, 8 Jul 2009 14:25:37 +0000 (18:25 +0400)]
Remove SDL/ prefix

15 years agoAdd out of memory and zero size argument checks to be consistent with
malc [Wed, 8 Jul 2009 14:24:05 +0000 (18:24 +0400)]
Add out of memory and zero size argument checks to be consistent with
the qemu_malloc routines

15 years agogetrlimit conversion mix-up
Ulrich Hecht [Fri, 3 Jul 2009 15:09:30 +0000 (17:09 +0200)]
getrlimit conversion mix-up

Fixes getrlimit implementation that overwrote the result of the syscall
instead of converting it

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agowrap path for access syscall
Ulrich Hecht [Fri, 3 Jul 2009 15:09:29 +0000 (17:09 +0200)]
wrap path for access syscall

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years ago64-bit clean socketcall syscall
Ulrich Hecht [Fri, 3 Jul 2009 15:09:28 +0000 (17:09 +0200)]
64-bit clean socketcall syscall

makes socketcall 64-bit clean so it works on 64-bit big-endian systems

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agopipe argument should not be signed
Ulrich Hecht [Fri, 3 Jul 2009 15:09:26 +0000 (17:09 +0200)]
pipe argument should not be signed

pipedes is an address, it should not be signed (breaks for addresses
> 0x80000000)

Signed-off-by: Ulrich Hecht <uli@suse.de>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agoconfigure: remove bogus linux-user check
Riku Voipio [Mon, 29 Jun 2009 14:26:11 +0000 (17:26 +0300)]
configure: remove bogus linux-user check

linux-user=yes is not a reliable identifier that linux-user targets
have been selected. user targets can be selected via --target-list
as well.

15 years agolinux-user/syscall.c: remove warning: ‘array’ may be used uninitialized in this function
vibi sreenivasan [Fri, 19 Jun 2009 08:04:39 +0000 (13:34 +0530)]
linux-user/syscall.c: remove warning: ‘array’ may be used uninitialized in this function

Removes the following warning

CC    i386-linux-user/syscall.o
cc1: warnings being treated as errors
/media/nfs/qemu/linux-user/syscall.c: In function ‘do_syscall’:
/media/nfs/qemu/linux-user/syscall.c:2219: warning: ‘array’ may be used uninitialized in this function

Signed-off-by: Vibi Sreenivasan <vibi_sreenivasan@cms.com>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agolinux-user: check some parameters for some socket syscalls.
Arnaud Patard [Fri, 19 Jun 2009 07:44:45 +0000 (10:44 +0300)]
linux-user: check some parameters for some socket syscalls.

This patch is fixing following issues :

- commit 8fea36025b9d6d360ff3b78f88a84ccf221807e8 was applied to
  do_getsockname instead of do_accept.
- Some syscalls were not checking properly the memory addresses passed
  as argument
- Add check before syscalls made for cases like do_getpeername() where
  we're using the address parameter after doing the syscall
- Fix do_accept to return EINVAL instead of EFAULT when parameters
  invalid to match with linux behaviour

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agolinux-user: increment MAX_ARG_PAGES
Arnaud Patard [Fri, 19 Jun 2009 07:39:36 +0000 (10:39 +0300)]
linux-user: increment MAX_ARG_PAGES

There's a error When doing something like that :
find / -type f -print0 | xargs -0 echo

[ done in a arm chroot with qemu-arm and linux binfmt stuff or with
find / -type f -print0 | qemu-arm -L <path> <path>/usr/bin/xargs -0
echo ]

Doing this outsite qemu is fine. The problem was the huge number of
parameters. Increasing MAX_ARG_PAGES is fixing that.

While I was at it, I've modified linux-user/main.c to report error code
of loader_exec. It helps to debug/know what's wrong.

Signed-off-by: Arnaud Patard <arnaud.patard@rtp-net.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
15 years agoFix the PCI header type of APB
Blue Swirl [Sun, 5 Jul 2009 20:33:02 +0000 (20:33 +0000)]
Fix the PCI header type of APB

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoUpdate OpenBIOS images to r505
Blue Swirl [Sun, 5 Jul 2009 18:50:32 +0000 (18:50 +0000)]
Update OpenBIOS images to r505

For Sparc64, this fixes the PCI bridge configuration bugs revealed by the
improved bridge handling (b7ee1603c16c1feb0d439d2ddf6cf824119d0aab).

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix Sparse warning
Blue Swirl [Sun, 5 Jul 2009 08:11:39 +0000 (08:11 +0000)]
Fix Sparse warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoWork around Solaris gas problem
Blue Swirl [Fri, 3 Jul 2009 19:25:29 +0000 (19:25 +0000)]
Work around Solaris gas problem

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoRename target_cpu to target_arch2
Blue Swirl [Fri, 3 Jul 2009 17:44:00 +0000 (17:44 +0000)]
Rename target_cpu to target_arch2

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agomonitor: Fix typo in documentation
Jan Kiszka [Fri, 3 Jul 2009 06:46:05 +0000 (08:46 +0200)]
monitor: Fix typo in documentation

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
15 years agotarget-mips: fix MADD and MSUB/MSUBU instructions
Nathan Froyd [Wed, 1 Jul 2009 17:52:22 +0000 (10:52 -0700)]
target-mips: fix MADD and MSUB/MSUBU instructions

MADD was not correctly writing to HI.

MSUB/MSUBU are specified as `HI||LO - product', not `product - HI||LO'.

Signed-off-by: Nathan Froyd <froydnj@codesourcery.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
15 years agoFix hxtool.
Stefan Weil [Wed, 1 Jul 2009 21:13:34 +0000 (23:13 +0200)]
Fix hxtool.

When converting from hx to texi format, hxtool (or to be
more precise sh which interprets hxtool) used standard
shell expansion of wildcards while writing lines to the
output.

Thus, something like "Password: ********"
looked very different in the generated documentation.

The patch disables this unwanted wildcard expansion.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
15 years agoUse ctz64 in favor of ffsll
Jan Kiszka [Thu, 2 Jul 2009 07:11:37 +0000 (09:11 +0200)]
Use ctz64 in favor of ffsll

Not all host platforms support ffsll.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
15 years agoRespect the standard
malc [Thu, 2 Jul 2009 14:19:31 +0000 (18:19 +0400)]
Respect the standard

15 years agoUse pstrcpy and pstrcat to avoid OpenBSD linker warning
Blue Swirl [Wed, 1 Jul 2009 20:29:39 +0000 (20:29 +0000)]
Use pstrcpy and pstrcat to avoid OpenBSD linker warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoSuppress a GCC warning
Blue Swirl [Wed, 1 Jul 2009 19:30:50 +0000 (19:30 +0000)]
Suppress a GCC warning

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix breakage by obsolete _P() for good
Blue Swirl [Wed, 1 Jul 2009 19:11:17 +0000 (19:11 +0000)]
Fix breakage by obsolete _P() for good

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix sdl_zoom compile problems on OpenBSD
Blue Swirl [Wed, 1 Jul 2009 18:49:34 +0000 (18:49 +0000)]
Fix sdl_zoom compile problems on OpenBSD

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix missing strnlen problems
Blue Swirl [Wed, 1 Jul 2009 18:24:44 +0000 (18:24 +0000)]
Fix missing strnlen problems

Fix missing strnlen (a GNU extension) problems by using qemu_strnlen
used for user emulators also for system emulators.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
15 years agoFix typo
malc [Tue, 30 Jun 2009 14:46:46 +0000 (18:46 +0400)]
Fix typo

Signed-off-by: malc <av1474@comtv.ru>
15 years agoRemove bogus -Werror
Paul Brook [Tue, 30 Jun 2009 11:10:52 +0000 (12:10 +0100)]
Remove bogus -Werror

Revert rules.mak changes from aba800a.  These should not have been here
to start with.

Signed-off-by: Paul Brook <paul@codesourcery.com>
15 years agoReplace -no-virtio-balloon by -balloon
Markus Armbruster [Fri, 26 Jun 2009 17:15:14 +0000 (19:15 +0200)]
Replace -no-virtio-balloon by -balloon

We want to do (at least) two things to the virtio-balloon device:
suppress it, and control its PCI address.  Option -no-virtio-balloon
lets us do only the former.  To get the latter, replace
-no-virtio-balloon with

    -balloon none   disable balloon device
    -balloon virtio[,addr=str]
                    enable virtio balloon device (default)

Syntax suggested by Anthony Liguori.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: tftp: Relax filename format check
Jan Kiszka [Mon, 29 Jun 2009 06:47:30 +0000 (08:47 +0200)]
slirp: tftp: Relax filename format check

[ Applies on top of my recently posted slirp series. ]

Allow tftp requests with filenames that do not start with a slash.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosdl: Fix memory leakage
Jan Kiszka [Sat, 27 Jun 2009 07:59:40 +0000 (09:59 +0200)]
sdl: Fix memory leakage

Valgrind was so kind to remark that no one bothers to release keycodes
after use and that something is fishy about cleaning up the requested
keyboard descriptor. With this patch applied, we no longer leak about
12k during startup.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoKVM: x86: Refactor persistent CPU state
Jan Kiszka [Sat, 27 Jun 2009 07:27:22 +0000 (09:27 +0200)]
KVM: x86: Refactor persistent CPU state

This patch aligns the KVM-related layout and encoding of the CPU state
to be saved to disk or migrated with qemu-kvm. The major differences are
reordering of fields and a compressed interrupt_bitmap into a single
number as there can be no more than one pending IRQ at a time.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agox86: Factor out pc_new_cpu
Jan Kiszka [Thu, 25 Jun 2009 06:23:39 +0000 (08:23 +0200)]
x86: Factor out pc_new_cpu

At this point, this refactoring looks like overkill. But we will need it
for CPU hotplugging, and qemu-kvm already carries it. Merging it early
would help qemu-kvm when rebasing against upstream.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Refactor acl commnds
Jan Kiszka [Thu, 25 Jun 2009 06:22:08 +0000 (08:22 +0200)]
monitor: Refactor acl commnds

Refactor the ACL monitor interface to make full use of the monitor
command dispatcher. This also gives proper help formatting and command
completion. Note that 'acl allow' and 'acl deny' were combined to
'acl_add aclname match allow|deny [index]' for consistency reasons.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Add completion for help command
Jan Kiszka [Thu, 25 Jun 2009 06:22:02 +0000 (08:22 +0200)]
monitor: Add completion for help command

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRevert "Introduce reset notifier order"
Jan Kiszka [Sat, 27 Jun 2009 07:25:07 +0000 (09:25 +0200)]
Revert "Introduce reset notifier order"

This reverts commit 8217606e6edb49591b4a6fd5a0d1229cebe470a9 (and
updates later added users of qemu_register_reset), we solved the
problem it originally addressed less invasively.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Make pci_add device options truely optional
Jan Kiszka [Thu, 25 Jun 2009 22:04:10 +0000 (00:04 +0200)]
monitor: Make pci_add device options truely optional

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agokvm: Rework VCPU synchronization
Jan Kiszka [Sat, 27 Jun 2009 07:24:58 +0000 (09:24 +0200)]
kvm: Rework VCPU synchronization

During startup and after reset we have to synchronize user space to the
in-kernel KVM state. Namely, we need to transfer the VCPU registers when
they change due to VCPU as well as APIC reset.

This patch refactors the required hooks so that kvm_init_vcpu registers
its own per-VCPU reset handler and adds a cpu_synchronize_state to the
APIC reset. That way we no longer depend on the new reset order (and can
drop this disliked interface again) and we can even drop a KVM hook in
main().

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomonitor: Drop pci_addr prefix from hotplug commands
Jan Kiszka [Thu, 25 Jun 2009 22:04:00 +0000 (00:04 +0200)]
monitor: Drop pci_addr prefix from hotplug commands

The "pci_addr=" prefix currently required by pci_add/remove and
drive_add has no practical use. Drop it, but still silently accept it
for backward compatibility.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoqcow2: Cache refcount blocks during snapshot creation
Kevin Wolf [Fri, 26 Jun 2009 18:19:38 +0000 (20:19 +0200)]
qcow2: Cache refcount blocks during snapshot creation

The really time consuming part of snapshotting is to adjust the reference count
of all clusters. Currently after each adjusted cluster the refcount block is
written to disk.

Don't write each single byte immediately to disk but cache all writes to the
refcount block and write them out once we're done with the block.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoblock-raw: Allow pread beyond the end of growable images
Kevin Wolf [Fri, 26 Jun 2009 17:51:24 +0000 (19:51 +0200)]
block-raw: Allow pread beyond the end of growable images

When using O_DIRECT, qcow2 snapshots didn't work any more for me. In the
process of creating the snapshot, qcow2 tries to pwrite some new information
(e.g. new L1 table) which will often end up being after the old end of the
image file. Now pwrite tries to align things and reads the old contents of the
file, read returns 0 because there is nothing to read after the end of file and
pwrite is stuck in an endless loop.

This patch allows to pread beyond the end of an image file. Whenever the
given offset is after the end of the image file, the read succeeds and fills
the buffer with zeros.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomake tags useful for block drivers and hardaware devices
Juan Quintela [Mon, 29 Jun 2009 11:49:29 +0000 (13:49 +0200)]
make tags useful for block drivers and hardaware devices

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSubstitute ifdef CONFIG_FOO by sound-obj-
Juan Quintela [Wed, 24 Jun 2009 22:08:12 +0000 (00:08 +0200)]
Substitute ifdef CONFIG_FOO by sound-obj-

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename SOUND_HW to sound-obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:11 +0000 (00:08 +0200)]
Rename SOUND_HW to sound-obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSubstitute ifdef CONFIG_FOO by obj-
Juan Quintela [Wed, 24 Jun 2009 22:08:10 +0000 (00:08 +0200)]
Substitute ifdef CONFIG_FOO by obj-

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoSubstitute ifdef CONFIG_FOO by obj-
Juan Quintela [Wed, 24 Jun 2009 22:08:09 +0000 (00:08 +0200)]
Substitute ifdef CONFIG_FOO by obj-

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agomove CONFIG_* values from yes to y
Juan Quintela [Wed, 24 Jun 2009 22:08:08 +0000 (00:08 +0200)]
move CONFIG_* values from yes to y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename OBJS to obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:07 +0000 (00:08 +0200)]
Rename OBJS to obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename USER_OBJS to user-obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:06 +0000 (00:08 +0200)]
Rename USER_OBJS to user-obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename XEN_OBJS to xen-obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:05 +0000 (00:08 +0200)]
Rename XEN_OBJS to xen-obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename SLIRP_OBJS to slirp-obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:04 +0000 (00:08 +0200)]
Rename SLIRP_OBJS to slirp-obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename AUDIO_OBJS to audio-obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:03 +0000 (00:08 +0200)]
Rename AUDIO_OBJS to audio-obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename BLOCK_OBJS to block-obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:02 +0000 (00:08 +0200)]
Rename BLOCK_OBJS to block-obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename OBJS to obj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:01 +0000 (00:08 +0200)]
Rename OBJS to obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename LIBOBJS to libobj-y
Juan Quintela [Wed, 24 Jun 2009 22:08:00 +0000 (00:08 +0200)]
Rename LIBOBJS to libobj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoRename OBJS to obj-y
Juan Quintela [Wed, 24 Jun 2009 22:07:59 +0000 (00:07 +0200)]
Rename OBJS to obj-y

Signed-off-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agocpu_unregister_map_client: fix memory leak.
Isaku Yamahata [Fri, 26 Jun 2009 09:57:18 +0000 (18:57 +0900)]
cpu_unregister_map_client: fix memory leak.

fix memory leak in cpu_unregister_map_client() and cpu_notify_map_clients().

Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoAdd documentation for Multiboot
Alexander Graf [Sun, 28 Jun 2009 14:55:55 +0000 (16:55 +0200)]
Add documentation for Multiboot

The documentation shows how to use -kernel and friends for booting Linux,
but obviously knows nothing about multiboot yet.

Let's include some documentation for multiboot, so people know how to fully
exploit this cool new feature.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMultiboot build system v4
Alexander Graf [Mon, 29 Jun 2009 13:37:40 +0000 (15:37 +0200)]
Multiboot build system v4

In order to build the multiboot option rom, we need a Makefile and a tool
to sign the rom with.

Both are provided by this patch and mostly taken from the extboot source,
written by Anthony Liguori.

Once built, the resulting binary gets copied to pc-bios automatically.

Building also occurs automatically when on an x86 host.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoMultiboot support v5
Alexander Graf [Mon, 29 Jun 2009 13:37:39 +0000 (15:37 +0200)]
Multiboot support v5

This patch implements support for Multiboot on x86 for -kernel.
Multiboot is a "new" approach to get rid of different bootloaders, providing
a unified interface for the kernel. It supports command line options and
kernel modules.

The two probably best known projects using multiboot are Xen and GNU Hurd.

This implementation should be mostly feature-complete. It is missing VBE
extensions, but as no system uses them currently it does not really hurt.

To use multiboot, specify the kernel as -kernel option. Modules should be given
as -initrd options, seperated by a comma (,). -append also works.

Please bear in mind that grub also does gzip decompression, which qemu does
not do yet. To run existing images, please ungzip them first.

The guest multiboot loader code is implemented as option rom using int 19.
Parts of the work are based on efforts by Rene Rebe, who originally ported
my code to int 19.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoExpose fw_cfg v2
Alexander Graf [Mon, 29 Jun 2009 13:37:38 +0000 (15:37 +0200)]
Expose fw_cfg v2

Multiboot passes options to the option rom using the fw_cfg device.
Right now, that device is local to the bochs_bios_init function.

Let's change that and expose it, so everyone may put data in there.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoChange bochs bios init order
Alexander Graf [Mon, 29 Jun 2009 13:37:37 +0000 (15:37 +0200)]
Change bochs bios init order

For multiboot support, we need bochs_bios_init to happen before
load_linux, so we get the fw_cfg device.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agopreserve the hypervisor bit while KVM trims the CPUID bits
Andre Przywara [Wed, 24 Jun 2009 22:08:04 +0000 (00:08 +0200)]
preserve the hypervisor bit while KVM trims the CPUID bits

The KVM kernel will disable all bits in CPUID which are not present in
the host. As this is mostly true for the hypervisor bit (1.ecx),
preserve its value before the trim and restore it afterwards.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoremove CPUID host hacks
Andre Przywara [Wed, 24 Jun 2009 22:08:03 +0000 (00:08 +0200)]
remove CPUID host hacks

KVM provides an in-kernel feature to disable CPUID bits that are not
present in the current host. So there is no need here to duplicate this
work. Additionally allows 3DNow! on capable processors, since the
restriction seems to apply to QEMU/TCG only.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agofix KVMs GET_SUPPORTED_CPUID feature usage
Andre Przywara [Wed, 24 Jun 2009 22:08:02 +0000 (00:08 +0200)]
fix KVMs GET_SUPPORTED_CPUID feature usage

If we want to trim the user provided CPUID bits for KVM to be not greater
than that of the host, we should not remove the bits _after_ we sent
them to the kernel.
This fixes the masking of features that are not present on the host by
moving the trim function and it's call from helper.c to kvm.c.
It helps to use -cpu host.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoCPUID Fn8000_0001.EAX is family/model/stepping, not features
Andre Przywara [Wed, 24 Jun 2009 22:08:01 +0000 (00:08 +0200)]
CPUID Fn8000_0001.EAX is family/model/stepping, not features

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agointroduce -cpu host target
Andre Przywara [Wed, 24 Jun 2009 22:08:00 +0000 (00:08 +0200)]
introduce -cpu host target

Although the guest's CPUID bits can be controlled in a fine grained way
in QEMU, a simple way to inject the host CPU is missing. This is handy
for KVM desktop virtualization, where one wants the guest to support the
full host feature set.
Introduce another CPU type called 'host', which will propagate the host's
CPUID bits to the guest. Unwanted bits can still be turned off by using
the existing syntax (-cpu host,-skinit)

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoallow hypervisor CPUID bit to be overriden
Andre Przywara [Wed, 24 Jun 2009 22:07:59 +0000 (00:07 +0200)]
allow hypervisor CPUID bit to be overriden

KVM defaults to the hypervisor CPUID bit to be set, whereas pure
QEMU clears it. On some occasions one wants to set or clear it the
other way round (for instance to get HyperV running inside a guest).

Move the bit-set to be done before the command line parsing and
enable it by default. One can disable it by using: -cpu qemu64,-hypervisor
Fix some whitespace damage on the way.

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agosupport colon in filenames
Ram Pai [Sat, 27 Jun 2009 00:41:50 +0000 (17:41 -0700)]
support colon in filenames

Problem: It is impossible to feed filenames with the character colon because
qemu interprets such names as a protocol. For example filename scsi:0, is
interpreted as a protocol by name "scsi".

This patch allows user to espace colon characters. For example the above
filename can now be expressed either as 'scsi\:0' or as file:scsi:0

anything following the "file:" tag is interpreted verbatin. However if "file:"
tag is omitted then any colon characters in the string must be escaped using
backslash.

Here are couple of examples:

scsi\:0\:abc is a local file scsi:0:abc
http\://myweb is a local file by name http://myweb
file:scsi:0:abc is a local file scsi:0:abc
file:http://myweb is a local file by name http://myweb

Signed-off-by: Ram Pai <linuxram@us.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoPrefer ncurses over curses
Jan Kiszka [Wed, 24 Jun 2009 10:29:11 +0000 (12:29 +0200)]
Prefer ncurses over curses

Not every distro provides libcurses anymore, at least OpenSUSE, and at
least under a standard library search path. So try to link against
standard ncurses first and then fall back to legacy curses.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Basic VLAN client info_str
Jan Kiszka [Wed, 24 Jun 2009 12:42:32 +0000 (14:42 +0200)]
slirp: Basic VLAN client info_str

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Make hostfwd_add/remove multi-instance-aware
Jan Kiszka [Wed, 24 Jun 2009 12:42:32 +0000 (14:42 +0200)]
slirp: Make hostfwd_add/remove multi-instance-aware

Extend the syntax of hostfwd_add/remove to optionally take a tuple of
VLAN ID and slirp stack name. If those are omitted, the commands will
continue to work on the first registered slirp stack.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agonet: Provide VLAN client lookup helper
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
net: Provide VLAN client lookup helper

Introduce qemu_find_vlan_client_by_name for VLANClientState lookup based
on VLAN ID and client name. This is useful for monitor commands.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Enable multi-instance support for the smb service
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
slirp: Enable multi-instance support for the smb service

Push the smb state, smb_dir, into SlirpState and construct it in a way
that allows multiple smb instances (one per slirp stack). Remove the smb
directory on slirp cleanup instead of qemu termination. As VLAN clients
are also cleaned up on process termination, no feature is lost.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Improve error handling in slirp_smb
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
slirp: Improve error handling in slirp_smb

Make sure for invocations from the monitor that slirp_smb properly
reports errors and doesn't terminate qemu.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Use shell to erase smb directory
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
slirp: Use shell to erase smb directory

Instead of open-coding this, we can use the power of the shell to remove
the smb_dir on exit.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Save/restore bootp client states
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
slirp: Save/restore bootp client states

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Enable multiple instances
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
slirp: Enable multiple instances

Once again this was a long journey to reach the destination: Allow to
instantiate slirp multiple times. But as in the past, the journey was
worthwhile, cleaning up, fixing and enhancing various parts of the user
space network stack along the way.

What is this particular change good for? Multiple slirps instances
allow separated user space networks for guests with multiple NICs. This
is already possible, but without any slirp support for the second
network, ie. without a chance to talk to that network from the host via
IP. We have a legacy guest system here that benefits from this slirp
enhancement, allowing us to run both of its NICs purely over
unprivileged user space IP stacks.

Another benefit of this patch is that it simply removes an artificial
restriction of the configuration space qemu is providing, avoiding
another source of surprises that users may face when playing with
possible setups.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Allocate/free stack instance dynamically
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
slirp: Allocate/free stack instance dynamically

Allocate the internal slirp state dynamically and provide and call
slirp_cleanup to properly release it after use. This patch finally
unbreaks slirp release and re-instantiation via host_net_* monitor
commands.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Use internal state in interface
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
slirp: Use internal state in interface

This now also exports the internal state to the slirp users in qemu,
returning it from slirp_init and expecting it along with service
invocations. Additionally provide an opaque value interface for the
callbacks from slirp into the qemu core.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Factor out internal state structure
Jan Kiszka [Wed, 24 Jun 2009 12:42:31 +0000 (14:42 +0200)]
slirp: Factor out internal state structure

The essence of this patch is to stuff (almost) all global variables of
the slirp stack into the structure Slirp. In this step, we still keep
the structure as global variable, directly accessible by the whole
stack. Changes to the external interface of slirp will be applied in
the following patches.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Drop link_up checks from if_output and slirp_socket_can_recv
Jan Kiszka [Wed, 24 Jun 2009 12:42:30 +0000 (14:42 +0200)]
slirp: Drop link_up checks from if_output and slirp_socket_can_recv

link_up is true once slirp is initialized, so these check are really not
required.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Clean up timeout handling around slirp_select_fill/poll
Jan Kiszka [Wed, 24 Jun 2009 12:42:30 +0000 (14:42 +0200)]
slirp: Clean up timeout handling around slirp_select_fill/poll

Again lot of dead code. Remove it.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Drop redundant checks from slirp_output
Jan Kiszka [Wed, 24 Jun 2009 12:42:30 +0000 (14:42 +0200)]
slirp: Drop redundant checks from slirp_output

Slirp doesn't invoke slirp[_can]_output before it is initialized. The
motivation for these checks (3b7f5d479c) no longer applies. So drop
them.

Note: slirp_vc will become invalid if the slirp stack is removed during
runtime. But this is no new bug and will be fixed later.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Kill slirp_is_inited
Jan Kiszka [Wed, 24 Jun 2009 12:42:30 +0000 (14:42 +0200)]
slirp: Kill slirp_is_inited

Avoid the need for slirp_is_inited by refactoring the protected
slirp_select_* functions. This also avoids the clearing of all fd sets
on select errors.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Clean up updtime
Jan Kiszka [Wed, 24 Jun 2009 12:42:30 +0000 (14:42 +0200)]
slirp: Clean up updtime

Drop redundant typecasts in both variants and remove the pointless
round-up in the UNIX version.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
15 years agoslirp: Make IP packet ID consistent
Jan Kiszka [Wed, 24 Jun 2009 12:42:30 +0000 (14:42 +0200)]
slirp: Make IP packet ID consistent

Currently, ip_id is always initialized to 0 on slirp startup (despite
the broken attempt to derive it from the clock). This is good for
reproducibility. But it is not preserved across save/restore. This patch
therefore drops the dead initialization code from ip_init and introduces
ip_id to the persistent slirp state.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>