Re: [PATCH] Disable Bus Master on PCI device shutdown
From: Alan Cox
Date: Wed Jun 06 2012 - 16:47:06 EST
> This protects against the case where a piece of hardware is continuing
> to DMA even after the driver shutdown method has been called? I'm not
It doesn't. We also have hardware which craps itself if you clear the bus
mastering bit and we have platforms where the BIOS gets most upset if you
do that on suspend paths. There are also lots of devices that simply
ignore the bus mastering bit !
> convinced this is safe. Some Broadcom parts will crash if busmastering
> is disabled while they're still performing DMA, and they'll then hang
> the bus if reenabled.
This is very common, disabling the bus master bit isn't exactly a
tested or well defined pathway. A lot of device FIFOs will also happily
belch out their queue when you flip the bit. So it might look like
progress but it probably isn't.
Unfortunately if you've got a device peeing into memory you need to fix
the driver, or sometimes the firmware. You can probably use the IOMMU for
some protection on newer systems.
And then you get things like the CS5520 where disabling bus mastering on
the IDE controller crashes the machine, and some UMA video devices that
honour the bit for video fetch.
>From the IDE experience you really need to be careful here. Changing the
default is asking for nasty and weird regressions.
This isn't a fix, its a band aid to cover over broken driver shutdown
methods. Those driver shutdown methods need fixing.
Alan
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/