mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hanna Hawa <hhhawa@amazon.com>
To: <axboe@kernel.dk>, <hdegoede@redhat.com>
Cc: <linux-ide@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<dwmw@amazon.co.uk>, <benh@amazon.com>, <ronenk@amazon.com>,
	<talel@amazon.com>, <jonnyc@amazon.com>, <hanochu@amazon.com>,
	<barakw@amazon.com>, <hhhawa@amazon.com>
Subject: [PATCH 2/2] ata: ahci: Add shutdown handler
Date: Mon, 9 Dec 2019 16:32:09 +0000	[thread overview]
Message-ID: <20191209163209.26284-3-hhhawa@amazon.com> (raw)
In-Reply-To: <20191209163209.26284-1-hhhawa@amazon.com>

An issue found while doing kexec on Annapurna Labs SoC: an AXI read
error occur due to an access from the interrupt handler of AHCI to the
AHCI controller.
This patch make sure that the interrupts are disabled for the controller
while doing kexec.

The shutdown handler is called during system shutdown to disable host
controller DMA and interrupts in order to avoid potentially corrupting
or otherwise interfering with a new kernel being started with kexec.

Signed-off-by: Hanna Hawa <hhhawa@amazon.com>
---
 drivers/ata/ahci.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/drivers/ata/ahci.c b/drivers/ata/ahci.c
index 05c2b32dcc4d..34ddc259343a 100644
--- a/drivers/ata/ahci.c
+++ b/drivers/ata/ahci.c
@@ -80,6 +80,7 @@ enum board_ids {
 
 static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent);
 static void ahci_remove_one(struct pci_dev *dev);
+static void ahci_shutdown(struct pci_dev *dev);
 static int ahci_vt8251_hardreset(struct ata_link *link, unsigned int *class,
 				 unsigned long deadline);
 static int ahci_avn_hardreset(struct ata_link *link, unsigned int *class,
@@ -593,6 +594,7 @@ static struct pci_driver ahci_pci_driver = {
 	.id_table		= ahci_pci_tbl,
 	.probe			= ahci_init_one,
 	.remove			= ahci_remove_one,
+	.shutdown		= ahci_shutdown,
 	.driver = {
 		.pm		= &ahci_pci_pm_ops,
 	},
@@ -1870,6 +1872,13 @@ static void ahci_remove_one(struct pci_dev *pdev)
 	ata_pci_remove_one(pdev);
 }
 
+static void ahci_shutdown(struct pci_dev *pdev)
+{
+	struct ata_host *host = pci_get_drvdata(pdev);
+
+	ahci_common_shutdown(host);
+}
+
 module_pci_driver(ahci_pci_driver);
 
 MODULE_AUTHOR("Jeff Garzik");
-- 
2.17.1


  parent reply	other threads:[~2019-12-09 16:33 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-09 16:32 [PATCH 0/2] " Hanna Hawa
2019-12-09 16:32 ` [PATCH 1/2] ata: libahci: move ahci platform shutdown function to libahci Hanna Hawa
2019-12-09 16:32 ` Hanna Hawa [this message]
2019-12-10  9:43 ` [PATCH 0/2] ata: ahci: Add shutdown handler Hans de Goede

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=20191209163209.26284-3-hhhawa@amazon.com \
    --to=hhhawa@amazon.com \
    --cc=axboe@kernel.dk \
    --cc=barakw@amazon.com \
    --cc=benh@amazon.com \
    --cc=dwmw@amazon.co.uk \
    --cc=hanochu@amazon.com \
    --cc=hdegoede@redhat.com \
    --cc=jonnyc@amazon.com \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ronenk@amazon.com \
    --cc=talel@amazon.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®