On Fri, 2010-07-30 at 20:42 +0000, H. Peter Anvin wrote: > On 07/30/2010 09:53 AM, David Woodhouse wrote: > > On Thu, 2010-07-29 at 21:41 -0700, Eric W. Biederman wrote: > >> There isn't a bus master shut off at the core level. > > > > Effectively, there is if you have an IOMMU. > > With the "core level" I meant Linux kernel code, as opposed to hardware > level which is slightly different; I meant it would make sense to at > least set the bus master control bit (PCI_COMMAND_MASTER) to zero before > kexec. Before kexec patch for ia64 was merged into mainline kernel, Zou Nan Hai and I had added a device_shootdown() routine to arch/ia64/kernel/crash.c that was called from machine_crash_shutdown(). device_shootdown() did exactly what you are proposing: +static void device_shootdown(void) +{ + struct pci_dev *dev; + irq_desc_t *desc; + u16 pci_command; + + list_for_each_entry(dev, &pci_devices, global_list) { + desc = irq_descp(dev->irq); + if (!desc->action) + continue; + pci_read_config_word(dev, PCI_COMMAND, &pci_command); + if (pci_command & PCI_COMMAND_MASTER) { + pci_command &= ~PCI_COMMAND_MASTER; + pci_write_config_word(dev, PCI_COMMAND, pci_command); + } + disable_irq_nosync(dev->irq); + desc->handler->end(dev->irq); + } +} There were some discussions regarding this and this code was removed by the time it was merged into mainline kernel. I can't remember the details of why. I remember one report of kernel hang on kexec that seemed to happen in device_shootdown(). I will look for any discussion threads I can find. -- Khalid ==================================================================== Khalid Aziz Telco Platform Software, ISB (970)898-9214 Hewlett-Packard khalid.aziz at hp.com Fort Collins, CO "The Linux kernel is subject to relentless development" - Alessandro Rubini