All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS
@ 2015-12-07  4:44 ` Ken Xue
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Xue @ 2015-12-07  4:44 UTC (permalink / raw)
  To: rjw, lenb, linux-acpi, linux-kernel
  Cc: SPG_Linux_Kernel, mika.westerberg, Andy Shevchenko, Ivan.Zheng,
	Alex.Chuang

D3cold is only regarded as valid if the "_PR3" object is present
for the given device after the commit <20dacb71ad28>
(ACPI/PM: Reworkdevice power management to follow ACPI 6).

But some old BIOS only defined "_PS3" for the D3COLD device.
And old kernel also believes the device has "_PS3" is a
D3COLD device.

So, add some logics for supporting D3 COLD device for old BIOS
which is compatible with earlier ACPI spec.

Signed-off-by: Ken Xue <Ken.Xue@amd.com>
Reported-and-tested-by: Gang Long <Gang.Long@amd.com>

---
 drivers/acpi/scan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 01136b8..85c16bb 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -979,7 +979,9 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)
 		acpi_bus_init_power_state(device, i);
 
 	INIT_LIST_HEAD(&device->power.states[ACPI_STATE_D3_COLD].resources);
-	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources))
+	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources) ||
+		((acpi_gbl_FADT.header.revision < 6) &&
+		device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set))
 		device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1;
 
 	/* Set defaults for D0 and D3hot states (always valid) */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS
@ 2015-12-07  4:44 ` Ken Xue
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Xue @ 2015-12-07  4:44 UTC (permalink / raw)
  To: rjw, lenb, linux-acpi, linux-kernel
  Cc: SPG_Linux_Kernel, mika.westerberg, Andy Shevchenko, Ivan.Zheng,
	Alex.Chuang

D3cold is only regarded as valid if the "_PR3" object is present
for the given device after the commit <20dacb71ad28>
(ACPI/PM: Reworkdevice power management to follow ACPI 6).

But some old BIOS only defined "_PS3" for the D3COLD device.
And old kernel also believes the device has "_PS3" is a
D3COLD device.

So, add some logics for supporting D3 COLD device for old BIOS
which is compatible with earlier ACPI spec.

Signed-off-by: Ken Xue <Ken.Xue@amd.com>
Reported-and-tested-by: Gang Long <Gang.Long@amd.com>

---
 drivers/acpi/scan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 01136b8..85c16bb 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -979,7 +979,9 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)
 		acpi_bus_init_power_state(device, i);
 
 	INIT_LIST_HEAD(&device->power.states[ACPI_STATE_D3_COLD].resources);
-	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources))
+	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources) ||
+		((acpi_gbl_FADT.header.revision < 6) &&
+		device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set))
 		device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1;
 
 	/* Set defaults for D0 and D3hot states (always valid) */
-- 
1.9.1






^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS
  2015-12-07  4:44 ` Ken Xue
  (?)
@ 2015-12-07 22:48 ` Rafael J. Wysocki
  2015-12-08  1:37     ` Ken Xue
  -1 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2015-12-07 22:48 UTC (permalink / raw)
  To: Ken Xue
  Cc: lenb, linux-acpi, linux-kernel, SPG_Linux_Kernel,
	mika.westerberg, Andy Shevchenko, Ivan.Zheng, Alex.Chuang

On Monday, December 07, 2015 12:44:33 PM Ken Xue wrote:
> D3cold is only regarded as valid if the "_PR3" object is present
> for the given device after the commit <20dacb71ad28>
> (ACPI/PM: Reworkdevice power management to follow ACPI 6).
> 
> But some old BIOS only defined "_PS3" for the D3COLD device.
> And old kernel also believes the device has "_PS3" is a
> D3COLD device.
> 
> So, add some logics for supporting D3 COLD device for old BIOS
> which is compatible with earlier ACPI spec.
> 
> Signed-off-by: Ken Xue <Ken.Xue@amd.com>
> Reported-and-tested-by: Gang Long <Gang.Long@amd.com>

Well, what really is the problem?

acpi_device_set_power() has a special case specifically for D3cold and
falls back to D3hot if D3cold has been requested but is not "valid".

> ---
>  drivers/acpi/scan.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> index 01136b8..85c16bb 100644
> --- a/drivers/acpi/scan.c
> +++ b/drivers/acpi/scan.c
> @@ -979,7 +979,9 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)
>  		acpi_bus_init_power_state(device, i);
>  
>  	INIT_LIST_HEAD(&device->power.states[ACPI_STATE_D3_COLD].resources);
> -	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources))
> +	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources) ||
> +		((acpi_gbl_FADT.header.revision < 6) &&
> +		device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set))
>  		device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1;
>  
>  	/* Set defaults for D0 and D3hot states (always valid) */
> 

-- 
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS
  2015-12-07 22:48 ` Rafael J. Wysocki
@ 2015-12-08  1:37     ` Ken Xue
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Xue @ 2015-12-08  1:37 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: lenb, linux-acpi, linux-kernel, SPG_Linux_Kernel,
	mika.westerberg, Andy Shevchenko, Ivan.Zheng, Alex.Chuang

On Mon, 2015-12-07 at 23:48 +0100, Rafael J. Wysocki wrote:
> On Monday, December 07, 2015 12:44:33 PM Ken Xue wrote:
> > D3cold is only regarded as valid if the "_PR3" object is present
> > for the given device after the commit <20dacb71ad28>
> > (ACPI/PM: Reworkdevice power management to follow ACPI 6).
> > 
> > But some old BIOS only defined "_PS3" for the D3COLD device.
> > And old kernel also believes the device has "_PS3" is a
> > D3COLD device.
> > 
> > So, add some logics for supporting D3 COLD device for old BIOS
> > which is compatible with earlier ACPI spec.
> > 
> > Signed-off-by: Ken Xue <Ken.Xue@amd.com>
> > Reported-and-tested-by: Gang Long <Gang.Long@amd.com>
> 
> Well, what really is the problem?

My problem is that
"acpi_device_can_poweroff" is called by "zpodd_init" in libata-zpodd.c. 
And ZPODD feature only can be enabled when D3_COLD is valid.

> 
> acpi_device_set_power() has a special case specifically for D3cold and
> falls back to D3hot if D3cold has been requested but is not "valid".
> 
> > ---
> >  drivers/acpi/scan.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> > index 01136b8..85c16bb 100644
> > --- a/drivers/acpi/scan.c
> > +++ b/drivers/acpi/scan.c
> > @@ -979,7 +979,9 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)
> >  		acpi_bus_init_power_state(device, i);
> >  
> >  	INIT_LIST_HEAD(&device->power.states[ACPI_STATE_D3_COLD].resources);
> > -	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources))
> > +	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources) ||
> > +		((acpi_gbl_FADT.header.revision < 6) &&
> > +		device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set))
> >  		device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1;
> >  
> >  	/* Set defaults for D0 and D3hot states (always valid) */
> > 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS
@ 2015-12-08  1:37     ` Ken Xue
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Xue @ 2015-12-08  1:37 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: lenb, linux-acpi, linux-kernel, SPG_Linux_Kernel,
	mika.westerberg, Andy Shevchenko, Ivan.Zheng, Alex.Chuang

On Mon, 2015-12-07 at 23:48 +0100, Rafael J. Wysocki wrote:
> On Monday, December 07, 2015 12:44:33 PM Ken Xue wrote:
> > D3cold is only regarded as valid if the "_PR3" object is present
> > for the given device after the commit <20dacb71ad28>
> > (ACPI/PM: Reworkdevice power management to follow ACPI 6).
> > 
> > But some old BIOS only defined "_PS3" for the D3COLD device.
> > And old kernel also believes the device has "_PS3" is a
> > D3COLD device.
> > 
> > So, add some logics for supporting D3 COLD device for old BIOS
> > which is compatible with earlier ACPI spec.
> > 
> > Signed-off-by: Ken Xue <Ken.Xue@amd.com>
> > Reported-and-tested-by: Gang Long <Gang.Long@amd.com>
> 
> Well, what really is the problem?

My problem is that
"acpi_device_can_poweroff" is called by "zpodd_init" in libata-zpodd.c. 
And ZPODD feature only can be enabled when D3_COLD is valid.

> 
> acpi_device_set_power() has a special case specifically for D3cold and
> falls back to D3hot if D3cold has been requested but is not "valid".
> 
> > ---
> >  drivers/acpi/scan.c | 4 +++-
> >  1 file changed, 3 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
> > index 01136b8..85c16bb 100644
> > --- a/drivers/acpi/scan.c
> > +++ b/drivers/acpi/scan.c
> > @@ -979,7 +979,9 @@ static void acpi_bus_get_power_flags(struct acpi_device *device)
> >  		acpi_bus_init_power_state(device, i);
> >  
> >  	INIT_LIST_HEAD(&device->power.states[ACPI_STATE_D3_COLD].resources);
> > -	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources))
> > +	if (!list_empty(&device->power.states[ACPI_STATE_D3_HOT].resources) ||
> > +		((acpi_gbl_FADT.header.revision < 6) &&
> > +		device->power.states[ACPI_STATE_D3_HOT].flags.explicit_set))
> >  		device->power.states[ACPI_STATE_D3_COLD].flags.valid = 1;
> >  
> >  	/* Set defaults for D0 and D3hot states (always valid) */
> > 
> 



^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS
  2015-12-08  1:37     ` Ken Xue
  (?)
@ 2015-12-08 13:14     ` Rafael J. Wysocki
  2015-12-09  1:18         ` Ken Xue
  -1 siblings, 1 reply; 8+ messages in thread
From: Rafael J. Wysocki @ 2015-12-08 13:14 UTC (permalink / raw)
  To: Ken Xue
  Cc: lenb, linux-acpi, linux-kernel, SPG_Linux_Kernel,
	mika.westerberg, Andy Shevchenko, Ivan.Zheng, Alex.Chuang

On Tuesday, December 08, 2015 09:37:56 AM Ken Xue wrote:
> On Mon, 2015-12-07 at 23:48 +0100, Rafael J. Wysocki wrote:
> > On Monday, December 07, 2015 12:44:33 PM Ken Xue wrote:
> > > D3cold is only regarded as valid if the "_PR3" object is present
> > > for the given device after the commit <20dacb71ad28>
> > > (ACPI/PM: Reworkdevice power management to follow ACPI 6).
> > > 
> > > But some old BIOS only defined "_PS3" for the D3COLD device.
> > > And old kernel also believes the device has "_PS3" is a
> > > D3COLD device.
> > > 
> > > So, add some logics for supporting D3 COLD device for old BIOS
> > > which is compatible with earlier ACPI spec.
> > > 
> > > Signed-off-by: Ken Xue <Ken.Xue@amd.com>
> > > Reported-and-tested-by: Gang Long <Gang.Long@amd.com>
> > 
> > Well, what really is the problem?
> 
> My problem is that
> "acpi_device_can_poweroff" is called by "zpodd_init" in libata-zpodd.c. 
> And ZPODD feature only can be enabled when D3_COLD is valid.

This means that acpi_device_can_poweroff() needs to be updated.  What about
like this:

static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
{
	return adev->power.states[ACPI_STATE_D3_COLD].flags.valid
		|| adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set;
}

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS
  2015-12-08 13:14     ` Rafael J. Wysocki
@ 2015-12-09  1:18         ` Ken Xue
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Xue @ 2015-12-09  1:18 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: lenb, linux-acpi, linux-kernel, SPG_Linux_Kernel,
	mika.westerberg, Andy Shevchenko, Ivan.Zheng, Alex.Chuang

On Tue, 2015-12-08 at 14:14 +0100, Rafael J. Wysocki wrote:
> On Tuesday, December 08, 2015 09:37:56 AM Ken Xue wrote:
> > On Mon, 2015-12-07 at 23:48 +0100, Rafael J. Wysocki wrote:
> > > On Monday, December 07, 2015 12:44:33 PM Ken Xue wrote:
> > > > D3cold is only regarded as valid if the "_PR3" object is present
> > > > for the given device after the commit <20dacb71ad28>
> > > > (ACPI/PM: Reworkdevice power management to follow ACPI 6).
> > > > 
> > > > But some old BIOS only defined "_PS3" for the D3COLD device.
> > > > And old kernel also believes the device has "_PS3" is a
> > > > D3COLD device.
> > > > 
> > > > So, add some logics for supporting D3 COLD device for old BIOS
> > > > which is compatible with earlier ACPI spec.
> > > > 
> > > > Signed-off-by: Ken Xue <Ken.Xue@amd.com>
> > > > Reported-and-tested-by: Gang Long <Gang.Long@amd.com>
> > > 
> > > Well, what really is the problem?
> > 
> > My problem is that
> > "acpi_device_can_poweroff" is called by "zpodd_init" in libata-zpodd.c. 
> > And ZPODD feature only can be enabled when D3_COLD is valid.
> 
> This means that acpi_device_can_poweroff() needs to be updated.  What about
> like this:
> 
> static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
> {
> 	return adev->power.states[ACPI_STATE_D3_COLD].flags.valid ||
		((acpi_gbl_FADT.header.revision < 6) &&
> 		 adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set);
> }

It also could work by refining "acpi_device_can_poweroff".
But ZPODD exactly requests D3 Cold support, So, checking ACPI version
should be necessary when D3 hot is explicit_set.
If you do not have other concern, I will submit new Patch later.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS
@ 2015-12-09  1:18         ` Ken Xue
  0 siblings, 0 replies; 8+ messages in thread
From: Ken Xue @ 2015-12-09  1:18 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: lenb, linux-acpi, linux-kernel, SPG_Linux_Kernel,
	mika.westerberg, Andy Shevchenko, Ivan.Zheng, Alex.Chuang

On Tue, 2015-12-08 at 14:14 +0100, Rafael J. Wysocki wrote:
> On Tuesday, December 08, 2015 09:37:56 AM Ken Xue wrote:
> > On Mon, 2015-12-07 at 23:48 +0100, Rafael J. Wysocki wrote:
> > > On Monday, December 07, 2015 12:44:33 PM Ken Xue wrote:
> > > > D3cold is only regarded as valid if the "_PR3" object is present
> > > > for the given device after the commit <20dacb71ad28>
> > > > (ACPI/PM: Reworkdevice power management to follow ACPI 6).
> > > > 
> > > > But some old BIOS only defined "_PS3" for the D3COLD device.
> > > > And old kernel also believes the device has "_PS3" is a
> > > > D3COLD device.
> > > > 
> > > > So, add some logics for supporting D3 COLD device for old BIOS
> > > > which is compatible with earlier ACPI spec.
> > > > 
> > > > Signed-off-by: Ken Xue <Ken.Xue@amd.com>
> > > > Reported-and-tested-by: Gang Long <Gang.Long@amd.com>
> > > 
> > > Well, what really is the problem?
> > 
> > My problem is that
> > "acpi_device_can_poweroff" is called by "zpodd_init" in libata-zpodd.c. 
> > And ZPODD feature only can be enabled when D3_COLD is valid.
> 
> This means that acpi_device_can_poweroff() needs to be updated.  What about
> like this:
> 
> static inline bool acpi_device_can_poweroff(struct acpi_device *adev)
> {
> 	return adev->power.states[ACPI_STATE_D3_COLD].flags.valid ||
		((acpi_gbl_FADT.header.revision < 6) &&
> 		 adev->power.states[ACPI_STATE_D3_HOT].flags.explicit_set);
> }

It also could work by refining "acpi_device_can_poweroff".
But ZPODD exactly requests D3 Cold support, So, checking ACPI version
should be necessary when D3 hot is explicit_set.
If you do not have other concern, I will submit new Patch later.



^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2015-12-09  1:24 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-07  4:44 [PATCH 1/1] ACPI: Support D3 COLD device for old BIOS Ken Xue
2015-12-07  4:44 ` Ken Xue
2015-12-07 22:48 ` Rafael J. Wysocki
2015-12-08  1:37   ` Ken Xue
2015-12-08  1:37     ` Ken Xue
2015-12-08 13:14     ` Rafael J. Wysocki
2015-12-09  1:18       ` Ken Xue
2015-12-09  1:18         ` Ken Xue

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.