]> git.proxmox.com Git - qemu.git/log
qemu.git
13 years agotarget-sh4: add ftrv instruction
Aurelien Jarno [Fri, 14 Jan 2011 19:39:18 +0000 (20:39 +0100)]
target-sh4: add ftrv instruction

Add the ftrv XMTRX,FVn instruction, which computes the 4-row x 4-column
matrix XMTRX by the 4-dimensional vector FVn.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: add fipr instruction
Aurelien Jarno [Fri, 14 Jan 2011 19:39:18 +0000 (20:39 +0100)]
target-sh4: add fipr instruction

Add the fipr FVm,FVn instruction, which computes the inner products of
a 4-dimensional single precision floating-point vector.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: implement FPU exceptions
Aurelien Jarno [Fri, 14 Jan 2011 19:39:18 +0000 (20:39 +0100)]
target-sh4: implement FPU exceptions

FPU exception support where not implemented on SH4. Implement them by
clearing the softfloat exceptions flags before an FP instruction (the
SH4 FPU also clear them before an instruction), and calling a function
to update the FPSCR register after an FP instruction. This function
update the corresponding FPSCR bits (both flags and cumulative flags)
and trigger exception if enabled.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: implement flush-to-zero
Aurelien Jarno [Fri, 14 Jan 2011 19:39:18 +0000 (20:39 +0100)]
target-sh4: implement flush-to-zero

When the FPSCR.DN bit is set, the SH4 FPU treat denormalized numbers as
zero. Enable the corresponding softfloat option when this bit is set.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: define FPSCR constants
Aurelien Jarno [Fri, 14 Jan 2011 19:39:18 +0000 (20:39 +0100)]
target-sh4: define FPSCR constants

Define FPSCR constants for all field and use them instead of hardcoded
values.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: use default-NaN mode
Aurelien Jarno [Fri, 14 Jan 2011 19:39:17 +0000 (20:39 +0100)]
target-sh4: use default-NaN mode

SH4 FPU doesn't propagate NaN, and instead always regenerate new ones.
Enable the default-NaN mode by default.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: fix default-NaN mode
Aurelien Jarno [Fri, 14 Jan 2011 19:39:17 +0000 (20:39 +0100)]
softfloat: fix default-NaN mode

When the default-NaN mode is enabled, it should return the default NaN
value, but it should anyway raise the invalid operation flag if one of
the operand is an sNaN.

I have checked that this behavior matches the ARM and SH4 manuals, as
well as real SH4 hardware.

Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agosoftfloat: SH4 has the sNaN bit set
Aurelien Jarno [Fri, 14 Jan 2011 19:39:17 +0000 (20:39 +0100)]
softfloat: SH4 has the sNaN bit set

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: switch sh4 to softfloat
Aurelien Jarno [Fri, 14 Jan 2011 19:39:17 +0000 (20:39 +0100)]
target-sh4: switch sh4 to softfloat

We need to be able to catch exceptions correctly and thus enable softfloat
on SH4.

As all machines except i386 and x86_64 are using softfloat, make it the
default and change the case to detect i386 and x86_64. Note that CRIS
doesn't have an FPU, so it can be configured with both softfloat-native
and softfloat.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoconfigure: fix broken test
Aurelien Jarno [Fri, 14 Jan 2011 19:21:22 +0000 (20:21 +0100)]
configure: fix broken test

Since commit d1807a4f836c27f6dc7061e53a834dd27f78e46a ./configure tries
to test files and directories with "test -f", which only test for regular
files. Test with "test -e", which looks for any kind of files.

This unbreak the configure script when not using a separate object
directory.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agomake trace options use autoconfy names
Paolo Bonzini [Thu, 23 Dec 2010 10:44:02 +0000 (11:44 +0100)]
make trace options use autoconfy names

These are not in any release, so I am just renaming them.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomove --srcdir detection earlier
Paolo Bonzini [Thu, 23 Dec 2010 10:44:00 +0000 (11:44 +0100)]
move --srcdir detection earlier

This will help getting config.guess and config.sub from the srcdir.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years ago [PATCH v3 14/15] remove HOST_CC mention from roms/{sea, vga}bios/config.mak
Paolo Bonzini [Thu, 23 Dec 2010 10:44:01 +0000 (11:44 +0100)]
 [PATCH v3 14/15] remove HOST_CC mention from roms/{sea, vga}bios/config.mak

Not used in the submodules.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoremove source_path_used
Paolo Bonzini [Thu, 23 Dec 2010 10:43:59 +0000 (11:43 +0100)]
remove source_path_used

Not necessary since we use mkdir -p and from this patch test -f.

Also, dirname returns "." if a path has no directory component,
as is the case for "sh configure".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomove "ln -sf" emulation to a function
Paolo Bonzini [Thu, 23 Dec 2010 10:43:58 +0000 (11:43 +0100)]
move "ln -sf" emulation to a function

"ln -sf" does not really do anything more than "ln -s" on Solaris.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoreorganize sdl-config tests
Paolo Bonzini [Thu, 23 Dec 2010 10:43:57 +0000 (11:43 +0100)]
reorganize sdl-config tests

This also allows overriding it with SDL_CONFIG, and warning in suspicious
cross-compilation scenarios.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agodo not default to non-prefixed pkg-config when cross compiling
Paolo Bonzini [Thu, 23 Dec 2010 10:43:56 +0000 (11:43 +0100)]
do not default to non-prefixed pkg-config when cross compiling

This can still be requested with PKG_CONFIG=/path/to/pkg-config.
Just do not use it as a default, and print a warning.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agofix spelling of $pkg_config, move default together with other cross tools
Paolo Bonzini [Thu, 23 Dec 2010 10:43:55 +0000 (11:43 +0100)]
fix spelling of $pkg_config, move default together with other cross tools

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoprovide portable HOST_LONG_BITS test
Paolo Bonzini [Thu, 23 Dec 2010 10:43:54 +0000 (11:43 +0100)]
provide portable HOST_LONG_BITS test

Do not hardcode the list of 64-bit CPUs.  Use sizeof(void *) to
compute it.  Renaming it to HOST_LONG_BITS to HOST_POINTER_BITS
is left for later.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agodo not pass bogus $(SRC_PATH) include paths to cc during configure
Paolo Bonzini [Thu, 23 Dec 2010 10:43:53 +0000 (11:43 +0100)]
do not pass bogus $(SRC_PATH) include paths to cc during configure

Non-existent -I paths are dropped silently by the compiler, but still
it is not polite to pass bogus options.  Configure-time tests do not
need any include files from the source path, so only include -I flags
at make time (when they're properly expanded).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotest cc with the complete set of chosen flags
Paolo Bonzini [Thu, 23 Dec 2010 10:43:52 +0000 (11:43 +0100)]
test cc with the complete set of chosen flags

The "test the C compiler works ok" comes before a bunch of flags
are added for --cpu or just depending on the host.  It helps
debugging if the test is done after these flags are (unconditionally)
added.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agofix sparse support (?)
Paolo Bonzini [Thu, 23 Dec 2010 10:43:51 +0000 (11:43 +0100)]
fix sparse support (?)

I didn't test with sparse, but the old code using += before a variable
was set was wrong.  Sparse support should probably be ripped out or
redone, but this at least keeps some sanity.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomove feature variables to the top
Paolo Bonzini [Thu, 23 Dec 2010 10:43:50 +0000 (11:43 +0100)]
move feature variables to the top

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agodefault make and install to environment variables
Paolo Bonzini [Thu, 23 Dec 2010 10:43:49 +0000 (11:43 +0100)]
default make and install to environment variables

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agodefault compilation tools to environment variables
Paolo Bonzini [Thu, 23 Dec 2010 10:43:48 +0000 (11:43 +0100)]
default compilation tools to environment variables

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomicroblaze: Improve unconditional direct branching
Edgar E. Iglesias [Fri, 14 Jan 2011 11:30:26 +0000 (12:30 +0100)]
microblaze: Improve unconditional direct branching

Avoid emitting conditional tcg operations for uncoditional
direct branches.

Signed-off-by: Edgar E. Iglesias <edgar.iglesias@petalogix.com>
13 years agocris: Set btaken when storing direct jumps
Edgar E. Iglesias [Thu, 13 Jan 2011 14:14:04 +0000 (15:14 +0100)]
cris: Set btaken when storing direct jumps

When storing a direct jmp from translation state into
runtime state we should set the btaken flag.

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
13 years agoslirp: Use strcasecmp() to check tftp mode, tsize
Sergei Gavrikov [Wed, 12 Jan 2011 13:57:18 +0000 (15:57 +0200)]
slirp: Use strcasecmp() to check tftp mode, tsize

According to RFC 1350 (TFTP Revision 2) the mode field can contain any
combination of upper and lower case; also RFC 2349 propagates that the
transfer size option ("tsize") is case in-sensitive too.

Current implementation of embedded TFTP server missed that what does
mess some TFTP clients. Fixed by using STRCASECMP(3) in the required
places.

Signed-off-by: Sergei Gavrikov <sergei.gavrikov@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
13 years agoppc405_uc: fix a buffer overflow
Blue Swirl [Wed, 12 Jan 2011 21:12:31 +0000 (21:12 +0000)]
ppc405_uc: fix a buffer overflow

Fix a buffer overflow, reported by cppcheck:
[/src/qemu/hw/ppc405_uc.c:72]: (error) Buffer access out-of-bounds: bd.bi_s_version

The use of field bi_s_version seems to be a typo, it should be
bi_r_version.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agolan9118: fix a buffer overflow
Blue Swirl [Wed, 12 Jan 2011 21:00:01 +0000 (21:00 +0000)]
lan9118: fix a buffer overflow

Fix a buffer overflow, reported by cppcheck:
[/src/qemu/hw/lan9118.c:849]: (error) Buffer access out-of-bounds: s.eeprom

All eeprom handling code assumes that the size of eeprom is 128,
except lan9118_eeprom_cmd. Fix this by restricting the address passed.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agovpc: fix a file descriptor leak
Blue Swirl [Wed, 12 Jan 2011 19:49:00 +0000 (19:49 +0000)]
vpc: fix a file descriptor leak

Fix a file descriptor leak, reported by cppcheck:
[/src/qemu/block/vpc.c:524]: (error) Resource leak: fd

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoqemu-io: fix a memory leak
Blue Swirl [Wed, 12 Jan 2011 19:48:59 +0000 (19:48 +0000)]
qemu-io: fix a memory leak

Fix a memory leak, reported by cppcheck:
[/src/qemu/qemu-io.c:1135]: (error) Memory leak: ctx

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agovvfat: fix a file descriptor leak
Blue Swirl [Wed, 12 Jan 2011 19:48:58 +0000 (19:48 +0000)]
vvfat: fix a file descriptor leak

Fix a file descriptor leak, reported by cppcheck:
[/src/qemu/block/vvfat.c:759]: (error) Resource leak: dir

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoloader: fix a file descriptor leak
Blue Swirl [Wed, 12 Jan 2011 19:48:57 +0000 (19:48 +0000)]
loader: fix a file descriptor leak

Fix a file descriptor leak, reported by cppcheck:
[/src/qemu/hw/loader.c:311]: (error) Resource leak: fd

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agovnc-auth-sasl: fix a memory leak
Blue Swirl [Wed, 12 Jan 2011 19:48:56 +0000 (19:48 +0000)]
vnc-auth-sasl: fix a memory leak

Fix a memory leak reported by cppcheck:
[/src/qemu/ui/vnc-auth-sasl.c:448]: (error) Memory leak: mechname

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agovirtio-serial-bus: bump up control vq size to 32
Amit Shah [Tue, 23 Nov 2010 11:31:15 +0000 (17:01 +0530)]
virtio-serial-bus: bump up control vq size to 32

The current default of 16 buffers for the control vq is too small.  We
can get more entries in there, for example when asking the guest to add
max. allowed ports.

Note: a more robust solution would involve some kind of event queueing
in host to guarantee no event loss. Added a TODO to look into
this later.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoMerge remote branch 'origin/master' into pci
Michael S. Tsirkin [Wed, 12 Jan 2011 15:39:36 +0000 (17:39 +0200)]
Merge remote branch 'origin/master' into pci

13 years agoaudio: split sample conversion and volume mixing
Michael Walle [Wed, 5 Jan 2011 00:05:47 +0000 (01:05 +0100)]
audio: split sample conversion and volume mixing

Refactor the volume mixing, so it can be reused for capturing devices.
Additionally, it removes superfluous multiplications with the nominal
volume within the hardware voice code path.

Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: malc <av1474@comtv.ru>
13 years agodisas: remove opcode printing on ARM hosts
Aurelien Jarno [Wed, 12 Jan 2011 13:55:36 +0000 (14:55 +0100)]
disas: remove opcode printing on ARM hosts

Following commit 5d48e9174e3bfa8655e1dc8f80887acd9040b427, it's possible
to remove the hack that used to display the opcodes on ARM hosts only.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoarm-dis: Include opcode hex when doing disassembly
Peter Maydell [Mon, 10 Jan 2011 16:16:26 +0000 (16:16 +0000)]
arm-dis: Include opcode hex when doing disassembly

Enhance the ARM disassembler used for debugging so that it includes
the hex dump of the opcode as well as the symbolic disassembly.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agousb: zap pdev from usbport
Gerd Hoffmann [Wed, 12 Jan 2011 10:34:50 +0000 (11:34 +0100)]
usb: zap pdev from usbport

It isn't needed any more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: rewrite fw path, fix numbering
Gerd Hoffmann [Wed, 12 Jan 2011 09:58:27 +0000 (10:58 +0100)]
usb: rewrite fw path, fix numbering

This patch rewrites the firmware path code to use the physical port
location tracking just added to the qemu usb core.  It also fixes the
port numbering to start with "1" in the firmware path.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agotcg arm/mips/ia64: add a comment about retranslation and caches
Aurelien Jarno [Mon, 10 Jan 2011 17:30:05 +0000 (18:30 +0100)]
tcg arm/mips/ia64: add a comment about retranslation and caches

Add a comment about cache coherency and retranslation, so that people
developping new targets based on existing ones are warned of the issue.

Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agolinux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP
Peter Maydell [Mon, 10 Jan 2011 13:11:24 +0000 (13:11 +0000)]
linux-user: Add configure check for linux/fiemap.h and IOC_FS_FIEMAP

Add a configure check for the existence of linux/fiemap.h and the
IOC_FS_FIEMAP ioctl. This fixes a compilation failure on Linux
systems which don't have that header file.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoARM: Fix decoding of VQSHL/VQSHLU immediate forms
Peter Maydell [Sat, 8 Jan 2011 16:01:16 +0000 (16:01 +0000)]
ARM: Fix decoding of VQSHL/VQSHLU immediate forms

Fix errors in the decoding of ARM VQSHL/VQSHLU immediate forms,
including using the new VQSHLU helper functions where appropriate.

Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agoARM: add neon helpers for VQSHLU
Juha Riihimäki [Sat, 8 Jan 2011 16:01:15 +0000 (16:01 +0000)]
ARM: add neon helpers for VQSHLU

Add neon helper functions to implement VQSHLU, which is a
signed-to-unsigned version of VQSHL available only as an
immediate form.

Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
Reviewed-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agousb: add port property.
Gerd Hoffmann [Fri, 10 Dec 2010 10:43:35 +0000 (11:43 +0100)]
usb: add port property.

This allows to explictily set the physical port where you want to
plug the usb device.  Example:

  -device usb-tablet,bus=usb.0,port=2

With explicit port addressing qemu can and will not automagically add
USB Hubs.  This means that:

  (a) You can plug two devices of your choice into the two uhci
      root ports.
  (b) If you want plug in more that two devices you have to care
      about adding a hub yourself.

Plugging a hub works this way:

  -device usb-hub,bus=usb.0,port=1

Use this to add a device to the hub:

  -device usb-tablet,bus=usb.0,port=1.1

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agotarget-sh4: fix fpu disabled/illegal exception
Aurelien Jarno [Tue, 11 Jan 2011 15:13:34 +0000 (16:13 +0100)]
target-sh4: fix fpu disabled/illegal exception

Illegal instructions in a slot delay should generate a slot illegal
instruction exception instead of an illegal instruction exception.

The current PC should be saved before generating such an exception,
but should not be corrected if in a delay slot, given it's already
done in the exception handler do_interrupt().

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agousb: keep track of physical port address.
Gerd Hoffmann [Fri, 10 Dec 2010 10:37:45 +0000 (11:37 +0100)]
usb: keep track of physical port address.

Add a path string to USBPort.  Add usb_port_location() function to set
the physical location of the usb port.  Update all drivers implementing
usb ports to call it.  Update the monitor commands to print it.  Wind it
up in qdev.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb storage: handle long responses
Gerd Hoffmann [Thu, 9 Dec 2010 22:31:49 +0000 (23:31 +0100)]
usb storage: handle long responses

The scsi layer may return us more data than the guests wants to have.
Handle this by just ignoring the extra bytes and calling the
{read,write}_data callback to finish the request.

Seen happening in real life with some extended inquiry command.
With this patch applied the linux kernel stops reseting the device
once at boot.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb storage: fix status reporting
Gerd Hoffmann [Thu, 9 Dec 2010 09:36:35 +0000 (10:36 +0100)]
usb storage: fix status reporting

Change usb_msd_send_status() to take a pointer to the status packet
instead of writing the status to s->usb_buf which might not point
to the correct location.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb storage: high speed support
Gerd Hoffmann [Fri, 3 Dec 2010 16:12:49 +0000 (17:12 +0100)]
usb storage: high speed support

Add high speed support to the usb mass storage device.  With this patch
applied the linux kernel recognises the usb storage device as highspeed
capable device and suggests to connect it to a highspeed port instead of
the uhci.  Tested with both uhci and (not-yet submitted) ehci.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: add device qualifier support
Gerd Hoffmann [Wed, 8 Dec 2010 16:35:22 +0000 (17:35 +0100)]
usb: add device qualifier support

Add support for device_qualifier and other_speed_config descriptors.
These are used to query the "other speed" configuration of usb 2.0
devices, i.e. in high-speed mode they return the full-speed
configuration and visa versa.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: add usb_desc_attach
Gerd Hoffmann [Fri, 3 Dec 2010 17:07:20 +0000 (18:07 +0100)]
usb: add usb_desc_attach

Add usb_desc_attach() which sets up the device according to the speed
the usb port is able to handle.  This function can be hooked into the
handle_attach callback.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: add attach callback
Gerd Hoffmann [Fri, 3 Dec 2010 16:59:36 +0000 (17:59 +0100)]
usb: add attach callback

Add handle_attach() callback to USBDeviceInfo which is called by the
generic package handler when the device is attached to the usb bus
(i.e. plugged into a port).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: add speed mask to ports
Gerd Hoffmann [Fri, 3 Dec 2010 16:30:13 +0000 (17:30 +0100)]
usb: add speed mask to ports

Add a field to usb ports indicating the speed(s) they are
able to handle.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: hid: change serial number to "42".
Gerd Hoffmann [Tue, 14 Dec 2010 15:46:40 +0000 (16:46 +0100)]
usb: hid: change serial number to "42".

It would be nice to have some way to signal our hid devices support
remote wakeup.  There is a descriptor bit for that of course.  Problem
with using is one is that older qemu versions used to set the bit even
though they did *not* support remote wakeup.  Bummer.

This patch changes the serial number of our hid devices from "1" to "42"
to signal "it is safe to enable remote wakeup".  The serial number was
choosen because it isn't used for anything and it is available in sysfs
so it is easy to match it using udev rules like this:

ACTION=="add", SUBSYSTEM=="usb", \
ATTR{product}=="QEMU USB Tablet", ATTR{serial}=="42", \
RUN+="usb_enable_autosuspend %p"

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: hid: remote wakeup support.
Gerd Hoffmann [Wed, 1 Dec 2010 10:50:04 +0000 (11:50 +0100)]
usb: hid: remote wakeup support.

Add usb_wakeup() call to the hid driver so remote wakeup actually works.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: hub: remote wakeup support.
Gerd Hoffmann [Wed, 15 Dec 2010 11:26:59 +0000 (12:26 +0100)]
usb: hub: remote wakeup support.

This patch makes the usb hub handle remote wakeup requests from devices
properly by updating the port status register and forwarding the wakeup
to the upstream port.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: uhci: remote wakeup support.
Gerd Hoffmann [Wed, 1 Dec 2010 10:47:40 +0000 (11:47 +0100)]
usb: uhci: remote wakeup support.

Add support for remote wakeup to the UHCI adapter.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: add usb_wakeup() + wakeup callback to port ops
Gerd Hoffmann [Wed, 1 Dec 2010 10:32:45 +0000 (11:32 +0100)]
usb: add usb_wakeup() + wakeup callback to port ops

Add wakeup callback to port ops for remote wakeup handling.
Also add a usb_wakeup() function for devices which want
trigger a remote wakeup.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: rework attach/detach workflow
Gerd Hoffmann [Wed, 1 Dec 2010 10:27:05 +0000 (11:27 +0100)]
usb: rework attach/detach workflow

Add separate detach callback to USBPortOps, split
uhci/ohci/musb/usbhub attach functions into two.

Move common code to the usb_attach() function, only
the hardware-specific bits remain in the attach/detach
callbacks.

Keep track of the port it is attached to for each usb device.

[ v3: fix tyops in usb-musb.c ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: create USBPortOps, move attach there.
Gerd Hoffmann [Wed, 1 Dec 2010 10:08:44 +0000 (11:08 +0100)]
usb: create USBPortOps, move attach there.

Create USBPortOps struct, move the attach function to that struct.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoioeventfd: error handling cleanup
Michael S. Tsirkin [Tue, 11 Jan 2011 12:10:15 +0000 (14:10 +0200)]
ioeventfd: error handling cleanup

- Don't return status from start/stop functions where it's ignored
- report errors to make debugging easier
- assert on unexpected failures
- don't disable notifiers on error so that we'll
  retry when guest driver restarts

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agousb: move remote wakeup handling to common code
Gerd Hoffmann [Tue, 30 Nov 2010 16:35:34 +0000 (17:35 +0100)]
usb: move remote wakeup handling to common code

This patch moves setting and clearing the remote_wakeup feature
bit (via USB_REQ_{SET,CLEAR}_FEATURE) to common code.  Also
USB_REQ_GET_STATUS handling is moved to common code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: move USB_REQ_{GET,SET}_CONFIGURATION handling to common code
Gerd Hoffmann [Fri, 26 Nov 2010 19:20:41 +0000 (20:20 +0100)]
usb: move USB_REQ_{GET,SET}_CONFIGURATION handling to common code

This patch adds fields to the USBDevice struct for the current
speed (hard-wired to full speed for now) and current device
configuration.  Also a init function is added which inializes
these fields.  This allows USB_REQ_{GET,SET}_CONFIGURATION
handling to be moved to common code.

For most drivers the conversion is trivial ad they support a single
configuration only anyway.  One exception is bluetooth where some
device-specific setup code runs after get/set configuration.  The
other is usb-net which actually has two configurations so the
the code to check for the active configuration has been adapted.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: move USB_REQ_SET_ADDRESS handling to common code
Gerd Hoffmann [Fri, 26 Nov 2010 11:35:10 +0000 (12:35 +0100)]
usb: move USB_REQ_SET_ADDRESS handling to common code

USB_REQ_SET_ADDRESS handling is identical in *all* emulated devices.
Move it to common code.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb network: use new descriptor infrastructure.
Gerd Hoffmann [Fri, 26 Nov 2010 09:25:06 +0000 (10:25 +0100)]
usb network: use new descriptor infrastructure.

Switch the usb network driver over to the
new descriptor infrastructure.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb storage: serial number support
Gerd Hoffmann [Fri, 26 Nov 2010 11:26:17 +0000 (12:26 +0100)]
usb storage: serial number support

If a serial number is present for the drive fill it into the usb
serialnumber string descriptor.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb descriptors: add settable strings.
Gerd Hoffmann [Fri, 26 Nov 2010 11:25:32 +0000 (12:25 +0100)]
usb descriptors: add settable strings.

This patch allows to set usb descriptor strings per device instance.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb hub: use new descriptor infrastructure.
Gerd Hoffmann [Fri, 26 Nov 2010 12:13:22 +0000 (13:13 +0100)]
usb hub: use new descriptor infrastructure.

Switch the usb hub driver over to the
new descriptor infrastructure.

It also removes the nr_ports variable and MAX_PORTS define and
introduces a NUM_PORTS define instead.  The numver of ports was
(and still is) fixed at 8 anyway.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb bluetooth: use new descriptor infrastructure.
Gerd Hoffmann [Thu, 25 Nov 2010 15:12:18 +0000 (16:12 +0100)]
usb bluetooth: use new descriptor infrastructure.

Switch the usb bluetooth driver over to the
new descriptor infrastructure.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb wacom: use new descriptor infrastructure.
Gerd Hoffmann [Thu, 25 Nov 2010 15:12:06 +0000 (16:12 +0100)]
usb wacom: use new descriptor infrastructure.

Switch the usb wavom driver over to the
new descriptor infrastructure.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb storage: use new descriptor infrastructure.
Gerd Hoffmann [Wed, 17 Nov 2010 10:05:41 +0000 (11:05 +0100)]
usb storage: use new descriptor infrastructure.

Switch the usb storage driver over to the
new descriptor infrastructure.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb serial: use new descriptor infrastructure.
Gerd Hoffmann [Wed, 17 Nov 2010 10:05:32 +0000 (11:05 +0100)]
usb serial: use new descriptor infrastructure.

Switch the usb serial drivers (serial, braille) over to the
new descriptor infrastructure.

Note that this removes the freely configurable vendor and product id
properties.  I think the only reason this was configurable is that the
only difference between the serial and the braille device is the
vendor+product id.  Of course the serial and braille devices keep their
different IDs, but they can't be overritten from the command line any
more.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb hid: use new descriptor infrastructure.
Gerd Hoffmann [Wed, 17 Nov 2010 10:05:05 +0000 (11:05 +0100)]
usb hid: use new descriptor infrastructure.

Switch the usb hid drivers (keyboard, mouse, tablet) over to the
new descriptor infrastructure.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: data structs and helpers for usb descriptors.
Gerd Hoffmann [Wed, 17 Nov 2010 10:03:53 +0000 (11:03 +0100)]
usb: data structs and helpers for usb descriptors.

This patch adds hw/usb-desc.[ch] files.  They carry data structures
for various usb descriptors and helper functions to generate usb
packets from the structures.

The intention is to have a internal representation of the device
desription which is more usable than the current char array blobs,
so we can have common code handle common usb device emulation using
the device description.

The usage of this infrastructure is optional for usb drivers as there
are cases such as pass-through where it probably isn't very useful.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: update MAINTAINERS
Gerd Hoffmann [Fri, 17 Dec 2010 10:11:25 +0000 (11:11 +0100)]
usb: update MAINTAINERS

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agocris: Remove unused orig_flags
Edgar E. Iglesias [Mon, 10 Jan 2011 22:28:08 +0000 (23:28 +0100)]
cris: Remove unused orig_flags

Based on a patch by Blue Swirl <blauwirbel@gmail.com>.

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
13 years agocris: Allow more TB chaining for crisv10
Edgar E. Iglesias [Mon, 10 Jan 2011 22:24:36 +0000 (23:24 +0100)]
cris: Allow more TB chaining for crisv10

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
13 years agocris: Support disassembly of crisv10
Edgar E. Iglesias [Mon, 10 Jan 2011 21:31:09 +0000 (22:31 +0100)]
cris: Support disassembly of crisv10

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
13 years agoMerge remote branch 'mst/for_anthony' into staging
Anthony Liguori [Mon, 10 Jan 2011 16:32:01 +0000 (10:32 -0600)]
Merge remote branch 'mst/for_anthony' into staging

13 years agodocs: Document virtio PCI -device ioeventfd=on|off
Stefan Hajnoczi [Fri, 17 Dec 2010 12:01:52 +0000 (12:01 +0000)]
docs: Document virtio PCI -device ioeventfd=on|off

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
13 years agovirtio-pci: Use ioeventfd for virtqueue notify
Stefan Hajnoczi [Fri, 17 Dec 2010 12:01:50 +0000 (12:01 +0000)]
virtio-pci: Use ioeventfd for virtqueue notify

Virtqueue notify is currently handled synchronously in userspace virtio.  This
prevents the vcpu from executing guest code while hardware emulation code
handles the notify.

On systems that support KVM, the ioeventfd mechanism can be used to make
virtqueue notify a lightweight exit by deferring hardware emulation to the
iothread and allowing the VM to continue execution.  This model is similar to
how vhost receives virtqueue notifies.

The result of this change is improved performance for userspace virtio devices.
Virtio-blk throughput increases especially for multithreaded scenarios and
virtio-net transmit throughput increases substantially.

Some virtio devices are known to have guest drivers which expect a notify to be
processed synchronously and spin waiting for completion.
For virtio-net, this also seems to interact with the guest stack in strange
ways so that TCP throughput for small message sizes (~200bytes)
is harmed. Only enable ioeventfd for virtio-blk for now.

Care must be taken not to interfere with vhost-net, which uses host
notifiers.  If the set_host_notifier() API is used by a device
virtio-pci will disable virtio-ioeventfd and let the device deal with
host notifiers as it wishes.

Finally, there used to be a limit of 6 KVM io bus devices inside the
kernel.  On such a kernel, don't use ioeventfd for virtqueue host
notification since the limit is reached too easily.  This ensures that
existing vhost-net setups (which always use ioeventfd) have ioeventfds
available so they can continue to work.

After migration and on VM change state (running/paused) virtio-ioeventfd
will enable/disable itself.

 * VIRTIO_CONFIG_S_DRIVER_OK -> enable virtio-ioeventfd
 * !VIRTIO_CONFIG_S_DRIVER_OK -> disable virtio-ioeventfd
 * virtio_pci_set_host_notifier() -> disable virtio-ioeventfd
 * vm_change_state(running=0) -> disable virtio-ioeventfd
 * vm_change_state(running=1) -> enable virtio-ioeventfd

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agokvm: test for ioeventfd support on old kernels
Stefan Hajnoczi [Mon, 10 Jan 2011 11:50:05 +0000 (13:50 +0200)]
kvm: test for ioeventfd support on old kernels

There used to be a limit of 6 KVM io bus devices in the kernel.
On such a kernel, we can't use many ioeventfds for host notification
since the limit is reached too easily.

Add an API to test for this condition.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agovirtio: move vmstate change tracking to core
Michael S. Tsirkin [Mon, 10 Jan 2011 12:28:40 +0000 (14:28 +0200)]
virtio: move vmstate change tracking to core

Move tracking vmstate change from virtio-net to virtio.c
as it is going to be used by virito-blk and virtio-pci
for the ioeventfd support.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agovirtio-pci: Rename bugs field to flags
Stefan Hajnoczi [Fri, 17 Dec 2010 12:01:49 +0000 (12:01 +0000)]
virtio-pci: Rename bugs field to flags

The VirtIOPCIProxy bugs field is currently used to enable workarounds
for older guests.  Rename it to flags so that other per-device behavior
can be tracked.

A later patch uses the flags field to remember whether ioeventfd should
be used for virtqueue host notification.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoqxl: tag as not hotpluggable
Gerd Hoffmann [Thu, 6 Jan 2011 14:14:40 +0000 (15:14 +0100)]
qxl: tag as not hotpluggable

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoMerge remote branch 'origin/master' into pci
Michael S. Tsirkin [Mon, 10 Jan 2011 11:43:48 +0000 (13:43 +0200)]
Merge remote branch 'origin/master' into pci

13 years agovga: tag as not hotplugable.
Gerd Hoffmann [Thu, 6 Jan 2011 14:14:39 +0000 (15:14 +0100)]
vga: tag as not hotplugable.

This patch tags all vga cards as not hotpluggable.  The qemu
standard vga will never ever be hotpluggable.  For cirrus + vmware
it might be possible to get that work some day.  Todays we can't
handle that for a number of reasons though.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopiix: tag as not hotpluggable.
Gerd Hoffmann [Thu, 6 Jan 2011 14:14:38 +0000 (15:14 +0100)]
piix: tag as not hotpluggable.

This patch tags all pci devices which belong to the piix3/4 chipsets as
not hotpluggable (Host bridge, ISA bridge, IDE controller, ACPI bridge).

Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci: allow devices being tagged as not hotpluggable.
Gerd Hoffmann [Thu, 6 Jan 2011 14:14:37 +0000 (15:14 +0100)]
pci: allow devices being tagged as not hotpluggable.

This patch adds a field to PCIDeviceInfo to tag devices as being
not hotpluggable.  Any attempt to plug-in or -out such a device
will throw an error.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoslirp: fix unaligned access in bootp code
Aurelien Jarno [Thu, 6 Jan 2011 21:43:13 +0000 (22:43 +0100)]
slirp: fix unaligned access in bootp code

Slirp code tries to be smart an avoid data copy by using pointer to
the data. This solution leads to unaligned access, in this case
preq_addr, which is a 32-bit long structure. There is no real point
of avoiding data copy in a such case, as the value itself is smaller
or the same size as a pointer.

The patch replaces pointers to the preq_addr structure by the strcture
itself, and use the address 0.0.0.0 if no address has been requested
(this is not a valid address in such a request). It compares it with
htonl(0L) for correctness reasons, in case a code checker look for such
mistakes. It also uses memcpy() for copying the data, which takes care
of alignement issues.

This fixes an unaligned access on IA64 host while requesting a DHCP
address.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agobswap.h: add cpu_to_be64wu()
Aurelien Jarno [Thu, 6 Jan 2011 21:43:13 +0000 (22:43 +0100)]
bswap.h: add cpu_to_be64wu()

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotcg/arm: improve constant loading
Aurelien Jarno [Thu, 6 Jan 2011 21:43:13 +0000 (22:43 +0100)]
tcg/arm: improve constant loading

Improve constant loading in two ways:
- On all ARM versions, it's possible to load 0xffffff00 = -0x100 using
  the mvn rd, #0. Fix the conditions.
- On <= ARMv6 versions, where movw and movt are not available, load the
  constants using mov and orr with rotations depending on the constant
  to load. This is very useful for example to load constants where the
  low byte is 0. This reduce the generated code size by about 7%.

Also fix the coding style at the same time.

Cc: Andrzej Zaborowski <balrog@zabor.org>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotcg/ia64: remove an unnecessary stop bit
Aurelien Jarno [Mon, 10 Jan 2011 00:39:49 +0000 (01:39 +0100)]
tcg/ia64: remove an unnecessary stop bit

Spotted by Richard Henderson.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: improve TLB
Aurelien Jarno [Sun, 9 Jan 2011 22:53:45 +0000 (23:53 +0100)]
target-sh4: improve TLB

SH4 is using 16-bit instructions which means most of the constants are
loaded through a constant pool at the end of the subroutine. The same
memory page is therefore accessed in exec and read mode.

With the current implementation, a QEMU TLB entry is set to read or
read/write mode after an UTLB search and to exec mode after an ITLB
search, which causes a lot of TLB exceptions to switch from read or
read/write to exec and vice versa.

This patch optimizes that by already setting the QEMU TLB entry in read
or read/write mode when an UTLB entry is copied into ITLB (during an
ITLB miss). This improve the emulation speed by about 14%.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotarget-sh4: implement writes to mmaped ITLB
Aurelien Jarno [Sun, 9 Jan 2011 22:53:45 +0000 (23:53 +0100)]
target-sh4: implement writes to mmaped ITLB

Some Linux kernels seems to implement ITLB/UTLB flushing through by
writing all TLB entries through the memory mapped interface instead
of writing one to MMUCR.TI.

Implement memory mapped ITLB write interface so that such kernels can
boot. This fixes https://bugs.launchpad.net/bugs/700774 .

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
13 years agotcg: fix typo in readme
Mike Frysinger [Sun, 9 Jan 2011 08:45:45 +0000 (03:45 -0500)]
tcg: fix typo in readme

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/README: Spelling fixes
Stefan Weil [Fri, 7 Jan 2011 20:34:50 +0000 (21:34 +0100)]
tcg/README: Spelling fixes

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>