Unverified Commit df325a53 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!3171 [OLK-6.6] ata: libata: disabling PhyRdy Change Interrupt based on actual LPM capability

Merge Pull Request from: @leoliu-oc 
 
The ahci spec mentions that PhyRdy Change Interrupt and Link Power Management (LPM) do not coexist.
	
However, before enabling LPM, the driver did not check whether the host supports LPM, but directly disabled PhyRdy Change Interrupt.
	
Increase the judgment on the actual support of LPM, and disable PhyRdy Change Interrupt only when it is supported.

### Issue
https://gitee.com/openeuler/kernel/issues/I8WYN1

### Test
Pass: Because the BIOS only turned off the slumber function of the link power management feature, the partial function was still enabled. Without importing the patch, the link power status was 0x631, which is not supported. With the patch imported, the link power status was 0x231 or 0x133, which is expected. 
 
Link:https://gitee.com/openeuler/kernel/pulls/3171

 

Reviewed-by: default avatarzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: default avatarXie XiuQi <xiexiuqi@huawei.com>
parents 8bb1c3d5 33e6654e
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -3371,6 +3371,8 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
			  struct ata_device **r_failed_dev)
{
	struct ata_port *ap = ata_is_host_link(link) ? link->ap : NULL;
	struct device *device = ap ? ap->host->dev : NULL;
	struct pci_dev *pdev = (!device || !dev_is_pci(device)) ? NULL : to_pci_dev(device);
	struct ata_eh_context *ehc = &link->eh_context;
	struct ata_device *dev, *link_dev = NULL, *lpm_dev = NULL;
	enum ata_lpm_policy old_policy = link->lpm_policy;
@@ -3379,6 +3381,11 @@ static int ata_eh_set_lpm(struct ata_link *link, enum ata_lpm_policy policy,
	unsigned int err_mask;
	int rc;

	/* if controller does not support lpm, then sets no LPM flags*/
	if ((pdev && pdev->vendor == PCI_VENDOR_ID_ZHAOXIN) &&
		!(~ap->host->flags & (ATA_HOST_NO_PART | ATA_HOST_NO_SSC | ATA_HOST_NO_DEVSLP)))
		link->flags |= ATA_LFLAG_NO_LPM;

	/* if the link or host doesn't do LPM, noop */
	if (!IS_ENABLED(CONFIG_SATA_HOST) ||
	    (link->flags & ATA_LFLAG_NO_LPM) || (ap && !ap->ops->set_lpm))