All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/13]: PCI Err: pci.h header file changes
@ 2005-06-28 23:58 Linas Vepstas
  2005-06-29  0:29 ` Greg KH
  2005-06-29  1:43 ` Benjamin Herrenschmidt
  0 siblings, 2 replies; 4+ messages in thread
From: Linas Vepstas @ 2005-06-28 23:58 UTC (permalink / raw)
  To: linux-kernel, Benjamin Herrenschmidt, long
  Cc: Hidetoshi Seto, Greg KH, ak, Paul Mackerras, linuxppc64-dev,
	linux-pci, johnrose

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]



pci-err-1-pci.h.patch

This patch adds PCI error recovery callbacks, error state and 
error return codes to include/linux/pci.h.  These are closely 
described in the next patch, a documentation file.

Signed-off-by: Linas Vepstas <linas@linas.org>

[-- Attachment #2: pci-err-1-pci.h.patch --]
[-- Type: text/plain, Size: 2196 bytes --]

--- linux-2.6.12-git10/include/linux/pci.h.linas-orig	2005-06-17 14:48:29.000000000 -0500
+++ linux-2.6.12-git10/include/linux/pci.h	2005-06-24 14:44:59.000000000 -0500
@@ -660,6 +660,37 @@ struct pci_dynids {
 	unsigned int use_driver_data:1; /* pci_driver->driver_data is used */
 };
 
+/* ---------------------------------------------------------------- */
+/** PCI error recovery infrastructure.  If a PCI device driver provides
+ *  a set fof callbacks in struct pci_error_handlers, then that device driver
+ *  will be notified of PCI bus errors, and can be driven to recovery.
+ */
+
+enum pci_channel_state {
+	pci_channel_io_normal = 0, /* I/O channel is in normal state */
+	pci_channel_io_frozen = 1, /* I/O to channel is blocked */
+	pci_channel_io_perm_failure, /* pci card is dead */
+};
+
+enum pcierr_result {
+	PCIERR_RESULT_NONE=0,        /* no result/none/not supported in device driver */
+	PCIERR_RESULT_CAN_RECOVER=1, /* Device driver can recover without slot reset */
+	PCIERR_RESULT_NEED_RESET,    /* Device driver wants slot to be reset. */
+	PCIERR_RESULT_DISCONNECT,    /* Device has completely failed, is unrecoverable */
+	PCIERR_RESULT_RECOVERED,     /* Device driver is fully recovered and operational */
+};
+
+/* PCI bus error event callbacks */
+struct pci_error_handlers
+{
+	enum pci_channel_state error_state;       /* current error state */
+	int (*error_detected)(struct pci_dev *dev, enum pci_channel_state error);
+	int (*mmio_enabled)(struct pci_dev *dev); /* MMIO has been reanbled, but not DMA */
+	int (*link_reset)(struct pci_dev *dev);   /* PCI Express link has been reset */
+	int (*slot_reset)(struct pci_dev *dev);   /* PCI slot has been reset */
+	void (*resume)(struct pci_dev *dev);      /* Device driver may resume normal operations */
+};
+
 struct module;
 struct pci_driver {
 	struct list_head node;
@@ -673,6 +704,7 @@ struct pci_driver {
 	int  (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable);   /* Enable wake event */
 	void (*shutdown) (struct pci_dev *dev);
 
+	struct pci_error_handlers err_handler;
 	struct device_driver	driver;
 	struct pci_dynids dynids;
 };

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

* Re: [PATCH 1/13]: PCI Err: pci.h header file changes
  2005-06-28 23:58 [PATCH 1/13]: PCI Err: pci.h header file changes Linas Vepstas
@ 2005-06-29  0:29 ` Greg KH
  2005-06-29  3:04   ` Andi Kleen
  2005-06-29  1:43 ` Benjamin Herrenschmidt
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2005-06-29  0:29 UTC (permalink / raw)
  To: Linas Vepstas
  Cc: linux-kernel, Benjamin Herrenschmidt, long, Hidetoshi Seto, ak,
	Paul Mackerras, linuxppc64-dev, linux-pci, johnrose

On Tue, Jun 28, 2005 at 06:58:17PM -0500, Linas Vepstas wrote:
> @@ -673,6 +704,7 @@ struct pci_driver {
>  	int  (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable);   /* Enable wake event */
>  	void (*shutdown) (struct pci_dev *dev);
>  
> +	struct pci_error_handlers err_handler;
>  	struct device_driver	driver;
>  	struct pci_dynids dynids;
>  };

Shouldn't that be a pointer and not the whole structure?  Wouldn't that
make it easier to "reuse" error handlers?

thanks,

greg k-h

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

* Re: [PATCH 1/13]: PCI Err: pci.h header file changes
  2005-06-28 23:58 [PATCH 1/13]: PCI Err: pci.h header file changes Linas Vepstas
  2005-06-29  0:29 ` Greg KH
@ 2005-06-29  1:43 ` Benjamin Herrenschmidt
  1 sibling, 0 replies; 4+ messages in thread
From: Benjamin Herrenschmidt @ 2005-06-29  1:43 UTC (permalink / raw)
  To: Linas Vepstas
  Cc: linux-kernel, long, Hidetoshi Seto, Greg KH, ak, Paul Mackerras,
	linuxppc64-dev, linux-pci, johnrose

On Tue, 2005-06-28 at 18:58 -0500, Linas Vepstas wrote:
> +
> +/* PCI bus error event callbacks */
> +struct pci_error_handlers
> +{
> +       enum pci_channel_state error_state;       /* current error state */
> +       int (*error_detected)(struct pci_dev *dev, enum pci_channel_state error);
> +       int (*mmio_enabled)(struct pci_dev *dev); /* MMIO has been reanbled, but not DMA */
> +       int (*link_reset)(struct pci_dev *dev);   /* PCI Express link has been reset */
> +       int (*slot_reset)(struct pci_dev *dev);   /* PCI slot has been reset */
> +       void (*resume)(struct pci_dev *dev);      /* Device driver may resume normal operations */
> +};

The state variable shouldn't be in that structure. As Greg pointed, we
should have a pointer to that structure in pci_driver, not a copy, and
the error state should be in pci_dev. (With you current code, it's per
driver which is broken anyway).

Ben.


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

* Re: [PATCH 1/13]: PCI Err: pci.h header file changes
  2005-06-29  0:29 ` Greg KH
@ 2005-06-29  3:04   ` Andi Kleen
  0 siblings, 0 replies; 4+ messages in thread
From: Andi Kleen @ 2005-06-29  3:04 UTC (permalink / raw)
  To: Greg KH
  Cc: Linas Vepstas, linux-kernel, Benjamin Herrenschmidt, long,
	Hidetoshi Seto, Paul Mackerras, linuxppc64-dev, linux-pci,
	johnrose

On Tue, Jun 28, 2005 at 05:29:51PM -0700, Greg KH wrote:
> On Tue, Jun 28, 2005 at 06:58:17PM -0500, Linas Vepstas wrote:
> > @@ -673,6 +704,7 @@ struct pci_driver {
> >  	int  (*enable_wake) (struct pci_dev *dev, pci_power_t state, int enable);   /* Enable wake event */
> >  	void (*shutdown) (struct pci_dev *dev);
> >  
> > +	struct pci_error_handlers err_handler;
> >  	struct device_driver	driver;
> >  	struct pci_dynids dynids;
> >  };
> 
> Shouldn't that be a pointer and not the whole structure?  Wouldn't that
> make it easier to "reuse" error handlers?

Yes, it's a good idea. In fact we could have a generic NIC error
handler structure then that just calls the watchdog timeout function.
I suspect that would be sufficient for most NICs.

-Andi

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

end of thread, other threads:[~2005-06-29  3:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-06-28 23:58 [PATCH 1/13]: PCI Err: pci.h header file changes Linas Vepstas
2005-06-29  0:29 ` Greg KH
2005-06-29  3:04   ` Andi Kleen
2005-06-29  1:43 ` Benjamin Herrenschmidt

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.