From: Tomas Henzl <thenzl@redhat.com>
To: "Elliott, Robert (Server Storage)" <Elliott@hp.com>,
"'linux-scsi@vger.kernel.org'" <linux-scsi@vger.kernel.org>,
"Stephen M. Cameron" <scameron@beardog.cce.hp.com>
Cc: "Handzik, Joe" <joseph.t.handzik@hp.com>,
Christoph Hellwig <hch@infradead.org>
Subject: Re: [PATCH V2] hpsa: refine the pci enable/disable handling
Date: Mon, 08 Sep 2014 17:26:02 +0200 [thread overview]
Message-ID: <540DCA8A.9010203@redhat.com> (raw)
In-Reply-To: <94D0CD8314A33A4D9D801C0FE68B402958C55BD2@G4W3202.americas.hpqcorp.net>
On 09/07/2014 01:38 AM, Elliott, Robert (Server Storage) wrote:
>
>> -----Original Message-----
>> From: linux-scsi-owner@vger.kernel.org [mailto:linux-scsi-
>> owner@vger.kernel.org] On Behalf Of Tomas Henzl
> ...
>
>> + /* kdump kernel is loading, we don't know in which state is
>> + * the pci interface. The dev->enable_cnt is equal zero
>> + * so we call enable+disable, wait a while and switch it on.
>> + */
>> + rc = pci_enable_device(pdev);
>> + if (rc) {
>> + dev_warn(&pdev->dev, "Failed to enable PCI device\n");
>> + return -ENODEV;
>> + }
>> + pci_disable_device(pdev);
>> + msleep(260); /* a randomly chosen number */
>> + rc = pci_enable_device(pdev);
>> + if (rc) {
>> + dev_warn(&pdev->dev, "failed to enable device.\n");
>> + return -ENODEV;
>> + }
>> +
>> /* Reset the controller with a PCI power-cycle or via doorbell
>> */
> I tested this patch by adding:
> reset_devices
> to the kernel command line, which sets a kernel global variable that
> triggers the driver to take this path.
>
> Controller initialization failed with:
> [ 21.822789] hpsa 0000:02:00.0: Waiting for controller to respond to no-op
> [ 121.822219] hpsa 0000:02:00.0: controller message 03:00 timed out
> [ 121.854814] hpsa 0000:02:00.0: no-op failed; re-trying
> ...
>
> The reason is that pci_disable_device clears the Bus Master Enable bit,
> and there is no call to pci_set_master after pci_enable. The controller is
> unable to return the response for the command sent by hpsa_noop down
> below. Adding pci_set_master(pdev) got it working.
And I was sure I've tested it, but apparently I haven't after adding the last part.
Thanks for testing.
>
> A call to pci_request_regions is also missing (that's supposed to
> be called before accessing the controller's memory space), but
> that's not fatal here.
This patch doesn't change this, pci_request_regions wasn't also called without
it before. Likely there probably are some weak points during the pci initialisation
and combined with the "OS BUG" there is room for changes.
I wanted just to get rid of the "disabling already-disabled device" warning
and change it only as least as possible so it doesn't stop working (but have failed though).
The patch below fixes the problem for me.
Christoph, what is the best approach - should I post this to the list as new patch
or would you prefer to drop the old version and repost a fixed patch?
Maybe HP could add the patch to their upcoming series in that case.
Tomas
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 7828834..cef5d49 100644
--- a/drivers/scsi/hpsa.c
+++ b/drivers/scsi/hpsa.c
@@ -6544,7 +6544,7 @@ static int hpsa_init_reset_devices(struct pci_dev *pdev)
dev_warn(&pdev->dev, "failed to enable device.\n");
return -ENODEV;
}
-
+ pci_set_master(pdev);
/* Reset the controller with a PCI power-cycle or via doorbell */
rc = hpsa_kdump_hard_reset_controller(pdev);
>
> ---
> Rob Elliott HP Server Storage
> --
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
prev parent reply other threads:[~2014-09-08 15:27 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-14 14:12 [PATCH V2] hpsa: refine the pci enable/disable handling Tomas Henzl
2014-08-14 15:17 ` scameron
2014-08-19 17:27 ` Christoph Hellwig
2014-09-06 23:38 ` Elliott, Robert (Server Storage)
2014-09-08 15:26 ` Tomas Henzl [this message]
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=540DCA8A.9010203@redhat.com \
--to=thenzl@redhat.com \
--cc=Elliott@hp.com \
--cc=hch@infradead.org \
--cc=joseph.t.handzik@hp.com \
--cc=linux-scsi@vger.kernel.org \
--cc=scameron@beardog.cce.hp.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;
as well as URLs for NNTP newsgroup(s).