qemu-commits
[Top][All Lists]
Advanced

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

[Qemu-commits] [qemu/qemu] a3c27e: hw/usb/host-libusb.c: fix build with


From: Peter Maydell
Subject: [Qemu-commits] [qemu/qemu] a3c27e: hw/usb/host-libusb.c: fix build with kernel < 5.0
Date: Sat, 23 Jan 2021 11:15:14 -0800

  Branch: refs/heads/master
  Home:   https://github.com/qemu/qemu
  Commit: a3c27ea0344d3cc7295a5f0589d5514913ec1522
      
https://github.com/qemu/qemu/commit/a3c27ea0344d3cc7295a5f0589d5514913ec1522
  Author: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M hw/usb/host-libusb.c

  Log Message:
  -----------
  hw/usb/host-libusb.c: fix build with kernel < 5.0

USBDEVFS_GET_SPEED is used since version 5.2.0 and
https://gitlab.com/qemu-project/qemu/-/commit/202d69a715a4b1824dcd7ec1683d027ed2bae6d3
resulting in the following build failure with kernel < 5.0:

../hw/usb/host-libusb.c: In function 'usb_host_open':
../hw/usb/host-libusb.c:953:32: error: 'USBDEVFS_GET_SPEED' undeclared (first 
use in this function); did you mean 'USBDEVFS_GETDRIVER'?
         int rc = ioctl(hostfd, USBDEVFS_GET_SPEED, NULL);
                                ^~~~~~~~~~~~~~~~~~
                                USBDEVFS_GETDRIVER

A tentative was made to fix this build failure with
https://gitlab.com/qemu-project/qemu/-/commit/4969e697c15ac536d5c0700381d5d026ef7f0588

However, the assumption that distros with old kernels also have old
libusb is just wrong so also add a check for defined(USBDEVFS_GET_SPEED)

Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
Message-id: 20201213213016.457350-1-fontaine.fabrice@gmail.com

[ kraxel: codestyle whitespace fixup ]

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: 268c02424b0b8078c15acdf73edbdeeb0dd80808
      
https://github.com/qemu/qemu/commit/268c02424b0b8078c15acdf73edbdeeb0dd80808
  Author: Alex Chen <alex.chen@huawei.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M hw/usb/ccid-card-passthru.c
    M hw/usb/core.c
    M hw/usb/dev-smartcard-reader.c
    M hw/usb/hcd-ehci.c

  Log Message:
  -----------
  hw/usb: Fix bad printf format specifiers

We should use printf format specifier "%u" instead of "%d" for
argument of type "unsigned int".

Reported-by: Euler Robot <euler.robot@huawei.com>
Signed-off-by: Alex Chen <alex.chen@huawei.com>
Message-id: 20201119025751.45750-1-alex.chen@huawei.com
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: c3585b600bae4e67867aac73e03a3edf38ec8f1f
      
https://github.com/qemu/qemu/commit/c3585b600bae4e67867aac73e03a3edf38ec8f1f
  Author: Markus Armbruster <armbru@redhat.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M hw/usb/hcd-xhci-pci.c
    M hw/usb/hcd-xhci-sysbus.c

  Log Message:
  -----------
  hw/usb: Convert to qdev_realize()

Device code shouldn't mess with QOM property "realized" since we have
proper interfaces (merge commit 6675a653).  Commit 8ddab8dd3d
"usb/hcd-xhci: Split pci wrapper for xhci base model" and commit
f00ff136ee "usb: hcd-xhci-sysbus: Attach xhci to sysbus device"
reintroduced two instances.  Clean them up.  Note that s->xhci is
a (bus-less) TYPE_XHCI device.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210119120151.53757-1-armbru@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: 96b66e55755a81f9e9e959e5f8a3d3aad9949167
      
https://github.com/qemu/qemu/commit/96b66e55755a81f9e9e959e5f8a3d3aad9949167
  Author: Philippe Mathieu-Daudé <philmd@redhat.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M hw/usb/hcd-xhci.h

  Log Message:
  -----------
  hw/usb/hcd-xhci: Fix extraneous format-truncation error on 32-bit hosts

For some reason the assert() added in commit ccb799313a5
("hw/usb: avoid format truncation warning when formatting
port name") does not fix when building with GCC 10.

KISS and expand the buffer by 4 bytes to silent the following
error when using GCC 10.2.1 on Fedora 33:

  hw/usb/hcd-xhci.c: In function 'usb_xhci_realize':
  hw/usb/hcd-xhci.c:3309:54: error: '%d' directive output may be truncated 
writing between 1 and 8 bytes into a region of size 5 
[-Werror=format-truncation=]
   3309 |             snprintf(port->name, sizeof(port->name), "usb2 port #%d", 
i+1);
        |                                                      ^~~~~~~~~~~~~~~
  hw/usb/hcd-xhci.c:3309:54: note: directive argument in the range [1, 89478486]
  In file included from /usr/include/stdio.h:866,
                   from include/qemu/osdep.h:85,
                   from hw/usb/hcd-xhci.c:22:
  /usr/include/bits/stdio2.h:70:10: note: '__builtin___snprintf_chk' output 
between 13 and 20 bytes into a destination of size 16
     70 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     71 |        __bos (__s), __fmt, __va_arg_pack ());
        |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  hw/usb/hcd-xhci.c:3323:54: error: '%d' directive output may be truncated 
writing between 1 and 8 bytes into a region of size 5 
[-Werror=format-truncation=]
   3323 |             snprintf(port->name, sizeof(port->name), "usb3 port #%d", 
i+1);
        |                                                      ^~~~~~~~~~~~~~~
  hw/usb/hcd-xhci.c:3323:54: note: directive argument in the range [1, 89478486]
  In file included from /usr/include/stdio.h:866,
                   from include/qemu/osdep.h:85,
                   from hw/usb/hcd-xhci.c:22:
  /usr/include/bits/stdio2.h:70:10: note: '__builtin___snprintf_chk' output 
between 13 and 20 bytes into a destination of size 16
     70 |   return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
        |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     71 |        __bos (__s), __fmt, __va_arg_pack ());
        |        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  cc1: all warnings being treated as errors

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210118181115.313742-1-philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: 2e8f72acb0e948566c129d3e819cd77b9a8789ac
      
https://github.com/qemu/qemu/commit/2e8f72acb0e948566c129d3e819cd77b9a8789ac
  Author: Philippe Mathieu-Daudé <philmd@redhat.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M include/scsi/utils.h
    M scsi/utils.c

  Log Message:
  -----------
  scsi/utils: Add INVALID_PARAM_VALUE sense code definition

Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210120153522.1173897-3-philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: d755cb9696e8aa16e850ac5f0b908015520cd395
      
https://github.com/qemu/qemu/commit/d755cb9696e8aa16e850ac5f0b908015520cd395
  Author: Philippe Mathieu-Daudé <philmd@redhat.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M hw/usb/dev-uas.c

  Log Message:
  -----------
  hw/usb/dev-uas: Report command additional adb length as unsupported

We are not ready to handle additional CDB data.

If a guest sends a packet with such additional data,
report the command parameter as not supported.

Specify a size (of 1 byte) for the add_cdb member we
are not using, to fix the following warning:

  usb/dev-uas.c:157:31: error: field 'status' with variable sized type 'uas_iu' 
not at the end of a struct or class is a GNU extension 
[-Werror,-Wgnu-variable-sized-type-not-at-end]
      uas_iu                    status;
                                ^

Reported-by: Ed Maste <emaste@FreeBSD.org>
Reported-by: Daniele Buono <dbuono@linux.vnet.ibm.com>
Reported-by: Han Han <hhan@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210120153522.1173897-4-philmd@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: 0f6dba145a4be998e0e5e4ccd94d9df8609eb327
      
https://github.com/qemu/qemu/commit/0f6dba145a4be998e0e5e4ccd94d9df8609eb327
  Author: Gerd Hoffmann <kraxel@redhat.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M hw/usb/bus.c
    M hw/usb/core.c
    M hw/usb/meson.build
    A hw/usb/pcap.c
    M include/hw/usb.h

  Log Message:
  -----------
  usb: add pcap support.

Log all traffic of a specific usb device to a pcap file for later
inspection.  File format is compatible with linux usb monitor.

Usage:
  qemu -device usb-${somedevice},pcap=file.pcap
  wireshark file.pcap

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20210119194452.2148048-1-kraxel@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>


  Commit: 2980a316734c420e7398aec026909dcfc8614c1d
      
https://github.com/qemu/qemu/commit/2980a316734c420e7398aec026909dcfc8614c1d
  Author: Gerd Hoffmann <kraxel@redhat.com>
  Date:   2021-01-22 (Fri, 22 Jan 2021)

  Changed paths:
    M hw/usb/host-libusb.c

  Log Message:
  -----------
  usb-host: map LIBUSB_SPEED_SUPER_PLUS to USB_SPEED_SUPER

Handle host superspeedplus (usb 3.1+) devices like superspeed (usb 3.0)
devices.  That is enough to get them handled properly by xhci.  They show
up as superspeed devices inside the guest, but should be able to actually
run at higher speeds.

Reported-by: Angel Pagan <Angel.Pagan@stratus.com>
Tested-by: Angel Pagan <Angel.Pagan@stratus.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-Id: <20210121150832.3564097-1-kraxel@redhat.com>


  Commit: e93c65a6c64fa18b0c61fb9338d364cbea32b6ef
      
https://github.com/qemu/qemu/commit/e93c65a6c64fa18b0c61fb9338d364cbea32b6ef
  Author: Peter Maydell <peter.maydell@linaro.org>
  Date:   2021-01-23 (Sat, 23 Jan 2021)

  Changed paths:
    M hw/usb/bus.c
    M hw/usb/ccid-card-passthru.c
    M hw/usb/core.c
    M hw/usb/dev-smartcard-reader.c
    M hw/usb/dev-uas.c
    M hw/usb/hcd-ehci.c
    M hw/usb/hcd-xhci-pci.c
    M hw/usb/hcd-xhci-sysbus.c
    M hw/usb/hcd-xhci.h
    M hw/usb/host-libusb.c
    M hw/usb/meson.build
    A hw/usb/pcap.c
    M include/hw/usb.h
    M include/scsi/utils.h
    M scsi/utils.c

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

usb: cleanups and fixes.
usb: add pcap support.

# gpg: Signature made Fri 22 Jan 2021 17:48:35 GMT
# gpg:                using RSA key A0328CFFB93A17A79901FE7D4CB6D8EED3E87138
# gpg: Good signature from "Gerd Hoffmann (work) <kraxel@redhat.com>" [full]
# gpg:                 aka "Gerd Hoffmann <gerd@kraxel.org>" [full]
# gpg:                 aka "Gerd Hoffmann (private) <kraxel@gmail.com>" [full]
# Primary key fingerprint: A032 8CFF B93A 17A7 9901  FE7D 4CB6 D8EE D3E8 7138

* remotes/kraxel/tags/usb-20210122-pull-request:
  usb-host: map LIBUSB_SPEED_SUPER_PLUS to USB_SPEED_SUPER
  usb: add pcap support.
  hw/usb/dev-uas: Report command additional adb length as unsupported
  scsi/utils: Add INVALID_PARAM_VALUE sense code definition
  hw/usb/hcd-xhci: Fix extraneous format-truncation error on 32-bit hosts
  hw/usb: Convert to qdev_realize()
  hw/usb: Fix bad printf format specifiers
  hw/usb/host-libusb.c: fix build with kernel < 5.0

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>


Compare: https://github.com/qemu/qemu/compare/0e3246263068...e93c65a6c64f



reply via email to

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