libata-core: devslp fails on ATP mSATA
(cc'ing Hannes and Margin)
Hello,
Quoted 8 lines · Andreas Werner
Hi,
i have a question regarding the devslp feature in several SATA devices.I currently working on an embedded board with a Freescale P1013/P1022. I have a mSATA Device from ATP which is connected to the SATA port. The Yocot Kernel 3.14.26 is used in the system.
This mSata failed with the following log messages:
...
Quoted 41 lines
The device is not recognized by the System, and i do not have access to it.
I have also tested the mSATA using a 3.14 Kernel and a 4.2 Kernel on a Intel Atom E3825. On this system, the mSATA is working perfectly.
Next test was to use a 3.4.18 Kernel (which was the old BSP) on the P1013. With this Kernel the mSATA is also working correctly.
During some deeper debuggin in
libata-core.ci find that the problem is regarding the devslp./* Check and mark DevSlp capability. Get DevSlp timing variables
* from SATA Settings page of Identify Device Data Log. */
if (ata_id_has_devslp(dev->id)) {
u8*sata_setting=ap->sector_buf;
int i, j;
dev->flags|=ATA_DFLAG_DEVSLP;err_mask= ata_read_log_page(dev,ATA_LOG_SATA_ID_DEV_DATA, ATA_LOG_SATA_SETTINGS, sata_setting, 1); if (err_mask) ata_dev_dbg(dev, "failed to get Identify Device Data, Emask 0x%x\n", err_mask);else
for (i = 0; i <ATA_LOG_DEVSLP_SIZE; i++) {
j =ATA_LOG_DEVSLP_OFFSET+ i;
dev->devslp_timing[i] = sata_setting[j];
}
}If i comment out this code, the device is recognized correctly. I figured out that only the "
ata_read_log_page" return aAC_ERR_DEV, and makes the device malfunction (-> failed to set xfermode).
Quoted 7 lines
I am not that familiar with SATA and did not understand why the "
ata_read_log_page" can corrupt my mSATA device.The only thing what i can imagine is, that the Host controller does not support devslp (which is the case).
Does anybody of you have hint for me to fixe that problem in a clean way?
So, I suppose this is a fallout from 9faa643855df ("libata: use READ_LOG_DMA_EXT"). The description just says "we should try use it" but is there any benefit from using NCQ variant of read log page? I mean, it's used during config and error handling, so it's not like queueing is gonna help anything. It ends up issuing NCQ commands on controllers which don't support NCQ and causes failures on devices which lie about supporting the feature.
Thanks.
Signature · 1 line
tejun
Quoted 7 lines · Tejun Heo
So, I suppose this is a fallout from
9faa643855df("libata: useREAD_LOG_DMA_EXT"). The description just says "we should try use it" but is there any benefit from using NCQ variant of read log page? I mean, it's used during config and error handling, so it's not like queueing is gonna help anything. It ends up issuing NCQ commands on controllers which don't support NCQ and causes failures on devices which lie about supporting the feature.
Hmmm... so, the controller locks up on READ_LOG_EXT issued as pio? That's just weird. I suppose you can blacklist the controller so that any attempt to read the log page fails without actually issuing the command.
Thanks.
Signature · 1 line
tejun
Quoted 9 lines · Tejun Heo
Quoted 7 lines · Tejun Heo
So, I suppose this is a fallout from
9faa643855df("libata: useREAD_LOG_DMA_EXT"). The description just says "we should try use it" but is there any benefit from using NCQ variant of read log page? I mean, it's used during config and error handling, so it's not like queueing is gonna help anything. It ends up issuing NCQ commands on controllers which don't support NCQ and causes failures on devices which lie about supporting the feature.
Quoted 9 lines
Hmmm... so, the controller locks up on
READ_LOG_EXTissued as pio? That's just weird. I suppose you can blacklist the controller so that any attempt to read the log page fails without actually issuing the command.Thanks.
Signature · 1 line
tejun
Hi,
yes since i am using 3.14 where the READ_LOG_DMA_EXT is not it, it seems that the controller locks up even on READ_LOG_EXT as PIO.
I have checked the current ERRATA sheet of the CPU but there are no issues regarding this problem.
Test on a Freescale T4240 show the same behaviour as on P1013/P1022. It seems that some FSL Cpus are affected.
I have asked my FAE at Freescale if he has some information about that kind of issue.
Blacklisting the controller would be a solution yes, but I just wanna wait the answer from the FAE to be sure we really have a problem.
What kind of identifier can I use for blacklisting? The driver name from the host driver? (fsl-sata) I did not find any register in the sata controller to read out an ID.
Regards
Andy
Hello, Andreas.
Quoted 7 lines · Andreas Werner
Blacklisting the controller would be a solution yes, but I just wanna wait the answer from the FAE to be sure we really have a problem.
What kind of identifier can I use for blacklisting? The driver name from the host driver? (fsl-sata) I did not find any register in the sata controller to read out an ID.
Whatever matches the affected controllers. If all sata_fsl controllers are affected, the driver init code can set the flag unconditionally.
Thanks.
Signature · 1 line
tejun
Quoted 11 lines · Tejun Heo
Hello, Andreas.
Quoted 7 lines · Andreas Werner
Blacklisting the controller would be a solution yes, but I just wanna wait the answer from the FAE to be sure we really have a problem.
What kind of identifier can I use for blacklisting? The driver name from the host driver? (fsl-sata) I did not find any register in the sata controller to read out an ID.
Quoted 8 lines
Whatever matches the affected controllers. If all
sata_fslcontrollers are affected, the driver init code can set the flag unconditionally.Thanks.
Signature · 1 line
tejun
Ok, setting the flag in the controller driver would be good. (still wating for the FAE for more info).
As I can see the horkage field is only defind in "struct ata_dev" would it be time to add a horkage field to "struct ata_host"?
All the other "flag" fields in the structs are used and/or reserved and it seems to be no good place for such flags.
What I am thinking about is.
1. Add new flag e.g. ATA_HORKAGE_NOLOG_PAGE_RD
2. Add horkage field to ata_host struct
2. Set this flag in ata_host struct in the sata_fsl driver (init)
3. Copy the controller horkage flags over to struct ata_device in the ata_dev_configure function in libata
At the end all flags set by the controller are applied to the ata device horkage flags, and can be used for blacklisting in libata.
May be there are better solution, or i am missing something.
What do you think about it?
Regards
Andy
Hello,
Quoted 2 lines · Andreas Werner
All the other "flag" fields in the structs are used and/or reserved and it seems to be no good place for such flags.
You can use the port flags - ATA_FLAG_*.
Quoted 3 lines
What I am thinking about is.
1. Add new flag e.g.
ATA_HORKAGE_NOLOG_PAGE_RD
ATA_FLAG_NO_LOG_PAGE?
Thanks.
Signature · 1 line
tejun
Quoted 6 lines · Tejun Heo
Hello,
Quoted 2 lines · Andreas Werner
All the other "flag" fields in the structs are used and/or reserved and it seems to be no good place for such flags.
Quoted 7 lines
You can use the port flags - ATA_FLAG_*.
Quoted 3 lines
What I am thinking about is.
1. Add new flag e.g.
ATA_HORKAGE_NOLOG_PAGE_RD
ATA_FLAG_NO_LOG_PAGE?
That seems to be much more simpler than my idea :-) Did not see the port stuff, i was focused on the host struct.
Thank you for the hint. I will prepare a Patch next week.
Quoted 5 lines
Thanks.
Signature · 1 line
tejun
Regards
Andy