Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'char-misc-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
"Here are a number of small driver fixes for 5.2-rc6

Nothing major, just fixes for reported issues:
- soundwire fixes
- thunderbolt fixes
- MAINTAINERS update for fpga maintainer change
- binder bugfix
- habanalabs 64bit pointer fix
- documentation updates

All of these have been in linux-next with no reported issues"

* tag 'char-misc-5.2-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
habanalabs: use u64_to_user_ptr() for reading user pointers
doc: fix documentation about UIO_MEM_LOGICAL using
MAINTAINERS / Documentation: Thorsten Scherer is the successor of Gavin Schenk
docs: fb: Add TER16x32 to the available font names
MAINTAINERS: fpga: hand off maintainership to Moritz
thunderbolt: Implement CIO reset correctly for Titan Ridge
binder: fix possible UAF when freeing buffer
thunderbolt: Make sure device runtime resume completes before taking domain lock
soundwire: intel: set dai min and max channels correctly
soundwire: stream: fix bad unlock balance
soundwire: stream: fix out of boundary access on port properties

+202 -98
+11 -11
Documentation/ABI/testing/sysfs-bus-siox
··· 1 1 What: /sys/bus/siox/devices/siox-X/active 2 2 KernelVersion: 4.16 3 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 3 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 4 4 Description: 5 5 On reading represents the current state of the bus. If it 6 6 contains a "0" the bus is stopped and connected devices are ··· 12 12 13 13 What: /sys/bus/siox/devices/siox-X/device_add 14 14 KernelVersion: 4.16 15 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 15 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 16 16 Description: 17 17 Write-only file. Write 18 18 ··· 27 27 28 28 What: /sys/bus/siox/devices/siox-X/device_remove 29 29 KernelVersion: 4.16 30 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 30 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 31 31 Description: 32 32 Write-only file. A single write removes the last device in the siox chain. 33 33 34 34 What: /sys/bus/siox/devices/siox-X/poll_interval_ns 35 35 KernelVersion: 4.16 36 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 36 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 37 37 Description: 38 38 Defines the interval between two poll cycles in nano seconds. 39 39 Note this is rounded to jiffies on writing. On reading the current value ··· 41 41 42 42 What: /sys/bus/siox/devices/siox-X-Y/connected 43 43 KernelVersion: 4.16 44 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 44 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 45 45 Description: 46 46 Read-only value. "0" means the Yth device on siox bus X isn't "connected" i.e. 47 47 communication with it is not ensured. "1" signals a working connection. 48 48 49 49 What: /sys/bus/siox/devices/siox-X-Y/inbytes 50 50 KernelVersion: 4.16 51 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 51 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 52 52 Description: 53 53 Read-only value reporting the inbytes value provided to siox-X/device_add 54 54 55 55 What: /sys/bus/siox/devices/siox-X-Y/status_errors 56 56 KernelVersion: 4.16 57 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 57 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 58 58 Description: 59 59 Counts the number of time intervals when the read status byte doesn't yield the 60 60 expected value. 61 61 62 62 What: /sys/bus/siox/devices/siox-X-Y/type 63 63 KernelVersion: 4.16 64 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 64 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 65 65 Description: 66 66 Read-only value reporting the type value provided to siox-X/device_add. 67 67 68 68 What: /sys/bus/siox/devices/siox-X-Y/watchdog 69 69 KernelVersion: 4.16 70 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 70 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 71 71 Description: 72 72 Read-only value reporting if the watchdog of the siox device is 73 73 active. "0" means the watchdog is not active and the device is expected to ··· 75 75 76 76 What: /sys/bus/siox/devices/siox-X-Y/watchdog_errors 77 77 KernelVersion: 4.16 78 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 78 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 79 79 Description: 80 80 Read-only value reporting the number to time intervals when the 81 81 watchdog was active. 82 82 83 83 What: /sys/bus/siox/devices/siox-X-Y/outbytes 84 84 KernelVersion: 4.16 85 - Contact: Gavin Schenk <g.schenk@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 85 + Contact: Thorsten Scherer <t.scherer@eckelmann.de>, Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 86 86 Description: 87 87 Read-only value reporting the outbytes value provided to siox-X/device_add.
+2 -2
Documentation/driver-api/uio-howto.rst
··· 276 276 - ``int memtype``: Required if the mapping is used. Set this to 277 277 ``UIO_MEM_PHYS`` if you you have physical memory on your card to be 278 278 mapped. Use ``UIO_MEM_LOGICAL`` for logical memory (e.g. allocated 279 - with :c:func:`kmalloc()`). There's also ``UIO_MEM_VIRTUAL`` for 280 - virtual memory. 279 + with :c:func:`__get_free_pages()` but not kmalloc()). There's also 280 + ``UIO_MEM_VIRTUAL`` for virtual memory. 281 281 282 282 - ``phys_addr_t addr``: Required if the mapping is used. Fill in the 283 283 address of your memory block. This address is the one that appears in
+1 -1
Documentation/fb/fbcon.txt
··· 79 79 80 80 Select the initial font to use. The value 'name' can be any of the 81 81 compiled-in fonts: 10x18, 6x10, 7x14, Acorn8x8, MINI4x6, 82 - PEARL8x8, ProFont6x11, SUN12x22, SUN8x16, VGA8x16, VGA8x8. 82 + PEARL8x8, ProFont6x11, SUN12x22, SUN8x16, TER16x32, VGA8x16, VGA8x8. 83 83 84 84 Note, not all drivers can handle font with widths not divisible by 8, 85 85 such as vga16fb.
+1 -2
MAINTAINERS
··· 6234 6234 K: fmc_d.*register 6235 6235 6236 6236 FPGA MANAGER FRAMEWORK 6237 - M: Alan Tull <atull@kernel.org> 6238 6237 M: Moritz Fischer <mdf@kernel.org> 6239 6238 L: linux-fpga@vger.kernel.org 6240 6239 S: Maintained ··· 14403 14404 F: include/linux/siphash.h 14404 14405 14405 14406 SIOX 14406 - M: Gavin Schenk <g.schenk@eckelmann.de> 14407 + M: Thorsten Scherer <t.scherer@eckelmann.de> 14407 14408 M: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> 14408 14409 R: Pengutronix Kernel Team <kernel@pengutronix.de> 14409 14410 S: Supported
+14 -2
drivers/android/binder.c
··· 1941 1941 1942 1942 static void binder_free_transaction(struct binder_transaction *t) 1943 1943 { 1944 - if (t->buffer) 1945 - t->buffer->transaction = NULL; 1944 + struct binder_proc *target_proc = t->to_proc; 1945 + 1946 + if (target_proc) { 1947 + binder_inner_proc_lock(target_proc); 1948 + if (t->buffer) 1949 + t->buffer->transaction = NULL; 1950 + binder_inner_proc_unlock(target_proc); 1951 + } 1952 + /* 1953 + * If the transaction has no target_proc, then 1954 + * t->buffer->transaction has already been cleared. 1955 + */ 1946 1956 binder_free_txn_fixups(t); 1947 1957 kfree(t); 1948 1958 binder_stats_deleted(BINDER_STAT_TRANSACTION); ··· 3561 3551 static void 3562 3552 binder_free_buf(struct binder_proc *proc, struct binder_buffer *buffer) 3563 3553 { 3554 + binder_inner_proc_lock(proc); 3564 3555 if (buffer->transaction) { 3565 3556 buffer->transaction->buffer = NULL; 3566 3557 buffer->transaction = NULL; 3567 3558 } 3559 + binder_inner_proc_unlock(proc); 3568 3560 if (buffer->async_transaction && buffer->target_node) { 3569 3561 struct binder_node *buf_node; 3570 3562 struct binder_work *w;
+1 -1
drivers/misc/habanalabs/habanalabs_ioctl.c
··· 140 140 params->op = args->op; 141 141 142 142 if (args->input_ptr && args->input_size) { 143 - input = memdup_user((const void __user *) args->input_ptr, 143 + input = memdup_user(u64_to_user_ptr(args->input_ptr), 144 144 args->input_size); 145 145 if (IS_ERR(input)) { 146 146 rc = PTR_ERR(input);
+2 -2
drivers/soundwire/intel.c
··· 715 715 return -ENOMEM; 716 716 } 717 717 718 - dais[i].playback.channels_min = 1; 719 - dais[i].playback.channels_max = max_ch; 718 + dais[i].capture.channels_min = 1; 719 + dais[i].capture.channels_max = max_ch; 720 720 dais[i].capture.rates = SNDRV_PCM_RATE_48000; 721 721 dais[i].capture.formats = SNDRV_PCM_FMTBIT_S16_LE; 722 722 }
+3 -4
drivers/soundwire/stream.c
··· 814 814 goto error; 815 815 } 816 816 817 - mutex_unlock(&bus->msg_lock); 817 + if (bus->multi_link) 818 + mutex_unlock(&bus->msg_lock); 818 819 } 819 820 820 821 return ret; ··· 1407 1406 } 1408 1407 1409 1408 for (i = 0; i < num_ports; i++) { 1410 - dpn_prop = &dpn_prop[i]; 1411 - 1412 - if (dpn_prop->num == port_num) 1409 + if (dpn_prop[i].num == port_num) 1413 1410 return &dpn_prop[i]; 1414 1411 } 1415 1412
+127 -61
drivers/thunderbolt/icm.c
··· 56 56 * @max_boot_acl: Maximum number of preboot ACL entries (%0 if not supported) 57 57 * @rpm: Does the controller support runtime PM (RTD3) 58 58 * @is_supported: Checks if we can support ICM on this controller 59 + * @cio_reset: Trigger CIO reset 59 60 * @get_mode: Read and return the ICM firmware mode (optional) 60 61 * @get_route: Find a route string for given switch 61 62 * @save_devices: Ask ICM to save devices to ACL when suspending (optional) ··· 75 74 bool safe_mode; 76 75 bool rpm; 77 76 bool (*is_supported)(struct tb *tb); 77 + int (*cio_reset)(struct tb *tb); 78 78 int (*get_mode)(struct tb *tb); 79 79 int (*get_route)(struct tb *tb, u8 link, u8 depth, u64 *route); 80 80 void (*save_devices)(struct tb *tb); ··· 166 164 { 167 165 int depth = tb_route_length(route); 168 166 return depth ? route & ~(0xffULL << (depth - 1) * TB_ROUTE_SHIFT) : 0; 167 + } 168 + 169 + static int pci2cio_wait_completion(struct icm *icm, unsigned long timeout_msec) 170 + { 171 + unsigned long end = jiffies + msecs_to_jiffies(timeout_msec); 172 + u32 cmd; 173 + 174 + do { 175 + pci_read_config_dword(icm->upstream_port, 176 + icm->vnd_cap + PCIE2CIO_CMD, &cmd); 177 + if (!(cmd & PCIE2CIO_CMD_START)) { 178 + if (cmd & PCIE2CIO_CMD_TIMEOUT) 179 + break; 180 + return 0; 181 + } 182 + 183 + msleep(50); 184 + } while (time_before(jiffies, end)); 185 + 186 + return -ETIMEDOUT; 187 + } 188 + 189 + static int pcie2cio_read(struct icm *icm, enum tb_cfg_space cs, 190 + unsigned int port, unsigned int index, u32 *data) 191 + { 192 + struct pci_dev *pdev = icm->upstream_port; 193 + int ret, vnd_cap = icm->vnd_cap; 194 + u32 cmd; 195 + 196 + cmd = index; 197 + cmd |= (port << PCIE2CIO_CMD_PORT_SHIFT) & PCIE2CIO_CMD_PORT_MASK; 198 + cmd |= (cs << PCIE2CIO_CMD_CS_SHIFT) & PCIE2CIO_CMD_CS_MASK; 199 + cmd |= PCIE2CIO_CMD_START; 200 + pci_write_config_dword(pdev, vnd_cap + PCIE2CIO_CMD, cmd); 201 + 202 + ret = pci2cio_wait_completion(icm, 5000); 203 + if (ret) 204 + return ret; 205 + 206 + pci_read_config_dword(pdev, vnd_cap + PCIE2CIO_RDDATA, data); 207 + return 0; 208 + } 209 + 210 + static int pcie2cio_write(struct icm *icm, enum tb_cfg_space cs, 211 + unsigned int port, unsigned int index, u32 data) 212 + { 213 + struct pci_dev *pdev = icm->upstream_port; 214 + int vnd_cap = icm->vnd_cap; 215 + u32 cmd; 216 + 217 + pci_write_config_dword(pdev, vnd_cap + PCIE2CIO_WRDATA, data); 218 + 219 + cmd = index; 220 + cmd |= (port << PCIE2CIO_CMD_PORT_SHIFT) & PCIE2CIO_CMD_PORT_MASK; 221 + cmd |= (cs << PCIE2CIO_CMD_CS_SHIFT) & PCIE2CIO_CMD_CS_MASK; 222 + cmd |= PCIE2CIO_CMD_WRITE | PCIE2CIO_CMD_START; 223 + pci_write_config_dword(pdev, vnd_cap + PCIE2CIO_CMD, cmd); 224 + 225 + return pci2cio_wait_completion(icm, 5000); 169 226 } 170 227 171 228 static bool icm_match(const struct tb_cfg_request *req, ··· 545 484 sw->authorized = authorized; 546 485 sw->security_level = security_level; 547 486 sw->boot = boot; 487 + init_completion(&sw->rpm_complete); 548 488 549 489 vss = parse_intel_vss(ep_name, ep_name_size); 550 490 if (vss) ··· 585 523 586 524 /* This switch still exists */ 587 525 sw->is_unplugged = false; 526 + 527 + /* Runtime resume is now complete */ 528 + complete(&sw->rpm_complete); 588 529 } 589 530 590 531 static void remove_switch(struct tb_switch *sw) ··· 897 832 remove_xdomain(xd); 898 833 tb_xdomain_put(xd); 899 834 } 835 + } 836 + 837 + static int icm_tr_cio_reset(struct tb *tb) 838 + { 839 + return pcie2cio_write(tb_priv(tb), TB_CFG_SWITCH, 0, 0x777, BIT(1)); 900 840 } 901 841 902 842 static int ··· 1310 1240 return false; 1311 1241 } 1312 1242 1243 + static int icm_ar_cio_reset(struct tb *tb) 1244 + { 1245 + return pcie2cio_write(tb_priv(tb), TB_CFG_SWITCH, 0, 0x50, BIT(9)); 1246 + } 1247 + 1313 1248 static int icm_ar_get_mode(struct tb *tb) 1314 1249 { 1315 1250 struct tb_nhi *nhi = tb->nhi; ··· 1552 1477 return -ETIMEDOUT; 1553 1478 } 1554 1479 1555 - static int pci2cio_wait_completion(struct icm *icm, unsigned long timeout_msec) 1556 - { 1557 - unsigned long end = jiffies + msecs_to_jiffies(timeout_msec); 1558 - u32 cmd; 1559 - 1560 - do { 1561 - pci_read_config_dword(icm->upstream_port, 1562 - icm->vnd_cap + PCIE2CIO_CMD, &cmd); 1563 - if (!(cmd & PCIE2CIO_CMD_START)) { 1564 - if (cmd & PCIE2CIO_CMD_TIMEOUT) 1565 - break; 1566 - return 0; 1567 - } 1568 - 1569 - msleep(50); 1570 - } while (time_before(jiffies, end)); 1571 - 1572 - return -ETIMEDOUT; 1573 - } 1574 - 1575 - static int pcie2cio_read(struct icm *icm, enum tb_cfg_space cs, 1576 - unsigned int port, unsigned int index, u32 *data) 1577 - { 1578 - struct pci_dev *pdev = icm->upstream_port; 1579 - int ret, vnd_cap = icm->vnd_cap; 1580 - u32 cmd; 1581 - 1582 - cmd = index; 1583 - cmd |= (port << PCIE2CIO_CMD_PORT_SHIFT) & PCIE2CIO_CMD_PORT_MASK; 1584 - cmd |= (cs << PCIE2CIO_CMD_CS_SHIFT) & PCIE2CIO_CMD_CS_MASK; 1585 - cmd |= PCIE2CIO_CMD_START; 1586 - pci_write_config_dword(pdev, vnd_cap + PCIE2CIO_CMD, cmd); 1587 - 1588 - ret = pci2cio_wait_completion(icm, 5000); 1589 - if (ret) 1590 - return ret; 1591 - 1592 - pci_read_config_dword(pdev, vnd_cap + PCIE2CIO_RDDATA, data); 1593 - return 0; 1594 - } 1595 - 1596 - static int pcie2cio_write(struct icm *icm, enum tb_cfg_space cs, 1597 - unsigned int port, unsigned int index, u32 data) 1598 - { 1599 - struct pci_dev *pdev = icm->upstream_port; 1600 - int vnd_cap = icm->vnd_cap; 1601 - u32 cmd; 1602 - 1603 - pci_write_config_dword(pdev, vnd_cap + PCIE2CIO_WRDATA, data); 1604 - 1605 - cmd = index; 1606 - cmd |= (port << PCIE2CIO_CMD_PORT_SHIFT) & PCIE2CIO_CMD_PORT_MASK; 1607 - cmd |= (cs << PCIE2CIO_CMD_CS_SHIFT) & PCIE2CIO_CMD_CS_MASK; 1608 - cmd |= PCIE2CIO_CMD_WRITE | PCIE2CIO_CMD_START; 1609 - pci_write_config_dword(pdev, vnd_cap + PCIE2CIO_CMD, cmd); 1610 - 1611 - return pci2cio_wait_completion(icm, 5000); 1612 - } 1613 - 1614 1480 static int icm_firmware_reset(struct tb *tb, struct tb_nhi *nhi) 1615 1481 { 1616 1482 struct icm *icm = tb_priv(tb); ··· 1572 1556 iowrite32(val, nhi->iobase + REG_FW_STS); 1573 1557 1574 1558 /* Trigger CIO reset now */ 1575 - return pcie2cio_write(icm, TB_CFG_SWITCH, 0, 0x50, BIT(9)); 1559 + return icm->cio_reset(tb); 1576 1560 } 1577 1561 1578 1562 static int icm_firmware_start(struct tb *tb, struct tb_nhi *nhi) ··· 1786 1770 } 1787 1771 } 1788 1772 1773 + static int complete_rpm(struct device *dev, void *data) 1774 + { 1775 + struct tb_switch *sw = tb_to_switch(dev); 1776 + 1777 + if (sw) 1778 + complete(&sw->rpm_complete); 1779 + return 0; 1780 + } 1781 + 1782 + static void remove_unplugged_switch(struct tb_switch *sw) 1783 + { 1784 + pm_runtime_get_sync(sw->dev.parent); 1785 + 1786 + /* 1787 + * Signal this and switches below for rpm_complete because 1788 + * tb_switch_remove() calls pm_runtime_get_sync() that then waits 1789 + * for it. 1790 + */ 1791 + complete_rpm(&sw->dev, NULL); 1792 + bus_for_each_dev(&tb_bus_type, &sw->dev, NULL, complete_rpm); 1793 + tb_switch_remove(sw); 1794 + 1795 + pm_runtime_mark_last_busy(sw->dev.parent); 1796 + pm_runtime_put_autosuspend(sw->dev.parent); 1797 + } 1798 + 1789 1799 static void icm_free_unplugged_children(struct tb_switch *sw) 1790 1800 { 1791 1801 unsigned int i; ··· 1824 1782 port->xdomain = NULL; 1825 1783 } else if (tb_port_has_remote(port)) { 1826 1784 if (port->remote->sw->is_unplugged) { 1827 - tb_switch_remove(port->remote->sw); 1785 + remove_unplugged_switch(port->remote->sw); 1828 1786 port->remote = NULL; 1829 1787 } else { 1830 1788 icm_free_unplugged_children(port->remote->sw); ··· 1870 1828 static int icm_runtime_suspend(struct tb *tb) 1871 1829 { 1872 1830 nhi_mailbox_cmd(tb->nhi, NHI_MAILBOX_DRV_UNLOADS, 0); 1831 + return 0; 1832 + } 1833 + 1834 + static int icm_runtime_suspend_switch(struct tb_switch *sw) 1835 + { 1836 + if (tb_route(sw)) 1837 + reinit_completion(&sw->rpm_complete); 1838 + return 0; 1839 + } 1840 + 1841 + static int icm_runtime_resume_switch(struct tb_switch *sw) 1842 + { 1843 + if (tb_route(sw)) { 1844 + if (!wait_for_completion_timeout(&sw->rpm_complete, 1845 + msecs_to_jiffies(500))) { 1846 + dev_dbg(&sw->dev, "runtime resuming timed out\n"); 1847 + } 1848 + } 1873 1849 return 0; 1874 1850 } 1875 1851 ··· 1970 1910 .complete = icm_complete, 1971 1911 .runtime_suspend = icm_runtime_suspend, 1972 1912 .runtime_resume = icm_runtime_resume, 1913 + .runtime_suspend_switch = icm_runtime_suspend_switch, 1914 + .runtime_resume_switch = icm_runtime_resume_switch, 1973 1915 .handle_event = icm_handle_event, 1974 1916 .get_boot_acl = icm_ar_get_boot_acl, 1975 1917 .set_boot_acl = icm_ar_set_boot_acl, ··· 1992 1930 .complete = icm_complete, 1993 1931 .runtime_suspend = icm_runtime_suspend, 1994 1932 .runtime_resume = icm_runtime_resume, 1933 + .runtime_suspend_switch = icm_runtime_suspend_switch, 1934 + .runtime_resume_switch = icm_runtime_resume_switch, 1995 1935 .handle_event = icm_handle_event, 1996 1936 .get_boot_acl = icm_ar_get_boot_acl, 1997 1937 .set_boot_acl = icm_ar_set_boot_acl, ··· 2039 1975 case PCI_DEVICE_ID_INTEL_ALPINE_RIDGE_C_2C_NHI: 2040 1976 icm->max_boot_acl = ICM_AR_PREBOOT_ACL_ENTRIES; 2041 1977 icm->is_supported = icm_ar_is_supported; 1978 + icm->cio_reset = icm_ar_cio_reset; 2042 1979 icm->get_mode = icm_ar_get_mode; 2043 1980 icm->get_route = icm_ar_get_route; 2044 1981 icm->save_devices = icm_fr_save_devices; ··· 2055 1990 case PCI_DEVICE_ID_INTEL_TITAN_RIDGE_4C_NHI: 2056 1991 icm->max_boot_acl = ICM_AR_PREBOOT_ACL_ENTRIES; 2057 1992 icm->is_supported = icm_ar_is_supported; 1993 + icm->cio_reset = icm_tr_cio_reset; 2058 1994 icm->get_mode = icm_ar_get_mode; 2059 1995 icm->driver_ready = icm_tr_driver_ready; 2060 1996 icm->device_connected = icm_tr_device_connected;
+33 -12
drivers/thunderbolt/switch.c
··· 239 239 int ret; 240 240 241 241 pm_runtime_get_sync(&sw->dev); 242 + 243 + if (!mutex_trylock(&sw->tb->lock)) { 244 + ret = restart_syscall(); 245 + goto out; 246 + } 247 + 242 248 ret = dma_port_flash_read(sw->dma_port, offset, val, bytes); 249 + mutex_unlock(&sw->tb->lock); 250 + 251 + out: 243 252 pm_runtime_mark_last_busy(&sw->dev); 244 253 pm_runtime_put_autosuspend(&sw->dev); 245 254 ··· 1028 1019 * the new tunnel too early. 1029 1020 */ 1030 1021 pci_lock_rescan_remove(); 1031 - pm_runtime_get_sync(&sw->dev); 1032 1022 1033 1023 switch (val) { 1034 1024 /* Approve switch */ ··· 1048 1040 break; 1049 1041 } 1050 1042 1051 - pm_runtime_mark_last_busy(&sw->dev); 1052 - pm_runtime_put_autosuspend(&sw->dev); 1053 1043 pci_unlock_rescan_remove(); 1054 1044 1055 1045 if (!ret) { ··· 1075 1069 if (val > 2) 1076 1070 return -EINVAL; 1077 1071 1072 + pm_runtime_get_sync(&sw->dev); 1078 1073 ret = tb_switch_set_authorized(sw, val); 1074 + pm_runtime_mark_last_busy(&sw->dev); 1075 + pm_runtime_put_autosuspend(&sw->dev); 1079 1076 1080 1077 return ret ? ret : count; 1081 1078 } ··· 1204 1195 bool val; 1205 1196 int ret; 1206 1197 1207 - if (!mutex_trylock(&sw->tb->lock)) 1208 - return restart_syscall(); 1198 + pm_runtime_get_sync(&sw->dev); 1199 + 1200 + if (!mutex_trylock(&sw->tb->lock)) { 1201 + ret = restart_syscall(); 1202 + goto exit_rpm; 1203 + } 1209 1204 1210 1205 /* If NVMem devices are not yet added */ 1211 1206 if (!sw->nvm) { ··· 1230 1217 goto exit_unlock; 1231 1218 } 1232 1219 1233 - pm_runtime_get_sync(&sw->dev); 1234 1220 ret = nvm_validate_and_write(sw); 1235 - if (ret) { 1236 - pm_runtime_mark_last_busy(&sw->dev); 1237 - pm_runtime_put_autosuspend(&sw->dev); 1221 + if (ret) 1238 1222 goto exit_unlock; 1239 - } 1240 1223 1241 1224 sw->nvm->authenticating = true; 1242 1225 ··· 1248 1239 } else { 1249 1240 ret = nvm_authenticate_device(sw); 1250 1241 } 1251 - pm_runtime_mark_last_busy(&sw->dev); 1252 - pm_runtime_put_autosuspend(&sw->dev); 1253 1242 } 1254 1243 1255 1244 exit_unlock: 1256 1245 mutex_unlock(&sw->tb->lock); 1246 + exit_rpm: 1247 + pm_runtime_mark_last_busy(&sw->dev); 1248 + pm_runtime_put_autosuspend(&sw->dev); 1257 1249 1258 1250 if (ret) 1259 1251 return ret; ··· 1390 1380 */ 1391 1381 static int __maybe_unused tb_switch_runtime_suspend(struct device *dev) 1392 1382 { 1383 + struct tb_switch *sw = tb_to_switch(dev); 1384 + const struct tb_cm_ops *cm_ops = sw->tb->cm_ops; 1385 + 1386 + if (cm_ops->runtime_suspend_switch) 1387 + return cm_ops->runtime_suspend_switch(sw); 1388 + 1393 1389 return 0; 1394 1390 } 1395 1391 1396 1392 static int __maybe_unused tb_switch_runtime_resume(struct device *dev) 1397 1393 { 1394 + struct tb_switch *sw = tb_to_switch(dev); 1395 + const struct tb_cm_ops *cm_ops = sw->tb->cm_ops; 1396 + 1397 + if (cm_ops->runtime_resume_switch) 1398 + return cm_ops->runtime_resume_switch(sw); 1398 1399 return 0; 1399 1400 } 1400 1401
+7
drivers/thunderbolt/tb.h
··· 79 79 * @connection_key: Connection key used with ICM messaging 80 80 * @link: Root switch link this switch is connected (ICM only) 81 81 * @depth: Depth in the chain this switch is connected (ICM only) 82 + * @rpm_complete: Completion used to wait for runtime resume to 83 + * complete (ICM only) 82 84 * 83 85 * When the switch is being added or removed to the domain (other 84 86 * switches) you need to have domain lock held. ··· 114 112 u8 connection_key; 115 113 u8 link; 116 114 u8 depth; 115 + struct completion rpm_complete; 117 116 }; 118 117 119 118 /** ··· 253 250 * @complete: Connection manager specific complete 254 251 * @runtime_suspend: Connection manager specific runtime_suspend 255 252 * @runtime_resume: Connection manager specific runtime_resume 253 + * @runtime_suspend_switch: Runtime suspend a switch 254 + * @runtime_resume_switch: Runtime resume a switch 256 255 * @handle_event: Handle thunderbolt event 257 256 * @get_boot_acl: Get boot ACL list 258 257 * @set_boot_acl: Set boot ACL list ··· 275 270 void (*complete)(struct tb *tb); 276 271 int (*runtime_suspend)(struct tb *tb); 277 272 int (*runtime_resume)(struct tb *tb); 273 + int (*runtime_suspend_switch)(struct tb_switch *sw); 274 + int (*runtime_resume_switch)(struct tb_switch *sw); 278 275 void (*handle_event)(struct tb *tb, enum tb_cfg_pkg_type, 279 276 const void *buf, size_t size); 280 277 int (*get_boot_acl)(struct tb *tb, uuid_t *uuids, size_t nuuids);