linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Douthit <stephend@silicom-usa.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Jens Axboe <axboe@kernel.dk>,
	"linux-ide@vger.kernel.org" <linux-ide@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ata: ahci: Lookup PCS register offset based on PCI device ID
Date: Mon, 12 Aug 2019 17:49:29 +0000	[thread overview]
Message-ID: <051cb164-19d5-9241-2941-0d866e565339@silicom-usa.com> (raw)
In-Reply-To: <CAPcyv4g+PdbisZd8=FpB5QiR_FCA2OQ9EqEF9yMAN=XWTYXY1Q@mail.gmail.com>

On 8/12/19 12:29 PM, Dan Williams wrote:
> On Mon, Aug 12, 2019 at 6:03 AM Stephen Douthit
> <stephend@silicom-usa.com> wrote:
>>
>> On 8/10/19 3:43 AM, Christoph Hellwig wrote:
>>> On Thu, Aug 08, 2019 at 08:24:31PM +0000, Stephen Douthit wrote:
>>>> Intel moved the PCS register from 0x92 to 0x94 on Denverton for some
>>>> reason, so now we get to check the device ID before poking it on reset.
>>>
>>> And now you just match on the new IDs, which means we'll perpetually
>>> catch up on any new device.  Dan, can you reach out inside Intel to
>>> figure out if there is a way to find out the PCS register location
>>> without the PCI ID check?
>>>
>>>
>>>>    static int ahci_pci_reset_controller(struct ata_host *host)
>>>>    {
>>>>       struct pci_dev *pdev = to_pci_dev(host->dev);
>>>> @@ -634,13 +669,14 @@ static int ahci_pci_reset_controller(struct ata_host *host)
>>>>
>>>>       if (pdev->vendor == PCI_VENDOR_ID_INTEL) {
>>>>               struct ahci_host_priv *hpriv = host->private_data;
>>>> +            int pcs = ahci_pcs_offset(host);
>>>>               u16 tmp16;
>>>>
>>>>               /* configure PCS */
>>>> -            pci_read_config_word(pdev, 0x92, &tmp16);
>>>> +            pci_read_config_word(pdev, pcs, &tmp16);
>>>>               if ((tmp16 & hpriv->port_map) != hpriv->port_map) {
>>>> -                    tmp16 |= hpriv->port_map;
>>>> -                    pci_write_config_word(pdev, 0x92, tmp16);
>>>> +                    tmp16 |= hpriv->port_map & 0xff;
>>>> +                    pci_write_config_word(pdev, pcs, tmp16);
>>>>               }
>>>>       }
>>>
>>> And Stephen, while you are at it, can you split this Intel-specific
>>> quirk into a separate helper?
>>
>> I can do that.  I'll wait until we hear back from Dan if there's a
>> better scheme than a device ID lookup.
> 
> Do you see any behavior change in practice with this patch? It's
> purportedly to re-enable the ports after a reset, but that would only
> be needed if the entire pci device reset. In this path the reset is
> being performed via the host control register. That is only meant to
> touch mmio registers, not config registers. So, as far as I can see
> this register bit twiddling after reset has never been necessary.

Not on Denverton.  I have seen AHCI reset issues on Avoton/Rangeley, but
I'd have to go digging at this point to know for sure if they were fixed
solely by the ahci_avn_hardreset() workaround, or that in combination
with the existing PCS workaround.

I found this not because of failure I saw in Linux, but because I was
using the Linux driver as reference while debugging the u-boot AHCI
driver.  When I couldn't find config space offset 0x92 defined in the
Denverton EDS I went digging, and that's where the patch comes from.

I wasn't quickly able to find what chipset the PCS workaround was added
for.  If it's for an obsolete chipset then dropping this entirely would
be cleaner.

Does anyone know the background of the original PCS workaround?

  reply	other threads:[~2019-08-12 17:49 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 20:24 [PATCH] ata: ahci: Lookup PCS register offset based on PCI device ID Stephen Douthit
2019-08-09  3:46 ` Jens Axboe
2019-08-09 14:13   ` Stephen Douthit
2019-08-09 14:16     ` Jens Axboe
2019-08-10  7:43 ` Christoph Hellwig
2019-08-10 20:22   ` Dan Williams
2019-08-12 13:02   ` Stephen Douthit
2019-08-12 14:11     ` Jens Axboe
2019-08-12 16:29     ` Dan Williams
2019-08-12 17:49       ` Stephen Douthit [this message]
2019-08-12 18:06         ` Christoph Hellwig
2019-08-12 19:12           ` Stephen Douthit
2019-08-12 19:31           ` Dan Williams
2019-08-13  7:29             ` Christoph Hellwig
2019-08-13 22:07               ` Dan Williams
2019-08-14 14:34                 ` Stephen Douthit
2019-08-14 16:09                   ` Dan Williams
2019-08-14 16:54                     ` Stephen Douthit
2019-08-14 17:17                       ` Dan Williams
2019-08-19 16:30                         ` Stephen Douthit
2019-08-20  2:17                           ` Dan Williams
2019-08-20 13:59                             ` Stephen Douthit

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=051cb164-19d5-9241-2941-0d866e565339@silicom-usa.com \
    --to=stephend@silicom-usa.com \
    --cc=axboe@kernel.dk \
    --cc=dan.j.williams@intel.com \
    --cc=hch@infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).