ahci minor quirk cleanups
Niklas Cassel
maintainercover ahci minor quirk cleanups
Hello all,
Here comes some minor AHCI quirk cleanups.
Kind regards,
Niklas
Niklas Cassel (2):
ahci: rename board_ahci_nosntf
ahci: clean up ahci_broken_devslp quirk
drivers/ata/ahci.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-)
Signature · 1 line
2.43.0
Niklas Cassel
maintainerPATCH 1/2 ahci: rename board_ahci_nosntf
Commit 7edbb6059274 ("ahci: clean up intel_pcs_quirk") added a new board type (board_ahci_pcs_quirk) which applies the Intel PCS quirk for legacy platforms. However, it also modified board_ahci_avn and board_ahci_nosntf to apply the same quirk.
board_ahci_avn is defined under the label:
/* board IDs for specific chipsets in alphabetical order */ This is a board for a specific chipset, so the naming is perfectly fine. (The name does not need to be suffixed with _pcs_quirk, since all controllers for this chipset require the quirk to be applied).
board_ahci_nosntf is defined under the label:
/* board IDs by feature in alphabetical order */
This is a board for a specific feature/quirk. However, it is used to apply two different quirks.
Rename board_ahci_nosntf to more clearly highlight that this board ID applies two different quirks.
--- drivers/ata/ahci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/ata/ahci.c +3 -3
@@ -53,7 +53,7 @@ enum board_ids { board_ahci_no_debounce_delay, board_ahci_nomsi, board_ahci_noncq, - board_ahci_nosntf, + board_ahci_nosntf_pcs_quirk,/* * board_ahci_pcs_quirk is for legacy Intel platforms. * Modern Intel platforms should use board_ahci instead.
@@ -165,7 +165,7 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, - [board_ahci_nosntf] = { + [board_ahci_nosntf_pcs_quirk] = {AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF | AHCI_HFLAG_INTEL_PCS_QUIRK), .flags = AHCI_FLAG_COMMON,
@@ -271,7 +271,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x2683), board_ahci_pcs_quirk }, /* ESB2 */ { PCI_VDEVICE(INTEL, 0x27c6), board_ahci_pcs_quirk }, /* ICH7-M DH */ { PCI_VDEVICE(INTEL, 0x2821), board_ahci_pcs_quirk }, /* ICH8 */ - { PCI_VDEVICE(INTEL, 0x2822), board_ahci_nosntf }, /* ICH8/Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0x2822), board_ahci_nosntf_pcs_quirk }, /* ICH8/Lewisburg RAID*/ { PCI_VDEVICE(INTEL, 0x2824), board_ahci_pcs_quirk }, /* ICH8 */ { PCI_VDEVICE(INTEL, 0x2829), board_ahci_pcs_quirk }, /* ICH8M */ { PCI_VDEVICE(INTEL, 0x282a), board_ahci_pcs_quirk }, /* ICH8M */
Signature · 1 line
2.43.0
Re: [PATCH 1/2] ahci: rename board_ahci_nosntf
Quoted 48 lines · Niklas Cassel
Commit
7edbb6059274("ahci: clean upintel_pcs_quirk") added a new board type (board_ahci_pcs_quirk) which applies the Intel PCS quirk for legacy platforms. However, it also modifiedboard_ahci_avnandboard_ahci_nosntfto apply the same quirk.
board_ahci_avnis defined under the label:
/* board IDs for specific chipsets in alphabetical order */ This is a board for a specific chipset, so the naming is perfectly fine. (The name does not need to be suffixed with_pcs_quirk, since all controllers for this chipset require the quirk to be applied).
board_ahci_nosntfis defined under the label:
/* board IDs by feature in alphabetical order */
This is a board for a specific feature/quirk. However, it is used to apply two different quirks.Rename
board_ahci_nosntfto more clearly highlight that this board ID applies two different quirks.Fixes 7edbb6059274 ("ahci: clean up intel_pcs_quirk")Signed-off-by Niklas Cassel <[email protected]>--- drivers/ata/ahci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)drivers/ata/ahci.c +2
-2@@ -53,7 +53,7 @@ enum board_ids { board_ahci_no_debounce_delay, board_ahci_nomsi, board_ahci_noncq, - board_ahci_nosntf, + board_ahci_nosntf_pcs_quirk,/* * board_ahci_pcs_quirk is for legacy Intel platforms. * Modern Intel platforms should use board_ahci instead. @@ -165,7 +165,7 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, - [board_ahci_nosntf] = { + [board_ahci_nosntf_pcs_quirk] = {AHCI_HFLAGS (AHCI_HFLAG_NO_SNTF | AHCI_HFLAG_INTEL_PCS_QUIRK), .flags = AHCI_FLAG_COMMON,
drivers/ata/ahci.c static const struct pci_device_id ahci_pci_tbl[] = { · line 274
Quoted 5 lines
drivers/ata/ahci.c +1
-1@@ -271,7 +271,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x2683), board_ahci_pcs_quirk }, /* ESB2 */ { PCI_VDEVICE(INTEL, 0x27c6), board_ahci_pcs_quirk }, /* ICH7-M DH */ { PCI_VDEVICE(INTEL, 0x2821), board_ahci_pcs_quirk }, /* ICH8 */ - { PCI_VDEVICE(INTEL, 0x2822), board_ahci_nosntf }, /* ICH8/Lewisburg RAID*/ + { PCI_VDEVICE(INTEL, 0x2822), board_ahci_nosntf_pcs_quirk }, /* ICH8/Lewisburg RAID*/
Minor nit: I would name the board board_ahci_pcs_quirk_nosntf to make it easier to see that this is a sub case of the general board_ahci_pcs_quirk.
drivers/ata/ahci.c static const struct pci_device_id ahci_pci_tbl[] = { · line 277
Quoted 3 lines
drivers/ata/ahci.c +0
-0{ PCI_VDEVICE(INTEL, 0x2824), board_ahci_pcs_quirk }, /* ICH8 */ { PCI_VDEVICE(INTEL, 0x2829), board_ahci_pcs_quirk }, /* ICH8M */ { PCI_VDEVICE(INTEL, 0x282a), board_ahci_pcs_quirk }, /* ICH8M */
With that, this look good.
Signature · 2 lines
Damien Le Moal Western Digital Research
Niklas Cassel
maintainerPATCH 2/2 ahci: clean up ahci_broken_devslp quirk
In reply to Niklas CasselMost quirks are applied using a specific board type board_ahci_no* (e.g. board_ahci_nomsi, board_ahci_noncq), which then sets a flag representing the specific quirk.
ahci_pci_tbl (which is the table of all supported PCI devices), then uses that board type for the PCI vendor and device IDs which need to be quirked.
The ahci_broken_devslp quirk is not implemented in this standard way.
Modify the ahci_broken_devslp quirk to be implemented like the other quirks. This way, we will not have the same PCI device and vendor ID scattered over ahci.c. It will simply be defined in a single location.
--- drivers/ata/ahci.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-)
drivers/ata/ahci.c +10 -16
@@ -51,6 +51,7 @@ enum board_ids { board_ahci_43bit_dma, board_ahci_ign_iferr, board_ahci_no_debounce_delay, + board_ahci_no_devslp_pcs_quirk, board_ahci_nomsi, board_ahci_noncq, board_ahci_nosntf_pcs_quirk,
@@ -151,6 +152,14 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, + [board_ahci_no_devslp_pcs_quirk] = { +AHCI_HFLAGS (AHCI_HFLAG_NO_DEVSLP | + AHCI_HFLAG_INTEL_PCS_QUIRK), + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &ahci_ops, + }, [board_ahci_nomsi] = { AHCI_HFLAGS (AHCI_HFLAG_NO_MSI), .flags = AHCI_FLAG_COMMON,
@@ -420,7 +429,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x06d7), board_ahci_pcs_quirk }, /* Comet Lake-H RAID */ { PCI_VDEVICE(INTEL, 0xa386), board_ahci_pcs_quirk }, /* Comet Lake PCH-V RAID */ { PCI_VDEVICE(INTEL, 0x0f22), board_ahci_pcs_quirk }, /* Bay Trail AHCI */ - { PCI_VDEVICE(INTEL, 0x0f23), board_ahci_pcs_quirk }, /* Bay Trail AHCI */ + { PCI_VDEVICE(INTEL, 0x0f23), board_ahci_no_devslp_pcs_quirk }, /* Bay Trail AHCI */ { PCI_VDEVICE(INTEL, 0x22a3), board_ahci_pcs_quirk }, /* Cherry Tr. AHCI */ { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_pcs_quirk }, /* ApolloLake AHCI */ { PCI_VDEVICE(INTEL, 0x34d3), board_ahci_pcs_quirk }, /* Ice Lake LP AHCI */
@@ -1420,17 +1429,6 @@ static bool ahci_broken_online(struct pci_dev *pdev)return pdev->bus->number == (val >>8 ) && pdev->devfn == (val &0xff ); } -static bool ahci_broken_devslp (struct pci_dev *pdev) -{ -/* device with broken DEVSLP but still showing SDS capability */ -static const struct pci_device_id ids[] = { - {PCI_VDEVICE (INTEL ,0x0f23 )},/* Valleyview SoC */ - {} - }; - -return pci_match_id (ids, pdev); -} -#ifdef CONFIG_ATA_ACPI static void ahci_gtf_filter_workaround (struct ata_host *host) {
@@ -1823,10 +1821,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) &dev_attr_remapped_nvme.attr, NULL); -/* must set flag prior to save config in order to take effect */ -if (ahci_broken_devslp (pdev)) - hpriv->flags |=AHCI_HFLAG_NO_DEVSLP ; -#ifdef CONFIG_ARM64 if (pdev->vendor == PCI_VENDOR_ID_HUAWEI && pdev->device == 0xa235 &&
Signature · 1 line
2.43.0
Re: [PATCH 2/2] ahci: clean up ahci_broken_devslp quirk
Quoted 48 lines · Niklas Cassel
Most quirks are applied using a specific board type board_ahci_no* (e.g.
board_ahci_nomsi,board_ahci_noncq), which then sets a flag representing the specific quirk.
ahci_pci_tbl(which is the table of all supported PCI devices), then uses that board type for the PCI vendor and device IDs which need to be quirked.The
ahci_broken_devslpquirk is not implemented in this standard way.Modify the
ahci_broken_devslpquirk to be implemented like the other quirks. This way, we will not have the same PCI device and vendor ID scattered overahci.c. It will simply be defined in a single location.Suggested-by Dan Williams <[email protected]>Signed-off-by Niklas Cassel <[email protected]>--- drivers/ata/ahci.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-)drivers/ata/ahci.c +9
-0@@ -51,6 +51,7 @@ enum board_ids { board_ahci_43bit_dma, board_ahci_ign_iferr, board_ahci_no_debounce_delay, + board_ahci_no_devslp_pcs_quirk, board_ahci_nomsi, board_ahci_noncq, board_ahci_nosntf_pcs_quirk,@@ -151,6 +152,14 @@ static const struct ata_port_info ahci_port_info[] = { .udma_mask = ATA_UDMA6, .port_ops = &ahci_ops, }, + [board_ahci_no_devslp_pcs_quirk] = { +AHCI_HFLAGS (AHCI_HFLAG_NO_DEVSLP | + AHCI_HFLAG_INTEL_PCS_QUIRK), + .flags = AHCI_FLAG_COMMON, + .pio_mask = ATA_PIO4, + .udma_mask = ATA_UDMA6, + .port_ops = &ahci_ops, + }, [board_ahci_nomsi] = { AHCI_HFLAGS (AHCI_HFLAG_NO_MSI), .flags = AHCI_FLAG_COMMON,
drivers/ata/ahci.c static const struct pci_device_id ahci_pci_tbl[] = { · line 432
Quoted 5 lines
drivers/ata/ahci.c +1
-1@@ -420,7 +429,7 @@ static const struct pci_device_id ahci_pci_tbl[] = { { PCI_VDEVICE(INTEL, 0x06d7), board_ahci_pcs_quirk }, /* Comet Lake-H RAID */ { PCI_VDEVICE(INTEL, 0xa386), board_ahci_pcs_quirk }, /* Comet Lake PCH-V RAID */ { PCI_VDEVICE(INTEL, 0x0f22), board_ahci_pcs_quirk }, /* Bay Trail AHCI */ - { PCI_VDEVICE(INTEL, 0x0f23), board_ahci_pcs_quirk }, /* Bay Trail AHCI */ + { PCI_VDEVICE(INTEL, 0x0f23), board_ahci_no_devslp_pcs_quirk }, /* Bay Trail AHCI */
Same nit as the previous patch: let's name this board_ahci_pcs_quirk_no_devslp.
With that, looks OK to me.
Quoted 32 lines
drivers/ata/ahci.c +0
-15{ PCI_VDEVICE(INTEL, 0x22a3), board_ahci_pcs_quirk }, /* Cherry Tr. AHCI */ { PCI_VDEVICE(INTEL, 0x5ae3), board_ahci_pcs_quirk }, /* ApolloLake AHCI */ { PCI_VDEVICE(INTEL, 0x34d3), board_ahci_pcs_quirk }, /* Ice Lake LP AHCI */@@ -1420,17 +1429,6 @@ static bool ahci_broken_online(struct pci_dev *pdev)return pdev->bus->number == (val >>8 ) && pdev->devfn == (val &0xff ); } -static bool ahci_broken_devslp (struct pci_dev *pdev) -{ -/* device with broken DEVSLP but still showing SDS capability */ -static const struct pci_device_id ids[] = { - {PCI_VDEVICE (INTEL ,0x0f23 )},/* Valleyview SoC */ - {} - }; - -return pci_match_id (ids, pdev); -} -#ifdef CONFIG_ATA_ACPI static void ahci_gtf_filter_workaround (struct ata_host *host) {@@ -1823,10 +1821,6 @@ static int ahci_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) &dev_attr_remapped_nvme.attr, NULL); -/* must set flag prior to save config in order to take effect */ -if (ahci_broken_devslp (pdev)) - hpriv->flags |=AHCI_HFLAG_NO_DEVSLP ; -#ifdef CONFIG_ARM64 if (pdev->vendor == PCI_VENDOR_ID_HUAWEI && pdev->device == 0xa235 &&
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 5 lines · Niklas Cassel
Hello all,
Here comes some minor AHCI quirk cleanups.
Quoted 7 lines
Kind regards,
NiklasNiklas Cassel (2):
ahci: renameboard_ahci_nosntf
ahci: clean upahci_broken_devslpquirk
Both,
Quoted 9 lines · Niklas Cassel
Hello all,
Here comes some minor AHCI quirk cleanups.
Kind regards,
Niklas
Quoted 6 lines
Niklas Cassel (2):
ahci: renameboard_ahci_nosntf
ahci: clean upahci_broken_devslpquirkdrivers/ata/ahci.c | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-)
Looks good and net lines removed, nice.