28 Sep, 2022
1 commit
-
commit 14c7d905283744809e6b82efae2f490660a11cda upstream.
Add support for Maple Ridge discrete USB4 host controller from Intel
which has a single USB4 port (versus the already supported dual port
Maple Ridge USB4 host controller).Cc: stable@vger.kernel.org
Signed-off-by: Gil Fine
Signed-off-by: Mika Westerberg
Signed-off-by: Greg Kroah-Hartman
08 Sep, 2022
1 commit
-
commit eb100b8fa8e8b59eb3e5fc7a5fd4a1e3c5950f64 upstream.
The received notification packet is held in pkg->buffer and not in pkg
itself. Fix this by using the correct buffer.Fixes: 81a54b5e1986 ("thunderbolt: Let the connection manager handle all notifications")
Cc: stable@vger.kernel.org
Signed-off-by: Mika Westerberg
Signed-off-by: Greg Kroah-Hartman
15 Jun, 2022
1 commit
-
[ Upstream commit 9d2d0a5cf0ca063f417681cc33e767ce52615286 ]
Brad reported that on Apple hardware with Light Ridge or Falcon Ridge
controller, plugging in a chain of Thunderbolt displays (Light Ridge
based controllers) causes all kinds of tearing and flickering. The
reason for this is that on Thunderbolt 1 hardware there is no lane
bonding so we have two independent 10 Gb/s lanes, and currently Linux
tunnels both displays through the lane 1. This makes the displays to
share the 10 Gb/s bandwidth which may not be enough for higher
resolutions.For this reason make the second tunnel go through the lane 0 instead.
This seems to match what the macOS connection manager is also doing.Reported-by: Brad Campbell
Signed-off-by: Mika Westerberg
Tested-by: Brad Campbell
Signed-off-by: Sasha Levin
27 Jan, 2022
1 commit
-
[ Upstream commit f3380cac0c0b3a6f49ab161e2a057c363962f48d ]
If protocol tunnels are already up when the driver is loaded, for
instance if the boot firmware implements connection manager of its own,
runtime PM reference count of the consumer devices behind the tunnel
might have been increased already before the device link is created but
the supplier device runtime PM reference count is not. This leads to a
situation where the supplier (the Thunderbolt driver) can runtime
suspend even if it should not because the corresponding protocol tunnel
needs to be up causing the devices to be removed from the corresponding
native bus.Prevent this from happening by making both sides of the link runtime PM
active briefly. The pm_runtime_put() for the consumer (PCIe
root/downstream port, xHCI) then allows it to runtime suspend again but
keeps the supplier runtime resumed the whole time it is runtime active.Signed-off-by: Mika Westerberg
Reviewed-by: Rafael J. Wysocki
Signed-off-by: Sasha Levin
07 Oct, 2021
1 commit
-
The structleak plugin causes the stack frame size to grow immensely when
used with KUnit:drivers/thunderbolt/test.c:1529:1: error: the frame size of 1176 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
Turn it off in this file.
Linus already split up tests in this file, so this change *should* be
redundant now.Signed-off-by: Brendan Higgins
Suggested-by: Arnd Bergmann
Acked-by: Mika Westerberg
Reviewed-by: Kees Cook
Signed-off-by: Shuah Khan
07 Sep, 2021
1 commit
-
The tb_test_credit_alloc_all() function had a huge number of
KUNIT_ASSERT() statements, all of which (though the magic of many many
layers of inscrutable macros) ended up allocating and initializing
various test assertion structures on the stack.Don't do that. The kernel stack isn't infinite, and we have compiler
warnings (now errors) for the case where a stack frame grows too large.Like it did here, by not an inconsiderable margin:
drivers/thunderbolt/test.c: In function ‘tb_test_credit_alloc_all’:
drivers/thunderbolt/test.c:2367:1: error: the frame size of 4500 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
2367 | }
| ^Solve this similarly to the lib/test_scanf case: split out the tests
into several smaller functions, each just testing one particular tunnel
credit allocation.This makes the i386 allyesconfig build work for me again.
Signed-off-by: Linus Torvalds
02 Sep, 2021
1 commit
-
Pull USB / Thunderbolt updates from Greg KH:
"Here is the big set of USB and Thunderbolt patches for 5.15-rc1.Nothing huge in here, just lots of constant forward progress on a
number of different drivers and hardware support:- more USB 4/Thunderbolt support added
- dwc3 driver updates and additions
- usb gadget fixes and addtions for new types
- udc gadget driver updates
- host controller updates
- removal of obsolete drivers
- other minor driver updates
All of these have been in linux-next for a while with no reported
issues"* tag 'usb-5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (148 commits)
usb: isp1760: otg control register access
usb: isp1760: use the right irq status bit
usb: isp1760: write to status and address register
usb: isp1760: fix qtd fill length
usb: isp1760: fix memory pool initialization
usb: typec: tcpm: Fix spelling mistake "atleast" -> "at least"
usb: dwc2: Fix spelling mistake "was't" -> "wasn't"
usb: renesas_usbhs: Fix spelling mistake "faile" -> "failed"
usb: host: xhci-rcar: Don't reload firmware after the completion
usb: xhci-mtk: allow bandwidth table rollover
usb: mtu3: fix random remote wakeup
usb: mtu3: return successful suspend status
usb: xhci-mtk: Do not use xhci's virt_dev in drop_endpoint
usb: xhci-mtk: modify the SOF/ITP interval for mt8195
usb: xhci-mtk: add a member of num_esit
usb: xhci-mtk: check boundary before check tt
usb: xhci-mtk: update fs bus bandwidth by bw_budget_table
usb: xhci-mtk: fix issue of out-of-bounds array access
usb: xhci-mtk: support option to disable usb2 ports
usb: xhci-mtk: fix use-after-free of mtk->hcd
...
24 Aug, 2021
1 commit
-
…el/git/westeri/thunderbolt into usb-next
Mika writes:
thunderbolt: Changes for v5.15 merge window
This includes following Thunderbolt/USB4 changes for the v5.15 merge
window:* Include authorized value in the KOBJ_CHANGE event of a device router
* A couple of improvements to get the driver working also with the AMD
USB4 host controller.All these have been in linux-next with no reported issues.
* tag 'thunderbolt-for-v5.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
thunderbolt: Fix port linking by checking all adapters
thunderbolt: Do not read control adapter config space
thunderbolt: Handle ring interrupt by reading interrupt status register
thunderbolt: Add vendor specific NHI quirk for auto-clearing interrupt status
thunderbolt: Add authorized value to the KOBJ_CHANGE uevent
09 Aug, 2021
5 commits
-
In tb_switch_default_link_ports(), while linking of ports,
only odd-numbered ports (1,3,5..) are considered and even-numbered
ports are not considered.AMD host router has lane adapters at 2 and 3 and link ports at adapter 2
is not considered due to which lane bonding gets disabled.Hence added a fix such that all ports are considered during
linking of ports.Signed-off-by: Basavaraj Natikar
Signed-off-by: Sanjay R Mehta
Signed-off-by: Mika Westerberg -
Adapter 0 is the control adapter and as per USB4 spec in section 2.2.6.2
control Adapters do not have an adapter configuration space.For this reason skip reading adapter config space in tb_port_init() when
the port number is 0. This actually simplifies the rest of the function
as we don't need to check for the port->port == 0 anymore.While there drop the extra empty line at the end of the function.
Signed-off-by: Basavaraj Natikar
Signed-off-by: Sanjay R Mehta
Signed-off-by: Mika Westerberg -
As per USB4 specification by default "Disable ISR Auto-Clear" bit is set
to zero and the Tx/Rx ring interrupt status needs to be cleared.Hence handle it by reading the interrupt status register (ISR) in the
MSI-X handler.Signed-off-by: Basavaraj Natikar
Signed-off-by: Sanjay R Mehta
Signed-off-by: Mika Westerberg -
Introduce nhi_check_quirks() routine to handle any vendor specific quirks
to manage a hardware specific implementation.On Intel hardware the USB4 controller supports clearing the interrupt
status register automatically right after it is being issued. For this
reason add a new quirk that does that on all Intel hardware.Signed-off-by: Basavaraj Natikar
Signed-off-by: Sanjay R Mehta
Signed-off-by: Mika Westerberg -
We need the driver core fixes in here as well.
Signed-off-by: Greg Kroah-Hartman
02 Aug, 2021
1 commit
-
For security reasons, we would like to monitor and track when the
Thunderbolt devices are authorized and deauthorized (i.e. when the
Thunderbolt sysfs "authorized" attribute changes). Currently the
userspace gets a udev change notification when there is a change, but
the state may have changed (again) by the time we look at the authorized
attribute in sysfs. So an authorization event may go unnoticed. Thus
make it easier by informing the actual change (new value of authorized
attribute) in the udev change notification.The change is included as a key value "authorized=" where
is the new value of sysfs attribute "authorized", and is described at
Documentation/ABI/testing/sysfs-bus-thunderbolt under
/sys/bus/thunderbolt/devices/.../authorized.Signed-off-by: Rajat Jain
Signed-off-by: Mika Westerberg
28 Jul, 2021
1 commit
-
This reverts commit 6f3badead6a078cf3c71f381f9d84ac922984a00.
It turns out bolt depends on having authorized attribute visible under
each device. Hiding it makes bolt crash as several people have reported
on various bug trackers. For this reason revert the commit.Link: https://gitlab.freedesktop.org/bolt/bolt/-/issues/174
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1979765
Link: https://bugs.archlinux.org/task/71569
Cc: stable@vger.kernel.org
Cc: Christian Kellner
Fixes: 6f3badead6a0 ("thunderbolt: Hide authorized attribute if router does not support PCIe tunnels")
Signed-off-by: Mika Westerberg
Link: https://lore.kernel.org/r/20210727142501.27476-1-mika.westerberg@linux.intel.com
Signed-off-by: Greg Kroah-Hartman
21 Jul, 2021
1 commit
-
The driver core ignores the return value of this callback because there
is only little it can do when a device disappears.This is the final bit of a long lasting cleanup quest where several
buses were converted to also return void from their remove callback.
Additionally some resource leaks were fixed that were caused by drivers
returning an error code in the expectation that the driver won't go
away.With struct bus_type::remove returning void it's prevented that newly
implemented buses return an ignored error code and so don't anticipate
wrong expectations for driver authors.Reviewed-by: Tom Rix (For fpga)
Reviewed-by: Mathieu Poirier
Reviewed-by: Cornelia Huck (For drivers/s390 and drivers/vfio)
Acked-by: Russell King (Oracle) (For ARM, Amba and related parts)
Acked-by: Mark Brown
Acked-by: Chen-Yu Tsai (for sunxi-rsb)
Acked-by: Pali Rohár
Acked-by: Mauro Carvalho Chehab (for media)
Acked-by: Hans de Goede (For drivers/platform)
Acked-by: Alexandre Belloni
Acked-By: Vinod Koul
Acked-by: Juergen Gross (For xen)
Acked-by: Lee Jones (For mfd)
Acked-by: Johannes Thumshirn (For mcb)
Acked-by: Johan Hovold
Acked-by: Srinivas Kandagatla (For slimbus)
Acked-by: Kirti Wankhede (For vfio)
Acked-by: Maximilian Luz
Acked-by: Heikki Krogerus (For ulpi and typec)
Acked-by: Samuel Iglesias Gonsálvez (For ipack)
Acked-by: Geoff Levand (For ps3)
Acked-by: Yehezkel Bernat (For thunderbolt)
Acked-by: Alexander Shishkin (For intel_th)
Acked-by: Dominik Brodowski (For pcmcia)
Acked-by: Rafael J. Wysocki (For ACPI)
Acked-by: Bjorn Andersson (rpmsg and apr)
Acked-by: Srinivas Pandruvada (For intel-ish-hid)
Acked-by: Dan Williams (For CXL, DAX, and NVDIMM)
Acked-by: William Breathitt Gray (For isa)
Acked-by: Stefan Richter (For firewire)
Acked-by: Benjamin Tissoires (For hid)
Acked-by: Thorsten Scherer (For siox)
Acked-by: Sven Van Asbroeck (For anybuss)
Acked-by: Ulf Hansson (For MMC)
Acked-by: Wolfram Sang # for I2C
Acked-by: Sudeep Holla
Acked-by: Geert Uytterhoeven
Acked-by: Dmitry Torokhov
Acked-by: Finn Thain
Signed-off-by: Uwe Kleine-König
Link: https://lore.kernel.org/r/20210713193522.1770306-6-u.kleine-koenig@pengutronix.de
Signed-off-by: Greg Kroah-Hartman
06 Jul, 2021
1 commit
-
Pull USB / Thunderbolt updates from Greg KH:
"Here is the big set of USB and Thunderbolt patches for 5.14-rc1.Nothing major here just lots of little changes for new hardware and
features. Highlights are:- more USB 4 support added to the thunderbolt core
- build warning fixes all over the place
- usb-serial driver updates and new device support
- mtu3 driver updates
- gadget driver updates
- dwc3 driver updates
- dwc2 driver updates
- isp1760 host driver updates
- musb driver updates
- lots of other tiny things.
Full details are in the shortlog.
All of these have been in linux-next for a while now with no reported
issues"* tag 'usb-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (223 commits)
phy: qcom-qusb2: Add configuration for SM4250 and SM6115
dt-bindings: phy: qcom,qusb2: document sm4250/6115 compatible
dt-bindings: usb: qcom,dwc3: Add bindings for sm6115/4250
USB: cdc-acm: blacklist Heimann USB Appset device
usb: xhci-mtk: allow multiple Start-Split in a microframe
usb: ftdi-elan: remove redundant continue statement in a while-loop
usb: class: cdc-wdm: return the correct errno code
xhci: remove redundant continue statement
usb: dwc3: Fix debugfs creation flow
usb: gadget: hid: fix error return code in hid_bind()
usb: gadget: eem: fix echo command packet response issue
usb: gadget: f_hid: fix endianness issue with descriptors
Revert "USB: misc: Add onboard_usb_hub driver"
Revert "of/platform: Add stubs for of_platform_device_create/destroy()"
Revert "usb: host: xhci-plat: Create platform device for onboard hubs in probe()"
Revert "arm64: dts: qcom: sc7180-trogdor: Add nodes for onboard USB hub"
xhci: solve a double free problem while doing s4
xhci: handle failed buffer copy to URB sg list and fix a W=1 copiler warning
xhci: Add adaptive interrupt rate for isoch TRBs with XHCI_AVOID_BEI quirk
xhci: Remove unused defines for ERST_SIZE and ERST_ENTRIES
...
03 Jul, 2021
1 commit
-
…/linux/kernel/git/shuah/linux-kselftest
Pull KUnit update from Shuah Khan:
"Fixes and features:- add support for skipped tests
- introduce kunit_kmalloc_array/kunit_kcalloc() helpers
- add gnu_printf specifiers
- add kunit_shutdown
- add unit test for filtering suites by names
- convert lib/test_list_sort.c to use KUnit
- code organization moving default config to tools/testing/kunit
- refactor of internal parser input handling
- cleanups and updates to documentation
- code cleanup related to casts"
* tag 'linux-kselftest-kunit-fixes-5.14-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: (29 commits)
kunit: add unit test for filtering suites by names
kasan: test: make use of kunit_skip()
kunit: test: Add example tests which are always skipped
kunit: tool: Support skipped tests in kunit_tool
kunit: Support skipped tests
thunderbolt: test: Reinstate a few casts of bitfields
kunit: tool: internal refactor of parser input handling
lib/test: convert lib/test_list_sort.c to use KUnit
kunit: introduce kunit_kmalloc_array/kunit_kcalloc() helpers
kunit: Remove the unused all_tests.config
kunit: Move default config from arch/um -> tools/testing/kunit
kunit: arch/um/configs: Enable KUNIT_ALL_TESTS by default
kunit: Add gnu_printf specifiers
lib/cmdline_kunit: Remove a cast which are no-longer required
kernel/sysctl-test: Remove some casts which are no-longer required
thunderbolt: test: Remove some casts which are no longer required
mmc: sdhci-of-aspeed: Remove some unnecessary casts from KUnit tests
iio: Remove a cast in iio-test-format which is no longer required
device property: Remove some casts in property-entry-test
Documentation: kunit: Clean up some string casts in examples
...
26 Jun, 2021
1 commit
-
Partially revert "thunderbolt: test: Remove some casts which are no
longer required". It turns out that typeof() doesn't support bitfields,
so these still need to be cast to the appropriate enum.The only mention of typeof() and bitfields I can find is in the proposal
to standardise them:
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n2619.htmThis was caught by the kernel test robot:
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org/thread/FDKBHAV7QNLNFU5NBI2RKV56DWDSOLGM/Fixes: 8f0877c26e4b ("thunderbolt: test: Remove some casts which are no longer required")
Reported-by: kernel test robot
Signed-off-by: David Gow
Signed-off-by: Shuah Khan
24 Jun, 2021
1 commit
-
With some of the stricter type checking in KUnit's EXPECT macros
removed, several casts in the thunderbolt KUnit tests are no longer
required.Remove the unnecessary casts, making the conditions clearer.
Signed-off-by: David Gow
Acked-by: Mika Westerberg
Reviewed-by: Brendan Higgins
Signed-off-by: Shuah Khan
15 Jun, 2021
1 commit
-
DROM for USB4 host/device has a shorter header than Thunderbolt DROM
header. This patch addresses host/device with USB4 DROM (According to spec:
Universal Serial Bus 4 (USB4) Device ROM Specification, Rev 1.0, Feb-2021).While there correct the data_len field to be 12 bits and rename
__unknown1 to reserved following the spec.Signed-off-by: Gil Fine
Signed-off-by: Mika Westerberg
11 Jun, 2021
5 commits
-
Alder Lake has the same integrated Thunderbolt/USB4 controller as
Intel Tiger Lake. By default it is still using firmware based connection
manager so we can use most of the Tiger Lake flows.Add the Alder Lake PCI IDs to the driver list of supported devices.
Signed-off-by: Azhar Shaikh
Reviewed-by: Yehezkel Bernat
Signed-off-by: Mika Westerberg -
This include is not needed so drop it.
Reported-by: kernel test robot
Reviewed-by: Yehezkel Bernat
Signed-off-by: Mika Westerberg -
In Intel Tiger Lake and beyond it takes some time after the force power
is set until the firmware connection manager is ready. So instead of
reading it once we poll it for 10ms before giving up.Signed-off-by: Gil Fine
Reviewed-by: Yehezkel Bernat
Signed-off-by: Mika Westerberg -
We only need to set up the device links when software connection manager
path is used. The firmware connection manager does not need them and if
they are present they may even cause problems.Reviewed-by: Yehezkel Bernat
Signed-off-by: Mika Westerberg -
We should not dereference ->dual_link_port if it is NULL and lane bonding
is requested. For this reason move lane bonding configuration happen
inside the block where ->dual_link_port != NULL.Fixes: 54509f5005ca ("thunderbolt: Add KUnit tests for path walking")
Reported-by: kernel test robot
Reported-by: Dan Carpenter
Reviewed-by: Yehezkel Bernat
Signed-off-by: Mika Westerberg
01 Jun, 2021
14 commits
-
If the NVM authentication fails immediately, like if the firmware
detects that the image is not valid for some reason, better to read the
status once and if set to non-zero fail the operation accordingly.Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
The same way we support these two operations for USB4 routers we can
extend the retimer NVM operations to support retimers also.Signed-off-by: Rajmohan Mani
Co-developed-by: Mika Westerberg
Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
It may be useful if the actual NVM authentication can be delayed to be
run later, for instance when the user logs out. For this reason add a
new NVM operation (AUHENTICATE_ONLY) that just triggers the authentication
procedure over whatever was written to the NVM storage.This is not supported with Thunderbolt 1-3 devices, though.
Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
Currently these write ops are used for updating router firmware images
only. Moving to tb.h helps the retimers also to use the same ops.Also add tb_ prefix to the enum while there.
Signed-off-by: Rajmohan Mani
Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
With help from platform firmware (ACPI) it is possible to power on
retimers even when there is no USB4 link (e.g nothing is connected to
the USB4 ports). This allows us to bring the USB4 sideband up so that we
can access retimers and upgrade their NVM firmware.If the platform has support for this, we expose two additional
attributes under USB4 ports: offline and rescan. These can be used to
bring the port offline, rescan for the retimers and put the port online
again. The retimer NVM upgrade itself works the same way than with cable
connected.Signed-off-by: Rajmohan Mani
Co-developed-by: Mika Westerberg
Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
When accessing retimers when there is no cable connected we are going to
need additional USB4 port operations. First the port needs to be put
into offline mode, and then the sideband channel transactions must be
enabled on the SBTX line. This adds support for these operations.Signed-off-by: Rajmohan Mani
Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
Typically retimers can be accessed only when the USB4 link is up (e.g
there is a cable connected). However, sometimes it is useful to be able
to access retimers even if there is nothing connected to the USB4 port.
For instance we may still want to be able to upgrade the retimer NVM
firmware even if the user does not have any USB4 devices. This is
something that USB4 spec leaves to implementers.In case of ACPI based systems, we can support this by providing a
special _DSM method under each USB4 port. This _DSM can be used to turn
on power to on-board retimers (and cycle it through different modes so
that the sideband becomes usable).This patch adds support for this _DSM and makes the functionality
available to the rest of the driver through tb_acpi_power_[on|off]_retimers().Signed-off-by: Rajmohan Mani
Co-developed-by: Mika Westerberg
Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
Create devices for each USB4 port. This is needed when we add retimer
access when there is no device connected but may be useful for other
purposes too following what USB subsystem does. This exports a single
attribute "link" that shows the type of the USB4 link (or "none" if
there is no cable connected).Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
The upstream port can be connected to any previous generation
Thunderbolt port so logging as "TBT" is more accurate than "TBT3.No functional changes.
Signed-off-by: Mika Westerberg
Reviewed-by: Greg Kroah-Hartman -
This adds a couple of KUnit tests for USB4 credit allocation.
Signed-off-by: Mika Westerberg
-
Intel Goshen Ridge reports wrong DP main credits in NVM 27 and earlier,
so add a quirk that fixes it. We also need to expand the quirk table to
match on hardware vendor/device IDs too.Signed-off-by: Mika Westerberg
-
The USB4 Connection Manager guide provides detailed information how the
USB4 router buffer (credit) allocation information should be used by the
connection manager when it allocates buffers for different paths. This
patch implements it for Linux. For USB 3.x and DisplayPort we use
directly the router preferences. The rest of the buffer space is then
used for PCIe and DMA (peer-to-peer, XDomain) traffic. DMA tunnels
require at least one buffer and PCIe six, so if there is not enough
buffers we fail the tunnel creation.For the legacy Thunderbolt 1-3 devices we use the existing hard-coded
scheme except for DMA where we use the values suggested by the USB4 spec
chapter 13.Co-developed-by: Gil Fine
Signed-off-by: Gil Fine
Signed-off-by: Mika Westerberg -
Once lane bonding has been enabled (or disabled) both lane adapters may
update their total credits accordingly. For this reason re-read the port
credits after lane bonding has been enabled or disabled.Signed-off-by: Mika Westerberg
-
USB4 routers must expose their preferred credit (buffer) allocation
information through router operation. This information tells the
connection manager how the router prefers its buffers to be allocated to
get the expected bandwidth for the supported protocols.Read this information and store it as part of struct tb_switch for each
USB4 router.Signed-off-by: Mika Westerberg