[PATCH v6 0/3] Support power resources defined in acpi on ata

Markus Probst posted 3 patches 1 month, 2 weeks ago
drivers/ata/libata-acpi.c  | 67 ++++++++++++++++++++++++++++++++++++++
drivers/ata/libata-core.c  |  2 ++
drivers/ata/libata-scsi.c  |  1 +
drivers/ata/libata.h       |  4 +++
drivers/scsi/sd.c          | 34 ++++++++++++++++++-
include/scsi/scsi_device.h |  6 ++++
6 files changed, 113 insertions(+), 1 deletion(-)
[PATCH v6 0/3] Support power resources defined in acpi on ata
Posted by Markus Probst 1 month, 2 weeks ago
This series adds support for power resources defined in acpi on ata
ports/devices. A device can define a power resource in an ata port/device,
which then gets powered on right before the port is probed. This can be
useful for devices, which have sata power connectors that are:
  a: powered down by default
  b: can be individually powered on
like in some synology nas devices. If thats the case it will be assumed,
that the power resource won't survive reboots and therefore the disk will
be stopped.

Changes since v5:
- moved the 3. patch before the 2. patch
- removed unnecessary blank line
- improved commit messages
- improved documentation
- fixed typo in error message

Changes since v4:
- improved documentation
- use false/true instead of 0/1
- removed repeating code in ata_acpi_dev_manage_restart
- split long lines
- removed debug message
- improved error message

Changes since v3:
- rename function from "ata_port_set_power_state"
  to "ata_acpi_port_power_on" and remove enable argument
- split "ata_acpi_port_power_on" and "ata_acpi_dev_manage_restart" into
  two commits
- improved commit messages
- improved comments (style and new comments)

Changes since v2:
- improved commit messages
- addressed warning from kernel test robot

Changes since v1:
- improved commit messages
- addressed style issues (too long lines and docs)
- removed ata_dev_manage_restart() and ata_port_set_power_state()
  methods
- improved log messages in ata_acpi_port_set_power_state

Markus Probst (3):
  scsi: sd: Add manage_restart device attribute to scsi_disk
  ata: Use ACPI methods to power on disks
  ata: stop disk on restart if ACPI power resources are found

 drivers/ata/libata-acpi.c  | 67 ++++++++++++++++++++++++++++++++++++++
 drivers/ata/libata-core.c  |  2 ++
 drivers/ata/libata-scsi.c  |  1 +
 drivers/ata/libata.h       |  4 +++
 drivers/scsi/sd.c          | 34 ++++++++++++++++++-
 include/scsi/scsi_device.h |  6 ++++
 6 files changed, 113 insertions(+), 1 deletion(-)

-- 
2.51.0
Re: [PATCH v6 0/3] Support power resources defined in acpi on ata
Posted by Martin K. Petersen 1 month ago
On Tue, 04 Nov 2025 14:24:31 +0000, Markus Probst wrote:

> This series adds support for power resources defined in acpi on ata
> ports/devices. A device can define a power resource in an ata port/device,
> which then gets powered on right before the port is probed. This can be
> useful for devices, which have sata power connectors that are:
>   a: powered down by default
>   b: can be individually powered on
> like in some synology nas devices. If thats the case it will be assumed,
> that the power resource won't survive reboots and therefore the disk will
> be stopped.
> 
> [...]

Applied to 6.19/scsi-queue, thanks!

[1/3] scsi: sd: Add manage_restart device attribute to scsi_disk
      https://git.kernel.org/mkp/scsi/c/8fdfdb148816
[2/3] ata: Use ACPI methods to power on disks
      https://git.kernel.org/mkp/scsi/c/ce6d26b5330c
[3/3] ata: stop disk on restart if ACPI power resources are found
      https://git.kernel.org/mkp/scsi/c/8c59fc1c90df

-- 
Martin K. Petersen
Re: [PATCH v6 0/3] Support power resources defined in acpi on ata
Posted by Martin K. Petersen 1 month, 1 week ago
Markus,

> This series adds support for power resources defined in acpi on ata
> ports/devices. A device can define a power resource in an ata port/device,
> which then gets powered on right before the port is probed. This can be
> useful for devices, which have sata power connectors that are:
>   a: powered down by default
>   b: can be individually powered on
> like in some synology nas devices. If thats the case it will be assumed,
> that the power resource won't survive reboots and therefore the disk will
> be stopped.

Applied to 6.19/scsi-staging, thanks!

-- 
Martin K. Petersen
Re: [PATCH v6 0/3] Support power resources defined in acpi on ata
Posted by Niklas Cassel 1 month, 1 week ago
On Tue, Nov 04, 2025 at 02:24:31PM +0000, Markus Probst wrote:
> This series adds support for power resources defined in acpi on ata
> ports/devices. A device can define a power resource in an ata port/device,
> which then gets powered on right before the port is probed. This can be
> useful for devices, which have sata power connectors that are:
>   a: powered down by default
>   b: can be individually powered on
> like in some synology nas devices. If thats the case it will be assumed,
> that the power resource won't survive reboots and therefore the disk will
> be stopped.

(snip)

> Markus Probst (3):
>   scsi: sd: Add manage_restart device attribute to scsi_disk
>   ata: Use ACPI methods to power on disks
>   ata: stop disk on restart if ACPI power resources are found
> 
>  drivers/ata/libata-acpi.c  | 67 ++++++++++++++++++++++++++++++++++++++
>  drivers/ata/libata-core.c  |  2 ++
>  drivers/ata/libata-scsi.c  |  1 +
>  drivers/ata/libata.h       |  4 +++
>  drivers/scsi/sd.c          | 34 ++++++++++++++++++-
>  include/scsi/scsi_device.h |  6 ++++
>  6 files changed, 113 insertions(+), 1 deletion(-)

Martin, James,

Please have a look.

If you have no comments, is it okay to take this via the libata tree,
or do you prefer to merge the series via the scsi tree?


Kind regards,
Niklas
Re: [PATCH v6 0/3] Support power resources defined in acpi on ata
Posted by Martin K. Petersen 1 month, 1 week ago
Niklas,

> If you have no comments, is it okay to take this via the libata tree,
> or do you prefer to merge the series via the scsi tree?

It all seemed pretty straightforward and given Damien's reviews I
applied this to SCSI. If that creates any merge conflicts for you, let
me know...

-- 
Martin K. Petersen
Re: [PATCH v6 0/3] Support power resources defined in acpi on ata
Posted by Niklas Cassel 1 month, 1 week ago
On Sat, Nov 08, 2025 at 01:28:23PM -0500, Martin K. Petersen wrote:
> 
> Niklas,
> 
> > If you have no comments, is it okay to take this via the libata tree,
> > or do you prefer to merge the series via the scsi tree?
> 
> It all seemed pretty straightforward and given Damien's reviews I
> applied this to SCSI. If that creates any merge conflicts for you, let
> me know...

Thank you Martin!

The changes are very self-contained, and essentially only touches
drivers/ata/libata-acpi.c, so I do not expect any merge conflicts.


Kind regards,
Niklas