Skip to content

Commit 17188c4

Browse files
committed
Merge: AHCI driver update for 9.5
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4642 JIRA: https://issues.redhat.com/browse/RHEL-23829 Upstream Status: From upstream linux mainline Depends: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/4106 This patch series contains updates to the AHCI/ATA subsystem. Omitted-fix: 1066fe8 ("ata: libata-core: Add ATA_HORKAGE_NOLPM for all Crucial BX SSD1 models") Omitted-fix: fa997b0 ("ata: ahci: Do not enable LPM if no LPM states are supported by the HBA") Omitted-fix: a6a75ed ("ata: libata-scsi: Set the RMB bit only for removable media devices") Omitted-fix: 4b08573 ("ata: libata-core: Do not try to set sleeping devices to standby") Omitted-fix: 0c76106 ("scsi: sd: Fix TCG OPAL unlock on system resume") Omitted-fix: f6549f5 ("ata,scsi: libata-core: Do not leak memory for ata_port struct members") Signed-off-by: Ewan D. Milne <emilne@redhat.com> Approved-by: Tomas Henzl <thenzl@redhat.com> Approved-by: John Meneghini <jmeneghi@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Lucas Zampieri <lzampier@redhat.com>
2 parents 7a49148 + 5430e44 commit 17188c4

File tree

19 files changed

+1650
-433
lines changed

19 files changed

+1650
-433
lines changed

drivers/ata/Kconfig

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,13 +116,14 @@ config SATA_AHCI
116116
If unsure, say N.
117117

118118
config SATA_MOBILE_LPM_POLICY
119-
int "Default SATA Link Power Management policy for mobile chipsets"
119+
int "Default SATA Link Power Management policy"
120120
range 0 4
121121
default 0
122122
depends on SATA_AHCI
123123
help
124124
Select the Default SATA Link Power Management (LPM) policy to use
125-
for mobile / laptop variants of chipsets / "South Bridges".
125+
for chipsets / "South Bridges" supporting low-power modes. Such
126+
chipsets are ubiquitous across laptops, desktops and servers.
126127

127128
The value set has the following meanings:
128129
0 => Keep firmware settings

drivers/ata/ahci.c

Lines changed: 325 additions & 230 deletions
Large diffs are not rendered by default.

drivers/ata/ahci.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -241,12 +241,11 @@ enum {
241241
AHCI_HFLAG_YES_ALPM = BIT(23), /* force ALPM cap on */
242242
AHCI_HFLAG_NO_WRITE_TO_RO = BIT(24), /* don't write to read
243243
only registers */
244-
AHCI_HFLAG_USE_LPM_POLICY = BIT(25), /* chipset that should use
245-
SATA_MOBILE_LPM_POLICY
246-
as default lpm_policy */
247-
AHCI_HFLAG_SUSPEND_PHYS = BIT(26), /* handle PHYs during
244+
AHCI_HFLAG_SUSPEND_PHYS = BIT(25), /* handle PHYs during
248245
suspend/resume */
249-
AHCI_HFLAG_NO_SXS = BIT(28), /* SXS not supported */
246+
AHCI_HFLAG_NO_SXS = BIT(26), /* SXS not supported */
247+
AHCI_HFLAG_43BIT_ONLY = BIT(27), /* 43bit DMA addr limit */
248+
AHCI_HFLAG_INTEL_PCS_QUIRK = BIT(28), /* apply Intel PCS quirk */
250249

251250
/* ap->flags bits */
252251

drivers/ata/ahci_mtk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ static int mtk_ahci_parse_property(struct ahci_host_priv *hpriv,
106106
struct device_node *np = dev->of_node;
107107

108108
/* enable SATA function if needed */
109-
if (of_find_property(np, "mediatek,phy-mode", NULL)) {
109+
if (of_property_present(np, "mediatek,phy-mode")) {
110110
plat->mode = syscon_regmap_lookup_by_phandle(
111111
np, "mediatek,phy-mode");
112112
if (IS_ERR(plat->mode)) {

drivers/ata/ahci_xgene.c

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@
1313
#include <linux/module.h>
1414
#include <linux/platform_device.h>
1515
#include <linux/ahci_platform.h>
16-
#include <linux/of_address.h>
17-
#include <linux/of_device.h>
18-
#include <linux/of_irq.h>
16+
#include <linux/of.h>
1917
#include <linux/phy/phy.h>
2018
#include "ahci.h"
2119

@@ -110,9 +108,8 @@ static int xgene_ahci_init_memram(struct xgene_ahci_context *ctx)
110108
* @timeout : timeout for achieving the value.
111109
*/
112110
static int xgene_ahci_poll_reg_val(struct ata_port *ap,
113-
void __iomem *reg, unsigned
114-
int val, unsigned long interval,
115-
unsigned long timeout)
111+
void __iomem *reg, unsigned int val,
112+
unsigned int interval, unsigned int timeout)
116113
{
117114
unsigned long deadline;
118115
unsigned int tmp;
@@ -736,7 +733,6 @@ static int xgene_ahci_probe(struct platform_device *pdev)
736733
struct ahci_host_priv *hpriv;
737734
struct xgene_ahci_context *ctx;
738735
struct resource *res;
739-
const struct of_device_id *of_devid;
740736
enum xgene_ahci_version version = XGENE_AHCI_V1;
741737
const struct ata_port_info *ppi[] = { &xgene_ahci_v1_port_info,
742738
&xgene_ahci_v2_port_info };
@@ -782,10 +778,8 @@ static int xgene_ahci_probe(struct platform_device *pdev)
782778
ctx->csr_mux = csr;
783779
}
784780

785-
of_devid = of_match_device(xgene_ahci_of_match, dev);
786-
if (of_devid) {
787-
if (of_devid->data)
788-
version = (unsigned long) of_devid->data;
781+
if (dev->of_node) {
782+
version = (enum xgene_ahci_version)of_device_get_match_data(dev);
789783
}
790784
#ifdef CONFIG_ACPI
791785
else {

drivers/ata/libahci.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1280,22 +1280,15 @@ static void ahci_port_init(struct device *dev, struct ata_port *ap,
12801280
int port_no, void __iomem *mmio,
12811281
void __iomem *port_mmio)
12821282
{
1283-
struct ahci_host_priv *hpriv = ap->host->private_data;
12841283
const char *emsg = NULL;
12851284
int rc;
1286-
u32 tmp;
12871285

12881286
/* make sure port is not active */
12891287
rc = ahci_deinit_port(ap, &emsg);
12901288
if (rc)
12911289
dev_warn(dev, "%s (%d)\n", emsg, rc);
12921290

12931291
ahci_port_clear_pending_irq(ap);
1294-
1295-
/* mark esata ports */
1296-
tmp = readl(port_mmio + PORT_CMD);
1297-
if ((tmp & PORT_CMD_ESP) && (hpriv->cap & HOST_CAP_SXS))
1298-
ap->pflags |= ATA_PFLAG_EXTERNAL;
12991292
}
13001293

13011294
void ahci_init_controller(struct ata_host *host)
@@ -2627,8 +2620,8 @@ void ahci_print_info(struct ata_host *host, const char *scc_s)
26272620
speed_s = "?";
26282621

26292622
dev_info(host->dev,
2630-
"AHCI %02x%02x.%02x%02x "
2631-
"%u slots %u ports %s Gbps 0x%x impl %s mode\n"
2623+
"AHCI vers %02x%02x.%02x%02x, "
2624+
"%u command slots, %s Gbps, %s mode\n"
26322625
,
26332626

26342627
(vers >> 24) & 0xff,
@@ -2637,11 +2630,17 @@ void ahci_print_info(struct ata_host *host, const char *scc_s)
26372630
vers & 0xff,
26382631

26392632
((cap >> 8) & 0x1f) + 1,
2640-
(cap & 0x1f) + 1,
26412633
speed_s,
2642-
impl,
26432634
scc_s);
26442635

2636+
dev_info(host->dev,
2637+
"%u/%u ports implemented (port mask 0x%x)\n"
2638+
,
2639+
2640+
hweight32(impl),
2641+
(cap & 0x1f) + 1,
2642+
impl);
2643+
26452644
dev_info(host->dev,
26462645
"flags: "
26472646
"%s%s%s%s%s%s%s"

drivers/ata/libahci_platform.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ static int ahci_platform_get_phy(struct ahci_host_priv *hpriv, u32 port,
363363
switch (rc) {
364364
case -ENOSYS:
365365
/* No PHY support. Check if PHY is required. */
366-
if (of_find_property(node, "phys", NULL)) {
366+
if (of_property_present(node, "phys")) {
367367
dev_err(dev,
368368
"couldn't get PHY in node %pOFn: ENOSYS\n",
369369
node);

0 commit comments

Comments
 (0)