Commit Graph

13354 Commits (b6f77fbe230ad3e9ec5c9115a1535137d5e5d04b)

Author SHA1 Message Date
Gerd Hoffmann b6f77fbe23 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>
2011-01-11 17:15:24 +01:00
Gerd Hoffmann 843d4e0c63 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>
2011-01-11 17:15:23 +01:00
Gerd Hoffmann 7b074a22da 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>
2011-01-11 17:01:03 +01:00
Gerd Hoffmann ac57bbb614 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>
2011-01-11 17:01:03 +01:00
Gerd Hoffmann 34239c7bc9 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>
2011-01-11 17:01:02 +01:00
Gerd Hoffmann 9159f6798e usb: uhci: remote wakeup support.
Add support for remote wakeup to the UHCI adapter.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 17:01:02 +01:00
Gerd Hoffmann 01eacab6e9 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>
2011-01-11 17:01:02 +01:00
Gerd Hoffmann 618c169b57 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>
2011-01-11 17:01:02 +01:00
Gerd Hoffmann 0d86d2bebb usb: create USBPortOps, move attach there.
Create USBPortOps struct, move the attach function to that struct.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 17:01:02 +01:00
Gerd Hoffmann ed5a83ddd8 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>
2011-01-11 15:56:01 +01:00
Gerd Hoffmann a980a065fb 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>
2011-01-11 15:56:01 +01:00
Gerd Hoffmann 41c6abbdeb 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>
2011-01-11 15:56:01 +01:00
Gerd Hoffmann 30c7d32a0a 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>
2011-01-11 15:56:01 +01:00
Gerd Hoffmann 4a1e1bc416 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>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 132a3f55f0 usb descriptors: add settable strings.
This patch allows to set usb descriptor strings per device instance.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 062651c7e7 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>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 4696425cd0 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>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 037a5203de 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>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 81bfd2f246 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>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann f29783f72e 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>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 0e4e9695d5 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>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 37fb59d303 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>
2011-01-11 15:56:00 +01:00
Gerd Hoffmann 5d0d62feee usb: update MAINTAINERS
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2011-01-11 15:56:00 +01:00
Edgar E. Iglesias 05bf441eb6 cris: Remove unused orig_flags
Based on a patch by Blue Swirl <blauwirbel@gmail.com>.

Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2011-01-10 23:28:08 +01:00
Edgar E. Iglesias 5cabc5ccfe cris: Allow more TB chaining for crisv10
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2011-01-10 23:24:36 +01:00
Edgar E. Iglesias b09cd072df cris: Support disassembly of crisv10
Signed-off-by: Edgar E. Iglesias <edgar@axis.com>
2011-01-10 22:31:09 +01:00
Anthony Liguori a7bd621d7a Merge remote branch 'mst/for_anthony' into staging 2011-01-10 10:32:01 -06:00
Aurelien Jarno 8aaf42ed0f 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>
2011-01-10 10:56:25 +01:00
Aurelien Jarno 102c29769f bswap.h: add cpu_to_be64wu()
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-10 10:55:10 +01:00
Aurelien Jarno 0f11f25a00 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>
2011-01-10 07:30:30 +01:00
Aurelien Jarno a3e28aa5c7 tcg/ia64: remove an unnecessary stop bit
Spotted by Richard Henderson.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-10 01:39:49 +01:00
Aurelien Jarno 829a49274f 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>
2011-01-10 00:02:16 +01:00
Aurelien Jarno c0f809c46a 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>
2011-01-09 23:59:12 +01:00
Mike Frysinger 759c90ba3d tcg: fix typo in readme
Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-09 21:01:01 +00:00
Stefan Weil aa95e3a57f tcg/README: Spelling fixes
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-09 21:00:16 +00:00
Stefan Weil e8dc093822 qemu-tech: Spelling fixes
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-09 20:59:53 +00:00
Stefan Weil 40c5c6cd2b qemu-doc: Spelling fixes
neccessary -> necessary
Keberos -> Kerberos
emuilated -> emulated
transciever -> transceiver
emulaton -> emulation
inital -> initial
MingGW -> MinGW

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-09 20:58:11 +00:00
Stefan Weil 2d983446ff qemu-doc: Add missing blanks
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-09 20:57:35 +00:00
Stefan Weil 576fd0a1cb qemu-doc: Add missing menu entry
Each @section should have a menu entry and a @node entry.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-09 20:57:24 +00:00
Stefan Weil 0d6753e5b3 qemu-doc: Clean whitespace
Remove blanks at line endings.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-09 20:57:18 +00:00
Blue Swirl 1a20a032cc usb-bsd: fix a file descriptor leak
Fix a file descriptor leak reported by cppcheck:
[/src/qemu/usb-bsd.c:392]: (error) Resource leak: bfd
[/src/qemu/usb-bsd.c:388]: (error) Resource leak: dfd

Rearrange the code to avoid descriptor leaks. Also add braces as
needed.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
2011-01-09 14:43:33 +00:00
Michael Walle d66bddd7a4 alsaaudio: add endianness support for VoiceIn
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-09 03:06:08 +03:00
Michael Walle b6c9c9401c ossaudio: add endianness support for VoiceIn
Signed-off-by: Michael Walle <michael@walle.cc>
Signed-off-by: malc <av1474@comtv.ru>
2011-01-09 03:05:24 +03:00
Aurelien Jarno d43ffce140 tcg/mips: fix branch target change during code retranslation
TCG on MIPS was trying to avoid changing the branch offset, but didn't
due to a stupid typo. Fix it.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-08 16:41:43 +01:00
Aurelien Jarno 9a3abc21a6 tcg/arm: fix qemu_st64 for big endian targets
Due to a typo, qemu_st64 doesn't properly byteswap the 32-bit low word of
a 64 bit word before saving it. This patch fixes that.

Acked-by: Andrzej Zaborowski <balrogg@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-08 16:41:33 +01:00
Aurelien Jarno c69806ab82 tcg/arm: fix branch target change during code retranslation
QEMU uses code retranslation to restore the CPU state when an exception
happens. For it to work the retranslation must not modify the generated
code. This is what is currently implemented in ARM TCG.

However on CPU that don't have icache/dcache/memory synchronised like
ARM, this requirement is stronger and code retranslation must not modify
the generated code "atomically", as the cache line might be flushed
at any moment (interrupt, exception, task switching), even if not
triggered by QEMU. The probability for this to happen is very low, and
depends on cache size and associativiy, machine load, interrupts, so the
symptoms are might happen randomly.

This requirement is currently not followed in tcg/arm, for the
load/store code, which basically has the following structure:
  1) tlb access code is written
  2) conditional fast path code is written
  3) branch is written with a temporary target
  4) slow path code is written
  5) branch target is updated
The cache lines corresponding to the retranslated code is not flushed
after code retranslation as the generated code is supposed to be the
same. However if the cache line corresponding to the branch instruction
is flushed between step 3 and 5, and is not flushed again before the
code is executed again, the branch target is wrong. In the guest, the
symptoms are MMU page fault at a random addresses, which leads to
kernel page fault or segmentation faults.

The patch fixes this issue by avoiding writing the branch target until
it is known, that is by writing only the branch instruction first, and
later only the offset.

This fixes booting linux guests on ARM hosts (tested: arm, i386, mips,
mipsel, sh4, sparc).

Acked-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
2011-01-08 16:39:47 +01:00
Aurelien Jarno 497aebb99e Merge branch 'linux-user-for-upstream' of git://gitorious.org/qemu-maemo/qemu
* 'linux-user-for-upstream' of git://gitorious.org/qemu-maemo/qemu:
  Remove dead code for ARM semihosting commandline handling
  Fix commandline handling for ARM semihosted executables
  linux-user: Fix incorrect NaN detection in ARM nwfpe emulation
  softfloat: Implement floatx80_is_any_nan() and float128_is_any_nan()
  linux-user: Implement FS_IOC_FIEMAP ioctl
  linux-user: Support ioctls whose parameter size is not constant
  linux-user: Implement sync_file_range{,2} syscalls
2011-01-08 16:25:48 +01:00
Wolfgang Schildbach 67af42ac5a Remove dead code for ARM semihosting commandline handling
There are some bits in the code which were used to store the commandline for
the semihosting call. These bits are now write-only and can be removed.

Signed-off-by: Wolfgang Schildbach <wschi@dolby.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-01-07 18:20:57 +02:00
Wolfgang Schildbach 2e8785acc6 Fix commandline handling for ARM semihosted executables
Use the copy of the command line that loader_build_argptr() sets up in guest
memory as the command line to return from the ARM SYS_GET_CMDLINE semihosting
call. Previously we were using a pointer to memory which had already been
freed before the guest program started.

This fixes https://bugs.launchpad.net/qemu/+bug/673613 .

Signed-off-by: Wolfgang Schildbach <wschi@dolby.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-01-07 18:20:48 +02:00
Peter Maydell 3ebe80c299 linux-user: Fix incorrect NaN detection in ARM nwfpe emulation
The code in the linux-user ARM nwfpe emulation was incorrectly
checking only for quiet NaNs when it should have been checking
for any kind of NaN. This is probably because the code in
question was taken from the Linux kernel, whose copy of the
softfloat library had been modified so that float*_is_nan()
returned true for all NaNs, not just quiet ones. The qemu
equivalent function is float*_is_any_nan(), so use that.
NB that this code is really obsolete since nobody uses FPE
for actual arithmetic now; this is just cleanup following
the recent renaming of the NaN related functions.

Acked-by: Aurelien Jarno <aurelien@aurel32.net>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@iki.fi>
2011-01-07 17:38:48 +02:00