Skip to contentSkip to conversation

ATA: ahci: Add Intel PCH-S RAID device ID

PATCH Superseded Roman Gardzinski 3 participants 3 messages Oct 27 libata

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ATA: ahci: Add Intel PCH-S RAID device ID

Add support for SATA devices in RAID mode for Nova Lake. No functional changes.

---
 drivers/ata/ahci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/ata/ahci.c +4 -0
index 9b8c0935001c..c60e7ba24502 100644
@@ -283,6 +283,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 		/* Comet Lake PCH-H RAID */
 		PCI_VDEVICE(INTEL, 0x06d6),
 		.driver_data = board_ahci_pcs_quirk,
+	}, {
+		/* Nova Lake PCH-S RAID */
+		PCI_VDEVICE(INTEL, 0x6e66),
+		.driver_data = board_ahci_pcs_quirk,
 	}, {
 		/* ICH6 */
 		PCI_VDEVICE(INTEL, 0x2652),
Signature · 1 line
2.53.0
#1 lore raw
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] ata: ahci: Nova Lake PCH-S RAID entry uses legacy board_ahci_pcs_quirk --

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] ata: ahci: Nova Lake PCH-S RAID entry uses legacy board_ahci_pcs_quirk --

commit 2589d3b85f965fdaa155298cf5da322c956d8de2
Author: Roman Gardzinski <[email protected]>

ATA: ahci: Add Intel PCH-S RAID device ID

This commit adds the Intel Nova Lake PCH-S RAID PCI device ID (0x6e66) to ahci_pci_tbl in drivers/ata/ahci.c.

drivers/ata/ahci.c static const struct pci_device_id ahci_pci_tbl[] = { · line 280

Quoted 12 lines
drivers/ata/ahci.c +4 -0
index 3c38ee3314ee9..f4b6235452dbd 100644
@@ -274,6 +274,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 		/* Comet Lake PCH-H RAID */
 		PCI_VDEVICE(INTEL, 0x06d6),
 		.driver_data = board_ahci_pcs_quirk,
+	}, {
+		/* Nova Lake PCH-S RAID */
+		PCI_VDEVICE(INTEL, 0x6e66),
+		.driver_data = board_ahci_pcs_quirk,

[Severity: High]
Should this new Nova Lake PCH-S RAID entry in ahci_pci_tbl use board_ahci instead of board_ahci_pcs_quirk?

In drivers/ata/ahci.c, enum board_ids notes that board_ahci_pcs_quirk is only for legacy Intel platforms:

/*
* board_ahci_pcs_quirk is for legacy Intel platforms.
* Modern Intel platforms should use board_ahci instead.
* (Some modern Intel platforms might have been added with
* board_ahci_pcs_quirk, however, we cannot change them to board_ahci
* without testing that the platform actually works without the quirk.) */
board_ahci_pcs_quirk,

Using board_ahci_pcs_quirk sets AHCI_HFLAG_INTEL_PCS_QUIRK in ahci_port_info[]. When the controller is probed, resumed, or reset via:

ahci_init_one() / ahci_pci_device_runtime_resume() / ahci_pci_device_resume()

    -> ahci_pci_reset_controller()
      -> ahci_intel_pcs_quirk()

ahci_intel_pcs_quirk() reads and writes hpriv->port_map into the legacy 6-port PCS_6 PCI configuration register (offset 0x92):

	pci_read_config_word(pdev, PCS_6, &tmp16);
	if ((tmp16 & hpriv->port_map) != hpriv->port_map) {
		tmp16 |= hpriv->port_map;
		pci_write_config_word(pdev, PCS_6, tmp16);
	}

On modern Intel platforms (and PCH-S controllers where the legacy 6-port PCS_6 layout does not apply), applying this quirk has previously caused regressions that broke SATA drive detection, as seen in commit 7edbb6059274 and commit 9e2f46cd8747. When the same Nova Lake controller is in AHCI mode, it matches PCI_DEVICE_CLASS(PCI_CLASS_STORAGE_SATA_AHCI, 0xffffff) and uses board_ahci.

Also, the commit message states "No functional changes", even though adding a new PCI device ID enables driver binding for this hardware. Could the entry be updated to use board_ahci and the commit message adjusted accordingly?

Signature · 1 line
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=1
maintainer
#2 lore raw
In reply to Roman Gardzinski

Hello Roman,

Quoted 15 lines · Roman Gardzinski

Add support for SATA devices in RAID mode for Nova Lake. No functional changes.

---
 drivers/ata/ahci.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/ata/ahci.c +0 -0
index 9b8c0935001c..c60e7ba24502 100644

drivers/ata/ahci.c static const struct pci_device_id ahci_pci_tbl[] = { · line 289

Quoted 7 lines
drivers/ata/ahci.c +4 -0
@@ -283,6 +283,10 @@ static const struct pci_device_id ahci_pci_tbl[] = {
 		/* Comet Lake PCH-H RAID */
 		PCI_VDEVICE(INTEL, 0x06d6),
 		.driver_data = board_ahci_pcs_quirk,
+	}, {
+		/* Nova Lake PCH-S RAID */
+		PCI_VDEVICE(INTEL, 0x6e66),
+		.driver_data = board_ahci_pcs_quirk,

Commit message should probably say something like:

When the Intel Nova Lake SATA controller is configured in RAID mode (rather than AHCI), the generic entry in ahci_pci_tbl which matches any device with the PCI class code for AHCI, is not sufficient, since the SATA controller in RAID mode uses a different PCI class code.

Like Sashiko also said, please also check if this entry (for RAID mode) should use board_ahci_pcs_quirk or board_ahci.

Kind regards,
Niklas