RE: [PATCH #upstream, v2] ahci: Implement SATA AHCI FIS-based switching support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Tejun, 

> -----Original Message-----
> From: Huang, Shane 
> 
> > > +static void ahci_fbs_dec_intr(struct ata_port *ap)
> > > +{
> > > +	struct ahci_port_priv *pp = ap->private_data;
> > > +	DPRINTK("ENTER\n");
> > > +
> > > +	if (pp->fbs_enabled) {
> > 
> > Just do BUG_ON(!pp->fbs_enabled);
> 
> OK.
> 
>  
> > > +		void __iomem *port_mmio = ahci_port_base(ap);
> > > +		u32 fbs = readl(port_mmio + PORT_FBS);
> > > +		int retries = 3;
> > > +
> > > +		/* time to wait for DEC is not specified by AHCI spec,
> > > +		 * add a retry loop for safety */
> > > +		do {
> > > +			writel(fbs | PORT_FBS_DEC, port_mmio + 
> > PORT_FBS);
> > > +			fbs = readl(port_mmio + PORT_FBS);
> > > +			retries--;
> > > +		} while ((fbs & PORT_FBS_DEC) && retries);


At the 2nd thought, if (!pp->fbs_enabled) appears unfortunately
(although it should not), replacement of if (pp->fbs_enabled) with
BUG_ON() will lead to the execution of the followed DEC, which
might lead to indeterminate result, because of AHCI v1.2 3.3.16:

Device Error Clear (DEC): ....... Software shall only set this bit to
'1' if
PxFBS.EN is set to '1' and PxFBS.SDE is set to '1'.

So I would suggest to keep my original implementation in v2, or put
BUG_ON to the else case, if you insist, to replace the original
dev_printk(KERN_ERR).



Thanks
Shane

--
To unsubscribe from this list: send the line "unsubscribe linux-ide" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystems]     [Linux SCSI]     [Linux RAID]     [Git]     [Kernel Newbies]     [Linux Newbie]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Samba]     [Device Mapper]

  Powered by Linux