* [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter
@ 2011-05-19 19:03 Michael Reed
2011-05-19 23:49 ` Greg KH
2011-05-25 17:07 ` [PATCH] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter mreed
0 siblings, 2 replies; 5+ messages in thread
From: Michael Reed @ 2011-05-19 19:03 UTC (permalink / raw)
To: linux-serial; +Cc: Michael Reed, Greg Kroah-Hartman, Breno Leitao, Scott Kilau
When working on the 8250_pci driver on PPC, the rmmod command was resulting in a crash when removing the module. The serial8250_do_pm() is called after the memory are deallocated, meaning that serial8250_set_sleep->serial_outp() will try to write to a
position that is invalid, crashing the system. The purpose of this patch is to correct that issue.
This patch was created against 2.6.38.6
Patch-created-by: Breno Leitao <leitao@linux.vnet.ibm.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Breno Leitao <leitao@linux.vnet.ibm.com>
Cc: Scott Kilau <scottk@digi.com>
Signed-off-by: Michael Reed <mreed@linux.vnet.ibm.com>
---
drivers/tty/serial/8250.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index b3b881b..7617cde 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -145,6 +145,8 @@ struct uart_8250_port {
unsigned char mcr_mask; /* mask of user bits */
unsigned char mcr_force; /* mask of forced bits */
unsigned char cur_iotype; /* Running I/O type */
+#define SERIAL8250_DYING 1
+ unsigned char status;
/*
* Some bits in registers are cleared on a read, so they must
@@ -2494,7 +2496,8 @@ void serial8250_do_pm(struct uart_port *port, unsigned int state,
struct uart_8250_port *p =
container_of(port, struct uart_8250_port, port);
- serial8250_set_sleep(p, state != 0);
+ if (!(p->status & SERIAL8250_DYING))
+ serial8250_set_sleep(p, state != 0);
}
EXPORT_SYMBOL(serial8250_do_pm);
@@ -2588,6 +2591,7 @@ static void serial8250_release_std_resource(struct uart_8250_port *up)
release_region(up->port.iobase, size);
break;
}
+ up->status |= SERIAL8250_DYING;
}
static int serial8250_request_rsa_resource(struct uart_8250_port *up)
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter
2011-05-19 19:03 [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter Michael Reed
@ 2011-05-19 23:49 ` Greg KH
2011-05-25 14:48 ` [PATCH] 8250: Fix capabilities when changing the port type leitao
2011-05-25 17:07 ` [PATCH] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter mreed
1 sibling, 1 reply; 5+ messages in thread
From: Greg KH @ 2011-05-19 23:49 UTC (permalink / raw)
To: Michael Reed; +Cc: linux-serial, Greg Kroah-Hartman, Breno Leitao, Scott Kilau
On Thu, May 19, 2011 at 02:03:43PM -0500, Michael Reed wrote:
> When working on the 8250_pci driver on PPC, the rmmod command was resulting in a crash when removing the module. The serial8250_do_pm() is called after the memory are deallocated, meaning that serial8250_set_sleep->serial_outp() will try to write to a
> position that is invalid, crashing the system. The purpose of this patch is to correct that issue.
> This patch was created against 2.6.38.6
>
> Patch-created-by: Breno Leitao <leitao@linux.vnet.ibm.com>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Breno Leitao <leitao@linux.vnet.ibm.com>
> Cc: Scott Kilau <scottk@digi.com>
> Signed-off-by: Michael Reed <mreed@linux.vnet.ibm.com>
> ---
> drivers/tty/serial/8250.c | 6 +++++-
> 1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
> index b3b881b..7617cde 100644
> --- a/drivers/tty/serial/8250.c
> +++ b/drivers/tty/serial/8250.c
> @@ -145,6 +145,8 @@ struct uart_8250_port {
> unsigned char mcr_mask; /* mask of user bits */
> unsigned char mcr_force; /* mask of forced bits */
> unsigned char cur_iotype; /* Running I/O type */
> +#define SERIAL8250_DYING 1
> + unsigned char status;
Ick, is this really necessary?
A bitfield would be best, only if that is the absolute last way to do
this (and I really think it isn't...)
thanks,
greg k-h
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] 8250: Fix capabilities when changing the port type
2011-05-19 23:49 ` Greg KH
@ 2011-05-25 14:48 ` leitao
2011-05-26 14:18 ` leitao
0 siblings, 1 reply; 5+ messages in thread
From: leitao @ 2011-05-25 14:48 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, scottk, Breno Leitao, Michael Reed
When changing the port type, the capabilities flags should be changed
also, otherwise the capabilities will not correspond to the port type,
which make set_sleep() crash on rmmod.
This patch just assign the correct capabilites when the port changes.
Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
CC: Michael Reed <mreed@linux.vnet.ibm.com>
---
drivers/tty/serial/8250.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index 6611535..060ce5c 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -3281,7 +3281,7 @@ void serial8250_unregister_port(int line)
if (serial8250_isa_devs) {
uart->port.flags &= ~UPF_BOOT_AUTOCONF;
uart->port.type = PORT_UNKNOWN;
- uart->port.dev = &serial8250_isa_devs->dev;
+ uart->capabilities = uart_config[uart->port.type].flags;
uart_add_one_port(&serial8250_reg, &uart->port);
} else {
uart->port.dev = NULL;
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter
2011-05-19 19:03 [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter Michael Reed
2011-05-19 23:49 ` Greg KH
@ 2011-05-25 17:07 ` mreed
1 sibling, 0 replies; 5+ messages in thread
From: mreed @ 2011-05-25 17:07 UTC (permalink / raw)
To: linux-serial; +Cc: Michael Reed, Greg Kroah-Hartman, Breno Leitao, Scott Kilau
From: Michael Reed <mreed@linux.vnet.ibm.com>
The purpose of the patch is to add EEH support to the 8250_PCI driver
for the IBM/Digi PCIE 2port Async EIA-232 Adapter that uses a PLX
chipset on the PPC platforrm. Basic support for this adapter was
recently added https://lkml.org/lkml/2011/5/11/341
This patch was created against the linux-next kernel
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Breno Leitao <leitao@linux.vnet.ibm.com>
Cc: Scott Kilau <scottk@digi.com>
Signed-off-by: Michael Reed <mreed@linux.vnet.ibm.com>
---
drivers/tty/serial/8250_pci.c | 47 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 47 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/serial/8250_pci.c b/drivers/tty/serial/8250_pci.c
index 4b4968a..5b328e4 100644
--- a/drivers/tty/serial/8250_pci.c
+++ b/drivers/tty/serial/8250_pci.c
@@ -2595,6 +2595,7 @@ pciserial_init_one(struct pci_dev *dev, const struct pci_device_id *ent)
board = &pci_boards[ent->driver_data];
rc = pci_enable_device(dev);
+ pci_save_state(dev);
if (rc)
return rc;
@@ -3868,6 +3869,51 @@ static struct pci_device_id serial_pci_tbl[] = {
{ 0, }
};
+static pci_ers_result_t serial8250_io_error_detected(struct pci_dev *dev,
+ pci_channel_state_t state)
+{
+ struct serial_private *priv = pci_get_drvdata(dev);
+
+ if (state == pci_channel_io_perm_failure)
+ return PCI_ERS_RESULT_DISCONNECT;
+
+ if (priv)
+ pciserial_suspend_ports(priv);
+
+ pci_disable_device(dev);
+
+ return PCI_ERS_RESULT_NEED_RESET;
+}
+
+static pci_ers_result_t serial8250_io_slot_reset(struct pci_dev *dev)
+{
+ int rc;
+
+ rc = pci_enable_device(dev);
+
+ if (rc)
+ return PCI_ERS_RESULT_DISCONNECT;
+
+ pci_restore_state(dev);
+ pci_save_state(dev);
+
+ return PCI_ERS_RESULT_RECOVERED;
+}
+
+static void serial8250_io_resume(struct pci_dev *dev)
+{
+ struct serial_private *priv = pci_get_drvdata(dev);
+
+ if (priv)
+ pciserial_resume_ports(priv);
+}
+
+static struct pci_error_handlers serial8250_err_handler = {
+ .error_detected = serial8250_io_error_detected,
+ .slot_reset = serial8250_io_slot_reset,
+ .resume = serial8250_io_resume,
+};
+
static struct pci_driver serial_pci_driver = {
.name = "serial",
.probe = pciserial_init_one,
@@ -3877,6 +3923,7 @@ static struct pci_driver serial_pci_driver = {
.resume = pciserial_resume_one,
#endif
.id_table = serial_pci_tbl,
+ .err_handler = &serial8250_err_handler,
};
static int __init serial8250_pci_init(void)
--
1.7.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] 8250: Fix capabilities when changing the port type
2011-05-25 14:48 ` [PATCH] 8250: Fix capabilities when changing the port type leitao
@ 2011-05-26 14:18 ` leitao
0 siblings, 0 replies; 5+ messages in thread
From: leitao @ 2011-05-26 14:18 UTC (permalink / raw)
To: gregkh; +Cc: linux-serial, scottk, Breno Leitao, Michael Reed
When changing the port type, the capabilities flags should be changed
also, otherwise the capabilities will not correspond to the port type,
which make set_sleep() crash on rmmod.
This patch just assign the correct capabilites when the port changes.
Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
CC: Michael Reed <mreed@linux.vnet.ibm.com>
---
drivers/tty/serial/8250.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/tty/serial/8250.c b/drivers/tty/serial/8250.c
index b40f7b9..b4129f5 100644
--- a/drivers/tty/serial/8250.c
+++ b/drivers/tty/serial/8250.c
@@ -3318,6 +3318,7 @@ void serial8250_unregister_port(int line)
uart->port.flags &= ~UPF_BOOT_AUTOCONF;
uart->port.type = PORT_UNKNOWN;
uart->port.dev = &serial8250_isa_devs->dev;
+ uart->capabilities = uart_config[uart->port.type].flags;
uart_add_one_port(&serial8250_reg, &uart->port);
} else {
uart->port.dev = NULL;
--
1.7.4.4
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-05-26 14:46 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-19 19:03 [PATCH 2/2] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter Michael Reed
2011-05-19 23:49 ` Greg KH
2011-05-25 14:48 ` [PATCH] 8250: Fix capabilities when changing the port type leitao
2011-05-26 14:18 ` leitao
2011-05-25 17:07 ` [PATCH] 8250_pci Add EEH support to the 8250 driver for IBM/Digi PCIe 2-port Adapter mreed
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.