All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: "Huang, Shane" <Shane.Huang@amd.com>
Cc: jgarzik@pobox.com, linux-ide@vger.kernel.org
Subject: Re: [PATCH #upstream, v2] ahci: Implement SATA AHCI FIS-based switching support
Date: Tue, 01 Sep 2009 21:28:55 +0900	[thread overview]
Message-ID: <4A9D1387.6040709@kernel.org> (raw)
In-Reply-To: <C8E4BD7D001E44499280E0884BD9DB30FC9776@sshaexmb1.amd.com>

Hello, Shane.

Huang, Shane wrote:
>> You can do
>>
>> 	pmp = fbs >> PORT_FBS_DWE_OFFSET;
>> 	if (pmp < ap->nr_pmp_links && 
>> ata_link_online(&ap->pmp_link[pmp])) {
>> 		link = &ap->pmp_link[pmp];
>> 		pp->fbs_need_dec = true;
>> 	}
> 
> PORT_FBS_SDE also need check, because(ahci v1.2  3.3.16):
> Device With Error (DWE): Set by hardware to the value of the
> Port Multiplier port number of the device that experienced a fatal
> error condition. This field is only valid when PxFBS.SDE = '1'.
> 
> So I'll update the code into:
> 	u32 fbs = readl(port_mmio + PORT_FBS);
> 	int pmp = fbs >> PORT_FBS_DWE_OFFSET;
> 
> 	if ((fbs & PORT_FBS_SDE) && (pmp < ap->nr_pmp_links) &&
> 	    ata_link_online(&ap->pmp_link[pmp])) {
> 		link = &ap->pmp_link[pmp];
> 		fbs_need_dec = true;
> 	}

Yeap, I missed the condition while trying to point out that the loop
wasn't necessary there.  Sorry.  :-P

>>>  	if (irq_stat & PORT_IRQ_IF_ERR) {
>>> -		host_ehi->err_mask |= AC_ERR_ATA_BUS;
>>> -		host_ehi->action |= ATA_EH_RESET;
>>> +		if (pp->fbs_need_dec)
>>> +			active_ehi->err_mask |= AC_ERR_DEV;
>>> +		else {
>>> +			host_ehi->err_mask |= AC_ERR_ATA_BUS;
>>> +			host_ehi->action |= ATA_EH_RESET;
>>> +		}
>>> +
>> Are you sure IF_ERR is device specific and doesn't require host link
>> reset?
> 
> Because I referred to the AHCI spec v1.2  9.3.6:
> An interface fatal error may be localized to a particular device or may
> be fatal to the entire port.....If the error is fatal to the entire
> port, then
> PxFBS.SDE shall be cleared to '0' by the hardware. Software should
> follow either the device specific or non-device specific error procedure
> depending on whether PxFBS.SDE is set to '1'.

Ah hah... thanks for the explanation.

>>> -	mem = dmam_alloc_coherent(dev, AHCI_PORT_PRIV_DMA_SZ, &mem_dma,
>>> -				  GFP_KERNEL);
>>> +	/* check FBS capability */
>>> +	if ((hpriv->cap & HOST_CAP_FBS) && sata_pmp_supported(ap)) {
>>> +		void __iomem *port_mmio = ahci_port_base(ap);
>>> +		u32 cmd = readl(port_mmio + PORT_CMD);
>>> +		if (cmd & PORT_CMD_FBSCP)
>>> +			pp->fbs_supported = true;
>> Maybe whine a bit if CAP indicates FBS but PORT_CMD doesn't?
> 
> Sure, updated as below:
> 	if (cmd & PORT_CMD_FBSCP)
> 		pp->fbs_supported = true;
> 	else
> 		WARN_ON(1);

WARN_ON() would be a tad bit too scary.  Given that on certain
hardwares it would always trigger.  A dev_printk() would be better.

> OK, thanks for your nice suggestions, I'll have to submit v3 later...

Nice work!  Thanks a lot for doing it.

-- 
tejun

  reply	other threads:[~2009-09-01 12:30 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-18  4:45 [PATCH #upstream, v2] ahci: Implement SATA AHCI FIS-based switching support Shane Huang
2009-08-31  8:01 ` Tejun Heo
2009-09-01 12:22   ` Huang, Shane
2009-09-01 12:28     ` Tejun Heo [this message]
2009-09-01 13:08       ` Huang, Shane
2009-09-01 13:14         ` Tejun Heo
2009-09-02  1:55           ` Huang, Shane
2009-09-02  1:58             ` Tejun Heo
2009-09-02  2:32               ` Huang, Shane
2009-09-02  2:40                 ` Tejun Heo
2009-09-02  6:42                   ` Huang, Shane
2009-09-02  6:49                     ` Tejun Heo
2009-09-02  6:58                       ` Huang, Shane
2009-09-03  4:53     ` Huang, Shane
2009-09-03  6:04       ` Tejun Heo
2009-09-04  2:25         ` Huang, Shane

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=4A9D1387.6040709@kernel.org \
    --to=tj@kernel.org \
    --cc=Shane.Huang@amd.com \
    --cc=jgarzik@pobox.com \
    --cc=linux-ide@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 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.