thunderbolt: Changes for v5.8 merge window

This adds support for Intel Tiger Lake Thunderbolt controller using
 firmware based connection manager. In addition the driver can now be
 built on non-x86 architectures as well. Then there are a couple of
 commits that make the driver work across kexec, replace a zero length
 array with flexible one, and revert one change that is not needed
 anymore because of NVMem subsystem improvements.
 -----BEGIN PGP SIGNATURE-----
 
 iQJUBAABCgA+FiEEVTdhRGBbNzLrSUBaAP2fSd+ZWKAFAl7M2XogHG1pa2Eud2Vz
 dGVyYmVyZ0BsaW51eC5pbnRlbC5jb20ACgkQAP2fSd+ZWKBo4A/9Fcw0uH2nKRZu
 iVSyrqrb9qrFU9Zb+pf8WeZWf7N3g22GfTRsQkTRtloyQdRIgipSuIhZmR4rsJ4x
 RZhMJabdvswDBpqDxnZ3abn4UMuqnLIs9u2tUOhUP19e/SSh98XeNsvTcdQ28LRM
 fpF+h4DDW8P7sJ/jkmw7VZ23BGhDPJwiZJaMsegHujFnFgCLYZjkzw/MLIBZTR+a
 xLJfGPXeQxvNbjISDlNMy5Skbt+tvMew+yaFhqg1F9rkDJBuQmUvuib5FfiGg1V9
 ggxnO5fdnv2TFow7QqGSMQbRHX01uoDMQkAAq/VznJpJiBFotCb2wNQMLY+dQmZK
 QzkkYM9LpacZq27KTeo1uRiAl+TfWodmBhvtqX0ogIUqLlJWZrlDRnONt/T8ZVvU
 R6Uy8cj8gmO5ol7UcUJ4QIIsME0yRwKd6TcLIvpzTXagsJ10H3lluxyLFn1V5T+F
 7wc1MBUTMX3L58c2zxvH74NdhIF3q59Y35NJ4hYLVvKspKkJE0umzWNegpoF+ZNw
 r3aVSLOAJTl2z7iE0Ssl3VhQ+WRuj2EVb1g0bdQr3soDdPgT0gzK2FqnzkVgHk2u
 xVDBDn5aAKo0bkUKrcBg4Dz5ECl/0QvSU12Nzy9GIvQNhRTzpgAEqzweEoZ6VyRw
 tnple/EiLHE0G8BGiSRfd66YDjk52xc=
 =qZRi
 -----END PGP SIGNATURE-----

Merge tag 'thunderbolt-for-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next

Mika writes:

thunderbolt: Changes for v5.8 merge window

This adds support for Intel Tiger Lake Thunderbolt controller using
firmware based connection manager. In addition the driver can now be
built on non-x86 architectures as well. Then there are a couple of
commits that make the driver work across kexec, replace a zero length
array with flexible one, and revert one change that is not needed
anymore because of NVMem subsystem improvements.

* tag 'thunderbolt-for-v5.8' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt:
  thunderbolt: Add trivial .shutdown
  thunderbolt: Update Kconfig to allow building on other architectures.
  thunderbolt: Replace zero-length array with flexible-array
  thunderbolt: Add support for Intel Tiger Lake
  Revert "thunderbolt: Prevent crash if non-active NVMem file is read"
This commit is contained in:
Greg Kroah-Hartman 2020-05-26 12:19:36 +02:00
commit d19c64b3d0
6 changed files with 30 additions and 9 deletions

View file

@ -2,7 +2,6 @@
menuconfig USB4
tristate "Unified support for USB4 and Thunderbolt"
depends on PCI
depends on X86 || COMPILE_TEST
select APPLE_PROPERTIES if EFI_STUB && X86
select CRC32
select CRYPTO

View file

@ -1633,6 +1633,15 @@ static void icm_icl_rtd3_veto(struct tb *tb, const struct icm_pkg_header *hdr)
icm_veto_end(tb);
}
static bool icm_tgl_is_supported(struct tb *tb)
{
/*
* If the firmware is not running use software CM. This platform
* should fully support both.
*/
return icm_firmware_running(tb->nhi);
}
static void icm_handle_notification(struct work_struct *work)
{
struct icm_notification *n = container_of(work, typeof(*n), work);
@ -2269,6 +2278,19 @@ struct tb *icm_probe(struct tb_nhi *nhi)
icm->rtd3_veto = icm_icl_rtd3_veto;
tb->cm_ops = &icm_icl_ops;
break;
case PCI_DEVICE_ID_INTEL_TGL_NHI0:
case PCI_DEVICE_ID_INTEL_TGL_NHI1:
icm->is_supported = icm_tgl_is_supported;
icm->driver_ready = icm_icl_driver_ready;
icm->set_uuid = icm_icl_set_uuid;
icm->device_connected = icm_icl_device_connected;
icm->device_disconnected = icm_tr_device_disconnected;
icm->xdomain_connected = icm_tr_xdomain_connected;
icm->xdomain_disconnected = icm_tr_xdomain_disconnected;
icm->rtd3_veto = icm_icl_rtd3_veto;
tb->cm_ops = &icm_icl_ops;
break;
}
if (!icm->is_supported || !icm->is_supported(tb)) {

View file

@ -1270,6 +1270,10 @@ static struct pci_device_id nhi_ids[] = {
.driver_data = (kernel_ulong_t)&icl_nhi_ops },
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_ICL_NHI1),
.driver_data = (kernel_ulong_t)&icl_nhi_ops },
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL_NHI0),
.driver_data = (kernel_ulong_t)&icl_nhi_ops },
{ PCI_VDEVICE(INTEL, PCI_DEVICE_ID_INTEL_TGL_NHI1),
.driver_data = (kernel_ulong_t)&icl_nhi_ops },
/* Any USB4 compliant host */
{ PCI_DEVICE_CLASS(PCI_CLASS_SERIAL_USB_USB4, ~0) },
@ -1285,6 +1289,7 @@ static struct pci_driver nhi_driver = {
.id_table = nhi_ids,
.probe = nhi_probe,
.remove = nhi_remove,
.shutdown = nhi_remove,
.driver.pm = &nhi_pm_ops,
};

View file

@ -73,6 +73,8 @@ extern const struct tb_nhi_ops icl_nhi_ops;
#define PCI_DEVICE_ID_INTEL_TITAN_RIDGE_DD_BRIDGE 0x15ef
#define PCI_DEVICE_ID_INTEL_ICL_NHI1 0x8a0d
#define PCI_DEVICE_ID_INTEL_ICL_NHI0 0x8a17
#define PCI_DEVICE_ID_INTEL_TGL_NHI0 0x9a1b
#define PCI_DEVICE_ID_INTEL_TGL_NHI1 0x9a1d
#define PCI_CLASS_SERIAL_USB_USB4 0x0c0340

View file

@ -348,12 +348,6 @@ static int tb_switch_nvm_read(void *priv, unsigned int offset, void *val,
return ret;
}
static int tb_switch_nvm_no_read(void *priv, unsigned int offset, void *val,
size_t bytes)
{
return -EPERM;
}
static int tb_switch_nvm_write(void *priv, unsigned int offset, void *val,
size_t bytes)
{
@ -399,7 +393,6 @@ static struct nvmem_device *register_nvmem(struct tb_switch *sw, int id,
config.read_only = true;
} else {
config.name = "nvm_non_active";
config.reg_read = tb_switch_nvm_no_read;
config.reg_write = tb_switch_nvm_write;
config.root_only = true;
}

View file

@ -80,7 +80,7 @@ struct tb {
int index;
enum tb_security_level security_level;
size_t nboot_acl;
unsigned long privdata[0];
unsigned long privdata[];
};
extern struct bus_type tb_bus_type;