History | View | Annotate | Download (12.2 kB)
usb: fix usb_qdev_init() error handling again
Commit f462141f18ffdd75847f6459ef83d90b831d12c0 introduced clean up codewhen usb_qdev_init() fails. Unfortunately it calls .handle_destroy()when .init() was never invoked or failed. This can lead to crashes when...
usb: fix usb_qdev_init error handling.
qdev doesn't call the ->exit callback on ->init failures, so we have totake care ourself that we cleanup property on errors.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
usb: make usb_create_simple catch and pass up errors.
Use qdev_init() instead of qdev_init_nofail(), usb device initializationcan fail, most common case being port and device speed mismatch. Handlefailures correctly and pass up NULL pointers then.
Also fixup usb_create_simple() callers (only one was buggy) to properly...
usb: claim port at device initialization time.
This patch makes qemu assign a port when creating the device, not whenattaching it. For most usb devices this isn't a noticable differencebecause they are in attached state all the time.
The change affects usb-host devices which live in detached state while...
Use glib memory allocation and free functions
qemu_malloc/qemu_free no longer exist after this commit.
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
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>
usb: Move (initial) call of usb_port_location to usb_fill_port
Cleanup / preparation patch for companion controller support. Note thatas a "side-effect" this patch also fixes the milkymist-softusb controllernot having a port_location set for its ports....
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>
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 busop should be a device_detach bus op, as pending async packets from thedevice should be cancelled on detach not on destroy....
usb: Add a usb_fill_port helper function
usb-bus: Don't allow speed mismatch while attaching devices
usb-bus: Don't allow attaching a device to a bus with no free ports
usb: Proper error propagation for usb_device_attach errors
usb: cancel async packets on unplug
This patch adds USBBusOps struct with (for now) only a single callbackwhich is called when a device is about to be destroyed. The USB Hostadapters are implementing this callback and use it to cancel any asyncrequests which might be in flight before the device actually goes away....
usb-bus: Add knowledge of USB_SPEED_SUPER to usb_speed helper
usb-bus: Don't detach non attached devices on device exit
This causes an "Error: tried to detach unattached usb device " to be printed,this can happen when deleting ie a usb host qdev, which did notget attached (because a device matching the filter never got plugged in)....
usb-bus: use snprintf
Avoid this warning from OpenBSD linker: LINK i386-softmmu/qemu../usb-bus.o(.text+0x27c): In function `usb_get_fw_dev_path':/src/qemu/hw/usb-bus.c:294: warning: sprintf() is often misused,please use snprintf()
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>...
usb core: add migration support
Yes, seriously. There is no migration support at all for usb devices.They loose state, especially the device address, and stop respondingbecause of that. Oops.
Luckily there is so much broken usb hardware out there that the guest...
usb: zap pdev from usbport
It isn't needed any more.
usb: rewrite fw path, fix numbering
This patch rewrites the firmware path code to use the physical portlocation tracking just added to the qemu usb core. It also fixes theport numbering to start with "1" in the firmware path.
usb: add port property.
This allows to explictily set the physical port where you want toplug the usb device. Example:
-device usb-tablet,bus=usb.0,port=2
With explicit port addressing qemu can and will not automagically addUSB Hubs. This means that:...
usb: keep track of physical port address.
Add a path string to USBPort. Add usb_port_location() function to setthe physical location of the usb port. Update all drivers implementingusb ports to call it. Update the monitor commands to print it. Wind it...
usb: add speed mask to ports
Add a field to usb ports indicating the speed(s) they areable to handle.
usb: create USBPortOps, move attach there.
Create USBPortOps struct, move the attach function to that struct.
usb descriptors: add settable strings.
This patch allows to set usb descriptor strings per device instance.
Record which USBDevice USBPort belongs too.
Ports on root hub will have NULL here. This is needed to reconstructpath from device to its root hub to build device path.
Signed-off-by: Gleb Natapov <gleb@redhat.com>Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
Add get_fw_dev_path callback for usb bus.
usb: remove dead assignments, spotted by clang analyzer
Value stored is never read.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
usb-bus: fix no params
After commit 702f3e0fb52c124c07f215426eeadb70a716643f, the params isnerver NULL. It should check *params instead of params to determinewhether the params is empty.
Signed-off-by: TeLeMan <geleman@gmail.com>Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
Avoid crash on '-usbdevice <device>' without parameters
Many usbdevice_init implementors assume params is non-NULL.
Signed-off-by: Jan Kiszka <jan.kiszka@web.de>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
error: Replace qemu_error() by error_report()
error_report() terminates the message with a newline. Strip it itfrom its arguments.
This fixes a few error messages lacking a newline:net_handle_fd_param()'s "No file descriptor named %s found", andtap_open()'s "vnet_hdr=1 requested, but no kernel support for...
Fix -usbdevice crash
If -usbdevice is used on a machine with no USB busses, usb_createwill fail and return NULL. Patch below handles this failure gracefullyrather than crashing when we try to init the device.
Signed-off-by: Paul Brook <paul@codesourcery.com>
qdev: Rename USBDevice member devname to product_desc
It's not a device name, it's the USB product description string.
Signed-off-by: Markus Armbruster <armbru@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
qdev: Separate USB product description from qdev name
Using the qdev name for the product description makes for inconvenientqdev names.
Put the product description in new USBDeviceInfo member product_desc.Make usb_qdev_init() use it. No user or guest visible change, since...
qdev: Replace device names containing whitespace
Device names with whitespace require quoting in the shell and in themonitor. Some of the offenders are also overly long. Some have amore convenient alias, some don't.
The place for verbose device names is DeviceInfo member desc. The...
usb: print attached status in info qtree
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
usb: make attach optional.
Add a auto_attach field to USBDevice, which is enabled by default.USB drivers can clear this field in case they do not want the devicebeing attached (i.e. plugged into a usb port) automatically aftersuccessfull init().
Use cases (see next patches):...
usb core: use qdev for -usbdevice
This patchs adds infrastructure to handle -usbdevice via qdev callbacks.USBDeviceInfo gets a name field (for the -usbdevice driver name) and acallback for -usbdevice parameter parsing.
The new usbdevice_create() function walks the qdev driver list and looks...
New qdev_init_nofail()
Like qdev_init(), but terminate program via hw_error() instead ofreturning an error value.
Use it instead of qdev_init() where terminating the program on failureis okay, either because it's during machine construction, or because...
usb: hook unplug into qdev, cleanups + fixes.
Hook into DeviceInfo->exit().
handle_destroy() must not free the state struct, this is handledby the new usb_qdev_exit() function now.
qdev_free(usb_device) works now.
Fix usb hub to qdev_free() all connected devices on unplug....
usb: hotplug windup
switch usb bus to inplace allocation.
Fix sys-queue.h conflict for good
Problem: Our file sys-queue.h is a copy of the BSD file, but there aresome additions and it's not entirely compatible. Because of that, there havebeen conflicts with system headers on BSD systems. Some hacks have beenintroduced in the commits 15cc9235840a22c289edbe064a9b3c19c5f49896,...
qdev/usb: add usb bus support to qdev, convert drivers.
TODO: * make the rest of qemu aware of usb busses and kill the FIXMEs added by this patch....
qdev/usb: make qemu aware of usb busses.
Move usb code from vl.c to usb-bus.c and make it use the new datastructures added by qdev conversion. qemu usb core should be ableto handle multiple USB busses just fine now (untested though).
Kill some usb_*_init() legacy functions, use usb_create_simple()...