Skip to content

Commit ced1b9e

Browse files
committed
Merge tag 'ata-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux
Pull ata updates from Damien Le Moal: - Replace the ATA_DFLAG_ZAC device flag with the helper function ata_dev_is_zac() testing directly the device class and device zoned mode (me) - Some small cleanup of ata_scsi_offline_dev() code (me) - Improve the description of the link power management (LPM) policies in Kconfig and in the comments defining these. Together with this, clarify the description of the ahci driver mobile_lpm_policy module parameter (me) - Various code refactoring of libata LPM handling (ata_eh_set_lpm() renaming, introduce ata_dev_config_lpm(), LPM related quirk handling, and LPM related feature advertizing on device scan) (me) - Avoid unnecessary device reset when revalidating after an error when LPM is used (me) - Do not allow setting a port/link LPM policy if LPM is not supported, either because the controller does not support partial, slumber nor devsleep, or when the port is an external port with hotplug capability (me) - Make sure that device initiated power management (DIPM) is not enabled if the host (controller) lacks support for this feature (me) - Improve messages and debug messages related to LPM, in particular, reduce the number of messages signaling the lack of LPM support (me) - Cache in memory a device general purpose log directory to avoid having to access this log for every log page access. The intent here is to reduce the number of read log commands when scanning or revalidating a device (me) - Change ata_dev_cleanup_cdl_resources() to be a static function (me) - Rename and simplify the mode setting functions (me) - Introduce the helper function ata_port_eh_scheduled() to check if EH is pending or running for a port (me) - Improve ata_eh_set_pending() (return bool instead of int) (me) - Use sysfs_emit() instead of scnprintf() for libata-transport attributes (Jonathan) - Use the existing macro definiton of RDC vendor ID instead of hardcoding it in the pata_rdc driver (Andy) - Rework how EH is called for a port to avoid needing to pass along the prereset, softreset, hardreset and postreset operations. The driver API documentation for this is also updated (me) * tag 'ata-6.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/libata/linux: (28 commits) Documentation: driver-api: Update libata error handler information ata: libata-eh: Simplify reset operation management ata: libata-eh: Remove ata_do_eh() ata: pata_rdc: Use registered definition for the RDC vendor ata: libata-eh: Make ata_eh_followup_srst_needed() return a bool ata: libata-transport: replace scnprintf with sysfs_emit for simple attributes ata: libata-eh: use bool for fastdrain in ata_eh_set_pending() ata: libata: Introduce ata_port_eh_scheduled() ata: libata-core: Rename ata_do_set_mode() ata: libata-eh: Rename and make ata_set_mode() static ata: libata-core: Make ata_dev_cleanup_cdl_resources() static ata: libata-core: Cache the general purpose log directory ata: libata_eh: Add debug messages to ata_eh_link_set_lpm() ata: libata-core: Reduce the number of messages signaling broken LPM ata: ahci: Disallow LPM policy control if not supported ata: ahci: Disallow LPM policy control for external ports ata: ahci: Disable DIPM if host lacks support ata: libata-sata: Disallow changing LPM state if not supported ata: libata-eh: Avoid unnecessary resets when revalidating devices ata: libata-core: Advertize device support for DIPM and HIPM features ...
2 parents e268c23 + 546527b commit ced1b9e

64 files changed

Lines changed: 565 additions & 444 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/driver-api/libata.rst

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -283,18 +283,25 @@ interrupts, start DMA engine, etc.
283283

284284
``->error_handler()`` is a driver's hook into probe, hotplug, and recovery
285285
and other exceptional conditions. The primary responsibility of an
286-
implementation is to call :c:func:`ata_do_eh` or :c:func:`ata_bmdma_drive_eh`
287-
with a set of EH hooks as arguments:
286+
implementation is to call :c:func:`ata_std_error_handler`.
288287

289-
'prereset' hook (may be NULL) is called during an EH reset, before any
290-
other actions are taken.
288+
:c:func:`ata_std_error_handler` will perform a standard error handling sequence
289+
to resurect failed devices, detach lost devices and add new devices (if any).
290+
This function will call the various reset operations for a port, as needed.
291+
These operations are as follows.
291292

292-
'postreset' hook (may be NULL) is called after the EH reset is
293-
performed. Based on existing conditions, severity of the problem, and
294-
hardware capabilities,
293+
* The 'prereset' operation (which may be NULL) is called during an EH reset,
294+
before any other action is taken.
295295

296-
Either 'softreset' (may be NULL) or 'hardreset' (may be NULL) will be
297-
called to perform the low-level EH reset.
296+
* The 'postreset' hook (which may be NULL) is called after the EH reset is
297+
performed. Based on existing conditions, severity of the problem, and hardware
298+
capabilities,
299+
300+
* Either the 'softreset' operation or the 'hardreset' operation will be called
301+
to perform the low-level EH reset. If both operations are defined,
302+
'hardreset' is preferred and used. If both are not defined, no low-level reset
303+
is performed and EH assumes that an ATA class device is connected through the
304+
link.
298305

299306
::
300307

drivers/ata/Kconfig

Lines changed: 26 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -117,23 +117,39 @@ config SATA_AHCI
117117

118118
config SATA_MOBILE_LPM_POLICY
119119
int "Default SATA Link Power Management policy"
120-
range 0 4
120+
range 0 5
121121
default 3
122122
depends on SATA_AHCI
123123
help
124124
Select the Default SATA Link Power Management (LPM) policy to use
125125
for chipsets / "South Bridges" supporting low-power modes. Such
126126
chipsets are ubiquitous across laptops, desktops and servers.
127-
128-
The value set has the following meanings:
127+
Each policy combines power saving states and features:
128+
- Partial: The Phy logic is powered but is in a reduced power
129+
state. The exit latency from this state is no longer than
130+
10us).
131+
- Slumber: The Phy logic is powered but is in an even lower power
132+
state. The exit latency from this state is potentially
133+
longer, but no longer than 10ms.
134+
- DevSleep: The Phy logic may be powered down. The exit latency from
135+
this state is no longer than 20 ms, unless otherwise
136+
specified by DETO in the device Identify Device Data log.
137+
- HIPM: Host Initiated Power Management (host automatically
138+
transitions to partial and slumber).
139+
- DIPM: Device Initiated Power Management (device automatically
140+
transitions to partial and slumber).
141+
142+
The possible values for the default SATA link power management
143+
policies are:
129144
0 => Keep firmware settings
130-
1 => Maximum performance
131-
2 => Medium power
132-
3 => Medium power with Device Initiated PM enabled
133-
4 => Minimum power
134-
135-
Note "Minimum power" is known to cause issues, including disk
136-
corruption, with some disks and should not be used.
145+
1 => No power savings (maximum performance)
146+
2 => HIPM (Partial)
147+
3 => HIPM (Partial) and DIPM (Partial and Slumber)
148+
4 => HIPM (Partial and DevSleep) and DIPM (Partial and Slumber)
149+
5 => HIPM (Slumber and DevSleep) and DIPM (Partial and Slumber)
150+
151+
Excluding the value 0, higher values represent policies with higher
152+
power savings.
137153

138154
config SATA_AHCI_PLATFORM
139155
tristate "Platform AHCI SATA support"

drivers/ata/ahci.c

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,17 +110,17 @@ static const struct scsi_host_template ahci_sht = {
110110

111111
static struct ata_port_operations ahci_vt8251_ops = {
112112
.inherits = &ahci_ops,
113-
.hardreset = ahci_vt8251_hardreset,
113+
.reset.hardreset = ahci_vt8251_hardreset,
114114
};
115115

116116
static struct ata_port_operations ahci_p5wdh_ops = {
117117
.inherits = &ahci_ops,
118-
.hardreset = ahci_p5wdh_hardreset,
118+
.reset.hardreset = ahci_p5wdh_hardreset,
119119
};
120120

121121
static struct ata_port_operations ahci_avn_ops = {
122122
.inherits = &ahci_ops,
123-
.hardreset = ahci_avn_hardreset,
123+
.reset.hardreset = ahci_avn_hardreset,
124124
};
125125

126126
static const struct ata_port_info ahci_port_info[] = {
@@ -674,7 +674,9 @@ MODULE_PARM_DESC(marvell_enable, "Marvell SATA via AHCI (1 = enabled)");
674674

675675
static int mobile_lpm_policy = -1;
676676
module_param(mobile_lpm_policy, int, 0644);
677-
MODULE_PARM_DESC(mobile_lpm_policy, "Default LPM policy for mobile chipsets");
677+
MODULE_PARM_DESC(mobile_lpm_policy,
678+
"Default LPM policy. Despite its name, this parameter applies "
679+
"to all chipsets, including desktop and server chipsets");
678680

679681
static char *ahci_mask_port_map;
680682
module_param_named(mask_port_map, ahci_mask_port_map, charp, 0444);
@@ -1774,15 +1776,26 @@ static void ahci_update_initial_lpm_policy(struct ata_port *ap)
17741776
* LPM if the port advertises itself as an external port.
17751777
*/
17761778
if (ap->pflags & ATA_PFLAG_EXTERNAL) {
1777-
ata_port_dbg(ap, "external port, not enabling LPM\n");
1779+
ap->flags |= ATA_FLAG_NO_LPM;
1780+
ap->target_lpm_policy = ATA_LPM_MAX_POWER;
17781781
return;
17791782
}
17801783

1784+
/* If no Partial or no Slumber, we cannot support DIPM. */
1785+
if ((ap->host->flags & ATA_HOST_NO_PART) ||
1786+
(ap->host->flags & ATA_HOST_NO_SSC)) {
1787+
ata_port_dbg(ap, "Host does not support DIPM\n");
1788+
ap->flags |= ATA_FLAG_NO_DIPM;
1789+
}
1790+
17811791
/* If no LPM states are supported by the HBA, do not bother with LPM */
17821792
if ((ap->host->flags & ATA_HOST_NO_PART) &&
17831793
(ap->host->flags & ATA_HOST_NO_SSC) &&
17841794
(ap->host->flags & ATA_HOST_NO_DEVSLP)) {
1785-
ata_port_dbg(ap, "no LPM states supported, not enabling LPM\n");
1795+
ata_port_dbg(ap,
1796+
"No LPM states supported, forcing LPM max_power\n");
1797+
ap->flags |= ATA_FLAG_NO_LPM;
1798+
ap->target_lpm_policy = ATA_LPM_MAX_POWER;
17861799
return;
17871800
}
17881801

drivers/ata/ahci_da850.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,13 @@ static int ahci_da850_hardreset(struct ata_link *link,
137137

138138
static struct ata_port_operations ahci_da850_port_ops = {
139139
.inherits = &ahci_platform_ops,
140-
.softreset = ahci_da850_softreset,
140+
.reset.softreset = ahci_da850_softreset,
141141
/*
142142
* No need to override .pmp_softreset - it's only used for actual
143143
* PMP-enabled ports.
144144
*/
145-
.hardreset = ahci_da850_hardreset,
146-
.pmp_hardreset = ahci_da850_hardreset,
145+
.reset.hardreset = ahci_da850_hardreset,
146+
.pmp_reset.hardreset = ahci_da850_hardreset,
147147
};
148148

149149
static const struct ata_port_info ahci_da850_port_info = {

drivers/ata/ahci_dm816.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static int ahci_dm816_softreset(struct ata_link *link,
124124

125125
static struct ata_port_operations ahci_dm816_port_ops = {
126126
.inherits = &ahci_platform_ops,
127-
.softreset = ahci_dm816_softreset,
127+
.reset.softreset = ahci_dm816_softreset,
128128
};
129129

130130
static const struct ata_port_info ahci_dm816_port_info = {

drivers/ata/ahci_imx.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -642,18 +642,19 @@ static int ahci_imx_softreset(struct ata_link *link, unsigned int *class,
642642
int ret;
643643

644644
if (imxpriv->type == AHCI_IMX53)
645-
ret = ahci_pmp_retry_srst_ops.softreset(link, class, deadline);
645+
ret = ahci_pmp_retry_srst_ops.reset.softreset(link, class,
646+
deadline);
646647
else
647-
ret = ahci_ops.softreset(link, class, deadline);
648+
ret = ahci_ops.reset.softreset(link, class, deadline);
648649

649650
return ret;
650651
}
651652

652653
static struct ata_port_operations ahci_imx_ops = {
653-
.inherits = &ahci_ops,
654-
.host_stop = ahci_imx_host_stop,
655-
.error_handler = ahci_imx_error_handler,
656-
.softreset = ahci_imx_softreset,
654+
.inherits = &ahci_ops,
655+
.host_stop = ahci_imx_host_stop,
656+
.error_handler = ahci_imx_error_handler,
657+
.reset.softreset = ahci_imx_softreset,
657658
};
658659

659660
static const struct ata_port_info ahci_imx_port_info = {

drivers/ata/ahci_qoriq.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,8 @@ static int ahci_qoriq_hardreset(struct ata_link *link, unsigned int *class,
146146
}
147147

148148
static struct ata_port_operations ahci_qoriq_ops = {
149-
.inherits = &ahci_ops,
150-
.hardreset = ahci_qoriq_hardreset,
149+
.inherits = &ahci_ops,
150+
.reset.hardreset = ahci_qoriq_hardreset,
151151
};
152152

153153
static const struct ata_port_info ahci_qoriq_port_info = {

drivers/ata/ahci_xgene.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -613,11 +613,11 @@ static irqreturn_t xgene_ahci_irq_intr(int irq, void *dev_instance)
613613
static struct ata_port_operations xgene_ahci_v1_ops = {
614614
.inherits = &ahci_ops,
615615
.host_stop = xgene_ahci_host_stop,
616-
.hardreset = xgene_ahci_hardreset,
616+
.reset.hardreset = xgene_ahci_hardreset,
617+
.reset.softreset = xgene_ahci_softreset,
618+
.pmp_reset.softreset = xgene_ahci_pmp_softreset,
617619
.read_id = xgene_ahci_read_id,
618620
.qc_issue = xgene_ahci_qc_issue,
619-
.softreset = xgene_ahci_softreset,
620-
.pmp_softreset = xgene_ahci_pmp_softreset
621621
};
622622

623623
static const struct ata_port_info xgene_ahci_v1_port_info = {
@@ -630,7 +630,7 @@ static const struct ata_port_info xgene_ahci_v1_port_info = {
630630
static struct ata_port_operations xgene_ahci_v2_ops = {
631631
.inherits = &ahci_ops,
632632
.host_stop = xgene_ahci_host_stop,
633-
.hardreset = xgene_ahci_hardreset,
633+
.reset.hardreset = xgene_ahci_hardreset,
634634
.read_id = xgene_ahci_read_id,
635635
};
636636

drivers/ata/ata_piix.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ static struct ata_port_operations piix_pata_ops = {
10741074
.cable_detect = ata_cable_40wire,
10751075
.set_piomode = piix_set_piomode,
10761076
.set_dmamode = piix_set_dmamode,
1077-
.prereset = piix_pata_prereset,
1077+
.reset.prereset = piix_pata_prereset,
10781078
};
10791079

10801080
static struct ata_port_operations piix_vmw_ops = {
@@ -1102,7 +1102,7 @@ static const struct scsi_host_template piix_sidpr_sht = {
11021102

11031103
static struct ata_port_operations piix_sidpr_sata_ops = {
11041104
.inherits = &piix_sata_ops,
1105-
.hardreset = sata_std_hardreset,
1105+
.reset.hardreset = sata_std_hardreset,
11061106
.scr_read = piix_sidpr_scr_read,
11071107
.scr_write = piix_sidpr_scr_write,
11081108
.set_lpm = piix_sidpr_set_lpm,

drivers/ata/libahci.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ struct ata_port_operations ahci_ops = {
162162

163163
.freeze = ahci_freeze,
164164
.thaw = ahci_thaw,
165-
.softreset = ahci_softreset,
166-
.hardreset = ahci_hardreset,
167-
.postreset = ahci_postreset,
168-
.pmp_softreset = ahci_softreset,
165+
.reset.softreset = ahci_softreset,
166+
.reset.hardreset = ahci_hardreset,
167+
.reset.postreset = ahci_postreset,
168+
.pmp_reset.softreset = ahci_softreset,
169169
.error_handler = ahci_error_handler,
170170
.post_internal_cmd = ahci_post_internal_cmd,
171171
.dev_config = ahci_dev_config,
@@ -192,7 +192,7 @@ EXPORT_SYMBOL_GPL(ahci_ops);
192192

193193
struct ata_port_operations ahci_pmp_retry_srst_ops = {
194194
.inherits = &ahci_ops,
195-
.softreset = ahci_pmp_retry_softreset,
195+
.reset.softreset = ahci_pmp_retry_softreset,
196196
};
197197
EXPORT_SYMBOL_GPL(ahci_pmp_retry_srst_ops);
198198

0 commit comments

Comments
 (0)