sdk/emulator/qemu.git
13 years agocheckpatch: Fix bracing false positives on #if
Blue Swirl [Fri, 15 Jul 2011 20:09:10 +0000 (20:09 +0000)]
checkpatch: Fix bracing false positives on #if

789f88d0b21fedfd4251d56bb7a9fbfbda7a4ac7 only fixed #else,
fix also #if.

Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/mips: Fix regression caused by typo (copy + paste bug)
Stefan Weil [Wed, 20 Jul 2011 18:56:36 +0000 (20:56 +0200)]
tcg/mips: Fix regression caused by typo (copy + paste bug)

cppcheck reports an error:
qemu/tcg/mips/tcg-target.c:1487: error: Invalid number of character (()

The unpatched code won't compile on mips hosts starting with commit
cea5f9a28faa528b6b1b117c9ab2d8828f473fef.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agods1225y: convert to qdev device, and use it in MIPS Jazz emulation
Hervé Poussineau [Mon, 18 Jul 2011 21:34:22 +0000 (23:34 +0200)]
ds1225y: convert to qdev device, and use it in MIPS Jazz emulation

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agods1225y: use trace framework
Hervé Poussineau [Mon, 18 Jul 2011 21:34:21 +0000 (23:34 +0200)]
ds1225y: use trace framework

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agods1225y: Remove protection stuff, which doesn't belong to this device
Hervé Poussineau [Mon, 18 Jul 2011 21:34:20 +0000 (23:34 +0200)]
ds1225y: Remove protection stuff, which doesn't belong to this device

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: add missing break on fmovdcc
Tsuneo Saito [Mon, 18 Jul 2011 06:36:57 +0000 (15:36 +0900)]
SPARC64: add missing break on fmovdcc

"break" is missing on V9 fmovdcc (%icc).

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: fix VIS1 SIMD signed compare instructions
Tsuneo Saito [Mon, 18 Jul 2011 06:00:00 +0000 (15:00 +0900)]
SPARC64: fix VIS1 SIMD signed compare instructions

The destination registers of SIMD signed compare instructions
(fcmp*<16|32>) are not FP registers but general purpose r registers.
Comparisons should be freg_rs1 CMP freg_rs2, that were reversed.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoMerge branch 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm
Blue Swirl [Wed, 20 Jul 2011 20:23:01 +0000 (20:23 +0000)]
Merge branch 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm

* 'for-upstream' of git://git.linaro.org/people/pmaydell/qemu-arm:
  target-arm: Fix BASEPRI, BASEPRI_MAX, and FAULTMASK access
  target-arm: Minimal implementation of performance counters
  Revert "Makefile.target: Allow target helpers to be in any *_helper.c file"
  Revert "target-arm: Use global env in neon_helper.c helpers"
  target-arm: Pass fp status pointer explicitly to neon fp helpers
  target-arm: Make VFP binop helpers take pointer to fpstatus, not CPUState
  target-arm: Add helper function to generate code to get fpstatus pointer
  Revert "target-arm: Use global env in iwmmxt_helper.c helpers"

Conflicts:
Makefile.target

13 years agoMerge remote-tracking branch 'agraf/xen-next' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:04:35 +0000 (08:04 -0500)]
Merge remote-tracking branch 'agraf/xen-next' into staging

13 years agoMerge remote-tracking branch 'kraxel/usb.19' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:03:20 +0000 (08:03 -0500)]
Merge remote-tracking branch 'kraxel/usb.19' into staging

13 years agoMerge remote-tracking branch 'spice/spice.v38' into staging
Anthony Liguori [Tue, 19 Jul 2011 13:02:35 +0000 (08:02 -0500)]
Merge remote-tracking branch 'spice/spice.v38' into staging

13 years agoMerge remote-tracking branch 'mst/for_anthony' into staging
Anthony Liguori [Tue, 19 Jul 2011 12:43:54 +0000 (07:43 -0500)]
Merge remote-tracking branch 'mst/for_anthony' into staging

13 years agoMerge remote-tracking branch 'riku/linux-user-for-upstream' into staging
Anthony Liguori [Tue, 19 Jul 2011 12:43:51 +0000 (07:43 -0500)]
Merge remote-tracking branch 'riku/linux-user-for-upstream' into staging

13 years agovirtio-console: Prevent abort()s in case of host chardev close
Amit Shah [Thu, 7 Jul 2011 12:05:27 +0000 (17:35 +0530)]
virtio-console: Prevent abort()s in case of host chardev close

A host chardev could close just before the guest sends some data to be
written.  This will cause an -EPIPE error.  This shouldn't be propagated
to virtio-serial-bus.

Ideally we should close the port once -EPIPE is received, but since the
chardev interface doesn't return such meaningful values to its users,
all we get is -1 for any kind of error.  Just return 0 for now and wait
for chardevs to return better error messages to act better on the return
messages.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
13 years agovirtio-serial-bus: Fix trailing \n in error_report string
Amit Shah [Thu, 7 Jul 2011 12:46:13 +0000 (18:16 +0530)]
virtio-serial-bus: Fix trailing \n in error_report string

Markus fixed offenders in the file but one instance sneaked in via
another patch.  Fix it.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
13 years agovirtio-console: Add some trace events
Amit Shah [Tue, 5 Jul 2011 11:07:49 +0000 (16:37 +0530)]
virtio-console: Add some trace events

Add some trace events for messages passed between the char layer and the
virtio-serial bus.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
13 years agovirtio-serial-bus: Add trace events
Amit Shah [Tue, 5 Jul 2011 11:06:39 +0000 (16:36 +0530)]
virtio-serial-bus: Add trace events

Add some trace events for messages passed between the guest and host.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
13 years agovirtio: fix indirect descriptor buffer overflow
Michael S. Tsirkin [Mon, 20 Jun 2011 10:42:27 +0000 (13:42 +0300)]
virtio: fix indirect descriptor buffer overflow

We were previously allowing arbitrarily-long indirect descriptors, which
could lead to a buffer overflow in qemu-kvm process.

CVE-2011-2212

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoxen: move to new pci initializers
Michael S. Tsirkin [Sun, 26 Jun 2011 13:30:45 +0000 (16:30 +0300)]
xen: move to new pci initializers

move ids to pci info structure

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agohw/piix_pci.c: Fix PIIX3-xen to initialize ids
Anthony PERARD [Wed, 22 Jun 2011 15:58:31 +0000 (16:58 +0100)]
hw/piix_pci.c: Fix PIIX3-xen to initialize ids

Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agopci_ids: tweak names to match linux/pci_ids.h
Michael S. Tsirkin [Sun, 26 Jun 2011 13:17:27 +0000 (16:17 +0300)]
pci_ids: tweak names to match linux/pci_ids.h

Sync xen names to ones used by linux. Add
xen platform device id as well.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agovhost: fix double free on device stop
Michael S. Tsirkin [Tue, 21 Jun 2011 17:34:17 +0000 (20:34 +0300)]
vhost: fix double free on device stop

vhost dev stop failed to clear the log field.
Typically not an issue as dev start overwrites this field,
but if logging gets disabled before the following start,
it doesn't so this causes a double free.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
13 years agoxen_console: fall back to qemu serial device
Alexander Graf [Sun, 3 Jul 2011 07:44:48 +0000 (09:44 +0200)]
xen_console: fall back to qemu serial device

The new xen_console protocol changed the default xen_console output device
from whatever Qemu chose to whatever xenstore choses and "pty" as fallback.

This is not how Qemu works. It has its own serial redirection semantics. So
it xenstore doesn't contain information on what to do, Qemu is the place to
ask.

Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen_console: support the new extended xenstore protocol
Stefano Stabellini [Thu, 30 Jun 2011 17:26:29 +0000 (18:26 +0100)]
xen_console: support the new extended xenstore protocol

Since CS 21994 on xen-unstable.hg and CS
466608f3a32e1f9808acdf832a5843af37e5fcec on qemu-xen-unstable.git, few
changes have been introduced to the PV console xenstore protocol, as
described by the document docs/misc/console.txt under xen-unstable.hg.

From the Qemu point of view, very few modifications are needed to
correctly support the protocol: read from xenstore the "output" node
that tell us what the output of the PV console is going to be.
In case the output is a tty, write to xenstore the device name.

Changes in v2:

- fix error paths: free malloc'ed strings and close the xenstore
connection before returning;

- remove useless snprintf in xenstore_store_pv_console_info if i == 0.

Changes in v3:

- replace xs_daemon_open/xs_daemon_close with xs_open/xs_close.

Changes in v4:

- add a compatibility implementation of xs_open/xs_close.

Changes in v5:

- fix code style.

[agraf] fix build error due to missing stub

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agocheckpatch: don't error out on },{ lines
Alexander Graf [Wed, 29 Jun 2011 06:04:27 +0000 (08:04 +0200)]
checkpatch: don't error out on },{ lines

When having code like this:

    static PCIDeviceInfo piix_ide_info[] = {
        {
            .qdev.name    = "piix3-ide",
            .qdev.size    = sizeof(PCIIDEState),
            .qdev.no_user = 1,
            .no_hotplug   = 1,
            .init         = pci_piix_ide_initfn,
            .vendor_id    = PCI_VENDOR_ID_INTEL,
            .device_id    = PCI_DEVICE_ID_INTEL_82371SB_1,
            .class_id     = PCI_CLASS_STORAGE_IDE,
        },{
            .qdev.name    = "piix4-ide",
            .qdev.size    = sizeof(PCIIDEState),
            .qdev.no_user = 1,
            .no_hotplug   = 1,
            .init         = pci_piix_ide_initfn,
            .vendor_id    = PCI_VENDOR_ID_INTEL,
            .device_id    = PCI_DEVICE_ID_INTEL_82371AB,
            .class_id     = PCI_CLASS_STORAGE_IDE,
        },{
            /* end of list */
        }
    };

checkpatch currently errors out, claiming that spaces need to follow
commas. However, this particular style of defining structs is pretty
common in qemu code and very readable. So let's declare it as supported
for the above case.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen_disk: treat "aio" as "raw"
Stefano Stabellini [Thu, 30 Jun 2011 14:42:31 +0000 (15:42 +0100)]
xen_disk: treat "aio" as "raw"

Sometimes the toolstack uses "aio" without an additional format
identifier, in such cases use "raw".

Updated in v2:

- fix code style.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoqemu_ram_ptr_length: take ram_addr_t as arguments
Stefano Stabellini [Mon, 27 Jun 2011 17:26:06 +0000 (18:26 +0100)]
qemu_ram_ptr_length: take ram_addr_t as arguments

qemu_ram_ptr_length should take ram_addr_t as argument rather than
target_phys_addr_t because is doing comparisons with RAMBlock addresses.

cpu_physical_memory_map should create a ram_addr_t address to pass to
qemu_ram_ptr_length from PhysPageDesc phys_offset.

Remove code after abort() in qemu_ram_ptr_length.

Changes in v2:

- handle 0 size in qemu_ram_ptr_length;

- rename addr1 to raddr;

- initialize raddr to ULONG_MAX.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen_disk: cope with missing xenstore "params" node
Stefano Stabellini [Mon, 27 Jun 2011 15:10:01 +0000 (16:10 +0100)]
xen_disk: cope with missing xenstore "params" node

When disk is a cdrom and the drive is empty the "params" node in
xenstore might be missing completely: cope with it instead of
segfaulting.

Updated in v2:

- actually removed the strchr(blkdev->params, ':') that caused the
segfault;

- free all the allocated strings from xenstore before returning;

Updated in v3:

- set blkdev fields to NULL after free'ing them.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen: add vkbd support for PV on HVM guests
Stefano Stabellini [Fri, 24 Jun 2011 16:36:11 +0000 (17:36 +0100)]
xen: add vkbd support for PV on HVM guests

Register the vkbd backend even when running as device emulator for HVM
guests: it is useful because it doesn't need a frequent timer like usb.

Check whether the XenInput DisplayState has been set in the initialise
state, rather than the input state.
In case the DisplayState hasn't been set and there is no vfb for this
domain, then set the XenInput DisplayState to the default one.

Changed in v2:

- use qemu_free instead of free;

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen_console: fix memory leak
Stefano Stabellini [Fri, 24 Jun 2011 15:59:46 +0000 (16:59 +0100)]
xen_console: fix memory leak

con_init leaks the string "type", fix it.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen: enable console and disk backend in HVM mode
Stefano Stabellini [Fri, 24 Jun 2011 14:54:48 +0000 (15:54 +0100)]
xen: enable console and disk backend in HVM mode

Initialize the Xen console backend and the Xen disk backend even when
running in HVM mode so that PV on HVM drivers can connect to them.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XEN
Jan Kiszka [Tue, 21 Jun 2011 20:59:09 +0000 (22:59 +0200)]
xen: Fold CONFIG_XEN_MAPCACHE into CONFIG_XEN

Xen won't be enabled if there is no backend support available for the
host. And that also means the map cache will work. So drop the separate
config switch and move the required stubs over to xen-stub.c.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen: Clean up map cache API naming
Jan Kiszka [Tue, 21 Jun 2011 20:59:08 +0000 (22:59 +0200)]
xen: Clean up map cache API naming

The map cache is a Xen thing, so its API should make this clear.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoxen: Clean up build system
Jan Kiszka [Tue, 21 Jun 2011 20:59:07 +0000 (22:59 +0200)]
xen: Clean up build system

Introduce CONFIG_XEN_BACKEND so that this new config solely controls the
target-independent backend build and CONFIG_XEN can focus on per-target
building.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Alexander Graf <agraf@suse.de>
13 years agoFix signal handling of SIG_IPI when io-thread is enabled
Alexandre Raymond [Wed, 15 Jun 2011 05:20:31 +0000 (01:20 -0400)]
Fix signal handling of SIG_IPI when io-thread is enabled

Both the signal thread (via sigwait()) and the cpu thread (via
a normal signal handler) were attempting to catch SIG_IPI.

This resulted in random freezes under Darwin.

This patch separates SIG_IPI from the rest of the signals handled
by the signal thread, because it is independently caught by the cpu
thread.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoFix signal handling when io-thread is disabled
Alexandre Raymond [Tue, 14 Jun 2011 14:05:36 +0000 (10:05 -0400)]
Fix signal handling when io-thread is disabled

Changes since v1:
- take pthread_sigmask() out of the ifdef as it is now common
to both parts.

This fix effectively blocks, in the main thread, the signals handled
by signalfd or the compatibility signal thread.

This way, such signals are received synchronously in the main thread
through sigfd_handler() instead of triggering the signal handler
directly, asynchronously.

Signed-off-by: Alexandre Raymond <cerbere@gmail.com>
Acked-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg/README: Expand advice on number of TCG ops per target insn
Peter Maydell [Wed, 22 Jun 2011 14:40:06 +0000 (15:40 +0100)]
tcg/README: Expand advice on number of TCG ops per target insn

Expand the note on the number of TCG ops generated per target insn,
to be clearer about the range of applicability of the 20 op rule
of thumb. Also add a note about the hard MAX_OP_PER_INSTR limit.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoset ELF_HWCAP for SPARC and SPARC64
Artyom Tarasenko [Thu, 14 Jul 2011 17:37:06 +0000 (19:37 +0200)]
set ELF_HWCAP for SPARC and SPARC64

setting ELF_HWCAP fixes dynamic library loading for Linux/sparc64
This patch allows loading busybox from Debian 6 initrd

Signed-off-by: Artyom Tarasenko <atar4qemu@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSparc: fix FPU and AM enable checks for translation
Blue Swirl [Thu, 14 Jul 2011 17:30:43 +0000 (17:30 +0000)]
Sparc: fix FPU and AM enable checks for translation

Translation used incorrectly CPUState fields directly to check
for FPU enable state and 32 bit address masking on Sparc64.

Fix by using TB flags instead.

Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: C99 comment fix for block-transfer ASIs
Tsuneo Saito [Thu, 14 Jul 2011 09:41:43 +0000 (18:41 +0900)]
SPARC64: C99 comment fix for block-transfer ASIs

Fixed C99 comments on block-tranfer ASIs.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: Add JPS1 ASI_BLK_AIU[PS]L ASIs for ldfa and stfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:42 +0000 (18:41 +0900)]
SPARC64: Add JPS1 ASI_BLK_AIU[PS]L ASIs for ldfa and stfa

Support JPS1 little endian block transfer ASIs.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: Add UA2007 ASI_BLK_AIU[PS]L? ASIs for stfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:41 +0000 (18:41 +0900)]
SPARC64: Add UA2007 ASI_BLK_AIU[PS]L? ASIs for stfa

Support UA2007 block store ASIs for stfa instructions.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: Add UA2007 ASI_BLK_AIU[PS]L? ASIs for ldfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:40 +0000 (18:41 +0900)]
SPARC64: Add UA2007 ASI_BLK_AIU[PS]L? ASIs for ldfa

Support UA2007 block load ASIs for ldfa instructions.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: fp_disabled checks on stfa/stdfa/stqfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:39 +0000 (18:41 +0900)]
SPARC64: fp_disabled checks on stfa/stdfa/stqfa

stfa/stdfa/stqfa instructions should raise fp_disabled exceptions
if %pstate.PEF==0 or %fprs.FEF==0.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: Implement stfa/stdfa/stqfa instrcutions properly
Tsuneo Saito [Thu, 14 Jul 2011 09:41:38 +0000 (18:41 +0900)]
SPARC64: Implement stfa/stdfa/stqfa instrcutions properly

This patch implements sparcv9 stfa/stdfa/stqfa instructions
with non block-store ASIs.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: fp_disabled checks on ldfa/lddfa/ldqfa
Tsuneo Saito [Thu, 14 Jul 2011 09:41:37 +0000 (18:41 +0900)]
SPARC64: fp_disabled checks on ldfa/lddfa/ldqfa

ldfa/lddfa/ldqfa instructions should raise fp_disabled exceptions
if %pstate.PEF==0 or %fprs.FEF==0.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoSPARC64: Implement ldfa/lddfa/ldqfa instructions properly
Tsuneo Saito [Thu, 14 Jul 2011 09:41:36 +0000 (18:41 +0900)]
SPARC64: Implement ldfa/lddfa/ldqfa instructions properly

This patch implements sparcv9 ldfa/lddfa/ldqfa instructions
with non block-load ASIs.

Signed-off-by: Tsuneo Saito <tsnsaito@gmail.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agolinux-user/signal.c: Rename s390 target_ucontext fields to fix ia64
Peter Maydell [Tue, 12 Jul 2011 20:27:15 +0000 (21:27 +0100)]
linux-user/signal.c: Rename s390 target_ucontext fields to fix ia64

The ia64 sys/ucontext.h defines macros 'uc_link', 'uc_sigmask' and
'uc_stack'. Rename the s390 target_ucontext struct members to tuc_*,
bringing them into line with the other targets and fixing a compile
failure on ia64 hosts caused by this clash.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agolinux-user: make MIPS and ARM eabi use same argument reordering
Riku Voipio [Tue, 12 Jul 2011 12:40:51 +0000 (15:40 +0300)]
linux-user: make MIPS and ARM eabi use same argument reordering

MIPS uses similar calling convention than ARM eabi, where when using
64-bit values some registers are skipped. This patch makes MIPS and ARM
eabi share the argument reordering code.

This affects ftruncate64, creating insane sized fails (or just failing).

Cc: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agolinux-user: correct syscall 123 on sh4
Riku Voipio [Tue, 12 Jul 2011 13:01:54 +0000 (16:01 +0300)]
linux-user: correct syscall 123 on sh4

As reported by Cédric VINCENT:

The syscall #123 on SH4 should be "TARGET_NR_cacheflush" instead of
"TARGET_NR_modify_ldt" [1].  The only consequence of this misnaming is
that many "Unsupported syscall" warnings are issued when emulating JIT
compilers.

Reported-by: Cédric VINCENT <cedric.vincent@st.com>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agoos-posix: set groups properly for -runas
Stefan Hajnoczi [Sat, 9 Jul 2011 09:22:07 +0000 (10:22 +0100)]
os-posix: set groups properly for -runas

Andrew Griffiths reports that -runas does not set supplementary group
IDs.  This means that gid 0 (root) is not dropped when switching to an
unprivileged user.

Add an initgroups(3) call to use the -runas user's /etc/groups
membership to update the supplementary group IDs.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Acked-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoesp: cancel current request only if some request is in flight
Hervé Poussineau [Sat, 9 Jul 2011 14:44:41 +0000 (16:44 +0200)]
esp: cancel current request only if some request is in flight

This bug was introduced in 94d3f98a3f3caddd7875f9a11776daeb84962a7b:
scsi_cancel_io was checking if some request was pending before trying
to cancel it, while scsi_req_cancel always cancels the request.

This may lead to a crash of Qemu due to dereferencing a NULL pointer,
as exhibited by NetBSD 5.1 installer on MIPS Magnum emulation.

Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotarget-alpha, target-ppc: Remove unnecessary setjmp.h include
Peter Maydell [Mon, 4 Jul 2011 21:02:46 +0000 (22:02 +0100)]
target-alpha, target-ppc: Remove unnecessary setjmp.h include

Remove the include of setjmp.h from the cpu.h of target-alpha
and target-ppc. This is unnecessary because cpu-defs.h already
includes this header; this change brings these two targets
into line with all the rest.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoRemove unneeded setjmp.h (fix compilation on Debian "lenny")
Stefan Weil [Mon, 4 Jul 2011 18:52:38 +0000 (20:52 +0200)]
Remove unneeded setjmp.h (fix compilation on Debian "lenny")

Some versions of png.h cannot be included after setjmp.h,
even when PNG_SKIP_SETJMP_CHECK was defined.

setjmp.h was included from qemu-common.h and is not needed there.
Removing the include statement fixes compilation of ui/vnc-enc-tight.c
with CONFIG_VNC_PNG defined.

Signed-off-by: Stefan Weil <weil@mail.berlios.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agotcg: Reload local variables after return from longjmp
Jan Kiszka [Sat, 2 Jul 2011 07:50:51 +0000 (09:50 +0200)]
tcg: Reload local variables after return from longjmp

Recent compilers look deep into cpu_exec, find longjmp as a noreturn
function and decide to smash some stack variables as they won't be used
again. This may lead to env becoming invalid after return from setjmp,
causing crashes. Fix it by reloading env from cpu_single_env in that
case.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoexec-all.h: Make MAX_OP_PER_INSTR large enough for target-arm's uses
Peter Maydell [Wed, 22 Jun 2011 14:16:32 +0000 (15:16 +0100)]
exec-all.h: Make MAX_OP_PER_INSTR large enough for target-arm's uses

The target-arm frontend's worst-case TCG ops per instr is 194 (and in
general many of the "load multiple registers" ARM instructions generate
more than 100 TCG ops). Raise MAX_OP_PER_INSTR accordingly to avoid
possible buffer overruns.

Since it doesn't make any sense for the "64 bit guest on 32 bit host"
case to have a smaller limit than the normal case, we collapse the
two cases back into each other again.

(This increase costs us about 14K in extra static buffer space and
21K of extra margin at the end of a 32MB codegen buffer.)

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoexec.c: Fix calculation of code_gen_buffer_max_size
Peter Maydell [Wed, 22 Jun 2011 10:58:25 +0000 (11:58 +0100)]
exec.c: Fix calculation of code_gen_buffer_max_size

When calculating the point at which we should not try to put another
TB into the code gen buffer, we have to allow not just for OPC_MAX_SIZE
but OPC_BUF_SIZE. This is because the target translate.c will only
stop when an instruction has put it past the OPC_MAX_SIZE limit, so
we have to include the MAX_OP_PER_INSTR margin which that final insn
might have used.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agospapr: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:10 +0000 (18:28 +0200)]
spapr: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agos390-virtio: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:09 +0000 (18:28 +0200)]
s390-virtio: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoppc405_uc: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:08 +0000 (18:28 +0200)]
ppc405_uc: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agopl080: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:07 +0000 (18:28 +0200)]
pl080: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomsix: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:06 +0000 (18:28 +0200)]
msix: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomsi: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:05 +0000 (18:28 +0200)]
msi: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agointel-hda: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:04 +0000 (18:28 +0200)]
intel-hda: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agohpet: use specific endian ld/st_phys
Alexander Graf [Tue, 5 Jul 2011 16:28:03 +0000 (18:28 +0200)]
hpet: use specific endian ld/st_phys

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agoexec: add endian specific phys ld/st functions
Alexander Graf [Wed, 6 Jul 2011 07:09:23 +0000 (09:09 +0200)]
exec: add endian specific phys ld/st functions

Device code some times needs to access physical memory and does that
through the ld./st._phys functions. However, these are the exact same
functions that the CPU uses to access memory, which means they will
be endianness swapped depending on the target CPU.

However, devices don't know about the CPU's endianness, but instead
access memory directly using their own interface to the memory bus,
so they need some way to read data with their native endianness.

This patch adds _le and _be functions to ld./st._phys.

Signed-off-by: Alexander Graf <agraf@suse.de>
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
13 years agomips: rlimit codes are not the same
Wesley W. Terpstra [Tue, 12 Jul 2011 11:42:00 +0000 (14:42 +0300)]
mips: rlimit codes are not the same

The codes for get/setrlimit differ between linux target platforms.
This patch adds conversion.
This is important else programs (rsyslog, python, ...) can go into a
near infinite loop trying to close all the file descriptors from 0 to
-1.

Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agomips: rlimit incorrectly converts values
Wesley W. Terpstra [Tue, 12 Jul 2011 11:38:22 +0000 (14:38 +0300)]
mips: rlimit incorrectly converts values

Byte swap was applied in the wrong order with testing for
RLIM_INFINITY. On mips bigendian from an amd64 system this results in
infinity being misinterpretted as 2^31-1.

This is a serious bug because it causes setrlimit stack size to kill
all child processes. This means (for example) that 'make' can run no
children. The mechanism of failure:
1. parent sets stack size rlimit to 'infinity'
2. qemu screws this value up
3. child process fetches stack size as a large (but non-infinite) value
4. qemu tries to allocate stack before execution
5. stack allocation fails (too big) and child process dies

Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agomips: null pointer deref should segfault
Wesley W. Terpstra [Tue, 12 Jul 2011 11:34:23 +0000 (14:34 +0300)]
mips: null pointer deref should segfault

Dereferencing a null pointer causes an exception 0xC (EXCP_AdEL)
instead of EXCP_TLBL. This should also trigger a segfault.

Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agomips: missing syscall returns wrong errno
Wesley W. Terpstra [Tue, 12 Jul 2011 11:33:23 +0000 (14:33 +0300)]
mips: missing syscall returns wrong errno

Return -TARGET_ENOSYS instead of -ENOSYS from linux-user/main.c
   * Caused strange 'Level 2 synchronization messages' instead of
correctly reporting the syscall was missing.
   * Made glibc simply fail instead of using older syscalls

Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
13 years agomips: sigaltstack args
Wesley W. Terpstra [Tue, 12 Jul 2011 11:32:31 +0000 (14:32 +0300)]
mips: sigaltstack args

The syscall sigaltstack takes two parameters, not zero. This patch
should have no impact as only values above 4 influence the runtime
behaviour. Nevertheless, it is wrong.

Signed-off-by: Wesley W. Terpstra <terpstra@debian.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agolinux-user/syscall.c: Enforce pselect6 sigset size restrictions
Peter Maydell [Tue, 28 Jun 2011 11:21:57 +0000 (12:21 +0100)]
linux-user/syscall.c: Enforce pselect6 sigset size restrictions

Enforce the same restriction on the size of the sigset passed to
pselect6 as the Linux kernel does. This is both correct and silences
a gcc 4.6 warning about a write-only variable.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agolinux-user: Implement prlimit64 syscall
Peter Maydell [Mon, 27 Jun 2011 16:44:52 +0000 (17:44 +0100)]
linux-user: Implement prlimit64 syscall

Implement the prlimit64 syscall.

Slightly modified to apply upstream -Riku

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agolinux-user: Add syscall numbers from kernel 2.6.39.2
Peter Maydell [Mon, 27 Jun 2011 16:44:51 +0000 (17:44 +0100)]
linux-user: Add syscall numbers from kernel 2.6.39.2

Add syscall numbers for new syscall numbers; this brings us
into line with Linux 2.6.39.2.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agolinux-user: Add support for even more FB ioctls
Cédric VINCENT [Wed, 29 Jun 2011 13:09:11 +0000 (15:09 +0200)]
linux-user: Add support for even more FB ioctls

This patch was validated with programs from DirectFB-1.0 and
WebKit/DirectFB.

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agolinux-user: Add support for more VT ioctls
Cédric VINCENT [Wed, 29 Jun 2011 13:09:10 +0000 (15:09 +0200)]
linux-user: Add support for more VT ioctls

DirectFB-1.0 uses at least two of the four added ioctls, and the two
others were added for completeness.  This patch was validated with the
program "vlock -all/-new".

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agolinux-user: Add support for KD...LED ioctls
Cédric VINCENT [Wed, 29 Jun 2011 13:09:09 +0000 (15:09 +0200)]
linux-user: Add support for KD...LED ioctls

DirectFB-1.0 uses at least one of the four added ioctls, and the three
others were added for completeness.  This patch was validated with the
program "setleds" and the following Makefile:

    SETLEDS_INIT  = setleds -v -num -caps -scroll
    SETLEDS_TESTS = sh -c ' \
setleds -v +num +caps +scroll; \
setleds -v -num -caps -scroll; \
setleds -v +num -caps -scroll; \
setleds -v +num +caps -scroll; \
setleds -v +num +caps +scroll; \
setleds -v -num +caps +scroll; \
setleds -v -num -caps +scroll; \
setleds -v -num -caps -scroll'

    SETLEDS_HOST = setleds
    SETLEDS_QEMU = "SETLEDS_QEMU not set"

    .PHONY: setleds_tests
    setleds_tests:
rm -f setleds.host setleds.target
$(SETLEDS_INIT:setleds=$(SETLEDS_HOST))
$(SETLEDS_TESTS:setleds=$(SETLEDS_HOST)) >> setleds.host
$(SETLEDS_INIT:setleds=$(SETLEDS_QEMU))
$(SETLEDS_TESTS:setleds=$(SETLEDS_QEMU)) >> setleds.target
cmp setleds.host setleds.target

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agoarm-semi: Provide access to CLI arguments passed through the "-append" option
Cédric VINCENT [Wed, 29 Jun 2011 10:49:41 +0000 (12:49 +0200)]
arm-semi: Provide access to CLI arguments passed through the "-append" option

This patch basically adapts the new semi-hosting command-line support
-- introduced by Wolfgang Schildbach in the commit 2e8785ac -- for use
in system-mode.

Note that the "arm_cmdline_len" and "host_cmdline_len" variables were
renamed respectively "input_size" and "output_size" because:

    * in C, the term "length" is generally used to count the number of
      character in a string, not to count the number of bytes in a
      buffer (as it is the case here).

    * in QEMU, the term "host" is used to name variables that are in
      the host address space, not to name variables in the target
      address space (as it is the case here).

    * in the case of this system-call, the terms "input" and "output"
      fit the semantic of the official ARM semi-hosting specification
      quite well.

I know renaming can be considered harmful but I do think in this case
the semantic really matters to keep this code more understandable.

Signed-off-by: Cédric VINCENT <cedric.vincent@st.com>
Reviewed-by: Christophe Lyon <christophe.lyon@st.com>
Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: Paul Brook <paul@codesourcery.com>
Cc: Wolfgang Schildbach <wschi@dolby.com>
Cc: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Riku Voipio <riku.voipio@linaro.org>
13 years agousb-ohci: raise interrupt on attach
Gerd Hoffmann [Thu, 7 Jul 2011 13:18:50 +0000 (15:18 +0200)]
usb-ohci: raise interrupt on attach

Got lost in commit 618c169b577db64ac6589ad48825d2e11760d1a6,
add it back in.  Also fix codestyle while we are at it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-hub: remove unused descriptor arrays
Gerd Hoffmann [Thu, 7 Jul 2011 13:02:58 +0000 (15:02 +0200)]
usb-hub: remove unused descriptor arrays

Somehow they where left over when converting the hub
to the new usb descriptor infrastructure ...

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: fixup bluetooth descriptors
Gerd Hoffmann [Wed, 6 Jul 2011 10:40:28 +0000 (12:40 +0200)]
usb: fixup bluetooth descriptors

Commit 4696425cd05c7baa0a4b469d43ba4b8488bcfc0f changes some
endpoints from isocrounous to interrupt by mistake.  Fix it.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb_register_port(): do not set port->opaque and port->index twice
Jes Sorensen [Mon, 4 Jul 2011 15:33:05 +0000 (17:33 +0200)]
usb_register_port(): do not set port->opaque and port->index twice

Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: update documentation
Gerd Hoffmann [Tue, 5 Jul 2011 14:58:41 +0000 (16:58 +0200)]
usb: update documentation

Add a paragraph on companion controller mode and a
configuration file which sets it all up for you.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoehci: add ich9 controller.
Gerd Hoffmann [Fri, 1 Jul 2011 09:51:02 +0000 (11:51 +0200)]
ehci: add ich9 controller.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agoehci: fix port count.
Gerd Hoffmann [Fri, 1 Jul 2011 07:56:43 +0000 (09:56 +0200)]
ehci: fix port count.

The ICH4 EHCI controller which we emulate has six ports not four.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agouhci: add ich9 controllers
Gerd Hoffmann [Fri, 1 Jul 2011 07:48:49 +0000 (09:48 +0200)]
uhci: add ich9 controllers

Add ich9 controllers,  Factor out properties to a separate
struct and reference it to reduce duplication.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agopci: add ich9 usb controller ids
Gerd Hoffmann [Fri, 1 Jul 2011 09:45:02 +0000 (11:45 +0200)]
pci: add ich9 usb controller ids

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ohci: Add support for being a companion controller
Hans de Goede [Fri, 24 Jun 2011 18:29:05 +0000 (20:29 +0200)]
usb-ohci: Add support for being a companion controller

To use as a companion controller, use pci-ohci as device and set the
masterbus and num-ports properties, ie:

-device usb-ehci,addr=0b.1,multifunction=on,id=ehci0
-device pci-ohci,addr=0b.0,multifunction=on,masterbus=ehci0.0,num-ports=4

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-uhci: Add support for being a companion controller
Hans de Goede [Fri, 24 Jun 2011 15:44:53 +0000 (17:44 +0200)]
usb-uhci: Add support for being a companion controller

To use as a companion controller set the masterbus property.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ehci: Add support for registering companion controllers
Hans de Goede [Fri, 24 Jun 2011 14:18:13 +0000 (16:18 +0200)]
usb-ehci: Add support for registering companion controllers

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ehci: Fix handling of PED and PEDC port status bits
Hans de Goede [Fri, 24 Jun 2011 12:36:13 +0000 (14:36 +0200)]
usb-ehci: Fix handling of PED and PEDC port status bits

The PED bit should only be set for highspeed devices and the PEDC bit
should not be set on "normal" PED bit changes, only on io errors.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: assert on calling usb_attach(port, NULL) on a port without a dev
Hans de Goede [Fri, 24 Jun 2011 12:26:18 +0000 (14:26 +0200)]
usb: assert on calling usb_attach(port, NULL) on a port without a dev

with the "usb-ehci: cleanup port reset handling" patch in place no callers
are calling usb_attach(port, NULL) for a port where port->dev is NULL.

Doing that makes no sense as that causes the port detach op to get called
for a port with nothing attached. Add an assert that port->dev != NULL when
dev == NULL, and remove the check for not having a port->dev in the dev == NULL
case.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ehci: cleanup port reset handling
Hans de Goede [Tue, 21 Jun 2011 10:23:40 +0000 (12:23 +0200)]
usb-ehci: cleanup port reset handling

Doing a usb_attach when dev is NULL will just result in the
port detach op getting called even though nothing was connected in
the first place.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ehci: Connect Status bit is read only, don't allow changing it by the guest
Hans de Goede [Tue, 21 Jun 2011 10:12:35 +0000 (12:12 +0200)]
usb-ehci: Connect Status bit is read only, don't allow changing it by the guest

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb-ehci: drop unused num-ports state member
Hans de Goede [Fri, 17 Jun 2011 13:26:29 +0000 (15:26 +0200)]
usb-ehci: drop unused num-ports state member

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: Replace device_destroy bus op with a child_detach port op
Hans de Goede [Fri, 24 Jun 2011 10:31:11 +0000 (12:31 +0200)]
usb: Replace device_destroy bus op with a child_detach port op

Note this fixes 2 things in one go, first of all the device_destroy bus
op should be a device_detach bus op, as pending async packets from the
device should be cancelled on detach not on destroy.

Secondly having this as a bus op won't work with companion controllers, since
then there will be 1 bus driven by the ehci controller and thus 1 set of bus
ops, but the device being detached may be downstream of a handed over port.
Making the detach of a downstream device a port op allows the ehci controller
to forward this to the companion controller port for handed over ports.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: Make port wakeup and complete ops take a USBPort instead of a Device
Hans de Goede [Tue, 21 Jun 2011 09:52:28 +0000 (11:52 +0200)]
usb: Make port wakeup and complete ops take a USBPort instead of a Device

This makes them consistent with the attach and detach ops, and in general
it makes sense to make portops take a port as argument. This also makes
adding support for a companion controller easier / cleaner.

[ kraxel: fix usb-musb.c build ]

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: Add a register_companion USB bus op.
Hans de Goede [Fri, 24 Jun 2011 09:29:56 +0000 (11:29 +0200)]
usb: Add a register_companion USB bus op.

This is a preparation patch for adding support for USB companion controllers.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: Move (initial) call of usb_port_location to usb_fill_port
Hans de Goede [Thu, 30 Jun 2011 10:05:19 +0000 (12:05 +0200)]
usb: Move (initial) call of usb_port_location to usb_fill_port

Cleanup / preparation patch for companion controller support. Note that
as a "side-effect" this patch also fixes the milkymist-softusb controller
not having a port_location set for its ports.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
13 years agousb: Add a usb_fill_port helper function
Hans de Goede [Thu, 30 Jun 2011 09:57:57 +0000 (11:57 +0200)]
usb: Add a usb_fill_port helper function

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>