Commit c001a52d authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

Merge branches 'pm-cpuidle', 'pm-core' and 'pm-sleep'

Merge cpuidle updates, PM core updates and one hiberation-related
update for 5.17-rc1:

 - Make cpuidle use default_groups in kobj_type (Greg Kroah-Hartman).

 - Fix two comments in cpuidle code (Jason Wang, Yang Li).

 - Simplify locking in pm_runtime_put_suppliers() (Rafael Wysocki).

 - Add safety net to supplier device release in the runtime PM core
   code (Rafael Wysocki).

 - Capture device status before disabling runtime PM for it (Rafael
   Wysocki).

 - Add new macros for declaring PM operations to allow drivers to
   avoid guarding them with CONFIG_PM #ifdefs or __maybe_unused and
   update some drivers to use these macros (Paul Cercueil).

 - Allow ACPI hardware signature to be honoured during restore from
   hibernation (David Woodhouse).

* pm-cpuidle:
  cpuidle: use default_groups in kobj_type
  cpuidle: Fix cpuidle_remove_state_sysfs() kerneldoc comment
  cpuidle: menu: Fix typo in a comment

* pm-core:
  PM: runtime: Simplify locking in pm_runtime_put_suppliers()
  mmc: mxc: Use the new PM macros
  mmc: jz4740: Use the new PM macros
  PM: runtime: Add safety net to supplier device release
  PM: runtime: Capture device status before disabling runtime PM
  PM: core: Add new *_PM_OPS macros, deprecate old ones
  PM: core: Redefine pm_ptr() macro
  r8169: Avoid misuse of pm_ptr() macro

* pm-sleep:
  PM: hibernate: Allow ACPI hardware signature to be honoured
Loading
Loading
Loading
Loading
+12 −3
Original line number Diff line number Diff line
@@ -225,14 +225,23 @@
			For broken nForce2 BIOS resulting in XT-PIC timer.

	acpi_sleep=	[HW,ACPI] Sleep options
			Format: { s3_bios, s3_mode, s3_beep, s4_nohwsig,
				  old_ordering, nonvs, sci_force_enable, nobl }
			Format: { s3_bios, s3_mode, s3_beep, s4_hwsig,
				  s4_nohwsig, old_ordering, nonvs,
				  sci_force_enable, nobl }
			See Documentation/power/video.rst for information on
			s3_bios and s3_mode.
			s3_beep is for debugging; it makes the PC's speaker beep
			as soon as the kernel's real-mode entry point is called.
			s4_hwsig causes the kernel to check the ACPI hardware
			signature during resume from hibernation, and gracefully
			refuse to resume if it has changed. This complies with
			the ACPI specification but not with reality, since
			Windows does not do this and many laptops do change it
			on docking. So the default behaviour is to allow resume
			and simply warn when the signature changes, unless the
			s4_hwsig option is enabled.
			s4_nohwsig prevents ACPI hardware signature from being
			used during resume from hibernation.
			used (or even warned about) during resume.
			old_ordering causes the ACPI 1.0 ordering of the _PTS
			control method, with respect to putting devices into
			low power states, to be enforced (the ACPI 2.0 ordering
+10 −4
Original line number Diff line number Diff line
@@ -265,6 +265,10 @@ defined in include/linux/pm.h:
      RPM_SUSPENDED, which means that each device is initially regarded by the
      PM core as 'suspended', regardless of its real hardware status

  `enum rpm_status last_status;`
    - the last runtime PM status of the device captured before disabling runtime
      PM for it (invalid initially and when disable_depth is 0)

  `unsigned int runtime_auto;`
    - if set, indicates that the user space has allowed the device driver to
      power manage the device at run time via the /sys/devices/.../power/control
@@ -333,10 +337,12 @@ drivers/base/power/runtime.c and include/linux/pm_runtime.h:

  `int pm_runtime_resume(struct device *dev);`
    - execute the subsystem-level resume callback for the device; returns 0 on
      success, 1 if the device's runtime PM status was already 'active' or
      error code on failure, where -EAGAIN means it may be safe to attempt to
      resume the device again in future, but 'power.runtime_error' should be
      checked additionally, and -EACCES means that 'power.disable_depth' is
      success, 1 if the device's runtime PM status is already 'active' (also if
      'power.disable_depth' is nonzero, but the status was 'active' when it was
      changing from 0 to 1) or error code on failure, where -EAGAIN means it may
      be safe to attempt to resume the device again in future, but
      'power.runtime_error' should be checked additionally, and -EACCES means
      that the callback could not be run, because 'power.disable_depth' was
      different from 0

  `int pm_runtime_resume_and_get(struct device *dev);`
+3 −1
Original line number Diff line number Diff line
@@ -139,8 +139,10 @@ static int __init acpi_sleep_setup(char *str)
		if (strncmp(str, "s3_beep", 7) == 0)
			acpi_realmode_flags |= 4;
#ifdef CONFIG_HIBERNATION
		if (strncmp(str, "s4_hwsig", 8) == 0)
			acpi_check_s4_hw_signature(1);
		if (strncmp(str, "s4_nohwsig", 10) == 0)
			acpi_no_s4_hw_signature();
			acpi_check_s4_hw_signature(0);
#endif
		if (strncmp(str, "nonvs", 5) == 0)
			acpi_nvs_nosave();
+21 −5
Original line number Diff line number Diff line
@@ -877,11 +877,11 @@ static inline void acpi_sleep_syscore_init(void) {}
#ifdef CONFIG_HIBERNATION
static unsigned long s4_hardware_signature;
static struct acpi_table_facs *facs;
static bool nosigcheck;
static int sigcheck = -1; /* Default behaviour is just to warn */

void __init acpi_no_s4_hw_signature(void)
void __init acpi_check_s4_hw_signature(int check)
{
	nosigcheck = true;
	sigcheck = check;
}

static int acpi_hibernation_begin(pm_message_t stage)
@@ -1009,12 +1009,28 @@ static void acpi_sleep_hibernate_setup(void)
	hibernation_set_ops(old_suspend_ordering ?
			&acpi_hibernation_ops_old : &acpi_hibernation_ops);
	sleep_states[ACPI_STATE_S4] = 1;
	if (nosigcheck)
	if (!sigcheck)
		return;

	acpi_get_table(ACPI_SIG_FACS, 1, (struct acpi_table_header **)&facs);
	if (facs)
	if (facs) {
		/*
		 * s4_hardware_signature is the local variable which is just
		 * used to warn about mismatch after we're attempting to
		 * resume (in violation of the ACPI specification.)
		 */
		s4_hardware_signature = facs->hardware_signature;

		if (sigcheck > 0) {
			/*
			 * If we're actually obeying the ACPI specification
			 * then the signature is written out as part of the
			 * swsusp header, in order to allow the boot kernel
			 * to gracefully decline to resume.
			 */
			swsusp_hardware_signature = facs->hardware_signature;
		}
	}
}
#else /* !CONFIG_HIBERNATION */
static inline void acpi_sleep_hibernate_setup(void) {}
+1 −2
Original line number Diff line number Diff line
@@ -485,8 +485,7 @@ static void device_link_release_fn(struct work_struct *work)
	/* Ensure that all references to the link object have been dropped. */
	device_link_synchronize_removal();

	while (refcount_dec_not_one(&link->rpm_active))
		pm_runtime_put(link->supplier);
	pm_runtime_release_supplier(link, true);

	put_device(link->consumer);
	put_device(link->supplier);
Loading