qemu-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-commits] [qemu/qemu] 4806ec: usb: usb_create() can't fail, drop us


From: GitHub
Subject: [Qemu-commits] [qemu/qemu] 4806ec: usb: usb_create() can't fail, drop useless error h...
Date: Wed, 25 Feb 2015 05:30:06 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: 4806ec9b2c57ff42a91d5419ac1137fffd1c9fb5
      
https://github.com/qemu/qemu/commit/4806ec9b2c57ff42a91d5419ac1137fffd1c9fb5
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/usb/bus.c
    M hw/usb/dev-bluetooth.c
    M hw/usb/dev-network.c
    M hw/usb/dev-serial.c
    M hw/usb/dev-storage.c

  Log Message:
  -----------
  usb: usb_create() can't fail, drop useless error handling

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3bc36a401e0f33e63a4d2c58b646ddf78efb567c
      
https://github.com/qemu/qemu/commit/3bc36a401e0f33e63a4d2c58b646ddf78efb567c
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/usb/bus.c
    M hw/usb/dev-bluetooth.c
    M hw/usb/dev-network.c
    M hw/usb/dev-serial.c
    M hw/usb/dev-storage.c
    M hw/usb/host-legacy.c

  Log Message:
  -----------
  usb: Improve -usbdevice error reporting a bit

Most LegacyUSBFactory usbdevice_init() methods realize with
qdev_init_nofail(), even though their caller usbdevice_create() can
handle failure.  Okay if it really can't fail (I didn't check), but
somewhat brittle.

usb_msd_init() and usb_bt_init() call qdev_init().  The latter
additionally reports an error when qdev_init() fails.

Realization failure produces multiple error reports: a specific one
from qdev_init(), and generic ones from usb_bt_init(),
usb_create_simple(), usbdevice_create() and usb_parse().

Remove realization from the usbdevice_init() methods.  Realize in
usbdevice_create(), and produce exactly one error message there.  You
still get another one from usb_parse().

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 06f22eb78f3eb557c667f5d0a46099e43a2aeb0d
      
https://github.com/qemu/qemu/commit/06f22eb78f3eb557c667f5d0a46099e43a2aeb0d
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/usb/bus.c

  Log Message:
  -----------
  usb: Do not prefix error_setg() messages with "Error: "

Because it produces beauties like

    (qemu) usb_add mouse
    Failed to initialize USB device 'usb-mouse': Error: tried to attach usb 
device QEMU USB Mouse to a bus with no free ports

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: bd8b92d5c8387c2c94f06665514c05000169fafd
      
https://github.com/qemu/qemu/commit/bd8b92d5c8387c2c94f06665514c05000169fafd
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/usb/bus.c

  Log Message:
  -----------
  usb: Suppress bogus error when automatic usb-hub creation fails

USBDevice's realize method usb_qdev_realize() automatically creates a
usb-hub when only one port is left.  Creating devices in realize
methods is questionable, but works.

If usb-hub creation fails, an error is reported to stderr, but the
failure is otherwise ignored.  We then create the actual device using
the last port, which may well succeed.

Example:

    $ qemu -nodefaults -S -display none -machine usb=on -monitor stdio
    QEMU 2.2.50 monitor - type 'help' for more information
    (qemu) device_add usb-mouse
    [Repeat 36 times]
    (qemu) info usb
      Device 0.0, Port 1, Speed 12 Mb/s, Product QEMU USB Mouse
      Device 0.0, Port 2, Speed 12 Mb/s, Product QEMU USB Hub
      Device 0.0, Port 2.1, Speed 12 Mb/s, Product QEMU USB Mouse
    [More mice and hubs omitted...]
      Device 0.0, Port 2.8.8.8.8.7, Speed 12 Mb/s, Product QEMU USB Mouse
    (qemu) device_add usb-mouse
    usb hub chain too deep
    Failed to initialize USB device 'usb-hub'
    (qemu) info usb
    [...]
      Device 0.0, Port 2.8.8.8.8.7, Speed 12 Mb/s, Product QEMU USB Mouse
      Device 0.0, Port 2.8.8.8.8.8, Speed 12 Mb/s, Product QEMU USB Mouse

Despite the "Failed" message, the command actually succeeded.

In QMP, it's worse.  When adding the 37th mouse via QMP, the command
fails with

    {"error": {"class": "GenericError", "desc": "usb hub chain too deep"}}

Additionally, "Failed to initialize USB device 'usb-hub'" is reported
on stderr.  Despite the command failure, the device was created.  This
is wrong.

Fix by avoiding qdev_init() for usb-hub creation, so we can ignore
errors cleanly.

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 599655c91f3a55ac75007e851deca09010787bd7
      
https://github.com/qemu/qemu/commit/599655c91f3a55ac75007e851deca09010787bd7
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/usb/bus.c

  Log Message:
  -----------
  usb: Change usb_create_simple() to abort on failure

Instead of returning null pointer.  Matches pci_create_simple(),
isa_create_simple(), sysbus_create_simple().  It's unused since the
previous commit, but I'll put it to use again shortly.

Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 456dcd8ab45a83dd51cca357cd9aa6ad337dc20d
      
https://github.com/qemu/qemu/commit/456dcd8ab45a83dd51cca357cd9aa6ad337dc20d
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/sh4/r2d.c

  Log Message:
  -----------
  r2d: Don't use legacy -usbdevice support for setting up board

It's tempting, because usbdevice_create() is so simple to use.  But
there's a lot of unwanted complexity behind the simple interface.
Switch to usb_create_simple().

Cc: Magnus Damm <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: c86580b889a0c22deba3afd4672472f23a1249d0
      
https://github.com/qemu/qemu/commit/c86580b889a0c22deba3afd4672472f23a1249d0
  Author: Markus Armbruster <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M hw/ppc/mac_newworld.c
    M hw/ppc/spapr.c

  Log Message:
  -----------
  PPC: Don't use legacy -usbdevice support for setting up board

It's tempting, because usbdevice_create() is so simple to use.  But
there's a lot of unwanted complexity behind the simple interface.
Switch to usb_create_simple().

Cc: Alexander Graf <address@hidden>
Cc: address@hidden
Signed-off-by: Markus Armbruster <address@hidden>
Reviewed-by: Alexander Graf <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: c3cf77cb63b71618224129df41f114488e0f74e4
      
https://github.com/qemu/qemu/commit/c3cf77cb63b71618224129df41f114488e0f74e4
  Author: David Gibson <address@hidden>
  Date:   2015-02-18 (Wed, 18 Feb 2015)

  Changed paths:
    M default-configs/arm-softmmu.mak
    M hw/usb/Makefile.objs

  Log Message:
  -----------
  Make sysbus EHCI devices ARM only by default

A number of ARM embedded boards include EHCI USB host controllers which
appear as directly mapped devices, rather than sitting on a PCI bus.

At present code to emulate such devices is included whenever EHCI support
is included.  This patch adjusts teh config options to only include them
in builds targetting ARM by default.

Signed-off-by: David Gibson <address@hidden>
Signed-off-by: Gerd Hoffmann <address@hidden>


  Commit: 3d30395f7fb3315e4ecf0de4e48790e1326bbd47
      
https://github.com/qemu/qemu/commit/3d30395f7fb3315e4ecf0de4e48790e1326bbd47
  Author: Peter Maydell <address@hidden>
  Date:   2015-02-25 (Wed, 25 Feb 2015)

  Changed paths:
    M default-configs/arm-softmmu.mak
    M hw/ppc/mac_newworld.c
    M hw/ppc/spapr.c
    M hw/sh4/r2d.c
    M hw/usb/Makefile.objs
    M hw/usb/bus.c
    M hw/usb/dev-bluetooth.c
    M hw/usb/dev-network.c
    M hw/usb/dev-serial.c
    M hw/usb/dev-storage.c
    M hw/usb/host-legacy.c

  Log Message:
  -----------
  Merge remote-tracking branch 'remotes/kraxel/tags/pull-usb-20150218-1' into 
staging

usb: error handling fixes from Markus, make sysbus ehci arm-only.

# gpg: Signature made Wed Feb 18 09:54:13 2015 GMT using RSA key ID D3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <address@hidden>"
# gpg:                 aka "Gerd Hoffmann <address@hidden>"
# gpg:                 aka "Gerd Hoffmann (private) <address@hidden>"

* remotes/kraxel/tags/pull-usb-20150218-1:
  Make sysbus EHCI devices ARM only by default
  PPC: Don't use legacy -usbdevice support for setting up board
  r2d: Don't use legacy -usbdevice support for setting up board
  usb: Change usb_create_simple() to abort on failure
  usb: Suppress bogus error when automatic usb-hub creation fails
  usb: Do not prefix error_setg() messages with "Error: "
  usb: Improve -usbdevice error reporting a bit
  usb: usb_create() can't fail, drop useless error handling

Signed-off-by: Peter Maydell <address@hidden>


Compare: https://github.com/qemu/qemu/compare/c28d4869ea12...3d30395f7fb3

reply via email to

[Prev in Thread] Current Thread [Next in Thread]