Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1449676

[PATCH] 8250: option 'force_polling' for buggy IRQs

From Max Staudt <mstaudt@suse.de>
Newsgroups linux.kernel
Subject [PATCH] 8250: option 'force_polling' for buggy IRQs
Date 2016-07-25 19:40 +0200
Message-ID <rYS1c-7ph-15@gated-at.bofh.it> (permalink)
Organization linux.* mail to news gateway

Show all headers | View raw


Some serial ports may not emit IRQs properly, or there may be a defect
in their routing on the motherboard.

This patch allows these ports to be used anyway (or until a better
workaround is known for a specific platform), though with no guarantees.

If you have such a buggy UART, boot Linux with 8250.force_polling=1 .

It is essentially the kernel level version of:

  setserial /dev/ttySn irq 0

and builds upon the polling code that is already in the kernel.
---
 drivers/tty/serial/8250/8250_core.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index 13ad5c3..c6a7fd1 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -58,6 +58,11 @@ static struct uart_driver serial8250_reg;
 
 static unsigned int skip_txen_test; /* force skip of txen test at init time */
 
+/* Force polled mode for all newly detected ports.
+ * This can be used if IRQs don't arrive and similar buggyness.
+ */
+static unsigned int force_polling;
+
 #define PASS_LIMIT	512
 
 #include <asm/serial.h>
@@ -335,6 +340,13 @@ static int univ8250_setup_irq(struct uart_8250_port *up)
 			  uart_poll_timeout(port) + HZ / 5);
 	}
 
+	if (force_polling) {
+		pr_debug("ttyS%d - using polled mode instead of interrupt %u\n",
+			 serial_index(port),
+			 port->irq);
+		port->irq = 0;
+	}
+
 	/*
 	 * If the "interrupt" for this port doesn't correspond with any
 	 * hardware interrupt, we use a timer-based system.  The original
@@ -1206,6 +1218,9 @@ MODULE_PARM_DESC(nr_uarts, "Maximum number of UARTs supported. (1-" __MODULE_STR
 module_param(skip_txen_test, uint, 0644);
 MODULE_PARM_DESC(skip_txen_test, "Skip checking for the TXEN bug at init time");
 
+module_param(force_polling, uint, 0644);
+MODULE_PARM_DESC(force_polling, "Set ports to polling mode at init time");
+
 #ifdef CONFIG_SERIAL_8250_RSA
 module_param_array(probe_rsa, ulong, &probe_rsa_count, 0444);
 MODULE_PARM_DESC(probe_rsa, "Probe I/O ports for RSA");
@@ -1232,6 +1247,7 @@ static void __used s8250_options(void)
 	module_param_cb(share_irqs, &param_ops_uint, &share_irqs, 0644);
 	module_param_cb(nr_uarts, &param_ops_uint, &nr_uarts, 0644);
 	module_param_cb(skip_txen_test, &param_ops_uint, &skip_txen_test, 0644);
+	module_param_cb(force_polling, uint, 0644);
 #ifdef CONFIG_SERIAL_8250_RSA
 	__module_param_call(MODULE_PARAM_PREFIX, probe_rsa,
 		&param_array_ops, .arr = &__param_arr_probe_rsa,
-- 
2.6.6

Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread


Thread

[PATCH] 8250: option 'force_polling' for buggy IRQs Max Staudt <mstaudt@suse.de> - 2016-07-25 19:40 +0200
  Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Greg KH <gregkh@linuxfoundation.org> - 2016-07-25 19:50 +0200
    Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Max Staudt <mstaudt@suse.de> - 2016-07-26 13:50 +0200
      Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Greg KH <gregkh@linuxfoundation.org> - 2016-07-26 17:10 +0200
        Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Max Staudt <mstaudt@suse.de> - 2016-07-26 18:20 +0200
          Re: [PATCH] 8250: option 'force_polling' for buggy IRQs One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-07-27 14:10 +0200
            Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Max Staudt <mstaudt@suse.de> - 2016-07-27 14:20 +0200
              Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Theodore Ts'o <tytso@mit.edu> - 2016-07-27 15:40 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-07-27 22:10 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Max Staudt <mstaudt@suse.de> - 2016-07-28 12:00 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Greg KH <gregkh@linuxfoundation.org> - 2016-07-28 16:50 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Theodore Ts'o <tytso@mit.edu> - 2016-07-28 18:10 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs ebiederm@xmission.com (Eric W. Biederman) - 2016-07-28 21:00 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-07-29 11:30 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs Max Staudt <mstaudt@suse.de> - 2016-07-29 12:00 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs ebiederm@xmission.com (Eric W. Biederman) - 2016-07-29 20:00 +0200
                Re: [PATCH] 8250: option 'force_polling' for buggy IRQs One Thousand Gnomes <gnomes@lxorguk.ukuu.org.uk> - 2016-08-01 17:30 +0200
  Re: [PATCH] 8250: option 'force_polling' for buggy IRQs kbuild test robot <lkp@intel.com> - 2016-07-25 20:30 +0200
    [PATCHv2] 8250: option 'force_polling' for buggy IRQs Max Staudt <mstaudt@suse.de> - 2016-07-26 13:50 +0200
    [PATCHv3] 8250: option 'force_polling' for buggy IRQs Max Staudt <mstaudt@suse.de> - 2016-07-26 14:00 +0200

csiph-web