History

Merge tag 'tty-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty

Pull tty / serial driver fixes from Greg KH: "Here are some small fixes for reported problems for tty and serial drivers for 5.13-rc4. They consist of: - 8250 bugfixes and new device support - lockdown security mode fixup - syzbot found problems fixed - 8250_omap fix for interrupt storm - revert of 8250_omap driver fix as it caused worse problem than the original issue All but the last patch have been in linux-next for a while, the last one is a revert of a problem found in linux-next with the 8250_omap driver change" * tag 'tty-5.13-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: Revert "serial: 8250: 8250_omap: Fix possible interrupt storm" serial: 8250_pci: handle FL_NOIRQ board flag serial: rp2: use 'request_firmware' instead of 'request_firmware_nowait' serial: 8250_pci: Add support for new HPE serial device serial: 8250: 8250_omap: Fix possible interrupt storm serial: 8250: Use BIT(x) for UART_{CAP,BUG}_* serial: 8250: Add UART_BUG_TXRACE workaround for Aspeed VUART serial: 8250_dw: Add device HID for new AMD UART controller serial: sh-sci: Fix off-by-one error in FIFO threshold register setting serial: core: fix suspicious security_locked_down() call serial: tegra: Fix a mask operation that is always true

Linus Torvalds committed 5 years ago

Commit 3837f9a2 parents 523d0b1 56dde6810 files · +92 −68Browse files

Unified · Split

10 files
  1. drivers/acpi/acpi_apd.c +1 −0
  2. drivers/tty/serial/8250/8250.h +17 −15
  3. drivers/tty/serial/8250/8250_aspeed_vuart.c +1 −0
  4. drivers/tty/serial/8250/8250_dw.c +1 −0
  5. drivers/tty/serial/8250/8250_pci.c +35 −12
  6. drivers/tty/serial/8250/8250_port.c +12 −0
  7. drivers/tty/serial/rp2.c +17 −35
  8. drivers/tty/serial/serial-tegra.c +1 −1
  9. drivers/tty/serial/serial_core.c +5 −3
  10. drivers/tty/serial/sh-sci.c +2 −2
drivers/acpi/acpi_apd.c+1−0
@@ -226,6 +226,7 @@ static const struct acpi_device_id acpi_apd_device_ids[] = { · 225 unmodified lines
226 { "AMDI0010", APD_ADDR(wt_i2c_desc) },226 { "AMDI0010", APD_ADDR(wt_i2c_desc) },
227 { "AMD0020", APD_ADDR(cz_uart_desc) },227 { "AMD0020", APD_ADDR(cz_uart_desc) },
228 { "AMDI0020", APD_ADDR(cz_uart_desc) },228 { "AMDI0020", APD_ADDR(cz_uart_desc) },
229 { "AMDI0022", APD_ADDR(cz_uart_desc) },
229 { "AMD0030", },230 { "AMD0030", },
230 { "AMD0040", APD_ADDR(fch_misc_desc)},231 { "AMD0040", APD_ADDR(fch_misc_desc)},
231 { "HYGO0010", APD_ADDR(wt_i2c_desc) },232 { "HYGO0010", APD_ADDR(wt_i2c_desc) },
drivers/tty/serial/8250/8250.h+17−15
@@ -7,6 +7,7 @@ · 6 unmodified lines
7 * Copyright (C) 2001 Russell King.7 * Copyright (C) 2001 Russell King.
8 */8 */
9 9
10#include <linux/bits.h>
10#include <linux/serial_8250.h>11#include <linux/serial_8250.h>
11#include <linux/serial_reg.h>12#include <linux/serial_reg.h>
12#include <linux/dmaengine.h>13#include <linux/dmaengine.h>
@@ -70,24 +71,25 @@ struct serial8250_config { · 57 unmodified lines
70 unsigned int flags;71 unsigned int flags;
71};72};
72 73
73#define UART_CAP_FIFO (1 << 8) /* UART has FIFO */74#define UART_CAP_FIFO BIT(8) /* UART has FIFO */
74#define UART_CAP_EFR (1 << 9) /* UART has EFR */75#define UART_CAP_EFR BIT(9) /* UART has EFR */
75#define UART_CAP_SLEEP (1 << 10) /* UART has IER sleep */76#define UART_CAP_SLEEP BIT(10) /* UART has IER sleep */
76#define UART_CAP_AFE (1 << 11) /* MCR-based hw flow control */77#define UART_CAP_AFE BIT(11) /* MCR-based hw flow control */
77#define UART_CAP_UUE (1 << 12) /* UART needs IER bit 6 set (Xscale) */78#define UART_CAP_UUE BIT(12) /* UART needs IER bit 6 set (Xscale) */
78#define UART_CAP_RTOIE (1 << 13) /* UART needs IER bit 4 set (Xscale, Tegra) */79#define UART_CAP_RTOIE BIT(13) /* UART needs IER bit 4 set (Xscale, Tegra) */
79#define UART_CAP_HFIFO (1 << 14) /* UART has a "hidden" FIFO */80#define UART_CAP_HFIFO BIT(14) /* UART has a "hidden" FIFO */
80#define UART_CAP_RPM (1 << 15) /* Runtime PM is active while idle */81#define UART_CAP_RPM BIT(15) /* Runtime PM is active while idle */
81#define UART_CAP_IRDA (1 << 16) /* UART supports IrDA line discipline */82#define UART_CAP_IRDA BIT(16) /* UART supports IrDA line discipline */
82#define UART_CAP_MINI (1 << 17) /* Mini UART on BCM283X family lacks:83#define UART_CAP_MINI BIT(17) /* Mini UART on BCM283X family lacks:
83 * STOP PARITY EPAR SPAR WLEN5 WLEN684 * STOP PARITY EPAR SPAR WLEN5 WLEN6
84 */85 */
85 86
86#define UART_BUG_QUOT (1 << 0) /* UART has buggy quot LSB */87#define UART_BUG_QUOT BIT(0) /* UART has buggy quot LSB */
87#define UART_BUG_TXEN (1 << 1) /* UART has buggy TX IIR status */88#define UART_BUG_TXEN BIT(1) /* UART has buggy TX IIR status */
88#define UART_BUG_NOMSR (1 << 2) /* UART has buggy MSR status bits (Au1x00) */89#define UART_BUG_NOMSR BIT(2) /* UART has buggy MSR status bits (Au1x00) */
89#define UART_BUG_THRE (1 << 3) /* UART has buggy THRE reassertion */90#define UART_BUG_THRE BIT(3) /* UART has buggy THRE reassertion */
90#define UART_BUG_PARITY (1 << 4) /* UART mishandles parity if FIFO enabled */91#define UART_BUG_PARITY BIT(4) /* UART mishandles parity if FIFO enabled */
92#define UART_BUG_TXRACE BIT(5) /* UART Tx fails to set remote DR */
91 93
92 94
93#ifdef CONFIG_SERIAL_8250_SHARE_IRQ95#ifdef CONFIG_SERIAL_8250_SHARE_IRQ
drivers/tty/serial/8250/8250_aspeed_vuart.c+1−0
@@ -437,6 +437,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) · 436 unmodified lines
437 port.port.status = UPSTAT_SYNC_FIFO;437 port.port.status = UPSTAT_SYNC_FIFO;
438 port.port.dev = &pdev->dev;438 port.port.dev = &pdev->dev;
439 port.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);439 port.port.has_sysrq = IS_ENABLED(CONFIG_SERIAL_8250_CONSOLE);
440 port.bugs |= UART_BUG_TXRACE;
440 441
441 rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);442 rc = sysfs_create_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
442 if (rc < 0)443 if (rc < 0)
drivers/tty/serial/8250/8250_dw.c+1−0
@@ -714,6 +714,7 @@ static const struct acpi_device_id dw8250_acpi_match[] = { · 713 unmodified lines
714 { "APMC0D08", 0},714 { "APMC0D08", 0},
715 { "AMD0020", 0 },715 { "AMD0020", 0 },
716 { "AMDI0020", 0 },716 { "AMDI0020", 0 },
717 { "AMDI0022", 0 },
717 { "BRCM2032", 0 },718 { "BRCM2032", 0 },
718 { "HISI0031", 0 },719 { "HISI0031", 0 },
719 { },720 { },
drivers/tty/serial/8250/8250_pci.c+35−12
@@ -56,6 +56,8 @@ struct serial_private { · 55 unmodified lines
56 int line[];56 int line[];
57};57};
58 58
59#define PCI_DEVICE_ID_HPE_PCI_SERIAL 0x37e
60
59static const struct pci_device_id pci_use_msi[] = {61static const struct pci_device_id pci_use_msi[] = {
60 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,62 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9900,
61 0xA000, 0x1000) },63 0xA000, 0x1000) },
@@ -63,6 +65,8 @@ static const struct pci_device_id pci_use_msi[] = { · 1 unmodified line
63 0xA000, 0x1000) },65 0xA000, 0x1000) },
64 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,66 { PCI_DEVICE_SUB(PCI_VENDOR_ID_NETMOS, PCI_DEVICE_ID_NETMOS_9922,
65 0xA000, 0x1000) },67 0xA000, 0x1000) },
68 { PCI_DEVICE_SUB(PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL,
69 PCI_ANY_ID, PCI_ANY_ID) },
66 { }70 { }
67};71};
68 72
@@ -1997,6 +2001,16 @@ static struct pci_serial_quirk pci_serial_quirks[] = { · 1928 unmodified lines
1997 .init = pci_hp_diva_init,2001 .init = pci_hp_diva_init,
1998 .setup = pci_hp_diva_setup,2002 .setup = pci_hp_diva_setup,
1999 },2003 },
2004 /*
2005 * HPE PCI serial device
2006 */
2007 {
2008 .vendor = PCI_VENDOR_ID_HP_3PAR,
2009 .device = PCI_DEVICE_ID_HPE_PCI_SERIAL,
2010 .subvendor = PCI_ANY_ID,
2011 .subdevice = PCI_ANY_ID,
2012 .setup = pci_hp_diva_setup,
2013 },
2000 /*2014 /*
2001 * Intel2015 * Intel
2002 */2016 */
@@ -3944,21 +3958,26 @@ pciserial_init_ports(struct pci_dev *dev, const struct pciserial_board *board) · 1941 unmodified lines
3944 uart.port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;3958 uart.port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
3945 uart.port.uartclk = board->base_baud * 16;3959 uart.port.uartclk = board->base_baud * 16;
3946 3960
3947 if (pci_match_id(pci_use_msi, dev)) {3961 if (board->flags & FL_NOIRQ) {
3948 dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n");3962 uart.port.irq = 0;
3949 pci_set_master(dev);
3950 rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES);
3951 } else {3963 } else {
3952 dev_dbg(&dev->dev, "Using legacy interrupts\n");3964 if (pci_match_id(pci_use_msi, dev)) {
3953 rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY);3965 dev_dbg(&dev->dev, "Using MSI(-X) interrupts\n");
3954 }3966 pci_set_master(dev);
3955 if (rc < 0) {3967 rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_ALL_TYPES);
3956 kfree(priv);3968 } else {
3957 priv = ERR_PTR(rc);3969 dev_dbg(&dev->dev, "Using legacy interrupts\n");
3958 goto err_deinit;3970 rc = pci_alloc_irq_vectors(dev, 1, 1, PCI_IRQ_LEGACY);
3971 }
3972 if (rc < 0) {
3973 kfree(priv);
3974 priv = ERR_PTR(rc);
3975 goto err_deinit;
3976 }
3977
3978 uart.port.irq = pci_irq_vector(dev, 0);
3959 }3979 }
3960 3980
3961 uart.port.irq = pci_irq_vector(dev, 0);
3962 uart.port.dev = &dev->dev;3981 uart.port.dev = &dev->dev;
3963 3982
3964 for (i = 0; i < nr_ports; i++) {3983 for (i = 0; i < nr_ports; i++) {
@@ -4973,6 +4992,10 @@ static const struct pci_device_id serial_pci_tbl[] = { · 1008 unmodified lines
4973 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,4992 { PCI_VENDOR_ID_HP, PCI_DEVICE_ID_HP_DIVA_AUX,
4974 PCI_ANY_ID, PCI_ANY_ID, 0, 0,4993 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4975 pbn_b2_1_115200 },4994 pbn_b2_1_115200 },
4995 /* HPE PCI serial device */
4996 { PCI_VENDOR_ID_HP_3PAR, PCI_DEVICE_ID_HPE_PCI_SERIAL,
4997 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
4998 pbn_b1_1_115200 },
4976 4999
4977 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,5000 { PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,
4978 PCI_ANY_ID, PCI_ANY_ID, 0, 0,5001 PCI_ANY_ID, PCI_ANY_ID, 0, 0,
drivers/tty/serial/8250/8250_port.c+12−0
@@ -1809,6 +1809,18 @@ void serial8250_tx_chars(struct uart_8250_port *up) · 1808 unmodified lines
1809 count = up->tx_loadsz;1809 count = up->tx_loadsz;
1810 do {1810 do {
1811 serial_out(up, UART_TX, xmit->buf[xmit->tail]);1811 serial_out(up, UART_TX, xmit->buf[xmit->tail]);
1812 if (up->bugs & UART_BUG_TXRACE) {
1813 /*
1814 * The Aspeed BMC virtual UARTs have a bug where data
1815 * may get stuck in the BMC's Tx FIFO from bursts of
1816 * writes on the APB interface.
1817 *
1818 * Delay back-to-back writes by a read cycle to avoid
1819 * stalling the VUART. Read a register that won't have
1820 * side-effects and discard the result.
1821 */
1822 serial_in(up, UART_SCR);
1823 }
1812 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);1824 xmit->tail = (xmit->tail + 1) & (UART_XMIT_SIZE - 1);
1813 port->icount.tx++;1825 port->icount.tx++;
1814 if (uart_circ_empty(xmit))1826 if (uart_circ_empty(xmit))
drivers/tty/serial/rp2.c+17−35
@@ -195,7 +195,6 @@ struct rp2_card { · 194 unmodified lines
195 void __iomem *bar0;195 void __iomem *bar0;
196 void __iomem *bar1;196 void __iomem *bar1;
197 spinlock_t card_lock;197 spinlock_t card_lock;
198 struct completion fw_loaded;
199};198};
200 199
201#define RP_ID(prod) PCI_VDEVICE(RP, (prod))200#define RP_ID(prod) PCI_VDEVICE(RP, (prod))
@@ -662,17 +661,10 @@ static void rp2_remove_ports(struct rp2_card *card) · 460 unmodified lines
662 card->initialized_ports = 0;661 card->initialized_ports = 0;
663}662}
664 663
665static void rp2_fw_cb(const struct firmware *fw, void *context)664static int rp2_load_firmware(struct rp2_card *card, const struct firmware *fw)
666{665{
667 struct rp2_card *card = context;
668 resource_size_t phys_base;666 resource_size_t phys_base;
669 int i, rc = -ENOENT;667 int i, rc = 0;
670
671 if (!fw) {
672 dev_err(&card->pdev->dev, "cannot find '%s' firmware image\n",
673 RP2_FW_NAME);
674 goto no_fw;
675 }
676 668
677 phys_base = pci_resource_start(card->pdev, 1);669 phys_base = pci_resource_start(card->pdev, 1);
678 670
@@ -718,23 +710,13 @@ static void rp2_fw_cb(const struct firmware *fw, void *context) · 39 unmodified lines
718 card->initialized_ports++;710 card->initialized_ports++;
719 }711 }
720 712
721 release_firmware(fw);713 return rc;
722no_fw:
723 /*
724 * rp2_fw_cb() is called from a workqueue long after rp2_probe()
725 * has already returned success. So if something failed here,
726 * we'll just leave the now-dormant device in place until somebody
727 * unbinds it.
728 */
729 if (rc)
730 dev_warn(&card->pdev->dev, "driver initialization failed\n");
731
732 complete(&card->fw_loaded);
733}714}
734 715
735static int rp2_probe(struct pci_dev *pdev,716static int rp2_probe(struct pci_dev *pdev,
736 const struct pci_device_id *id)717 const struct pci_device_id *id)
737{718{
719 const struct firmware *fw;
738 struct rp2_card *card;720 struct rp2_card *card;
739 struct rp2_uart_port *ports;721 struct rp2_uart_port *ports;
740 void __iomem * const *bars;722 void __iomem * const *bars;
@@ -745,7 +727,6 @@ static int rp2_probe(struct pci_dev *pdev, · 4 unmodified lines
745 return -ENOMEM;727 return -ENOMEM;
746 pci_set_drvdata(pdev, card);728 pci_set_drvdata(pdev, card);
747 spin_lock_init(&card->card_lock);729 spin_lock_init(&card->card_lock);
748 init_completion(&card->fw_loaded);
749 730
750 rc = pcim_enable_device(pdev);731 rc = pcim_enable_device(pdev);
751 if (rc)732 if (rc)
@@ -778,21 +759,23 @@ static int rp2_probe(struct pci_dev *pdev, · 26 unmodified lines
778 return -ENOMEM;759 return -ENOMEM;
779 card->ports = ports;760 card->ports = ports;
780 761
781 rc = devm_request_irq(&pdev->dev, pdev->irq, rp2_uart_interrupt,762 rc = request_firmware(&fw, RP2_FW_NAME, &pdev->dev);
782 IRQF_SHARED, DRV_NAME, card);763 if (rc < 0) {
783 if (rc)764 dev_err(&pdev->dev, "cannot find '%s' firmware image\n",
765 RP2_FW_NAME);
784 return rc;766 return rc;
767 }
785 768
786 /*769 rc = rp2_load_firmware(card, fw);
787 * Only catastrophic errors (e.g. ENOMEM) are reported here.770
788 * If the FW image is missing, we'll find out in rp2_fw_cb()771 release_firmware(fw);
789 * and print an error message.772 if (rc < 0)
790 */773 return rc;
791 rc = request_firmware_nowait(THIS_MODULE, 1, RP2_FW_NAME, &pdev->dev,774
792 GFP_KERNEL, card, rp2_fw_cb);775 rc = devm_request_irq(&pdev->dev, pdev->irq, rp2_uart_interrupt,
776 IRQF_SHARED, DRV_NAME, card);
793 if (rc)777 if (rc)
794 return rc;778 return rc;
795 dev_dbg(&pdev->dev, "waiting for firmware blob...\n");
796 779
797 return 0;780 return 0;
798}781}
@@ -801,7 +784,6 @@ static void rp2_remove(struct pci_dev *pdev) · 2 unmodified lines
801{784{
802 struct rp2_card *card = pci_get_drvdata(pdev);785 struct rp2_card *card = pci_get_drvdata(pdev);
803 786
804 wait_for_completion(&card->fw_loaded);
805 rp2_remove_ports(card);787 rp2_remove_ports(card);
806}788}
807 789
drivers/tty/serial/serial-tegra.c+1−1
@@ -338,7 +338,7 @@ static void tegra_uart_fifo_reset(struct tegra_uart_port *tup, u8 fcr_bits) · 337 unmodified lines
338 338
339 do {339 do {
340 lsr = tegra_uart_read(tup, UART_LSR);340 lsr = tegra_uart_read(tup, UART_LSR);
341 if ((lsr | UART_LSR_TEMT) && !(lsr & UART_LSR_DR))341 if ((lsr & UART_LSR_TEMT) && !(lsr & UART_LSR_DR))
342 break;342 break;
343 udelay(1);343 udelay(1);
344 } while (--tmout);344 } while (--tmout);
drivers/tty/serial/serial_core.c+5−3
@@ -863,9 +863,11 @@ static int uart_set_info(struct tty_struct *tty, struct tty_port *port, · 862 unmodified lines
863 goto check_and_exit;863 goto check_and_exit;
864 }864 }
865 865
866 retval = security_locked_down(LOCKDOWN_TIOCSSERIAL);866 if (change_irq || change_port) {
867 if (retval && (change_irq || change_port))867 retval = security_locked_down(LOCKDOWN_TIOCSSERIAL);
868 goto exit;868 if (retval)
869 goto exit;
870 }
869 871
870 /*872 /*
871 * Ask the low level driver to verify the settings.873 * Ask the low level driver to verify the settings.
drivers/tty/serial/sh-sci.c+2−2
@@ -1023,10 +1023,10 @@ static int scif_set_rtrg(struct uart_port *port, int rx_trig) · 1022 unmodified lines
1023{1023{
1024 unsigned int bits;1024 unsigned int bits;
1025 1025
1026 if (rx_trig >= port->fifosize)
1027 rx_trig = port->fifosize - 1;
1026 if (rx_trig < 1)1028 if (rx_trig < 1)
1027 rx_trig = 1;1029 rx_trig = 1;
1028 if (rx_trig >= port->fifosize)
1029 rx_trig = port->fifosize;
1030 1030
1031 /* HSCIF can be set to an arbitrary level. */1031 /* HSCIF can be set to an arbitrary level. */
1032 if (sci_getreg(port, HSRTRGR)->size) {1032 if (sci_getreg(port, HSRTRGR)->size) {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t