netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/3] mv643xx fixes - Disable interrupts on all ports during initialization
@ 2006-06-27 14:51 Brent Cook
  2006-06-27 15:16 ` John Haller
  2006-06-30 16:20 ` Jeff Garzik
  0 siblings, 2 replies; 5+ messages in thread
From: Brent Cook @ 2006-06-27 14:51 UTC (permalink / raw)
  To: netdev


This patch disable interrupts on all ports during initialization. The current 
assumes that the firmware has already disabled all interrupts on all ports. 
We have encountered some boards that do not always disable interrupts (XES 
XPedite 6200 for instance) on a soft reset. This patch prevents a kernel 
panic if a packet is received before the DMA ring buffers are setup for a 
port on which interrupts are left enabled by the firmware.

Signed-off-by: Brent Cook <bcook@bpointsys.com>

Index: linux-2.6-bps/drivers/net/mv643xx_eth.c
===================================================================
--- linux-2.6-bps/drivers/net/mv643xx_eth.c	(revision 100)
+++ linux-2.6-bps/drivers/net/mv643xx_eth.c	(revision 101)
@@ -777,6 +777,13 @@
 	unsigned int size;
 	int err;
 
+	/* Mask all interrupts on ethernet port */
+	mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num),
+		 ETH_INT_MASK_ALL);
+	/* wait for previous write to complete */
+	mv_read(MV643XX_ETH_INTERRUPT_MASK_REG(port_num));
+
 	err = request_irq(dev->irq, mv643xx_eth_int_handler,
 			SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev);
 	if (err) {

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

* Re: [PATCH 1/3] mv643xx fixes - Disable interrupts on all ports during initialization
  2006-06-27 14:51 [PATCH 1/3] mv643xx fixes - Disable interrupts on all ports during initialization Brent Cook
@ 2006-06-27 15:16 ` John Haller
  2006-06-27 16:09   ` Nathaniel Case
  2006-06-30 16:20 ` Jeff Garzik
  1 sibling, 1 reply; 5+ messages in thread
From: John Haller @ 2006-06-27 15:16 UTC (permalink / raw)
  To: Brent Cook; +Cc: netdev

Brent Cook wrote:
> This patch disable interrupts on all ports during initialization. The current 
> assumes that the firmware has already disabled all interrupts on all ports. 
> We have encountered some boards that do not always disable interrupts (XES 
> XPedite 6200 for instance) on a soft reset. This patch prevents a kernel 
> panic if a packet is received before the DMA ring buffers are setup for a 
> port on which interrupts are left enabled by the firmware.
You probably have bigger problems than the interrupt being left
enabled.  If the interrupt is left enabled, the DMA engine
is probably left enabled, and if a packet happens
to come in before the driver can properly configure them,
some random part of memory will get overwritten.
The firmware needs to disable this device before transferring
control to the kernel, both the interrupts and the DMA,
there is no way to fix this in the kernel.

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

* Re: [PATCH 1/3] mv643xx fixes - Disable interrupts on all ports during initialization
  2006-06-27 15:16 ` John Haller
@ 2006-06-27 16:09   ` Nathaniel Case
  0 siblings, 0 replies; 5+ messages in thread
From: Nathaniel Case @ 2006-06-27 16:09 UTC (permalink / raw)
  To: John Haller; +Cc: Brent Cook, netdev

On Tue, 2006-06-27 at 10:16 -0500, John Haller wrote:
> Brent Cook wrote:
> > This patch disable interrupts on all ports during initialization. The current 
> > assumes that the firmware has already disabled all interrupts on all ports. 
> > We have encountered some boards that do not always disable interrupts (XES 
> > XPedite 6200 for instance) on a soft reset. This patch prevents a kernel 
> > panic if a packet is received before the DMA ring buffers are setup for a 
> > port on which interrupts are left enabled by the firmware.
> You probably have bigger problems than the interrupt being left
> enabled.  If the interrupt is left enabled, the DMA engine
> is probably left enabled, and if a packet happens
> to come in before the driver can properly configure them,
> some random part of memory will get overwritten.
> The firmware needs to disable this device before transferring
> control to the kernel, both the interrupts and the DMA,
> there is no way to fix this in the kernel.

I agree that the patch isn't the best fix for this problem.

Brent, for this particular case, I believe there's chip errata for the
Discovery bridge preventing it from resetting itself when the board
resets itself in non-monarch mode.  That's why interrupts are left
enabled.  This issue should never crop up if the board is monarch on the
PCI bus.

So the proper workaround would be for our firmware to account for this
case and disable interrupts, ethernet, etc. on a soft non-monarch reset.
We could also do this in the boot wrapper code as a safety measure.

Also, note that the firmware _will_ already explicitly disable ethernet
before transferring control over to the OS _if_ you're booting over
ethernet instead of flash.

- Nate Case <ncase@xes-inc.com>


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

* Re: [PATCH 1/3] mv643xx fixes - Disable interrupts on all ports during initialization
  2006-06-27 14:51 [PATCH 1/3] mv643xx fixes - Disable interrupts on all ports during initialization Brent Cook
  2006-06-27 15:16 ` John Haller
@ 2006-06-30 16:20 ` Jeff Garzik
  2006-07-03 18:11   ` Brent Cook
  1 sibling, 1 reply; 5+ messages in thread
From: Jeff Garzik @ 2006-06-30 16:20 UTC (permalink / raw)
  To: Brent Cook; +Cc: netdev

Brent Cook wrote:
> This patch disable interrupts on all ports during initialization. The current 
> assumes that the firmware has already disabled all interrupts on all ports. 
> We have encountered some boards that do not always disable interrupts (XES 
> XPedite 6200 for instance) on a soft reset. This patch prevents a kernel 
> panic if a packet is received before the DMA ring buffers are setup for a 
> port on which interrupts are left enabled by the firmware.
> 
> Signed-off-by: Brent Cook <bcook@bpointsys.com>

ACK patches 1-3, but:


[jgarzik@pretzel netdev-2.6]$ git-applymbox /g/tmp/mbox ~/info/signoff.txt
3 patch(es) to process.

Applying 'mv643xx fixes - Disable interrupts on all ports during 
initialization'
fatal: corrupt patch at line 19

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

* [PATCH 1/3] mv643xx fixes - Disable interrupts on all ports during initialization
  2006-06-30 16:20 ` Jeff Garzik
@ 2006-07-03 18:11   ` Brent Cook
  0 siblings, 0 replies; 5+ messages in thread
From: Brent Cook @ 2006-07-03 18:11 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev

That's the last time I hand-edit a patch - this is really more of a workaround 
since I've learned that the interrupts should have been disabled by the 
firmware anyway. But, it doesn't hurt. Updated description

This patch disable interrupts on all ports during initialization. The
current driver assumes that the firmware has already disabled all interrupts 
on all ports. We have encountered some boards that do not always disable
interrupts (XES XPedite 6200 for instance) on a soft reset on all ethernet 
ports. This patch prevents a kernel panic if a packet is received before the 
DMA ring buffers are setup for a port on which interrupts are left enabled by 
the firmware.

Signed-off-by: Brent Cook <bcook@bpointsys.com>

Index: current/drivers/net/mv643xx_eth.c
===================================================================
--- current/drivers/net/mv643xx_eth.c	(revision 101)
+++ current/drivers/net/mv643xx_eth.c	(working copy)
@@ -777,6 +777,12 @@
 	unsigned int size;
 	int err;
 
+	/* Mask all interrupts on ethernet port */
+	mv_write(MV643XX_ETH_INTERRUPT_MASK_REG(port_num),
+		ETH_INT_MASK_ALL);
+	/* wait for previous write to complete */
+	mv_read(MV643XX_ETH_INTERRUPT_MASK_REG(port_num));
+
 	err = request_irq(dev->irq, mv643xx_eth_int_handler,
 			SA_SHIRQ | SA_SAMPLE_RANDOM, dev->name, dev);
 	if (err) {

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

end of thread, other threads:[~2006-07-03 18:11 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-27 14:51 [PATCH 1/3] mv643xx fixes - Disable interrupts on all ports during initialization Brent Cook
2006-06-27 15:16 ` John Haller
2006-06-27 16:09   ` Nathaniel Case
2006-06-30 16:20 ` Jeff Garzik
2006-07-03 18:11   ` Brent Cook

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).