summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt/debugfs.c
AgeCommit message (Collapse)Author
2021-03-12thunderbolt: debugfs: Show all accessible dwordsGil Fine
Currently, when first failure occurs while reading of the block, we stop reading the block and jump to the next capability. This doesn't cover the case of block with "holes" of inaccessible dwords, followed by accessible dwords. This patch address this problem. In case of failure while reading the complete block in one transaction, (because of one or more dwords is inaccessible), we read the remaining dwords of the block dword-by-dword, one dword per transaction, till the end of the block. By doing this, we handle the case of block with "holes" of inaccessible dwords, followed by accessible dwords. The accessible dwords are shown with the fields: <offset> <relative_offset> <cap_id> <vs_cap_id> <value> E.g.: 0x01eb 236 0x05 0x06 0x0000d166 While the inaccesible dwords are shown as: <offset> <not accessible> E.g.: 0x01ed <not accessible> Signed-off-by: Gil Fine <gil.fine@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2021-03-08thunderbolt: debugfs: Handle fail reading blockGil Fine
There are cases when reading block of dwords in single transaction fail, for several reasons, mostly if HW publish to implement all of the dwords, while actually it doesn't or if some dwords not accessible for read for security reasons. We handle these cases by trying to read the block, dword-by-dword, one dword per transaction, till we get a failure. Signed-off-by: Gil Fine <gil.fine@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2020-12-08Merge tag 'thunderbolt-for-v5.11-rc1' of ↵Greg Kroah-Hartman
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v5.11 merge window This includes following Thunderbolt/USB4 changes for v5.11 merge window: * DMA traffic test driver * USB4 router NVM upgrade improvements * USB4 router operations proxy implementation available in the recent Intel Connection Manager firmwares * Support for Intel Maple Ridge discrete Thunderbolt 4 controller * A couple of cleanups and minor improvements. * tag 'thunderbolt-for-v5.11-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: (22 commits) thunderbolt: Add support for Intel Maple Ridge thunderbolt: Add USB4 router operation proxy for firmware connection manager thunderbolt: Move constants for USB4 router operations to tb_regs.h thunderbolt: Add connection manager specific hooks for USB4 router operations thunderbolt: Pass TX and RX data directly to usb4_switch_op() thunderbolt: Pass metadata directly to usb4_switch_op() thunderbolt: Perform USB4 router NVM upgrade in two phases thunderbolt: Return -ENOTCONN when ERR_CONN is received thunderbolt: Keep the parent runtime resumed for a while on device disconnect thunderbolt: Log adapter numbers in decimal in path activation/deactivation thunderbolt: Log which connection manager implementation is used thunderbolt: Move max_boot_acl field to correct place in struct icm MAINTAINERS: Add Isaac as maintainer of Thunderbolt DMA traffic test driver thunderbolt: Add DMA traffic test driver thunderbolt: Add support for end-to-end flow control thunderbolt: Make it possible to allocate one directional DMA tunnel thunderbolt: Create debugfs directory automatically for services thunderbolt: Add functions for enabling and disabling lane bonding on XDomain thunderbolt: Add link_speed and link_width to XDomain thunderbolt: Create XDomain devices for loops back to the host ...
2020-11-11thunderbolt: Create debugfs directory automatically for servicesMika Westerberg
This allows service drivers to use it as parent directory if they need to add their own debugfs entries. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Acked-by: Yehezkel Bernat <YehezkelShB@gmail.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-11-05thunderbolt: Add uaccess dependency to debugfs interfaceCasey Bowman
Some calls in the debugfs interface are made to the linux/uaccess.h header, but the header is not referenced. So, for x86_64 architectures, this dependency seems to be pulled in elsewhere, which leads to a successful compilation. However, on arm/arm64 architectures, it was found to error out on implicit declarations. This change fixes the implicit declaration error by adding the linux/uaccess.h header. Fixes: 54e418106c76 ("thunderbolt: Add debugfs interface") Signed-off-by: Casey Bowman <casey.g.bowman@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2020-09-10thunderbolt: debugfs: Fix uninitialized return in counters_write()Dan Carpenter
If the first line is in an invalid format then the "ret" value is uninitialized. We should return -EINVAL instead. Fixes: 54e418106c76 ("thunderbolt: Add debugfs interface") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
2020-09-03thunderbolt: Add debugfs interfaceGil Fine
This adds debugfs interface that can be used for debugging possible issues in hardware/software. It exposes router and adapter config spaces through files like this: /sys/kernel/debug/thunderbolt/<DEVICE>/regs /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT1>/regs /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT1>/path /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT1>/counters /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT2>/regs /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT2>/path /sys/kernel/debug/thunderbolt/<DEVICE>/<PORT2>/counters ... The "regs" is either the router or port configuration space register dump. The "path" is the port path configuration space and "counters" is the optional counters configuration space. These files contains one register per line so it should be easy to use normal filtering tools to find the registers of interest if needed. The router and adapter regs file becomes writable when CONFIG_USB4_DEBUGFS_WRITE is enabled (which is not supposed to be done in production systems) and in this case the developer can write "offset value" lines there to modify the hardware directly. For convenience this also supports the long format the read side produces (but ignores the additional fields). The counters file can be written even when CONFIG_USB4_DEBUGFS_WRITE is not enabled and it is only used to clear the counter values. Signed-off-by: Gil Fine <gil.fine@intel.com> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com> Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>