Skip to contentSkip to conversation

drm/i915: make system freeze support depend on CONFIG_ACPI_SLEEP

PATCH In review Imre Deak 4 participants 8 messages Jun 23, 2014 – Jul 8, 2014

Subsystems (2)
lore
Share & tools
lore

Imre Deak

author
#0 lore raw

PATCH 1/1 drm/i915: make system freeze support depend on CONFIG_ACPI_SLEEP

To achieve further power savings during system freeze (aka connected standby, or s0ix) we have to send a PCI_D1 opregion notification. As the information about the state we're entering (system freeze, suspend to ram or suspend to disk) is only available through the ACPI subsystem, make this support depend on the relevant kconfig option. Things will still work if this option isn't set, albeit with less than optimial power saving.

This also fixes a compile breakage when the option is not set introduced in

commit e5747e3adcd67ae27105003ec99fb58cba180105

Author: Jesse Barnes <[email protected]>
Date:   Thu Jun 12 08:35:47 2014 -0700

drm/i915: send proper opregion notifications on suspend/resume

---
 drivers/gpu/drm/i915/i915_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +4 -3
index 7ae4e2a..43dc8f7 100644
@@ -544,10 +544,11 @@ static int i915_drm_freeze(struct drm_device *dev)
 
 	i915_save_state(dev);
 
-	if (acpi_target_system_state() >= ACPI_STATE_S3)
-		opregion_target_state = PCI_D3cold;
-	else
+	opregion_target_state = PCI_D3cold;
+#if IS_ENABLED(CONFIG_ACPI_SLEEP)
+	if (acpi_target_system_state() < ACPI_STATE_S3)
 		opregion_target_state = PCI_D1;
+#endif
 	intel_opregion_notify_adapter(dev, opregion_target_state);
 
 	intel_uncore_forcewake_reset(dev, false);
Signature · 1 line
1.8.4
maintainer
#1 lore raw
Quoted 28 lines · Imre Deak

To achieve further power savings during system freeze (aka connected standby, or s0ix) we have to send a PCI_D1 opregion notification. As the information about the state we're entering (system freeze, suspend to ram or suspend to disk) is only available through the ACPI subsystem, make this support depend on the relevant kconfig option. Things will still work if this option isn't set, albeit with less than optimial power saving.

This also fixes a compile breakage when the option is not set introduced in

commit e5747e3adcd67ae27105003ec99fb58cba180105

Author: Jesse Barnes <[email protected]>
Date:   Thu Jun 12 08:35:47 2014 -0700

drm/i915: send proper opregion notifications on suspend/resume

---
 drivers/gpu/drm/i915/i915_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 7ae4e2a..43dc8f7 100644

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_freeze(struct drm_device *dev) · line 548

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.c +2 -3
@@ -544,10 +544,11 @@ static int i915_drm_freeze(struct drm_device *dev)
 
 	i915_save_state(dev);
 
-	if (acpi_target_system_state() >= ACPI_STATE_S3)
-		opregion_target_state = PCI_D3cold;
-	else
+	opregion_target_state = PCI_D3cold;
+#if IS_ENABLED(CONFIG_ACPI_SLEEP)

Maybe this should just check for CONFIG_ACPI?

BR,
Jani.

Quoted 13 lines
drivers/gpu/drm/i915/i915_drv.c +2 -0
+	if (acpi_target_system_state() < ACPI_STATE_S3)
 		opregion_target_state = PCI_D1;
+#endif
 	intel_opregion_notify_adapter(dev, opregion_target_state);
 
 	intel_uncore_forcewake_reset(dev, false);
Signature · 6 lines
1.8.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
author
#2 lore raw
Quoted 32 lines · Jani Nikula
Quoted 31 lines · Imre Deak

To achieve further power savings during system freeze (aka connected standby, or s0ix) we have to send a PCI_D1 opregion notification. As the information about the state we're entering (system freeze, suspend to ram or suspend to disk) is only available through the ACPI subsystem, make this support depend on the relevant kconfig option. Things will still work if this option isn't set, albeit with less than optimial power saving.

This also fixes a compile breakage when the option is not set introduced in

commit e5747e3adcd67ae27105003ec99fb58cba180105

Author: Jesse Barnes <[email protected]>
Date:   Thu Jun 12 08:35:47 2014 -0700

drm/i915: send proper opregion notifications on suspend/resume

---
 drivers/gpu/drm/i915/i915_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 7ae4e2a..43dc8f7 100644
@@ -544,10 +544,11 @@ static int i915_drm_freeze(struct drm_device *dev)
 
 	i915_save_state(dev);
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_freeze(struct drm_device *dev) · line 548

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +2 -3
-	if (acpi_target_system_state() >= ACPI_STATE_S3)
-		opregion_target_state = PCI_D3cold;
-	else
+	opregion_target_state = PCI_D3cold;
+#if IS_ENABLED(CONFIG_ACPI_SLEEP)

Maybe this should just check for CONFIG_ACPI?

I wanted to send the PCI_D1 signal only if we are sure that the target sleep state is S0ix (or S1/2) and fall back to the old behavior to send PCI_D3cold in all other cases.

But you are right, it would make much sense if CONFIG_ACPI_SLEEP=n the target state would be always S0ix. Rafael could you confirm this?

--Imre

Quoted 9 lines

BR,
Jani.

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +2 -0
+	if (acpi_target_system_state() < ACPI_STATE_S3)
 		opregion_target_state = PCI_D1;
+#endif
 	intel_opregion_notify_adapter(dev, opregion_target_state);
 
Quoted 9 lines
Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.c +0 -0
 	intel_uncore_forcewake_reset(dev, false);
Signature · 6 lines
1.8.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

maintainer
#3 lore raw
Quoted 41 lines · Imre Deak
Quoted 32 lines · Jani Nikula
Quoted 31 lines · Imre Deak

To achieve further power savings during system freeze (aka connected standby, or s0ix) we have to send a PCI_D1 opregion notification. As the information about the state we're entering (system freeze, suspend to ram or suspend to disk) is only available through the ACPI subsystem, make this support depend on the relevant kconfig option. Things will still work if this option isn't set, albeit with less than optimial power saving.

This also fixes a compile breakage when the option is not set introduced in

commit e5747e3adcd67ae27105003ec99fb58cba180105

Author: Jesse Barnes <[email protected]>
Date:   Thu Jun 12 08:35:47 2014 -0700

drm/i915: send proper opregion notifications on suspend/resume

---
 drivers/gpu/drm/i915/i915_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 7ae4e2a..43dc8f7 100644
@@ -544,10 +544,11 @@ static int i915_drm_freeze(struct drm_device *dev)
 
 	i915_save_state(dev);
 
Quoted 7 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_freeze(struct drm_device *dev) · line 548

Quoted 5 lines
drivers/gpu/drm/i915/i915_drv.c +2 -3
-	if (acpi_target_system_state() >= ACPI_STATE_S3)
-		opregion_target_state = PCI_D3cold;
-	else
+	opregion_target_state = PCI_D3cold;
+#if IS_ENABLED(CONFIG_ACPI_SLEEP)

Maybe this should just check for CONFIG_ACPI?

Quoted 6 lines

I wanted to send the PCI_D1 signal only if we are sure that the target sleep state is S0ix (or S1/2) and fall back to the old behavior to send PCI_D3cold in all other cases.

But you are right, it would make much sense if CONFIG_ACPI_SLEEP=n the target state would be always S0ix. Rafael could you confirm this?

intel_opregion_notify_adapter() is a NOP for CONFIG_ACPI=n anyway. And AFAICT CONFIG_ACPI=y && CONFIG_ACPI_SLEEP=n is broken.

BR,
Jani.

Quoted 22 lines

--Imre

Quoted 18 lines

BR,
Jani.

Quoted 13 lines
drivers/gpu/drm/i915/i915_drv.c +2 -0
+	if (acpi_target_system_state() < ACPI_STATE_S3)
 		opregion_target_state = PCI_D1;
+#endif
 	intel_opregion_notify_adapter(dev, opregion_target_state);
 
 	intel_uncore_forcewake_reset(dev, false);
Signature · 6 lines
1.8.4

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 1 line
Jani Nikula, Intel Open Source Technology Center
author
#4 lore raw
Quoted 42 lines · Jani Nikula
Quoted 41 lines · Imre Deak
Quoted 39 lines · Jani Nikula
Quoted 28 lines · Imre Deak

To achieve further power savings during system freeze (aka connected standby, or s0ix) we have to send a PCI_D1 opregion notification. As the information about the state we're entering (system freeze, suspend to ram or suspend to disk) is only available through the ACPI subsystem, make this support depend on the relevant kconfig option. Things will still work if this option isn't set, albeit with less than optimial power saving.

This also fixes a compile breakage when the option is not set introduced in

commit e5747e3adcd67ae27105003ec99fb58cba180105

Author: Jesse Barnes <[email protected]>
Date:   Thu Jun 12 08:35:47 2014 -0700

drm/i915: send proper opregion notifications on suspend/resume

---
 drivers/gpu/drm/i915/i915_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 7ae4e2a..43dc8f7 100644

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_freeze(struct drm_device *dev) · line 548

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.c +2 -3
@@ -544,10 +544,11 @@ static int i915_drm_freeze(struct drm_device *dev)
 
 	i915_save_state(dev);
 
-	if (acpi_target_system_state() >= ACPI_STATE_S3)
-		opregion_target_state = PCI_D3cold;
-	else
+	opregion_target_state = PCI_D3cold;
+#if IS_ENABLED(CONFIG_ACPI_SLEEP)

Maybe this should just check for CONFIG_ACPI?

Quoted 8 lines
Quoted 6 lines

I wanted to send the PCI_D1 signal only if we are sure that the target sleep state is S0ix (or S1/2) and fall back to the old behavior to send PCI_D3cold in all other cases.

But you are right, it would make much sense if CONFIG_ACPI_SLEEP=n the target state would be always S0ix. Rafael could you confirm this?

intel_opregion_notify_adapter() is a NOP for CONFIG_ACPI=n anyway.

Ok, but the question for me is what's the target sleep state in case of CONFIG_ACPI=y and CONFIG_ACPI_SLEEP=n.

Quoted 1 line

And AFAICT CONFIG_ACPI=y && CONFIG_ACPI_SLEEP=n is broken.

But it seems like a valid configuration. So it needs to be fixed separately.

--Imre

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

#5 lore raw
Quoted 41 lines · Imre Deak
Quoted 40 lines · Jani Nikula
Quoted 39 lines · Imre Deak
Quoted 38 lines · Jani Nikula
Quoted 28 lines · Imre Deak

To achieve further power savings during system freeze (aka connected standby, or s0ix) we have to send a PCI_D1 opregion notification. As the information about the state we're entering (system freeze, suspend to ram or suspend to disk) is only available through the ACPI subsystem, make this support depend on the relevant kconfig option. Things will still work if this option isn't set, albeit with less than optimial power saving.

This also fixes a compile breakage when the option is not set introduced in

commit e5747e3adcd67ae27105003ec99fb58cba180105

Author: Jesse Barnes <[email protected]>
Date:   Thu Jun 12 08:35:47 2014 -0700

drm/i915: send proper opregion notifications on suspend/resume

---
  drivers/gpu/drm/i915/i915_drv.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 7ae4e2a..43dc8f7 100644

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_freeze(struct drm_device *dev) · line 548

Quoted 8 lines
drivers/gpu/drm/i915/i915_drv.c +2 -3
@@ -544,10 +544,11 @@ static int i915_drm_freeze(struct drm_device *dev)
 
  	i915_save_state(dev);
 
-	if (acpi_target_system_state() >= ACPI_STATE_S3)
-		opregion_target_state = PCI_D3cold;
-	else
+	opregion_target_state = PCI_D3cold;
+#if IS_ENABLED(CONFIG_ACPI_SLEEP)

Maybe this should just check for CONFIG_ACPI?

Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

I wanted to send the PCI_D1 signal only if we are sure that the target sleep state is S0ix (or S1/2) and fall back to the old behavior to send PCI_D3cold in all other cases.

But you are right, it would make much sense if CONFIG_ACPI_SLEEP=n the target state would be always S0ix. Rafael could you confirm this?

The target state should be S0 for CONFIG_ACPI_SLEEP unset.

Quoted 5 lines
Quoted 1 line

intel_opregion_notify_adapter() is a NOP for CONFIG_ACPI=n anyway.

Ok, but the question for me is what's the target sleep state in case of CONFIG_ACPI=y and CONFIG_ACPI_SLEEP=n.

Quoted 1 line

And AFAICT CONFIG_ACPI=y && CONFIG_ACPI_SLEEP=n is broken.

Broken how?

Quoted 2 lines

But it seems like a valid configuration. So it needs to be fixed separately.

It is a valid configuration.

Rafael

#6 lore raw
Quoted 41 lines · Rafael J. Wysocki
Quoted 40 lines · Imre Deak
Quoted 39 lines · Jani Nikula
Quoted 38 lines · Imre Deak
Quoted 37 lines · Jani Nikula
Quoted 28 lines · Imre Deak

To achieve further power savings during system freeze (aka connected standby, or s0ix) we have to send a PCI_D1 opregion notification. As the information about the state we're entering (system freeze, suspend to ram or suspend to disk) is only available through the ACPI subsystem, make this support depend on the relevant kconfig option. Things will still work if this option isn't set, albeit with less than optimial power saving.

This also fixes a compile breakage when the option is not set introduced in

commit e5747e3adcd67ae27105003ec99fb58cba180105

Author: Jesse Barnes <[email protected]>
Date:   Thu Jun 12 08:35:47 2014 -0700

drm/i915: send proper opregion notifications on suspend/resume

---
  drivers/gpu/drm/i915/i915_drv.c | 7 ++++---
  1 file changed, 4 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.c +0 -0
index 7ae4e2a..43dc8f7 100644

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_freeze(struct · line 548

Quoted 7 lines
drivers/gpu/drm/i915/i915_drv.c +2 -2
@@ -544,10 +544,11 @@ static int i915_drm_freeze(struct 
 drm_device *dev)
        i915_save_state(dev);
  -    if (acpi_target_system_state() >= ACPI_STATE_S3)
-        opregion_target_state = PCI_D3cold;
-    else
+    opregion_target_state = PCI_D3cold;
+#if IS_ENABLED(CONFIG_ACPI_SLEEP)

Maybe this should just check for CONFIG_ACPI?

Quoted 9 lines
Quoted 6 lines
Quoted 6 lines
Quoted 6 lines

I wanted to send the PCI_D1 signal only if we are sure that the target sleep state is S0ix (or S1/2) and fall back to the old behavior to send PCI_D3cold in all other cases.

But you are right, it would make much sense if CONFIG_ACPI_SLEEP=n the target state would be always S0ix. Rafael could you confirm this?

The target state should be S0 for CONFIG_ACPI_SLEEP unset.

Actually, no, it shouldn't. Or rather it depends on why CONFIG_ACPI_SLEEP is unset.

If that's because CONFIG_ACPI is unset, the target sleep state is undefined and acpi_target_system_state() should not be called then.

Rafael

#7 lore raw
Quoted 57 lines · Rafael J. Wysocki
Quoted 50 lines · Rafael J. Wysocki
Quoted 49 lines · Imre Deak
Quoted 48 lines · Jani Nikula
Quoted 47 lines · Imre Deak
Quoted 27 lines · Jani Nikula
Quoted 26 lines · Imre Deak

To achieve further power savings during system freeze (aka connected standby, or s0ix) we have to send a PCI_D1 opregion notification. As the information about the state we're entering (system freeze, suspend to ram or suspend to disk) is only available through the ACPI
subsystem, make this support depend on the relevant kconfig option. Things will still work if this option isn't set, albeit with less than
optimial power saving.

This also fixes a compile breakage when the option is not set introduced
in

commit e5747e3adcd67ae27105003ec99fb58cba180105

Author: Jesse Barnes <[email protected]>
Date:   Thu Jun 12 08:35:47 2014 -0700

drm/i915: send proper opregion notifications on suspend/resume

---
 drivers/gpu/drm/i915/i915_drv.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
Quoted 14 lines

drivers/gpu/drm/i915/i915_drv.c static int i915_drm_freeze(struct · line 548

Quoted 13 lines
drivers/gpu/drm/i915/i915_drv.c +2 -2
index 7ae4e2a..43dc8f7 100644
@@ -544,10 +544,11 @@ static int i915_drm_freeze(struct
 drm_device *dev)
       i915_save_state(dev);
 -    if (acpi_target_system_state() >= ACPI_STATE_S3)
-        opregion_target_state = PCI_D3cold;
-    else
+    opregion_target_state = PCI_D3cold;
+#if IS_ENABLED(CONFIG_ACPI_SLEEP)

Maybe this should just check for CONFIG_ACPI?

I wanted to send the PCI_D1 signal only if we are sure that the target sleep state is S0ix (or S1/2) and fall back to the old behavior to send
PCI_D3cold in all other cases.

Quoted 5 lines
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines

But you are right, it would make much sense if CONFIG_ACPI_SLEEP=n the target state would be always S0ix. Rafael could you confirm this?

The target state should be S0 for CONFIG_ACPI_SLEEP unset.

Quoted 6 lines

Actually, no, it shouldn't. Or rather it depends on why CONFIG_ACPI_SLEEP is unset.

If that's because CONFIG_ACPI is unset, the target sleep state is undefined and
acpi_target_system_state() should not be called then.

Ok, I've merged Imre's original patch to not call acpi_target_system_state then.
-Daniel

Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch