linux-serial.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/2] KT serial controller IIR workaround
@ 2011-11-22 21:41 Dan Williams
  2011-11-22 21:41 ` [PATCH v3 1/2] serial/8250_pci: setup-quirk workaround for the kt serial controller Dan Williams
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Dan Williams @ 2011-11-22 21:41 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, linux-serial, alan

Changes since v2 [1]:
* reflowed on tty-next (commit: 161e773c "UART: add CSR SiRFprimaII..."
* add a quirk to turn on msi to try to prevent shared interrupts

[1]: https://lkml.org/lkml/2011/11/15/264

---

Dan Williams (2):
      serial/8250_pci: setup-quirk workaround for the kt serial controller
      serial/8250_pci: init-quirk msi support for kt serial controller


 drivers/tty/serial/8250.c     |    4 +++-
 drivers/tty/serial/8250_pci.c |   31 ++++++++++++++++++++++++++++++-
 include/linux/serial_core.h   |    1 +
 3 files changed, 34 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v3 1/2] serial/8250_pci: setup-quirk workaround for the kt serial controller
  2011-11-22 21:41 [PATCH v3 0/2] KT serial controller IIR workaround Dan Williams
@ 2011-11-22 21:41 ` Dan Williams
  2011-11-22 21:41 ` [PATCH v3 2/2] serial/8250_pci: init-quirk msi support for " Dan Williams
  2011-11-22 23:08 ` [PATCH v3 0/2] KT serial controller IIR workaround Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2011-11-22 21:41 UTC (permalink / raw)
  To: gregkh; +Cc: Nhan H Mai, linux-kernel, linux-serial, alan

Workaround dropped notifications in the iir register.  Prevent reads
coincident with new interrupt notifications by reading the iir at most
once per interrupt.

Reported-by: Nhan H Mai <nhan.h.mai@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/tty/serial/8250.c     |    4 +++-
 drivers/tty/serial/8250_pci.c |   17 ++++++++++++++++-
 include/linux/serial_core.h   |    1 +
 3 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index eeadf1b..3a8e5bf 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -1619,11 +1619,13 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id)
 	do {
 		struct uart_8250_port *up;
 		struct uart_port *port;
+		bool skip;
 
 		up = list_entry(l, struct uart_8250_port, list);
 		port = &up->port;
+		skip = pass_counter && up->port.flags & UPF_IIR_ONCE;
 
-		if (port->handle_irq(port)) {
+		if (!skip && port->handle_irq(port)) {
 			handled = 1;
 			end = NULL;
 		} else if (end == NULL)
diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index 825937a..8742ef5 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -1092,6 +1092,14 @@ static int skip_tx_en_setup(struct serial_private *priv,
 	return pci_default_setup(priv, board, port, idx);
 }
 
+static int kt_serial_setup(struct serial_private *priv,
+			   const struct pciserial_board *board,
+			   struct uart_port *port, int idx)
+{
+	port->flags |= UPF_IIR_ONCE;
+	return skip_tx_en_setup(priv, board, port, idx);
+}
+
 static int pci_eg20t_init(struct pci_dev *dev)
 {
 #if defined(CONFIG_SERIAL_PCH_UART) || defined(CONFIG_SERIAL_PCH_UART_MODULE)
@@ -1110,7 +1118,6 @@ pci_xr17c154_setup(struct serial_private *priv,
 	return pci_default_setup(priv, board, port, idx);
 }
 
-/* This should be in linux/pci_ids.h */
 #define PCI_VENDOR_ID_SBSMODULARIO	0x124B
 #define PCI_SUBVENDOR_ID_SBSMODULARIO	0x124B
 #define PCI_DEVICE_ID_OCTPRO		0x0001
@@ -1136,6 +1143,7 @@ pci_xr17c154_setup(struct serial_private *priv,
 #define PCI_DEVICE_ID_OXSEMI_16PCI958	0x9538
 #define PCIE_DEVICE_ID_NEO_2_OX_IBM	0x00F6
 #define PCI_DEVICE_ID_PLX_CRONYX_OMEGA	0xc001
+#define PCI_DEVICE_ID_INTEL_PATSBURG_KT 0x1d3d
 
 /* Unknown vendors/cards - this should not be in linux/pci_ids.h */
 #define PCI_SUBDEVICE_ID_UNKNOWN_0x1584	0x1584
@@ -1220,6 +1228,13 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.subdevice	= PCI_ANY_ID,
 		.setup		= ce4100_serial_setup,
 	},
+	{
+		.vendor		= PCI_VENDOR_ID_INTEL,
+		.device		= PCI_DEVICE_ID_INTEL_PATSBURG_KT,
+		.subvendor	= PCI_ANY_ID,
+		.subdevice	= PCI_ANY_ID,
+		.setup		= kt_serial_setup,
+	},
 	/*
 	 * ITE
 	 */
diff --git a/include/linux/serial_core.h b/include/linux/serial_core.h
index 945e02c..b67305e 100644
--- a/include/linux/serial_core.h
+++ b/include/linux/serial_core.h
@@ -351,6 +351,7 @@ struct uart_port {
 #define UPF_CONS_FLOW		((__force upf_t) (1 << 23))
 #define UPF_SHARE_IRQ		((__force upf_t) (1 << 24))
 #define UPF_EXAR_EFR		((__force upf_t) (1 << 25))
+#define UPF_IIR_ONCE		((__force upf_t) (1 << 26))
 /* The exact UART type is known and should not be probed.  */
 #define UPF_FIXED_TYPE		((__force upf_t) (1 << 27))
 #define UPF_BOOT_AUTOCONF	((__force upf_t) (1 << 28))

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH v3 2/2] serial/8250_pci: init-quirk msi support for kt serial controller
  2011-11-22 21:41 [PATCH v3 0/2] KT serial controller IIR workaround Dan Williams
  2011-11-22 21:41 ` [PATCH v3 1/2] serial/8250_pci: setup-quirk workaround for the kt serial controller Dan Williams
@ 2011-11-22 21:41 ` Dan Williams
  2011-11-22 23:08 ` [PATCH v3 0/2] KT serial controller IIR workaround Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Dan Williams @ 2011-11-22 21:41 UTC (permalink / raw)
  To: gregkh; +Cc: linux-kernel, linux-serial, alan

The semantics of UPF_IIR_ONCE (once per serial irq) are only guaranteed
if the kt irq is not shared (once per serial isr in the shared case ==
potentially unwanted reads of the IIR).

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
---
 drivers/tty/serial/8250_pci.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index 8742ef5..2cbf78f 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -1118,6 +1118,18 @@ pci_xr17c154_setup(struct serial_private *priv,
 	return pci_default_setup(priv, board, port, idx);
 }
 
+static int try_enable_msi(struct pci_dev *dev)
+{
+	/* use msi if available, but fallback to legacy otherwise */
+	pci_enable_msi(dev);
+	return 0;
+}
+
+static void disable_msi(struct pci_dev *dev)
+{
+	pci_disable_msi(dev);
+}
+
 #define PCI_VENDOR_ID_SBSMODULARIO	0x124B
 #define PCI_SUBVENDOR_ID_SBSMODULARIO	0x124B
 #define PCI_DEVICE_ID_OCTPRO		0x0001
@@ -1233,7 +1245,9 @@ static struct pci_serial_quirk pci_serial_quirks[] __refdata = {
 		.device		= PCI_DEVICE_ID_INTEL_PATSBURG_KT,
 		.subvendor	= PCI_ANY_ID,
 		.subdevice	= PCI_ANY_ID,
+		.init		= try_enable_msi,
 		.setup		= kt_serial_setup,
+		.exit		= disable_msi,
 	},
 	/*
 	 * ITE


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v3 0/2] KT serial controller IIR workaround
  2011-11-22 21:41 [PATCH v3 0/2] KT serial controller IIR workaround Dan Williams
  2011-11-22 21:41 ` [PATCH v3 1/2] serial/8250_pci: setup-quirk workaround for the kt serial controller Dan Williams
  2011-11-22 21:41 ` [PATCH v3 2/2] serial/8250_pci: init-quirk msi support for " Dan Williams
@ 2011-11-22 23:08 ` Alan Cox
  2 siblings, 0 replies; 4+ messages in thread
From: Alan Cox @ 2011-11-22 23:08 UTC (permalink / raw)
  To: Dan Williams; +Cc: gregkh, linux-kernel, linux-serial

On Tue, 22 Nov 2011 13:41:19 -0800
Dan Williams <dan.j.williams@intel.com> wrote:

> Changes since v2 [1]:
> * reflowed on tty-next (commit: 161e773c "UART: add CSR
> SiRFprimaII..."
> * add a quirk to turn on msi to try to prevent shared interrupts
> 
> [1]: https://lkml.org/lkml/2011/11/15/264
> 
> ---
> 
> Dan Williams (2):
>       serial/8250_pci: setup-quirk workaround for the kt serial
> controller serial/8250_pci: init-quirk msi support for kt serial
> controller

Series

Acked-by: Alan Cox <alan@linux.intel.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-22 22:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-22 21:41 [PATCH v3 0/2] KT serial controller IIR workaround Dan Williams
2011-11-22 21:41 ` [PATCH v3 1/2] serial/8250_pci: setup-quirk workaround for the kt serial controller Dan Williams
2011-11-22 21:41 ` [PATCH v3 2/2] serial/8250_pci: init-quirk msi support for " Dan Williams
2011-11-22 23:08 ` [PATCH v3 0/2] KT serial controller IIR workaround Alan Cox

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).