All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tiezhu Yang <yangtiezhu@loongson.cn>
To: Lukas Wunner <lukas@wunner.de>
Cc: Bjorn Helgaas <bhelgaas@google.com>,
	Konstantin Khlebnikov <khlebnikov@openvz.org>,
	Khalid Aziz <khalid.aziz@oracle.com>,
	Vivek Goyal <vgoyal@redhat.com>,
	oohall@gmail.com, rafael.j.wysocki@intel.com,
	Xuefeng Li <lixuefeng@loongson.cn>,
	Huacai Chen <chenhc@lemote.com>,
	Jiaxun Yang <jiaxun.yang@flygoat.com>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [RFC PATCH v2] PCI/portdrv: Only disable Bus Master on kexec reboot and connected PCI devices
Date: Mon, 14 Sep 2020 14:13:31 +0800	[thread overview]
Message-ID: <43683243-f8e2-c555-447a-f108740c70e8@loongson.cn> (raw)
In-Reply-To: <20200914040625.GA20033@wunner.de>

On 09/14/2020 12:06 PM, Lukas Wunner wrote:
> 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()

pcie_port_device_remove() deletes pci_disable_device(dev)  at the beginning of this patch.


diff 
<https://lore.kernel.org/linux-pci/CAAhV-H5-X9OcBe3iRxF8PnKW-0j_10FVqm8cbiqW2-Lv4mTTdQ@mail.gmail.com/T/#iZ2e.:..:1600028950-10644-1-git-send-email-yangtiezhu::40loongson.cn:0drivers:pci:pcie:portdrv_core.c> 
--git a/drivers/pci/pcie/portdrv_core.c 
b/drivers/pci/pcie/portdrv_core.c index 50a9522..1991aca 100644 --- 
a/drivers/pci/pcie/portdrv_core.c +++ b/drivers/pci/pcie/portdrv_core.c 
@@ -491,7 +491,6 @@ void pcie_port_device_remove(struct pci_dev *dev)   {
  	device_for_each_child(&dev->dev, NULL, remove_iter);
  	pci_free_irq_vectors(dev);
- pci_disable_device(dev);   }

>
> Thanks,
>
> Lukas


  reply	other threads:[~2020-09-14  6:13 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-13 20:29 [RFC PATCH v2] PCI/portdrv: Only disable Bus Master on kexec reboot and connected PCI devices Tiezhu Yang
2020-09-14  4:06 ` Lukas Wunner
2020-09-14  6:13   ` Tiezhu Yang [this message]
2020-09-14  6:30     ` Tiezhu Yang
     [not found] ` <tencent_44F0201A70619BA613F16BA4@qq.com>
2020-09-14  4:31   ` Huacai Chen
2020-09-14  6:17     ` Tiezhu Yang
2020-09-14  5:59 ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43683243-f8e2-c555-447a-f108740c70e8@loongson.cn \
    --to=yangtiezhu@loongson.cn \
    --cc=bhelgaas@google.com \
    --cc=chenhc@lemote.com \
    --cc=jiaxun.yang@flygoat.com \
    --cc=khalid.aziz@oracle.com \
    --cc=khlebnikov@openvz.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lixuefeng@loongson.cn \
    --cc=lukas@wunner.de \
    --cc=oohall@gmail.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=vgoyal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.