[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200914040625.GA20033@wunner.de>
Date: Mon, 14 Sep 2020 06:06:25 +0200
From: Lukas Wunner <lukas@...ner.de>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: Bjorn Helgaas <bhelgaas@...gle.com>,
Konstantin Khlebnikov <khlebnikov@...nvz.org>,
Khalid Aziz <khalid.aziz@...cle.com>,
Vivek Goyal <vgoyal@...hat.com>, oohall@...il.com,
rafael.j.wysocki@...el.com, Xuefeng Li <lixuefeng@...ngson.cn>,
Huacai Chen <chenhc@...ote.com>,
Jiaxun Yang <jiaxun.yang@...goat.com>,
linux-pci@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [RFC PATCH v2] PCI/portdrv: Only disable Bus Master on kexec
reboot and connected PCI devices
On Mon, Sep 14, 2020 at 04:29:10AM +0800, Tiezhu Yang wrote:
> --- a/drivers/pci/pcie/portdrv_pci.c
> +++ b/drivers/pci/pcie/portdrv_pci.c
> @@ -143,6 +144,28 @@ static void pcie_portdrv_remove(struct pci_dev *dev)
> }
>
> pcie_port_device_remove(dev);
> + pci_disable_device(dev);
> +}
> +
> +static void pcie_portdrv_shutdown(struct pci_dev *dev)
> +{
> + if (pci_bridge_d3_possible(dev)) {
> + pm_runtime_forbid(&dev->dev);
> + pm_runtime_get_noresume(&dev->dev);
> + pm_runtime_dont_use_autosuspend(&dev->dev);
> + }
> +
> + pcie_port_device_remove(dev);
> +
> + /*
> + * If this is a kexec reboot, turn off Bus Master bit on the
> + * device to tell it to not continue to do DMA. Don't touch
> + * devices in D3cold or unknown states.
> + * If it is not a kexec reboot, firmware will hit the PCI
> + * devices with big hammer and stop their DMA any way.
> + */
> + if (kexec_in_progress && (dev->current_state <= PCI_D3hot))
> + pci_disable_device(dev);
The last portion of this function is already executed afterwards by
pci_device_shutdown(). You don't need to duplicate it here:
device_shutdown()
dev->bus->shutdown() == pci_device_shutdown()
drv->shutdown() == pcie_portdrv_shutdown()
pci_disable_device()
pci_disable_device()
Thanks,
Lukas
Powered by blists - more mailing lists