13 Jan, 2019
1 commit
-
commit 7ed1c1901fe52e6c5828deb155920b44b0adabb1 upstream.
Currently a number of Makefiles break when used with toolchains that
pass extra flags in CC and other cross-compile related variables (such
as --sysroot).Thus we get this error when we use a toolchain that puts --sysroot in
the CC var:~/src/linux/tools$ make iio
[snip]
iio_event_monitor.c:18:10: fatal error: unistd.h: No such file or directory
#include
^~~~~~~~~~This occurs because we clobber several env vars related to
cross-compiling with lines like this:CC = $(CROSS_COMPILE)gcc
Although this will point to a valid cross-compiler, we lose any extra
flags that might exist in the CC variable, which can break toolchains
that rely on them (for example, those that use --sysroot).This easily shows up using a Yocto SDK:
$ . [snip]/sdk/environment-setup-cortexa8hf-neon-poky-linux-gnueabi
$ echo $CC
arm-poky-linux-gnueabi-gcc -march=armv7-a -mfpu=neon -mfloat-abi=hard
-mcpu=cortex-a8
--sysroot=[snip]/sdk/sysroots/cortexa8hf-neon-poky-linux-gnueabi$ echo $CROSS_COMPILE
arm-poky-linux-gnueabi-$ echo ${CROSS_COMPILE}gcc
krm-poky-linux-gnueabi-gccAlthough arm-poky-linux-gnueabi-gcc is a cross-compiler, we've lost the
--sysroot and other flags that enable us to find the right libraries to
link against, so we can't find unistd.h and other libraries and headers.
Normally with the --sysroot flag we would find unistd.h in the sdk
directory in the sysroot:$ find [snip]/sdk/sysroots -path '*/usr/include/unistd.h'
[snip]/sdk/sysroots/cortexa8hf-neon-poky-linux-gnueabi/usr/include/unistd.hThe perf Makefile adds CC = $(CROSS_COMPILE)gcc if and only if CC is not
already set, and it compiles correctly with the above toolchain.So, generalize the logic that perf uses in the common Makefile and
remove the manual CC = $(CROSS_COMPILE)gcc lines from each Makefile.Note that this patch does not fix cross-compile for all the tools (some
have other bugs), but it does fix it for all except usb and acpi, which
still have other unrelated issues.I tested both with and without the patch on native and cross-build and
there appear to be no regressions.Link: http://lkml.kernel.org/r/20180107214028.23771-1-martin@martingkelly.com
Signed-off-by: Martin Kelly
Acked-by: Mark Brown
Cc: Tejun Heo
Cc: Li Zefan
Cc: Johannes Weiner
Cc: Linus Walleij
Cc: "K. Y. Srinivasan"
Cc: Haiyang Zhang
Cc: Stephen Hemminger
Cc: Jonathan Cameron
Cc: Pali Rohar
Cc: Richard Purdie
Cc: Jacek Anaszewski
Cc: Pavel Machek
Cc: Peter Zijlstra
Cc: Ingo Molnar
Cc: Arnaldo Carvalho de Melo
Cc: Robert Moore
Cc: Lv Zheng
Cc: "Rafael J. Wysocki"
Cc: Greg Kroah-Hartman
Cc: Valentina Manea
Cc: Shuah Khan
Cc: Mario Limonciello
Signed-off-by: Andrew Morton
Signed-off-by: Linus Torvalds
Cc: Ignat Korchagin
Signed-off-by: Greg Kroah-Hartman
05 Sep, 2018
1 commit
-
[ Upstream commit a2b22dddc7bb6110ac3b5ed1a60aa9279836fadb ]
The tools/usb/ffs-test.c file defines cpu_to_le16/32 by using the C
library htole16/32 function calls. However, cpu_to_le16/32 are used when
initializing structures, i.e in a context where a function call is not
allowed.It works fine on little endian systems because htole16/32 are defined by
the C library as no-ops. But on big-endian systems, they are actually
doing something, which might involve calling a function, causing build
failures, such as:ffs-test.c:48:25: error: initializer element is not constant
#define cpu_to_le32(x) htole32(x)
^~~~~~~
ffs-test.c:128:12: note: in expansion of macro ‘cpu_to_le32’
.magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2),
^~~~~~~~~~~To solve this, we code cpu_to_le16/32 in a way that allows them to be
used when initializing structures. This fix was imported from
meta-openembedded/android-tools/fix-big-endian-build.patch written by
Thomas Petazzoni .CC: Thomas Petazzoni
Signed-off-by: Peter Senna Tschudin
Signed-off-by: Felipe Balbi
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
03 Aug, 2018
2 commits
-
[ Upstream commit de19ca6fd72c7dd45ad82403e7b3fe9c74ef6767 ]
As the amount of available ports varies by the kernels build
configuration. To remove the limitation of the fixed 128 ports
we allocate the amount of idevs by using the number we get
from the kernel.Signed-off-by: Michael Grzeschik
Acked-by: Shuah Khan (Samsung OSG)
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman -
[ Upstream commit d179f99a651685b19333360e6558110da2fe9bd7 ]
detach_port() fails to call usbip_vhci_driver_close() from its error
path after usbip_vhci_detach_device() returns failure, leaking memory
allocated in usbip_vhci_driver_open() and holding udev_context and udev
references. Fix it to call usbip_vhci_driver_close().Signed-off-by: Shuah Khan (Samsung OSG)
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
19 Mar, 2018
1 commit
-
[ Upstream commit 77be4c878c72e411ad22af96b6f81dd45c26450a ]
Indeed musl doesn't define old SIGCLD signal name but only new one SIGCHLD.
SIGCHLD is the new POSIX name for that signal so it doesn't change
anything on other libcs.This fixes this kind of build error:
usbipd.c: In function ‘set_signal’:
usbipd.c:459:12: error: 'SIGCLD' undeclared (first use in this function)
sigaction(SIGCLD, &act, NULL);
^~~~~~
usbipd.c:459:12: note: each undeclared identifier is reported only once
for each function it appears in
Makefile:407: recipe for target 'usbipd.o' failed
make[3]: *** [usbipd.o] Error 1Signed-off-by: Julien BOIBESSOT
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman
04 Feb, 2018
2 commits
-
commit ef824501f50846589f02173d73ce3fe6021a9d2a upstream.
usbip host lists devices attached to vhci_hcd on the same server
when user does attach over localhost or specifies the server as the
remote.usbip attach -r localhost -b busid
or
usbip attach -r servername (or server IP)Fix it to check and not list devices that are attached to vhci_hcd.
Signed-off-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman -
commit ef54cf0c600fb8f5737fb001a9e357edda1a1de8 upstream.
usbip host binds to devices attached to vhci_hcd on the same server
when user does attach over localhost or specifies the server as the
remote.usbip attach -r localhost -b busid
or
usbip attach -r servername (or server IP)Unbind followed by bind works, however device is left in a bad state with
accesses via the attached busid result in errors and system hangs during
shutdown.Fix it to check and bail out if the device is already attached to vhci_hcd.
Signed-off-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
03 Jan, 2018
1 commit
-
commit 544c4605acc5ae4afe7dd5914147947db182f2fb upstream.
usbip bind writes commands followed by random string when writing to
match_busid attribute in sysfs, caused by using full variable size
instead of string length.Signed-off-by: Juan Zea
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
20 Dec, 2017
1 commit
-
commit 2f2d0088eb93db5c649d2a5e34a3800a8a935fc5 upstream.
When a client has a USB device attached over IP, the vhci_hcd driver is
locally leaking a socket pointer address via the/sys/devices/platform/vhci_hcd/status file (world-readable) and in debug
output when "usbip --debug port" is run.Fix it to not leak. The socket pointer address is not used at the moment
and it was made visible as a convenient way to find IP address from socket
pointer address by looking up /proc/net/{tcp,tcp6}.As this opens a security hole, the fix replaces socket pointer address with
sockfd.Reported-by: Secunia Research
Signed-off-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
10 Dec, 2017
2 commits
-
[ Upstream commit c15562c0dcb2c7f26e891923b784cf1926b8c833 ]
usbip_host_driver.h now depends on several additional headers, which
need to be installed along with it.Fixes: 021aed845303 ("staging: usbip: userspace: migrate usbip_host_driver ...")
Fixes: 3391ba0e2792 ("usbip: tools: Extract generic code to be shared with ...")
Signed-off-by: Ben Hutchings
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
Signed-off-by: Sasha Levin
Signed-off-by: Greg Kroah-Hartman -
commit 1ac7c8a78be85f84b019d3d2742d1a9f07255cc5 upstream.
usbip attach fails to find a free port when the device on the first port
is a USB_SPEED_SUPER device and non-super speed device is being attached.
It keeps checking the first port and returns without a match getting stuck
in a loop.Fix it check to find the first port with matching speed.
Reported-by: Juan Zea
Signed-off-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
02 Nov, 2017
1 commit
-
Many source files in the tree are missing licensing information, which
makes it harder for compliance tools to determine the correct license.By default all files without license information are under the default
license of the kernel, which is GPL version 2.Update the files which contain no license information with the 'GPL-2.0'
SPDX license identifier. The SPDX identifier is a legally binding
shorthand, which can be used instead of the full boiler plate text.This patch is based on work done by Thomas Gleixner and Kate Stewart and
Philippe Ombredanne.How this work was done:
Patches were generated and checked against linux-4.14-rc6 for a subset of
the use cases:
- file had no licensing information it it.
- file was a */uapi/* one with no licensing information in it,
- file was a */uapi/* one with existing licensing information,Further patches will be generated in subsequent months to fix up cases
where non-standard license headers were used, and references to license
had to be inferred by heuristics based on keywords.The analysis to determine which SPDX License Identifier to be applied to
a file was done in a spreadsheet of side by side results from of the
output of two independent scanners (ScanCode & Windriver) producing SPDX
tag:value files created by Philippe Ombredanne. Philippe prepared the
base worksheet, and did an initial spot review of a few 1000 files.The 4.13 kernel was the starting point of the analysis with 60,537 files
assessed. Kate Stewart did a file by file comparison of the scanner
results in the spreadsheet to determine which SPDX license identifier(s)
to be applied to the file. She confirmed any determination that was not
immediately clear with lawyers working with the Linux Foundation.Criteria used to select files for SPDX license identifier tagging was:
- Files considered eligible had to be source code files.
- Make and config files were included as candidates if they contained >5
lines of source
- File already had some variant of a license header in it (even if
Reviewed-by: Philippe Ombredanne
Reviewed-by: Thomas Gleixner
Signed-off-by: Greg Kroah-Hartman
01 Sep, 2017
1 commit
-
This patch adds recovery from false busy state on concurrent attach
operation.The procedure of attach operation is as below.
1) Find an unused port in /sys/devices/platform/vhci_hcd/status.
(userspace)
2) Request attach found port to driver through
/sys/devices/platform/vhci_hcd/attach. (userspace)
3) Lock table, reserve requested port and unlock table. (vhci driver)Attaching more than one remote devices concurrently, same unused port
number will be found in step-1. Then one request will succeed and
others will fail even though there are some unused ports.With this patch, driver returns EBUSY when requested port has already
been used. In this case, attach command retries from step-1: finding
another unused port. If there's no unused port, the attach operation
will fail in step-1. Otherwise it retries automatically using another
unused port.vhci-hcd's interface (only errno) is changed as following.
Current errno New errno Condition
EINVAL same as left specified port number is in invalid
range
EAGAIN same as left platform_get_drvdata() failed
EINVAL same as left specified socket fd is not valid
EINVAL EBUSY specified port status is not freeThe errno EBUSY was not used in userspace
src/usbip_attach.c:import_device(). It is needed to distinguish the
condition to be able to retry from other unrecoverable errors.It is possible to avoid this failure by introducing userspace exclusive
control. But it's exaggerated for this special condition. The locking
itself has done in driver.
As an alternate solution, userspace doesn't specify port number, driver
searches unused port and it returns port number to the userspace. With
this solution, the interface is much different than this patch.Signed-off-by: Nobuo Iwata
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
20 Jun, 2017
1 commit
-
…/usb into usb-testing
Felipe writes:
usb: changes for v4.13 merge window
This time around we have a total of 57 non-merge commits. A list of
most important changes follows:- Improvements to dwc3 tracing interface
- Initial dual-role support for dwc3
- Improvements to how we handle DMA resources in dwc3
- A new f_uac1 implementation which much more flexible
- Removal of AVR32 bits
- Improvements to f_mass_storage driver
13 Jun, 2017
6 commits
-
This patch adds a USB3 HCD to an existing USB2 HCD and provides
the support of SuperSpeed, in case the device can only be enumerated
with SuperSpeed.The bulk of the added code in usb3_bos_desc and hub_control to support
SuperSpeed is borrowed from the commit 1cd8fd2887e162ad ("usb: gadget:
dummy_hcd: add SuperSpeed support").With this patch, each vhci will have VHCI_HC_PORTS HighSpeed ports
and VHCI_HC_PORTS SuperSpeed ports.Suggested-by: Krzysztof Opasiak
Signed-off-by: Yuyang Du
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman -
A vhci struct is added as the platform-specific data to the vhci
platform device, in order to get the vhci by its platform device.
This is done in vhci_hcd_init().Signed-off-by: Yuyang Du
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman -
In parse_status(), all nports number of idev's are initiated to
0 by memset(), it is simply wrong, because parse_status() reads
the status sys file one by one, therefore, it can only update the
according vhci_driver->idev's for it to parse.Reviewed-by: Krzysztof Opasiak
Signed-off-by: Yuyang Du
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman -
The commit 0775a9cbc694e8c7 ("usbip: vhci extension: modifications
to vhci driver") introduced multiple controllers, but the status
of the ports are only extracted from the first status file, fix it.Reviewed-by: Krzysztof Opasiak
Signed-off-by: Yuyang Du
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman -
A new field ncontrollers is added to the vhci_driver structure.
And this field is stored by scanning the vhci_hcd* dirs in the
platform udev.Suggested-and-reviewed-by: Krzysztof Opasiak
Signed-off-by: Yuyang Du
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman -
If we get nonpositive number of ports, there is no sense to
continue, then fail gracefully.In addition, the commit 0775a9cbc694e8c72 ("usbip: vhci extension:
modifications to vhci driver") introduced configurable numbers of
controllers and ports, but we have a static port number maximum,
MAXNPORT. If exceeded, the idev array will be overflown. We fix
it by validating the nports to make sure the port number max is
not exceeded.Reviewed-by: Krzysztof Opasiak
Signed-off-by: Yuyang Du
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
02 Jun, 2017
1 commit
-
Currently, default vary will not accomodate superspeed endpoints
causing unexpected babble errors in the IN direction. Let's update
default 'vary' parameter so that we can maintain a "short-less"
transfer as hinted at the comment.Reported-by: Ammy Yi
Signed-off-by: Felipe Balbi
18 Apr, 2017
1 commit
-
Since when we got rid of usbfs, the /proc/bus/usb is now
elsewhere. Fix references for it.Signed-off-by: Mauro Carvalho Chehab
Acked-by: Serge Hallyn
Signed-off-by: Greg Kroah-Hartman
08 Apr, 2017
1 commit
-
The commit 0775a9cbc694e8c72 ("usbip: vhci extension: modifications
to vhci driver") introduced multiple controllers, and nports as a sys
file, and claimed to read the nports from it, but it didn't.In addition, the get_nports() has been so wrong that even with 8 port
lines for instance, it gets 7 (I am guessing it is due to a '\n' mess).
Nevertheless, we fix it by reading the nports attribute.Reviewed-by: Krzysztof Opasiak
Signed-off-by: Yuyang Du
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
17 Mar, 2017
2 commits
-
GCC 7 now warns when switch statements fall through implicitly, and with
-Werror enabled in configure.ac, that makes these tools unbuildable.We fix this by notifying the compiler that this particular case statement
is meant to fall through.Reviewed-by: Peter Senna Tschudin
Signed-off-by: Jonathan Dieter
Signed-off-by: Greg Kroah-Hartman -
The usbip userspace tools call sprintf()/snprintf() and don't check for
the return value which can lead the paths to overflow, truncating the
final file in the path.More urgently, GCC 7 now warns that these aren't checked with
-Wformat-overflow, and with -Werror enabled in configure.ac, that makes
these tools unbuildable.This patch fixes these problems by replacing sprintf() with snprintf() in
one place and adding checks for the return value of snprintf().Reviewed-by: Peter Senna Tschudin
Signed-off-by: Jonathan Dieter
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
16 Mar, 2017
1 commit
-
Add .gitignore file for untracked files in tools/usb.
Signed-off-by: Prarit Bhargava
Signed-off-by: Greg Kroah-Hartman
26 Jan, 2017
1 commit
-
Felipe writes:
USB: changes for v4.11
Here's the big pull request for the Gadget
API. Again the majority of changes sit in dwc2
driver. Most important changes contain a workaround
for GOTGCTL being wrong, a sleep-inside-spinlock fix
and the big series of cleanups on dwc2.One important thing on dwc3 is that we don't anymore
need gadget drivers to cope with unaligned OUT
transfers for us. We have support for appending one
extra chained TRB to align transfer ourselves.Apart from these, the usual set of typos,
non-critical fixes, etc.
24 Jan, 2017
2 commits
-
Without SS descriptors, we have no possibility of running on SS
controllers such as DWC3.Signed-off-by: Felipe Balbi
-
_BSD_SOURCE is deprecated and gives a build warning. Let's use
_DEFAULT_SOURCE instead.Signed-off-by: Felipe Balbi
11 Jan, 2017
2 commits
-
Update README file:
- remove outdated parts
- clarify terminology and general structure
- add some description of vUDCSigned-off-by: Krzysztof Opasiak
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman -
Add some simple script which creates a USB gadget using ConfigFS
and then exports it using vUDC.This may be useful for people who just started playing with
USB/IP and vUDC as it shows exact steps how to setup all stuff.Signed-off-by: Krzysztof Opasiak
Acked-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
06 Dec, 2016
1 commit
-
Add the following files to .gitignore
compile
libsrc/libusbip_la-sysfs_utils.lo
libsrc/libusbip_la-usbip_device_driver.lo
libsrc/libusbip_la-usbip_host_common.loSigned-off-by: Shuah Khan
Signed-off-by: Greg Kroah-Hartman
07 Nov, 2016
1 commit
-
This patch removes checking of socket descriptor value in daemons.
It was checked to be less than FD_SETSIZE(1024 usually) but it's not
correct.To be exact, the maximum value of descriptor comes from
rlimit(RLIMIT_NOFILE).Following kernel code determines the value :
get_unused_fd_flags() : fs/files.c
__alloc_fd() : fs/files.c
expand_files() : fs/files.cThe defalut (soft limit) is defines as INR_OPEN_CUR(1024) in
include/linux/fs.h which is referenced form INIT_RLIMS in
include/asm-generic/resource.h. The value may be modified with ulimt,
sysctl, security configuration and etc.With the kernel code above, when socket() system call returns positive
value, the value must be within rlimit(RLIMIT_NOFILE). No extra
checking is needed when socket() returns positive.Without 'usbip: vhci number of ports extension' patch set, there's no
practical problem because of number of USB port restriction. With the
patch set, the value of socket descriptor can exceed FD_SETSIZE(1024
usually) if the rlimit is changed.Signed-off-by: Nobuo Iwata
Signed-off-by: Greg Kroah-Hartman
04 May, 2016
1 commit
-
Adding names database to port command.
BEFORE) 'unknown' for vendor and product string.
Imported USB devices
====================
Port 00: at Low Speed(1.5Mbps)
unknown vendor : unknown product (03f0:0224)
3-1 -> usbip://10.0.2.15:3240/5-1
-> remote bus/dev 005/002AFTER) Most vendor string will be converted.
Imported USB devices
====================
Port 00: at Low Speed(1.5Mbps)
Hewlett-Packard : unknown product (03f0:0224)
3-1 -> usbip://10.0.2.15:3240/5-1
-> remote bus/dev 005/002Signed-off-by: Nobuo Iwata
Signed-off-by: Greg Kroah-Hartman
27 Apr, 2016
3 commits
-
Modify userspace tools to allow exporting and connecting to vudc.
This commit is a result of cooperation between Samsung R&D Institute
Poland and Open Operating Systems Student Society at University
of Warsaw (O2S3@UW) consisting of:Igor Kotrasinski
Karol Kosik
Ewelina Kosmider
Dawid Lazarczyk
Piotr SzulcTutor and project owner:
Krzysztof OpasiakSigned-off-by: Igor Kotrasinski
Signed-off-by: Ewelina Kosmider
[Various bug fixes and improvements]
Signed-off-by: Krzysztof Opasiak
Signed-off-by: Greg Kroah-Hartman -
Adds an equivalent of usbip_host_driver for the vudc. Most
of the code is already shared, but this adds some vudc specific
code for getting information about devices.Based on code created in cooperation with Open Operating Systems
Student Society at University of Warsaw (O2S3@UW) consisting of:Igor Kotrasinski
Karol Kosik
Ewelina Kosmider
Dawid Lazarczyk
Piotr SzulcTutor and project owner:
Krzysztof OpasiakSigned-off-by: Krzysztof Opasiak
Signed-off-by: Greg Kroah-Hartman -
Extract the code from current stub driver backend and a common
interface for both stub driver and vudc. This allows to share most
of the usbipd code for both of them.Based on code created in cooperation with Open Operating Systems
Student Society at University of Warsaw (O2S3@UW) consisting of:Igor Kotrasinski
Karol Kosik
Ewelina Kosmider
Dawid Lazarczyk
Piotr SzulcTutor and project owner:
Krzysztof OpasiakSigned-off-by: Krzysztof Opasiak
Signed-off-by: Greg Kroah-Hartman
23 Oct, 2015
1 commit
-
Felipe writes:
usb: patches for v4.4 merge window
This pull request is large with a total of 136 non-merge
commits. Because of its size, we will only describe the big things in
broad terms.Many will be happy to know that dwc3 is now almost twice as fast after
some profiling and speed improvements. Also in dwc3, John Youn from
Synopsys added support for their new DWC USB3.1 IP Core and the HAPS
platform which can be used to validate it.A series of patches from Robert Baldyga cleaned up uses of
ep->driver_data as a flag for "claimed endpoint" in favor of the new
ep->claimed flag.Sudip Mukherjee fixed a ton of really old problems on the amd5536udc
driver. That should make a few people happy.Heikki Krogerus worked on converting dwc3 to the unified device property
interface.Together with these, there's a ton of non-critical fixes, typos and
stuff like that.Signed-off-by: Felipe Balbi
27 Sep, 2015
2 commits
-
For ctrl out test, it needs length > vary, so in order to run it with
default parameters, we do this change.Acked-by: Michal Nazarewicz
Cc: Michal Nazarewicz
Signed-off-by: Peter Chen
Signed-off-by: Felipe Balbi -
The 'length' is the transfer length, not the packet size, so
change the help text.Acked-by: Michal Nazarewicz
Cc: Michal Nazarewicz
Signed-off-by: Peter Chen
Signed-off-by: Felipe Balbi