summaryrefslogtreecommitdiffstats
path: root/drivers/tty
Commit message (Collapse)AuthorAgeFilesLines
* Merge tag 'hwparam-20170420' of ↵Linus Torvalds2017-05-106-14/+14
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs Pull hw lockdown support from David Howells: "Annotation of module parameters that configure hardware resources including ioports, iomem addresses, irq lines and dma channels. This allows a future patch to prohibit the use of such module parameters to prevent that hardware from being abused to gain access to the running kernel image as part of locking the kernel down under UEFI secure boot conditions. Annotations are made by changing: module_param(n, t, p) module_param_named(n, v, t, p) module_param_array(n, t, m, p) to: module_param_hw(n, t, hwtype, p) module_param_hw_named(n, v, t, hwtype, p) module_param_hw_array(n, t, hwtype, m, p) where the module parameter refers to a hardware setting hwtype specifies the type of the resource being configured. This can be one of: ioport Module parameter configures an I/O port iomem Module parameter configures an I/O mem address ioport_or_iomem Module parameter could be either (runtime set) irq Module parameter configures an I/O port dma Module parameter configures a DMA channel dma_addr Module parameter configures a DMA buffer address other Module parameter configures some other value Note that the hwtype is compile checked, but not currently stored (the lockdown code probably won't require it). It is, however, there for future use. A bonus is that the hwtype can also be used for grepping. The intention is for the kernel to ignore or reject attempts to set annotated module parameters if lockdown is enabled. This applies to options passed on the boot command line, passed to insmod/modprobe or direct twiddling in /sys/module/ parameter files. The module initialisation then needs to handle the parameter not being set, by (1) giving an error, (2) probing for a value or (3) using a reasonable default. What I can't do is just reject a module out of hand because it may take a hardware setting in the module parameters. Some important modules, some ipmi stuff for instance, both probe for hardware and allow hardware to be manually specified; if the driver is aborts with any error, you don't get any ipmi hardware. Further, trying to do this entirely in the module initialisation code doesn't protect against sysfs twiddling. [!] Note that in and of itself, this series of patches should have no effect on the the size of the kernel or code execution - that is left to a patch in the next series to effect. It does mark annotated kernel parameters with a KERNEL_PARAM_FL_HWPARAM flag in an already existing field" * tag 'hwparam-20170420' of git://git.kernel.org/pub/scm/linux/kernel/git/dhowells/linux-fs: (38 commits) Annotate hardware config module parameters in sound/pci/ Annotate hardware config module parameters in sound/oss/ Annotate hardware config module parameters in sound/isa/ Annotate hardware config module parameters in sound/drivers/ Annotate hardware config module parameters in fs/pstore/ Annotate hardware config module parameters in drivers/watchdog/ Annotate hardware config module parameters in drivers/video/ Annotate hardware config module parameters in drivers/tty/ Annotate hardware config module parameters in drivers/staging/vme/ Annotate hardware config module parameters in drivers/staging/speakup/ Annotate hardware config module parameters in drivers/staging/media/ Annotate hardware config module parameters in drivers/scsi/ Annotate hardware config module parameters in drivers/pcmcia/ Annotate hardware config module parameters in drivers/pci/hotplug/ Annotate hardware config module parameters in drivers/parport/ Annotate hardware config module parameters in drivers/net/wireless/ Annotate hardware config module parameters in drivers/net/wan/ Annotate hardware config module parameters in drivers/net/irda/ Annotate hardware config module parameters in drivers/net/hamradio/ Annotate hardware config module parameters in drivers/net/ethernet/ ...
| * Annotate hardware config module parameters in drivers/tty/David Howells2017-04-206-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the kernel is running in secure boot mode, we lock down the kernel to prevent userspace from modifying the running kernel image. Whilst this includes prohibiting access to things like /dev/mem, it must also prevent access by means of configuring driver modules in such a way as to cause a device to access or modify the kernel image. To this end, annotate module_param* statements that refer to hardware configuration and indicate for future reference what type of parameter they specify. The parameter parser in the core sees this information and can skip such parameters with an error message if the kernel is locked down. The module initialisation then runs as normal, but just sees whatever the default values for those parameters is. Note that we do still need to do the module initialisation because some drivers have viable defaults set in case parameters aren't specified and some drivers support automatic configuration (e.g. PNP or PCI) in addition to manually coded parameters. This patch annotates drivers in drivers/tty/. Suggested-by: Alan Cox <gnomes@lxorguk.ukuu.org.uk> Signed-off-by: David Howells <dhowells@redhat.com> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> cc: Jiri Slaby <jslaby@suse.com> cc: linux-serial@vger.kernel.org
* | Merge tag 'tty-4.12-rc1' of ↵Linus Torvalds2017-05-0837-1006/+1467
|\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty Pull tty/serial updates from Greg KH: "Here is the "big" TTY/Serial patch updates for 4.12-rc1 Not a lot of new things here, the normal number of serial driver updates and additions, tiny bugs fixed, and some core files split up to make future changes a bit easier for Nicolas's "tiny-tty" work. All of these have been in linux-next for a while" * tag 'tty-4.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty: (62 commits) serial: small Makefile reordering tty: split job control support into a file of its own tty: move baudrate handling code to a file of its own console: move console_init() out of tty_io.c serial: 8250_early: Add earlycon support for Palmchip UART tty: pl011: use "qdf2400_e44" as the earlycon name for QDF2400 E44 vt: make mouse selection of non-ASCII consistent vt: set mouse selection word-chars to gpm's default imx-serial: Reduce RX DMA startup latency when opening for reading serial: omap: suspend device on probe errors serial: omap: fix runtime-pm handling on unbind tty: serial: omap: add UPF_BOOT_AUTOCONF flag for DT init serial: samsung: Remove useless spinlock serial: samsung: Add missing checks for dma_map_single failure serial: samsung: Use right device for DMA-mapping calls serial: imx: setup DCEDTE early and ensure DCD and RI irqs to be off tty: fix comment typo s/repsonsible/responsible/ tty: amba-pl011: Fix spurious TX interrupts serial: xuartps: Enable clocks in the pm disable case also serial: core: Re-use struct uart_port {name} field ...
| * | serial: small Makefile reorderingNicolas Pitre2017-04-181-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Move 21285 entry down alongside other UART drivers to be more consistent with the rest of the file. It is kept before 8250 though, to preserve the existing link ordering between those two. Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | tty: split job control support into a file of its ownNicolas Pitre2017-04-183-537/+566
| | | | | | | | | | | | | | | | | | | | | | | | | | | This makes it easier for job control to become optional and/or usable independently from tty_io.c, as well as providing a nice purpose separation. No logical changes from this patch. Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | tty: move baudrate handling code to a file of its ownNicolas Pitre2017-04-183-223/+234
| | | | | | | | | | | | | | | | | | | | | | | | To allow reuse without the rest of the tty_ioctl code. No logical changes from this patch. Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | console: move console_init() out of tty_io.cNicolas Pitre2017-04-181-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | All the console driver handling code lives in printk.c. Move console_init() there as well so console support can still be used when the TTY code is configured out. No logical changes from this patch. Signed-off-by: Nicolas Pitre <nico@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | serial: 8250_early: Add earlycon support for Palmchip UARTMarc Gonzalez2017-04-182-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | Define an OF early console for Palmchip UART, which can be enabled by passing "earlycon" on the boot command line. Signed-off-by: Marc Gonzalez <marc_gonzalez@sigmadesigns.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | tty: pl011: use "qdf2400_e44" as the earlycon name for QDF2400 E44Timur Tabi2017-04-181-8/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Define a new early console name for Qualcomm Datacenter Technologies QDF2400 SOCs affected by erratum 44, instead of piggy-backing on "pl011". Previously, to enable traditional (non-SPCR) earlycon, the documentation said to specify "earlycon=pl011,<address>,qdf2400_e44", but the code was broken and this didn't actually work. So instead, the method for specifying the E44 work-around with traditional earlycon is "earlycon=qdf2400_e44,<address>". Both methods of earlycon are now enabled with the same function. Fixes: e53e597fd4c4 ("tty: pl011: fix earlycon work-around for QDF2400 erratum 44") Signed-off-by: Timur Tabi <timur@codeaurora.org> Cc: stable <stable@vger.kernel.org> # 4.11 Tested-by: Shanker Donthineni <shankerd@codeaurora.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | Merge 4.11-rc7 into tty-nextGreg Kroah-Hartman2017-04-171-16/+69
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | We want the tty patch revert in here to handle merges and future work properly. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | vt: make mouse selection of non-ASCII consistentAdam Borowski2017-04-111-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For some reason a handful of ISO-8859-1 symbols are excluded from "word chars" while the vast majority of Unicode is hard-coded as included, even when inappropriate (we really would want to _not_ select line-drawing/etc). Those symbols are: ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿×÷ Thus, let's not special-case any non-ASCII anymore. Attempts to set these via ioctl will be silently ignored. As an extra bonus, we debloat the kernel by 128 bytes. Signed-off-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | vt: set mouse selection word-chars to gpm's defaultAdam Borowski2017-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since forever, gpm was this code's only user, and it overrides the table on start so the default was never seen -- until Bill Allombert's "consolation" came in. The in-kernel set is "A-Za-z0-9_" which fails to catch typical file names, etc. Let's change this to gpm's conservative default, ie "-A-Za-z0-9_./"; most terminals include more, for example xfce4-terminal has "-A-Za-z0-9,./?%&#:_=+@~". There's some discussion at https://bugs.debian.org/846587 Signed-off-by: Adam Borowski <kilobyte@angband.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | imx-serial: Reduce RX DMA startup latency when opening for readingPeter Senna Tschudin2017-04-111-14/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduce RX DMA start latency for the first reception when port is opened for reading. Instead of waiting for an interrupt signaling data on RX FIFO or data too old on RX FIFO, start RX DMA immediately when the serial port is opened for reading. Before this patch, the average RX DMA latency for the first reception was 42489 microseconds with a standard deviation of 25721 microseconds in 36 samples. After the patch the average RX DMA latency for the first reception, when the serial port is opened for reading, is 653 microseconds with a standard deviation of 294 microseconds in 36 samples. Signed-off-by: Peter Senna Tschudin <peter.senna@collabora.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: omap: suspend device on probe errorsJohan Hovold2017-04-111-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make sure to actually suspend the device before returning after a failed (or deferred) probe. Note that autosuspend must be disabled before runtime pm is disabled in order to balance the usage count due to a negative autosuspend delay as well as to make the final put suspend the device synchronously. Fixes: 388bc2622680 ("omap-serial: Fix the error handling in the omap_serial probe") Cc: Shubhrajyoti D <shubhrajyoti@ti.com> Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Tony Lindgren <tony@atomide.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: omap: fix runtime-pm handling on unbindJohan Hovold2017-04-111-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | An unbalanced and misplaced synchronous put was used to suspend the device on driver unbind, something which with a likewise misplaced pm_runtime_disable leads to external aborts when an open port is being removed. Unhandled fault: external abort on non-linefetch (0x1028) at 0xfa024010 ... [<c046e760>] (serial_omap_set_mctrl) from [<c046a064>] (uart_update_mctrl+0x50/0x60) [<c046a064>] (uart_update_mctrl) from [<c046a400>] (uart_shutdown+0xbc/0x138) [<c046a400>] (uart_shutdown) from [<c046bd2c>] (uart_hangup+0x94/0x190) [<c046bd2c>] (uart_hangup) from [<c045b760>] (__tty_hangup+0x404/0x41c) [<c045b760>] (__tty_hangup) from [<c045b794>] (tty_vhangup+0x1c/0x20) [<c045b794>] (tty_vhangup) from [<c046ccc8>] (uart_remove_one_port+0xec/0x260) [<c046ccc8>] (uart_remove_one_port) from [<c046ef4c>] (serial_omap_remove+0x40/0x60) [<c046ef4c>] (serial_omap_remove) from [<c04845e8>] (platform_drv_remove+0x34/0x4c) Fix this up by resuming the device before deregistering the port and by suspending and disabling runtime pm only after the port has been removed. Also make sure to disable autosuspend before disabling runtime pm so that the usage count is balanced and device actually suspended before returning. Note that due to a negative autosuspend delay being set in probe, the unbalanced put would actually suspend the device on first driver unbind, while rebinding and again unbinding would result in a negative power.usage_count. Fixes: 7e9c8e7dbf3b ("serial: omap: make sure to suspend device before remove") Cc: Felipe Balbi <balbi@kernel.org> Cc: Santosh Shilimkar <santosh.shilimkar@ti.com> Signed-off-by: Johan Hovold <johan@kernel.org> Acked-by: Tony Lindgren <tony@atomide.com> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | tty: serial: omap: add UPF_BOOT_AUTOCONF flag for DT initSebastian Reichel2017-04-081-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The UPF_BOOT_AUTOCONF flag is needed for proper flow control support. Acked-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: Sebastian Reichel <sre@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: samsung: Remove useless spinlockMarek Szyprowski2017-04-081-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Spinlock taken only for dma_map_single() for TX buffer is completely useless and doesn't protect anything, so remove it to simplify the code. Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: samsung: Add missing checks for dma_map_single failureMarek Szyprowski2017-04-081-7/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds missing checks for dma_map_single() failure and proper error reporting. Although this issue was harmless on ARM architecture, it is always good to use the DMA mapping API in a proper way. This patch fixes the following DMA API debug warning: WARNING: CPU: 1 PID: 3785 at lib/dma-debug.c:1171 check_unmap+0x8a0/0xf28 dma-pl330 121a0000.pdma: DMA-API: device driver failed to check map error[device address=0x000000006e0f9000] [size=4096 bytes] [mapped as single] Modules linked in: CPU: 1 PID: 3785 Comm: (agetty) Tainted: G W 4.11.0-rc1-00137-g07ca963-dirty #59 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c011aaa4>] (unwind_backtrace) from [<c01127c0>] (show_stack+0x20/0x24) [<c01127c0>] (show_stack) from [<c06ba5d8>] (dump_stack+0x84/0xa0) [<c06ba5d8>] (dump_stack) from [<c0139528>] (__warn+0x14c/0x180) [<c0139528>] (__warn) from [<c01395a4>] (warn_slowpath_fmt+0x48/0x50) [<c01395a4>] (warn_slowpath_fmt) from [<c072a114>] (check_unmap+0x8a0/0xf28) [<c072a114>] (check_unmap) from [<c072a834>] (debug_dma_unmap_page+0x98/0xc8) [<c072a834>] (debug_dma_unmap_page) from [<c0803874>] (s3c24xx_serial_shutdown+0x314/0x52c) [<c0803874>] (s3c24xx_serial_shutdown) from [<c07f5124>] (uart_port_shutdown+0x54/0x88) [<c07f5124>] (uart_port_shutdown) from [<c07f522c>] (uart_shutdown+0xd4/0x110) [<c07f522c>] (uart_shutdown) from [<c07f6a8c>] (uart_hangup+0x9c/0x208) [<c07f6a8c>] (uart_hangup) from [<c07c426c>] (__tty_hangup+0x49c/0x634) [<c07c426c>] (__tty_hangup) from [<c07c78ac>] (tty_ioctl+0xc88/0x16e4) [<c07c78ac>] (tty_ioctl) from [<c03b5f2c>] (do_vfs_ioctl+0xc4/0xd10) [<c03b5f2c>] (do_vfs_ioctl) from [<c03b6bf4>] (SyS_ioctl+0x7c/0x8c) [<c03b6bf4>] (SyS_ioctl) from [<c010b4a0>] (ret_fast_syscall+0x0/0x3c) Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com> Fixes: 62c37eedb74c8 ("serial: samsung: add dma reqest/release functions") CC: stable@vger.kernel.org # v4.10+ Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: samsung: Use right device for DMA-mapping callsMarek Szyprowski2017-04-081-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Driver should provide its own struct device for all DMA-mapping calls instead of extracting device pointer from DMA engine channel. Although this is harmless from the driver operation perspective on ARM architecture, it is always good to use the DMA mapping API in a proper way. This patch fixes following DMA API debug warning: WARNING: CPU: 0 PID: 0 at lib/dma-debug.c:1241 check_sync+0x520/0x9f4 samsung-uart 12c20000.serial: DMA-API: device driver tries to sync DMA memory it has not allocated [device address=0x000000006df0f580] [size=64 bytes] Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.11.0-rc1-00137-g07ca963 #51 Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [<c011aaa4>] (unwind_backtrace) from [<c01127c0>] (show_stack+0x20/0x24) [<c01127c0>] (show_stack) from [<c06ba5d8>] (dump_stack+0x84/0xa0) [<c06ba5d8>] (dump_stack) from [<c0139528>] (__warn+0x14c/0x180) [<c0139528>] (__warn) from [<c01395a4>] (warn_slowpath_fmt+0x48/0x50) [<c01395a4>] (warn_slowpath_fmt) from [<c0729058>] (check_sync+0x520/0x9f4) [<c0729058>] (check_sync) from [<c072967c>] (debug_dma_sync_single_for_device+0x88/0xc8) [<c072967c>] (debug_dma_sync_single_for_device) from [<c0803c10>] (s3c24xx_serial_start_tx_dma+0x100/0x2f8) [<c0803c10>] (s3c24xx_serial_start_tx_dma) from [<c0804338>] (s3c24xx_serial_tx_chars+0x198/0x33c) Reported-by: Seung-Woo Kim <sw0312.kim@samsung.com> Fixes: 62c37eedb74c8 ("serial: samsung: add dma reqest/release functions") CC: stable@vger.kernel.org # v4.0+ Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com> Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com> Reviewed-by: Krzysztof Kozlowski <krzk@kernel.org> Reviewed-by: Shuah Khan <shuahkh@osg.samsung.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: imx: setup DCEDTE early and ensure DCD and RI irqs to be offUwe Kleine-König2017-04-081-13/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the UART is operated in DTE mode and UCR3_DCD or UCR3_RI are 1 (which is the reset default) and the opposite side pulls the respective line to its active level the irq triggers after it is requested in .probe. These irqs were already disabled in .startup but this might be too late. Also setup of the UFCR_DCEDTE bit (currently done in .set_termios) is done very late which is critical as it also controls direction of some pins. So setup UFCR_DCEDTE earlier (in .probe) and also disable the broken irqs in DTE mode there before requesting irqs. Acked-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | tty: fix comment typo s/repsonsible/responsible/Thadeu Lima de Souza Cascardo2017-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@cascardo.eti.br> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | tty: amba-pl011: Fix spurious TX interruptsJayachandran C2017-04-081-9/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On SMP systems, we see a lot of spurious TX interrupts when a program generates a steady stream of output to the pl011 UART. The problem can be easily seen when one CPU generates the output while another CPU handles the pl011 interrupts, and the rate of output is low enough not to fill the TX FIFO. The problem seems to be: -- CPU a -- -- CPU b -- (take port lock) pl011_start_tx pl011_start_tx_pio enable TXIM in REG_IMSC -> causes uart tx intr (pl011_int) pl011_tx_chars pl011_int ...tx chars, all done... (wait for port lock) pl011_stop_tx . disable TXIM . (release port lock) -> (take port lock) check for TXIM, not enabled (release port lock) return IRQ_NONE Enabling the TXIM in pl011_start_tx_pio() causes the interrupt to be generated and delivered to CPU b, even though pl011_tx_chars() is able to complete the TX and then disable the tx interrupt. Fix this by enabling TXIM only after pl011_tx_chars, if it is needed. pl011_tx_chars will return a boolean indicating whether the TX interrupts have to be enabled. Debugged-by: Vijaya Kumar <Vijaya.Kumar@cavium.com> Signed-off-by: Jayachandran C <jnair@caviumnetworks.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: xuartps: Enable clocks in the pm disable case alsoShubhrajyoti Datta2017-04-081-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When Power management is disabled then the clocks are not getting enabled. This patch enables it for the !PM case also. While at it also pm_runtime_set_active is called before calling pm_runtime_enable. Reported-by: Michal Simek <michal.simek@xilinx.com> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: core: Re-use struct uart_port {name} fieldAndy Shevchenko2017-04-081-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since we have port name stored in struct uart_port, we better to use that one instead of open coding. This will make it one place source for easier maintenance or modifications. While here, replace printk(KERN_INFO ) by pr_info(). It seems last printk() call in serial_core.c. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serdev: Add serdev_device_write subroutineAndrey Smirnov2017-04-081-5/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add serdev_device_write() a blocking call allowing to transfer arbitraty amount of data (potentially exceeding amount that serdev_device_write_buf can process in a single call) To support that, also add serdev_device_write_wakeup(). Drivers wanting to use full extent of serdev_device_write functionality are expected to provide serdev_device_write_wakeup() as a sole handler of .write_wakeup event or call it as a part of driver's custom .write_wakeup code. Because serdev_device_write() subroutine is a superset of serdev_device_write_buf() the patch re-impelements latter is terms of the former. For drivers wanting to just use serdev_device_write_buf() .write_wakeup handler is optional. Cc: cphealy@gmail.com Cc: Guenter Roeck <linux@roeck-us.net> Cc: linux-serial@vger.kernel.org Cc: linux-kernel@vger.kernel.org Reviewed-by: Rob Herring <robh@kernel.org> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | serial: sprd: adjust TIMEOUT to a big valueWei Qiao2017-04-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | SPRD_TIMEOUT was 256, which is too small to wait until the status switched to workable in a while loop, so that the earlycon could not work correctly. Signed-off-by: Wei Qiao <wei.qiao@spreadtrum.com> Signed-off-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | Merge 4.11-rc5 into tty-nextGreg Kroah-Hartman2017-04-035-6/+36
| |\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | We want the serial fixes in here as well to handle merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: serial: fsl_lpuart: lock port on console writeStefan Agner2017-03-311-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The console write code is not entirely race free (e.g. the operations to disabling the UART interrupts are not atomic) hence locking is required. This has been become apparent with the PREEMPT RT patchset applied: With the fully preemptible kernel configuration the system often ended up in a freeze already at startup. Disable interrupts and lock using read_lock_irqsave. Try to lock in the sysrq/oops case, but don't bother if locking fails. Signed-off-by: Stefan Agner <stefan@agner.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: altera_uart: add earlycon supportTobias Klauser2017-03-312-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Nios2 currently uses its own early printk implementation, rather than using unified earlycon support to show boot messages on altera_uart. Add earlycon support to altera_uart so that other archs may use it. Also, this (together with the corresponding patch for altera_jtaguart) will allow the early printk implementation in arch/nios2 to be removed in a future patch. Cc: Ley Foon Tan <lftan@altera.com> Signed-off-by: Tobias Klauser <tklauser@distanz.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: Disable default console blanking intervalTim Gardner2017-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BugLink: http://bugs.launchpad.net/bugs/869017 Console blanking is not enabling DPMS power saving (thereby negating any power-saving benefit), and is simply turning the screen content blank. This means that any crash output is invisible which is unhelpful on a server (virtual or otherwise). Furthermore, CRT burn in concerns should no longer govern the default case. Affected users could always set consoleblank on the kernel command line. Signed-off-by: Tim Gardner <tim.gardner@canonical.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Jiri Slaby <jslaby@suse.com> Cc: Adam Borowski <kilobyte@angband.pl> Cc: Scot Doyle <lkml14@scotdoyle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: 8250: 8250_core: Fix irq name for 8250 serial IRQVignesh R2017-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Using dev_name() as IRQ name during request_irq() might be misleading in case of serial over PCI. Therefore identify serial port IRQ using uart_port's name field. This will help mapping IRQs to appropriate ttySN(where N is the serial port index) instances. Signed-off-by: Vignesh R <vigneshr@ti.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: serial_core: Add name field to uart_port structVignesh R2017-03-311-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a field to store name of uart_port that can be used to easily identify UART port instances on a system that has more than one UART instance. The name is of the form ttyXN(eg. ttyS0, ttyAMA0,..) where N is number that particular UART instance. This field will be useful when printing debug info for a particular port or in register IRQs with unique IRQ name. Port name is populated during uart_add_one_port(). Signed-off-by: Vignesh R <vigneshr@ti.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: 8250_lpss: Unconditionally set PCI master for QuarkJan Kiszka2017-03-311-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MSI needs it as well. Should have no practical impact, though, as DMA is always available on the Quark. But given the few users of pci_alloc_irq_vectors so far, this incorrect pattern may spread otherwise. Fixes: 3f3a46951e02 ("serial: 8250_lpss: set PCI master only for private DMA") Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: sh-sci: Fix (AUTO)RTS in sci_init_pins()Geert Uytterhoeven2017-03-311-6/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If a UART has dedicated RTS/CTS pins, and hardware control flow is disabled (or AUTORTS is not yet effective), changing any serial port configuration deasserts RTS, as .set_termios() calls sci_init_pins(). To fix this, consider the current (AUTO)RTS state when (re)initializing the pins. Note that for SCIFA/SCIFB, AUTORTS needs explicit configuration of the RTS# pin function, while (H)SCIF handles this automatically. Fixes: d2b9775d795ec05f ("serial: sh-sci: Correct pin initialization on (H)SCIF") Fixes: e9d7a45a03991349 ("serial: sh-sci: Add pin initialization for SCIFA/SCIFB") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: sh-sci: Fix late enablement of AUTORTSGeert Uytterhoeven2017-03-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When changing hardware control flow for a UART with dedicated RTS/CTS pins, the new AUTORTS state is not immediately reflected in the hardware, but only when RTS is raised. However, the serial core does not call .set_mctrl() after .set_termios(), hence AUTORTS may only become effective when the port is closed, and reopened later. Note that this problem does not happen when manually using stty to change CRTSCTS, as AUTORTS will work fine on next open. To fix this, call .set_mctrl() from .set_termios() when dedicated RTS/CTS pins are present, to refresh the AUTORTS or RTS state. This is similar to what other drivers supporting AUTORTS do (e.g. omap-serial). Reported-by: Baumann, Christoph (C.) <cbaumann@visteon.com> Fixes: 33f50ffc253854cf ("serial: sh-sci: Fix support for hardware-assisted RTS/CTS") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: sh-sci: Fix hang in sci_reset()Geert Uytterhoeven2017-03-311-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the .set_termios() callback resets the UART, it first waits (busy loops) until all characters in the transmit FIFO have been transmitted, to prevent a port configuration change from impacting these characters. However, if the UART has dedicated RTS/CTS hardware flow control enabled, these characters may have been stuck in the FIFO due to CTS not being asserted by the remote side. - When a new user opens the port, .set_termios() is called while transmission is still disabled, leading to an infinite loop: NMI watchdog: BUG: soft lockup - CPU#0 stuck for 22s! - When an active user changes port configuration without waiting for the draining of the transmit FIFO, this may also block indefinitely, until CTS is asserted by the remote side. This has been observed with SCIFA (on r8a7740/armadillo), and SCIFB and HSCIF (on r8a7791/koelsch). To fix this, remove the code that waits for the draining of the transmit FIFO. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: st-asc: Change default baudrate from 9600 to 115200Lee Jones2017-03-311-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9600 is old school. Most applications use 115200 as the default baud these days. Signed-off-by: Lee Jones <lee.jones@linaro.org> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: serial: st-asc: Make the locking RT awareLionel Debieve2017-03-311-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The lock is a sleeping lock and local_irq_save() is not the standard implementation now. Working for both -RT and non RT. Signed-off-by: Lionel Debieve <lionel.debieve@st.com> Acked-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Acked-by: Patrice Chotard <patrice.chotard@st.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty/hvc_console: fix console lock ordering with spinlockDenis Kirjanov2017-03-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | hvc_remove() takes a spin lock first then acquires the console semaphore. This situation can easily lead to a deadlock scenario where we call scheduler with spin lock held. Signed-off-by: Denis Kirjanov <kda@linux-powerpc.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: reset termios state on device registrationJohan Hovold2017-03-311-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Free any saved termios data when registering a tty device so that the termios state is reset when reusing a minor number. This is useful for hot-pluggable buses such as USB where it does not make much sense to reuse saved termios data from an unrelated device when a new device is later plugged in. This specifically avoids a situation where the new device does not have the carrier-detect signal wired, but the saved termios state has CLOCAL cleared, effectively preventing the port from being opened in blocking mode as noted by Jan Kundrát <jan.kundrat@cesnet.cz>. Note that clearing the saved data at deregistration would not work as the device could still be open. Also note that the termios data is not reset for drivers with TTY_DRIVER_DYNAMIC_ALLOC set (e.g. legacy pty) as their character device is registered at driver registration and could theoretically already have been opened (and pty termios state is never saved anyway). Reported-by: Jan Kundrát <jan.kundrat@cesnet.cz> Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: drop obsolete termios_locked commentsJohan Hovold2017-03-311-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Drop comments about tty-driver termios_locked structures, which have been outdated since commit fe6e29fdb1a7 ("tty: simplify ktermios allocation"). Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: close race between device register and openJohan Hovold2017-03-311-20/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The tty class device is currently not registered until after the character device has been registered thereby leaving a small window were a racing open could end up with a NULL tty->dev pointer due to the class-device lookup failing in alloc_tty_struct. Close this race by registering the class device before the character device while making sure to defer the user-space uevent notification until after the character device has been registered. Note that some tty drivers expect a valid tty->dev and would misbehave or crash otherwise. Some line disciplines also currently dereference the class device unconditionally despite the fact that not every tty is guaranteed to have one (Unix98 pty), but this is being fixed separately. Signed-off-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | Merge 4.11-rc4 into tty-nextGreg Kroah-Hartman2017-03-293-78/+34
| |\ \ \ \ | | | |_|/ | | |/| | | | | | | | | | | | | | | | | | | | | | We want the tty/serial fixes in here to handle bugfixes and merge issues. Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | Revert "tty: Fix ldisc crash on reopened tty"Greg Kroah-Hartman2017-03-291-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 71472fa9c52b1da27663c275d416d8654b905f05. It caused merge issues, and Dmitry found some review issues. Reported-by: Dmitry Vyukov <dvyukov@google.com> Reported-by: Stephen Rothwell <sfr@canb.auug.org.au> Cc: Mikulas Patocka <mpatocka@redhat.com> Cc: Peter Hurley <peter@hurleysoftware.com> Cc: Michael Neuling <mikey@neuling.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: 8250_dw: simplify optional reset handlingPhilipp Zabel2017-03-171-8/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As of commit bb475230b8e5 ("reset: make optional functions really optional"), the reset framework API calls use NULL pointers to describe optional, non-present reset controls. This allows to return errors from devm_reset_control_get_optional and to call reset_control_(de)assert unconditionally. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: serial_core, remove state checks in uart_poll*Jiri Slaby2017-03-171-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coverity complains about uart_state checks in polling functions. And it is indeed correct. We do something like this: struct uart_state *state = drv->state + line; if (!state) return; Adding 'line' to drv->state would move the potential NULL pointer to something near NULL and the check is useless. Even if we checked pure drv->state, nothing guarantees it is not freed and NULLed after the check. So if the only user of this interface (kgdboc) needs to assure something, this is neither the correct thing, nor place to do so. Signed-off-by: Jiri Slaby <jslaby@suse.cz> Cc: linux-serial@vger.kernel.org Cc: Jason Wessel <jason.wessel@windriver.com> Cc: kgdb-bugreport@lists.sourceforge.net Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | serial: 8250_fintek: Enable high speed mode on Fintek F81866Lukas Redlinger2017-03-171-5/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fintek F81866 supports baud rates higher than 115200 but needs to raise it's clock speed from 1.84 to 14.76 MHz. This is eight times faster, so gives 921600 as resulting baud_base. F81866 clock register 0xf2: Bit 7-2 reserved Bit 1-0 00: 1.8432MHz 01: 18.432MHz 10: 24MHz 11: 14.769MHz Signed-off-by: Lukas Redlinger <rel+kernel@agilox.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: Fix ldisc crash on reopened ttyPeter Hurley2017-03-171-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the tty has been hungup, the ldisc instance may have been destroyed. Continued input to the tty will be ignored as long as the ldisc instance is not visible to the flush_to_ldisc kworker. However, when the tty is reopened and a new ldisc instance is created, the flush_to_ldisc kworker can obtain an ldisc reference before the new ldisc is completely initialized. This will likely crash: BUG: unable to handle kernel paging request at 0000000000002260 IP: [<ffffffff8152dc5d>] n_tty_receive_buf_common+0x6d/0xb80 PGD 2ab581067 PUD 290c11067 PMD 0 Oops: 0000 [#1] PREEMPT SMP Modules linked in: nls_iso8859_1 ip6table_filter [.....] CPU: 2 PID: 103 Comm: kworker/u16:1 Not tainted 4.6.0-rc7+wip-xeon+debug #rc7+wip Hardware name: Dell Inc. Precision WorkStation T5400 /0RW203, BIOS A11 04/30/2012 Workqueue: events_unbound flush_to_ldisc task: ffff8802ad16d100 ti: ffff8802ad31c000 task.ti: ffff8802ad31c000 RIP: 0010:[<ffffffff8152dc5d>] [<ffffffff8152dc5d>] n_tty_receive_buf_common+0x6d/0xb80 RSP: 0018:ffff8802ad31fc70 EFLAGS: 00010296 RAX: 0000000000000000 RBX: ffff8802aaddd800 RCX: 0000000000000001 RDX: 00000000ffffffff RSI: ffffffff810db48f RDI: 0000000000000246 RBP: ffff8802ad31fd08 R08: 0000000000000000 R09: 0000000000000001 R10: ffff8802aadddb28 R11: 0000000000000001 R12: ffff8800ba6da808 R13: ffff8802ad18be80 R14: ffff8800ba6da858 R15: ffff8800ba6da800 FS: 0000000000000000(0000) GS:ffff8802b0a00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000002260 CR3: 000000028ee5d000 CR4: 00000000000006e0 Stack: ffffffff81531219 ffff8802aadddab8 ffff8802aadddde0 ffff8802aadddd78 ffffffff00000001 ffff8800ba6da858 ffff8800ba6da860 ffff8802ad31fd30 ffffffff81885f78 ffffffff81531219 0000000000000000 0000000200000000 Call Trace: [<ffffffff81531219>] ? flush_to_ldisc+0x49/0xd0 [<ffffffff81885f78>] ? mutex_lock_nested+0x2c8/0x430 [<ffffffff81531219>] ? flush_to_ldisc+0x49/0xd0 [<ffffffff8152e784>] n_tty_receive_buf2+0x14/0x20 [<ffffffff81530cb2>] tty_ldisc_receive_buf+0x22/0x50 [<ffffffff8153128e>] flush_to_ldisc+0xbe/0xd0 [<ffffffff810a0ebd>] process_one_work+0x1ed/0x6e0 [<ffffffff810a0e3f>] ? process_one_work+0x16f/0x6e0 [<ffffffff810a13fe>] worker_thread+0x4e/0x490 [<ffffffff810a13b0>] ? process_one_work+0x6e0/0x6e0 [<ffffffff810a7ef2>] kthread+0xf2/0x110 [<ffffffff810ae68c>] ? preempt_count_sub+0x4c/0x80 [<ffffffff8188ab52>] ret_from_fork+0x22/0x50 [<ffffffff810a7e00>] ? kthread_create_on_node+0x220/0x220 Code: ff ff e8 27 a0 35 00 48 8d 83 78 05 00 00 c7 45 c0 00 00 00 00 48 89 45 80 48 8d 83 e0 05 00 00 48 89 85 78 ff ff ff 48 8b 45 b8 <48> 8b b8 60 22 00 00 48 8b 30 89 f8 8b 8b 88 04 00 00 29 f0 8d RIP [<ffffffff8152dc5d>] n_tty_receive_buf_common+0x6d/0xb80 RSP <ffff8802ad31fc70> CR2: 0000000000002260 Ensure the kworker cannot obtain the ldisc reference until the new ldisc is completely initialized. Fixes: 892d1fa7eaae ("tty: Destroy ldisc instance on hangup") Reported-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Peter Hurley <peter@hurleysoftware.com> Signed-off-by: Michael Neuling <mikey@neuling.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | tty: pty: Fix ldisc flush after userspace become aware of the data alreadyWang YanQing2017-03-171-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While using emacs, cat or others' commands in konsole with recent kernels, I have met many times that CTRL-C freeze konsole. After konsole freeze I can't type anything, then I have to open a new one, it is very annoying. See bug report: https://bugs.kde.org/show_bug.cgi?id=175283 The platform in that bug report is Solaris, but now the pty in linux has the same problem or the same behavior as Solaris :) It has high possibility to trigger the problem follow steps below: Note: In my test, BigFile is a text file whose size is bigger than 1G 1:open konsole 1:cat BigFile 2:CTRL-C After some digging, I find out the reason is that commit 1d1d14da12e7 ("pty: Fix buffer flush deadlock") changes the behavior of pty_flush_buffer. Thread A Thread B -------- -------- 1:n_tty_poll return POLLIN 2:CTRL-C trigger pty_flush_buffer tty_buffer_flush n_tty_flush_buffer 3:attempt to check count of chars: ioctl(fd, TIOCINQ, &available) available is equal to 0 4:read(fd, buffer, avaiable) return 0 5:konsole close fd Yes, I know we could use the same patch included in the BUG report as a workaround for linux platform too. But I think the data in ldisc is belong to application of another side, we shouldn't clear it when we want to flush write buffer of this side in pty_flush_buffer. So I think it is better to disable ldisc flush in pty_flush_buffer, because its new hehavior bring no benefit except that it mess up the behavior between POLLIN, and TIOCINQ or FIONREAD. Also I find no flush_buffer function in others' tty driver has the same behavior as current pty_flush_buffer. Fixes: 1d1d14da12e7 ("pty: Fix buffer flush deadlock") CC: stable@vger.kernel.org # v4.0+ Signed-off-by: Wang YanQing <udknight@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| * | | | uartlite: Adding a kernel parameter for the number of uartlitesSam Povilus2017-03-172-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The number of uartlites should be set by a kernel parameter instead of using a #define. This allows the user to set the number of uartlites using only kconfig and not modifying kernel source. The uartlite is used by FPGAs that support a basically unlimited number of uarts so limiting it at 16 dosn't make sense as users might need more than that. Signed-off-by: Sam Povilus <kernel.development@povil.us> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
OpenPOWER on IntegriCloud