Re: [PATCH] PCI: Add pci shutdown ability

Grant Grundler
2005-04-26T15:51:12Z

On Mon, Apr 25, 2005 at 05:12:09PM -0400, Alan Stern wrote:
> Do you have any suggestions for a better way to stop a device from issuing
> IRQs and doing DMA at any point between the time when the old kernel
> panics and the time when the new kernel loads the device's driver?

PCI Bus resets?

That means linux kernel needs to reconfigure everything unless
the BIOS gets invoked again (machine reset). Linux has *most*
of the code to do this but I'm pretty sure enough existing
configs won't work that this will be very painful.

> I looked into the possibility of having the PCI core disable interrupt
> generation and DMA on each new device as it is discovered. Unfortunately
> there is no dependable, universal way to do this for IRQs.

Sure there is. Every IRQ line goes to an IRQ controller.
Arch specific code deals with programming the controller and can
mask all interrupts (or not). Historically, they've been left unmasked
for ISA IRQ discovery and debugging misrouted IRQ lines.

> (A notable gap in the original PCI specification, IMHO.) Another problem
> with this
> approach is that on some platforms the initial console is a PCI device
> driven by the firmware, but the firmware won't tell Linux which device it
> is! Disable the wrong device and away goes your screen display.

Exactly. That's really the main problem with disabling DMA globally.
I don't have any brilliant ideas on how to fix this either
except shutdown console before PCI bus walks and switch to
linux console after PCI bus walks. Makes debugging PCI issues
a bit more difficult though.

grant