Cleanup ahci_broken_lpm()
Niklas Cassel
maintainerv2 cover Cleanup ahci_broken_lpm()
Hello all,
This series cleans up ahci_broken_lpm(), and adds ASUSPRO-D840SA to the table of boards with broken LPM.
Kind regards,
Niklas
Changes since v1:
-Addressed review comments from Hans.
Niklas Cassel (3):
ata: ahci: Use correct BIOS build date for ThinkPad W541 quirk
ata: ahci: Refactor ahci_broken_lpm()
ata: ahci: Disallow LPM for ASUSPRO-D840SA motherboard
drivers/ata/ahci.c | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-)
Signature · 1 line
2.49.0
Niklas Cassel
maintainerPATCH v2 1/3 ata: ahci: Use correct BIOS build date for ThinkPad W541 quirk
Fix the TODO in ahci_broken_lpm() by using the proper BIOS build date.
The proper BIOS build date was provided by Hans, see Link.
--- drivers/ata/ahci.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/ata/ahci.c +1 -7
@@ -1438,13 +1438,7 @@ static bool ahci_broken_lpm(struct pci_dev *pdev) DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W541"), }, - /* - * Note date based on release notes, 2.35 has been - * reported to be good, but I've been unable to get - * a hold of the reporter to get the DMI BIOS date. - * TODO: fix this. - */ - .driver_data = "20180310", /* 2.35 */ + .driver_data = "20180409", /* 2.35 */ }, { }/* terminate list */ };
Signature · 1 line
2.49.0
Re: [PATCH v2 1/3] ata: ahci: Use correct BIOS build date for ThinkPad W541 quirk
Hi,
Quoted 6 lines · Niklas Cassel
Fix the TODO in
ahci_broken_lpm()by using the proper BIOS build date.The proper BIOS build date was provided by Hans, see Link.
Thanks, patch looks good to me:
Regards,
Hans
Quoted 23 lines
--- drivers/ata/ahci.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)drivers/ata/ahci.c +1
-7@@ -1438,13 +1438,7 @@ static bool ahci_broken_lpm(struct pci_dev *pdev) DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"), DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad W541"), }, - /* - * Note date based on release notes, 2.35 has been - * reported to be good, but I've been unable to get - * a hold of the reporter to get the DMI BIOS date. - * TODO: fix this. - */ - .driver_data = "20180310", /* 2.35 */ + .driver_data = "20180409", /* 2.35 */ }, { }/* terminate list */ };
Re: [PATCH v2 1/3] ata: ahci: Use correct BIOS build date for ThinkPad W541 quirk
In reply to Niklas CasselQuoted 6 lines · Niklas Cassel
Fix the TODO in
ahci_broken_lpm()by using the proper BIOS build date.The proper BIOS build date was provided by Hans, see Link.
Signature · 2 lines
Damien Le Moal Western Digital Research
Niklas Cassel
maintainerPATCH v2 2/3 ata: ahci: Refactor ahci_broken_lpm()
In reply to Niklas CasselCurrently, the match table in ahci_broken_lpm() contains DMI BIOS dates of BIOSes that are known to be working.
Having a list of known to be working versions is usually the wrong way to do things (as this list could theoretically be infinite).
Refactor this match table to contain DMI BIOS dates of BIOSes that are known to not be working, such that this list can be extended with BIOS versions (for other boards) that are known to not be working, where there is no good BIOS version (because all existing versions are broken).
--- drivers/ata/ahci.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/ata/ahci.c +22 -6
@@ -1411,34 +1411,50 @@ static bool ahci_broken_suspend(struct pci_dev *pdev)static bool ahci_broken_lpm (struct pci_dev *pdev) {static const struct dmi_system_id sysids[] = { -/* Various Lenovo 50 series have LPM issues with older BIOSen */ +/* Table contains DMI BIOS dates of BIOSes with broken LPM. */ { .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"ThinkPad X250" ), }, - .driver_data ="20180406" ,/* 1.31 */ +/* +* 1.31, build date 20180406, has working LPM, mark any +* DMI BIOS date before that as broken. +*/ + .driver_data ="20180405" , }, { .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"ThinkPad L450" ), }, - .driver_data ="20180420" ,/* 1.28 */ +/* +* 1.28, build date 20180420, has working LPM, mark any +* DMI BIOS date before that as broken. +*/ + .driver_data ="20180419" , }, { .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"ThinkPad T450s" ), }, - .driver_data ="20180315" ,/* 1.33 */ +/* +* 1.33, build date 20180315, has working LPM, mark any +* DMI BIOS date before that as broken. +*/ + .driver_data ="20180314" , }, { .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ),DMI_MATCH (DMI_PRODUCT_VERSION ,"ThinkPad W541" ), }, - .driver_data ="20180409" ,/* 2.35 */ +/* +* 2.35, build date 20180409, has working LPM, mark any +* DMI BIOS date before that as broken. +*/ + .driver_data ="20180408" , }, { }/* terminate list */ };
@@ -1452,7 +1468,7 @@ static bool ahci_broken_lpm(struct pci_dev *pdev)dmi_get_date (DMI_BIOS_DATE , &year, &month, &date);snprintf (buf,sizeof (buf),"%04d%02d%02d" , year, month, date); -return strcmp (buf, dmi->driver_data) <0 ; +return strcmp (buf, dmi->driver_data) <=0 ; }static bool ahci_broken_online (struct pci_dev *pdev)
Signature · 1 line
2.49.0
Re: [PATCH v2 2/3] ata: ahci: Refactor ahci_broken_lpm()
Quoted 6 lines · Niklas Cassel
Currently, the match table in
ahci_broken_lpm()contains DMI BIOS dates of BIOSes that are known to be working.Having a list of known to be working versions is usually the wrong way to do things (as this list could theoretically be infinite).
Quoted 7 lines
Refactor this match table to contain DMI BIOS dates of BIOSes that are known to not be working, such that this list can be extended with BIOS versions (for other boards) that are known to not be working, where there is no good BIOS version (because all existing versions are broken).
Reviewed-by Hans de Goede <[email protected]>Signed-off-by Niklas Cassel <[email protected]>
Signature · 2 lines
Damien Le Moal Western Digital Research
Niklas Cassel
maintainerPATCH v2 3/3 ata: ahci: Disallow LPM for ASUSPRO-D840SA motherboard
In reply to Niklas CasselA user has bisected a regression which causes graphical corruptions on his screen to commit 7627a0edef54 ("ata: ahci: Drop low power policy board type").
Simply reverting commit 7627a0edef54 ("ata: ahci: Drop low power policy board type") makes the graphical corruptions on his screen to go away. (Note: there are no visible messages in dmesg that indicates a problem with AHCI.)
The user also reports that the problem occurs regardless if there is an HDD or an SSD connected via AHCI, so the problem is not device related.
The devices also work fine on other motherboards, so it seems specific to the ASUSPRO-D840SA motherboard.
While enabling low power modes for AHCI is not supposed to affect completely unrelated hardware, like a graphics card, it does however allow the system to enter deeper PC-states, which could expose ACPI issues that were previously not visible (because the system never entered these lower power states before).
There are previous examples where enabling LPM exposed serious BIOS/ACPI bugs, see e.g. commit 240630e61870 ("ahci: Disable LPM on Lenovo 50 series laptops with a too old BIOS").
Since there hasn't been any BIOS update in years for the ASUSPRO-D840SA motherboard, disable LPM for this board, in order to avoid entering lower PC-states, which triggers graphical corruptions.
--- drivers/ata/ahci.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/ata/ahci.c +11 -0
@@ -1456,6 +1456,17 @@ static bool ahci_broken_lpm(struct pci_dev *pdev)*/ .driver_data = "20180408", }, + { + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), + DMI_MATCH(DMI_PRODUCT_VERSION, "ASUSPRO D840MB_M840SA"), + }, + /* + * 320, build date 20230208, has broken LPM, no working + * BIOS exists at the time of writing. + */ + .driver_data = "20230208", + }, { } /* terminate list */ }; const struct dmi_system_id *dmi = dmi_first_match(sysids);
Signature · 1 line
2.49.0
Re: [PATCH v2 3/3] ata: ahci: Disallow LPM for ASUSPRO-D840SA motherboard
Quoted 29 lines · Niklas Cassel
A user has bisected a regression which causes graphical corruptions on his screen to commit
7627a0edef54("ata: ahci: Drop low power policy board type").Simply reverting commit
7627a0edef54("ata: ahci: Drop low power policy board type") makes the graphical corruptions on his screen to go away. (Note: there are no visible messages in dmesg that indicates a problem with AHCI.)The user also reports that the problem occurs regardless if there is an HDD or an SSD connected via AHCI, so the problem is not device related.
The devices also work fine on other motherboards, so it seems specific to the ASUSPRO-D840SA motherboard.
While enabling low power modes for AHCI is not supposed to affect completely unrelated hardware, like a graphics card, it does however allow the system to enter deeper PC-states, which could expose ACPI issues that were previously not visible (because the system never entered these lower power states before).
There are previous examples where enabling LPM exposed serious BIOS/ACPI bugs, see e.g. commit
240630e61870("ahci: Disable LPM on Lenovo 50 series laptops with a too old BIOS").Since there hasn't been any BIOS update in years for the ASUSPRO-D840SA motherboard, disable LPM for this board, in order to avoid entering lower PC-states, which triggers graphical corruptions.
Quoted 6 lines
Cc [email protected] # Depends on ahci_broken_lpm() refactorReviewed-by Hans de Goede <[email protected]>Reported-by Andy Yang <[email protected]>Fixes 7627a0edef54 ("ata: ahci: Drop low power policy board type")Signed-off-by Niklas Cassel <[email protected]>
Signature · 2 lines
Damien Le Moal Western Digital Research
Quoted 8 lines · Niklas Cassel
This series cleans up
ahci_broken_lpm(), and adds ASUSPRO-D840SA to the table of boards with broken LPM.Kind regards,
Niklas[...]
Applied to libata/linux.git (for-6.16-fixes), thanks!
[1/3] ata: ahci: Use correct BIOS build date for ThinkPad W541 quirk
https://git.kernel.org/libata/linux/c/6f29d393 [2/3] ata: ahci: Refactor ahci_broken_lpm() https://git.kernel.org/libata/linux/c/e3ea4ae4 [3/3] ata: ahci: Disallow LPM for ASUSPRO-D840SA motherboard https://git.kernel.org/libata/linux/c/4b151c71
Kind regards,
Niklas
Niklas Cassel
maintainerQuoted 10 lines · Niklas Cassel
Quoted 8 lines · Niklas Cassel
This series cleans up
ahci_broken_lpm(), and adds ASUSPRO-D840SA to the table of boards with broken LPM.Kind regards,
Niklas[...]
Quoted 8 lines
Applied to libata/linux.git (for-6.16-fixes), thanks!
[1/3] ata: ahci: Use correct BIOS build date for ThinkPad W541 quirk
https://git.kernel.org/libata/linux/c/6f29d393 [2/3] ata: ahci: Refactor ahci_broken_lpm() https://git.kernel.org/libata/linux/c/e3ea4ae4 [3/3] ata: ahci: Disallow LPM for ASUSPRO-D840SA motherboard https://git.kernel.org/libata/linux/c/4b151c71
Patch [2/3] and [3/3] have been dropped from for-6.16-fixes, will rework these as Mikko pointed out that the solution is not really future proof.
Patch [1/3] is kept.
Kind regards,
Niklas