From: Sinan Kaya <okaya@codeaurora.org>
To: linux-pci@vger.kernel.org, timur@codeaurora.org
Cc: Bjorn Helgaas <bhelgaas@google.com>,
linux-arm-msm@vger.kernel.org, kexec@lists.infradead.org,
linux-arm-kernel@lists.infradead.org,
open list <linux-kernel@vger.kernel.or>
Subject: Re: [PATCH] PCI: Try to clean up resources via remove if shutdown doesn't exist
Date: Fri, 25 May 2018 10:36:49 -0700 [thread overview]
Message-ID: <d0970733-d56b-9a96-26cd-4c911c127579@codeaurora.org> (raw)
In-Reply-To: <1527257063-15843-1-git-send-email-okaya@codeaurora.org>
[+cc kexec]
On 5/25/2018 7:04 AM, Sinan Kaya wrote:
> It is up to a driver to implement shutdown() callback. If shutdown()
> callback is not implemented, PCI device can have pending interrupt and
> even do DMA transactions while the system is going down.
>
> If kexec is in use, this can damage the newly booting kexec kernel
> or even prevent it from booting altogether. Fallback to calling the
> remove() callback if shutdown() isn't implemented for a given driver.
>
> Signed-off-by: Sinan Kaya <okaya@codeaurora.org>
> ---
> drivers/pci/pci-driver.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c
> index 6ace470..4ac72e3 100644
> --- a/drivers/pci/pci-driver.c
> +++ b/drivers/pci/pci-driver.c
> @@ -475,8 +475,17 @@ static void pci_device_shutdown(struct device *dev)
>
> pm_runtime_resume(dev);
>
> + /*
> + * Try shutdown callback if it exists, otherwise fallback to remove
> + * callback. PCI drivers can do DMA and have pending interrupts.
> + * Leaving the DMA and interrupts pending could damage the newly
> + * booting kexec kernel as well as prevent it from booting altogether
> + * if the pending interrupt is level.
> + */
> if (drv && drv->shutdown)
> drv->shutdown(pci_dev);
> + else if (drv && drv->remove)
> + drv->remove(pci_dev);
>
> /*
> * If this is a kexec reboot, turn off Bus Master bit on the
>
--
Sinan Kaya
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies, Inc.
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec
parent reply other threads:[~2018-05-25 17:36 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <1527257063-15843-1-git-send-email-okaya@codeaurora.org>]
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=d0970733-d56b-9a96-26cd-4c911c127579@codeaurora.org \
--to=okaya@codeaurora.org \
--cc=bhelgaas@google.com \
--cc=kexec@lists.infradead.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.or \
--cc=linux-pci@vger.kernel.org \
--cc=timur@codeaurora.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox