Re: Potential scheduler regression

2017-07-13 Thread Ben Guthro
On Tue, Jul 11, 2017 at 5:55 AM, Greg KH <gre...@linuxfoundation.org> wrote:
> On Tue, Jul 11, 2017 at 10:30:14AM +0200, Ingo Molnar wrote:
>>
>> * Ben Guthro <b...@guthro.net> wrote:
>>
>> > > If people have experience with these in the "enterprise" distros, or any 
>> > > other
>> > > tree, and want to provide me with backported, and tested, patches, I'll 
>> > > be
>> > > glad to consider them for stable kernels.
>> > >
>> > > thanks,
>> > >
>> > > greg k-h
>> >
>> > I tried to do a simple cherry-pick of the suggested patches - but they
>> > apply against files that don't exist in the 4.9 series.
>>
>> I think there are only two strategies to maintain a backport which work in 
>> the
>> long run:
>>
>>  - insist on the simplest fixes and pure cherry-picks
>>
>>  - or pick up _everything_ to sync up the two versions.
>>
>> The latter would mean a lot of commits - and I'm afraid it would also 
>> involve the
>> scheduler header split-up, which literally involves hundreds of files plus
>> perpetual build-breakage risk, so it's a no-no.
>>
>> > In my release of 4.9 - I'm planning on doing the simpler revert of 
>> > 1b568f0aab
>> > that introduced the performance degradation, rather than pulling in lots 
>> > of code
>> > from newer kernels.
>>
>> That sounds much saner - I'd even Ack that approach for -stable as a special
>> exception, than to complicate things with excessive backports.
>
> Ok, I'll revert that for the next stable release after this one that is
> currently under review.
>
> thanks,
>
> greg k-h

Greg,

Just for clarity - is the "next one" 4.9.38 (posted today for review)
- or the one following?

Thanks,
Ben


Re: Potential scheduler regression

2017-07-13 Thread Ben Guthro
On Tue, Jul 11, 2017 at 5:55 AM, Greg KH  wrote:
> On Tue, Jul 11, 2017 at 10:30:14AM +0200, Ingo Molnar wrote:
>>
>> * Ben Guthro  wrote:
>>
>> > > If people have experience with these in the "enterprise" distros, or any 
>> > > other
>> > > tree, and want to provide me with backported, and tested, patches, I'll 
>> > > be
>> > > glad to consider them for stable kernels.
>> > >
>> > > thanks,
>> > >
>> > > greg k-h
>> >
>> > I tried to do a simple cherry-pick of the suggested patches - but they
>> > apply against files that don't exist in the 4.9 series.
>>
>> I think there are only two strategies to maintain a backport which work in 
>> the
>> long run:
>>
>>  - insist on the simplest fixes and pure cherry-picks
>>
>>  - or pick up _everything_ to sync up the two versions.
>>
>> The latter would mean a lot of commits - and I'm afraid it would also 
>> involve the
>> scheduler header split-up, which literally involves hundreds of files plus
>> perpetual build-breakage risk, so it's a no-no.
>>
>> > In my release of 4.9 - I'm planning on doing the simpler revert of 
>> > 1b568f0aab
>> > that introduced the performance degradation, rather than pulling in lots 
>> > of code
>> > from newer kernels.
>>
>> That sounds much saner - I'd even Ack that approach for -stable as a special
>> exception, than to complicate things with excessive backports.
>
> Ok, I'll revert that for the next stable release after this one that is
> currently under review.
>
> thanks,
>
> greg k-h

Greg,

Just for clarity - is the "next one" 4.9.38 (posted today for review)
- or the one following?

Thanks,
Ben


Re: Potential scheduler regression

2017-07-10 Thread Ben Guthro
On Mon, Jul 10, 2017 at 11:26 AM, Greg KH <gre...@linuxfoundation.org> wrote:
> On Mon, Jul 10, 2017 at 11:25:32AM +0200, Peter Zijlstra wrote:
>> On Fri, Jul 07, 2017 at 04:55:27PM -0400, Ben Guthro wrote:
>>
>> > Apologies on the delay - it took a bit to get the machines, to run the 
>> > test.
>> >
>> > I am happy to report that the kernel at 1ad3aaf3fcd2, seems to regain
>> > performance loss from 1b568f0aab, in our test environment.
>>
>> Excellent.
>>
>> > Since 4.9 is an LTS kernel - is this appropriate to suggest to be
>> > included in the linux-stable list?
>>
>> Hurm... so I typically suck at (also) keeping track of -stable things.
>>
>> But given LTS, there might be a few more commits that might make sense
>> to include.
>>
>> This series corrects NUMA topology creation:
>>
>> 8c0334697dc3 ("sched/topology: Refactor function 
>> build_overlap_sched_groups()")
>> c743f0a5c50f ("sched/fair, cpumask: Export for_each_cpu_wrap()")
>> 0372dd2736e0 ("sched/topology: Fix building of overlapping sched-groups")
>> 91eaed0d6131 ("sched/topology: Simplify build_overlap_sched_groups()")
>> b0151c25548c ("sched/debug: Print the scheduler topology group mask")
>> a420b0630362 ("sched/topology: Verify the first group matches the child 
>> domain")
>> f32d782e31bf ("sched/topology: Optimize build_group_mask()")
>> c20e1ea4b61c ("sched/topology: Move comment about asymmetric node setups")
>> af85596c74de ("sched/topology: Remove FORCE_SD_OVERLAP")
>> 73bb059f9b8a ("sched/topology: Fix overlapping sched_group_mask")
>> 8d5dc5126bb2 ("sched/topology: Small cleanup")
>> 005f874dd284 ("sched/topology: Add sched_group_capacity debugging")
>> 1676330ecfa8 ("sched/topology: Fix overlapping sched_group_capacity")
>>
>> (there's a few more commits at the end of that series that add comments
>> and renames a bunch of stuff which doesn't really fix anything).
>>
>> Cures a BUG_ON through sysrq:
>>
>> 896bbb252258 ("sched/core: Allow __sched_setscheduler() in interrupts when 
>> PI is not used")
>>
>>
>> Performance issues:
>>
>>
>> 502ce005ab95 ("sched/fair: Use task_groups instead of leaf_cfs_rq_list to 
>> walk all cfs_rqs")
>> a9e7f6544b9c ("sched/fair: Fix O(nr_cgroups) in load balance path")
>>
>> c249f255aab8 ("sched/rt: Minimize rq->lock contention in 
>> do_sched_rt_period_timer()")
>>
>> 8655d5497735 ("sched/numa: Use down_read_trylock() for the mmap_sem")
>>
>>
>>
>> And then the patch you want for this:
>>
>> 1ad3aaf3fcd2 ("sched/core: Implement new approach to scale 
>> select_idle_cpu()")
>>
>>
>>
>> I have no real idea how much of any those qualify for 4.9, but know most
>> of those patches ended up in the various enterprise distros in some form
>> or other.
>
> If people have experience with these in the "enterprise" distros, or
> any other tree, and want to provide me with backported, and tested,
> patches, I'll be glad to consider them for stable kernels.
>
> thanks,
>
> greg k-h

I tried to do a simple cherry-pick of the suggested patches - but they
apply against files that don't exist in the 4.9 series.
This means it would be a more complicated port, that, without having
the original author's context - there's a non-zero possibility that
I'd botch the port. As such, I'll yield to Peter's expertise here.

In my release of 4.9 - I'm planning on doing the simpler revert of
1b568f0aab that introduced the performance degradation, rather than
pulling in lots of code from newer kernels.

Thanks
Ben G


Re: Potential scheduler regression

2017-07-10 Thread Ben Guthro
On Mon, Jul 10, 2017 at 11:26 AM, Greg KH  wrote:
> On Mon, Jul 10, 2017 at 11:25:32AM +0200, Peter Zijlstra wrote:
>> On Fri, Jul 07, 2017 at 04:55:27PM -0400, Ben Guthro wrote:
>>
>> > Apologies on the delay - it took a bit to get the machines, to run the 
>> > test.
>> >
>> > I am happy to report that the kernel at 1ad3aaf3fcd2, seems to regain
>> > performance loss from 1b568f0aab, in our test environment.
>>
>> Excellent.
>>
>> > Since 4.9 is an LTS kernel - is this appropriate to suggest to be
>> > included in the linux-stable list?
>>
>> Hurm... so I typically suck at (also) keeping track of -stable things.
>>
>> But given LTS, there might be a few more commits that might make sense
>> to include.
>>
>> This series corrects NUMA topology creation:
>>
>> 8c0334697dc3 ("sched/topology: Refactor function 
>> build_overlap_sched_groups()")
>> c743f0a5c50f ("sched/fair, cpumask: Export for_each_cpu_wrap()")
>> 0372dd2736e0 ("sched/topology: Fix building of overlapping sched-groups")
>> 91eaed0d6131 ("sched/topology: Simplify build_overlap_sched_groups()")
>> b0151c25548c ("sched/debug: Print the scheduler topology group mask")
>> a420b0630362 ("sched/topology: Verify the first group matches the child 
>> domain")
>> f32d782e31bf ("sched/topology: Optimize build_group_mask()")
>> c20e1ea4b61c ("sched/topology: Move comment about asymmetric node setups")
>> af85596c74de ("sched/topology: Remove FORCE_SD_OVERLAP")
>> 73bb059f9b8a ("sched/topology: Fix overlapping sched_group_mask")
>> 8d5dc5126bb2 ("sched/topology: Small cleanup")
>> 005f874dd284 ("sched/topology: Add sched_group_capacity debugging")
>> 1676330ecfa8 ("sched/topology: Fix overlapping sched_group_capacity")
>>
>> (there's a few more commits at the end of that series that add comments
>> and renames a bunch of stuff which doesn't really fix anything).
>>
>> Cures a BUG_ON through sysrq:
>>
>> 896bbb252258 ("sched/core: Allow __sched_setscheduler() in interrupts when 
>> PI is not used")
>>
>>
>> Performance issues:
>>
>>
>> 502ce005ab95 ("sched/fair: Use task_groups instead of leaf_cfs_rq_list to 
>> walk all cfs_rqs")
>> a9e7f6544b9c ("sched/fair: Fix O(nr_cgroups) in load balance path")
>>
>> c249f255aab8 ("sched/rt: Minimize rq->lock contention in 
>> do_sched_rt_period_timer()")
>>
>> 8655d5497735 ("sched/numa: Use down_read_trylock() for the mmap_sem")
>>
>>
>>
>> And then the patch you want for this:
>>
>> 1ad3aaf3fcd2 ("sched/core: Implement new approach to scale 
>> select_idle_cpu()")
>>
>>
>>
>> I have no real idea how much of any those qualify for 4.9, but know most
>> of those patches ended up in the various enterprise distros in some form
>> or other.
>
> If people have experience with these in the "enterprise" distros, or
> any other tree, and want to provide me with backported, and tested,
> patches, I'll be glad to consider them for stable kernels.
>
> thanks,
>
> greg k-h

I tried to do a simple cherry-pick of the suggested patches - but they
apply against files that don't exist in the 4.9 series.
This means it would be a more complicated port, that, without having
the original author's context - there's a non-zero possibility that
I'd botch the port. As such, I'll yield to Peter's expertise here.

In my release of 4.9 - I'm planning on doing the simpler revert of
1b568f0aab that introduced the performance degradation, rather than
pulling in lots of code from newer kernels.

Thanks
Ben G


Re: Potential scheduler regression

2017-07-07 Thread Ben Guthro
On Wed, Jul 5, 2017 at 12:48 PM, Peter Zijlstra <pet...@infradead.org> wrote:
> On Wed, Jul 05, 2017 at 11:42:46AM -0400, Ben Guthro wrote:
>> Hello,
>>
>> I've been in the process of updating our kernel in our appliance VM
>> from an old LTS kernel (4.1.y) to something a bit more modern (4.9.y)
>> - and ran into a performance regression, when our QA team was running
>> some regression suites.
>>
>>
>> I bisect this behavior to the following commit, introduced in the 4.9
>> merge window:
>>
>
> Could you test a later kernel that includes commit:
>
>   1ad3aaf3fcd2 ("sched/core: Implement new approach to scale 
> select_idle_cpu()")
>

(resend without html)

Apologies on the delay - it took a bit to get the machines, to run the test.

I am happy to report that the kernel at 1ad3aaf3fcd2, seems to regain
performance loss from 1b568f0aab, in our test environment.

Since 4.9 is an LTS kernel - is this appropriate to suggest to be
included in the linux-stable list?


Re: Potential scheduler regression

2017-07-07 Thread Ben Guthro
On Wed, Jul 5, 2017 at 12:48 PM, Peter Zijlstra  wrote:
> On Wed, Jul 05, 2017 at 11:42:46AM -0400, Ben Guthro wrote:
>> Hello,
>>
>> I've been in the process of updating our kernel in our appliance VM
>> from an old LTS kernel (4.1.y) to something a bit more modern (4.9.y)
>> - and ran into a performance regression, when our QA team was running
>> some regression suites.
>>
>>
>> I bisect this behavior to the following commit, introduced in the 4.9
>> merge window:
>>
>
> Could you test a later kernel that includes commit:
>
>   1ad3aaf3fcd2 ("sched/core: Implement new approach to scale 
> select_idle_cpu()")
>

(resend without html)

Apologies on the delay - it took a bit to get the machines, to run the test.

I am happy to report that the kernel at 1ad3aaf3fcd2, seems to regain
performance loss from 1b568f0aab, in our test environment.

Since 4.9 is an LTS kernel - is this appropriate to suggest to be
included in the linux-stable list?


Potential scheduler regression

2017-07-05 Thread Ben Guthro
Hello,

I've been in the process of updating our kernel in our appliance VM
from an old LTS kernel (4.1.y) to something a bit more modern (4.9.y)
- and ran into a performance regression, when our QA team was running
some regression suites.


I bisect this behavior to the following commit, introduced in the 4.9
merge window:


commit 1b568f0aabf280555125bc7cefc08321ff0ebaba
Author: Peter Zijlstra <pet...@infradead.org>
Date:   Mon May 9 10:38:41 2016 +0200

sched/core: Optimize SCHED_SMT

Avoid pointless SCHED_SMT code when running on !SMT hardware.

Signed-off-by: Peter Zijlstra (Intel) <pet...@infradead.org>
Cc: Linus Torvalds <torva...@linux-foundation.org>
Cc: Mike Galbraith <efa...@gmx.de>
Cc: Peter Zijlstra <pet...@infradead.org>
Cc: Thomas Gleixner <t...@linutronix.de>
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar <mi...@kernel.org>



It seems that this commit can have a performance impact on virtual
machines running on VMWare ESXi,
Now...this seemed strange to me, since it appears that the bulk of the
change comes down to the code in kernel/sched/core.c:

#ifdef CONFIG_SCHED_SMT
DEFINE_STATIC_KEY_FALSE(sched_smt_present);

static void sched_init_smt(void)
{
/*
 * We've enumerated all CPUs and will assume that if any CPU
 * has SMT siblings, CPU0 will too.
 */
if (cpumask_weight(cpu_smt_mask(0)) > 1)
static_branch_enable(_smt_present);
}
#else


I have verified that, in this environment, the vCPU presented to the
guest has hyperthreading enabled,
but only presents a single hyperthread.
cpumask_weight(cpu_smt_mask(0) resolves to 1

This is backed up with the cpuinfo, and lscpu output, as well

Results of /proc/cpuinfo for cpu0:

~$ cat /proc/cpuinfo | head -27
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 63
model name  : Intel(R) Xeon(R) CPU E5-2697 v3 @ 2.60GHz
stepping: 2
microcode   : 0x2d
cpu MHz : 2599.732
cache size  : 35840 KB
physical id : 0
siblings: 4
core id : 0
cpu cores   : 4
apicid  : 0
initial apicid  : 0
fpu : yes
fpu_exception   : yes
cpuid level : 15
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology
tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma
cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes
xsave avx f16c rdrand hypervisor lahf_lm abm epb fsgsbase tsc_adjust
bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
bugs:
bogomips: 5199.99
clflush size: 64
cache_alignment : 64
address sizes   : 42 bits physical, 48 bits virtual
power management:

Results of "lscpu" :

~$ lscpu
Architecture:  x86_64
CPU op-mode(s):32-bit, 64-bit
Byte Order:Little Endian
CPU(s):4
On-line CPU(s) list:   0-3
Thread(s) per core:1
Core(s) per socket:4
Socket(s): 1
NUMA node(s):  1
Vendor ID: GenuineIntel
CPU family:6
Model: 63
Stepping:  2
CPU MHz:   2599.732
BogoMIPS:  5199.99
Hypervisor vendor: VMware
Virtualization type:   full
L1d cache: 32K
L1i cache: 32K
L2 cache:  256K
L3 cache:  35840K
NUMA node0 CPU(s): 0-3



Now - I suppose that we could just carry around a patch, to revert
this commit, whenever we wanted to update our kernel...but I'd prefer
to understand the problem better - since this is currently falling
into the category of "being able to have progress, or understanding,
but not necessarily both"


In advance of the question - the tip of the tree (v4.12 at an earlier
RC version) was tested, and at that time, no discernable difference
was noticed, from 4.9, WRT this performance regression in our tests.
However - this code remains unchanged AFAICT in v4.12


This is my first dip back into LKML in probably 4 years - so apologies
if this has been previously discussed. I tried to do my research ahead
of time - but either this has not been discussed, or my google-fu was
weak when attempting the search parameters.


Do you happen to know what might be happening here?



Thank you in advance, for any information that you may be able to provide


Ben Guthro
SimpliVity / Hewlett Packard Enterprise


Potential scheduler regression

2017-07-05 Thread Ben Guthro
Hello,

I've been in the process of updating our kernel in our appliance VM
from an old LTS kernel (4.1.y) to something a bit more modern (4.9.y)
- and ran into a performance regression, when our QA team was running
some regression suites.


I bisect this behavior to the following commit, introduced in the 4.9
merge window:


commit 1b568f0aabf280555125bc7cefc08321ff0ebaba
Author: Peter Zijlstra 
Date:   Mon May 9 10:38:41 2016 +0200

sched/core: Optimize SCHED_SMT

Avoid pointless SCHED_SMT code when running on !SMT hardware.

Signed-off-by: Peter Zijlstra (Intel) 
Cc: Linus Torvalds 
Cc: Mike Galbraith 
Cc: Peter Zijlstra 
Cc: Thomas Gleixner 
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ingo Molnar 



It seems that this commit can have a performance impact on virtual
machines running on VMWare ESXi,
Now...this seemed strange to me, since it appears that the bulk of the
change comes down to the code in kernel/sched/core.c:

#ifdef CONFIG_SCHED_SMT
DEFINE_STATIC_KEY_FALSE(sched_smt_present);

static void sched_init_smt(void)
{
/*
 * We've enumerated all CPUs and will assume that if any CPU
 * has SMT siblings, CPU0 will too.
 */
if (cpumask_weight(cpu_smt_mask(0)) > 1)
static_branch_enable(_smt_present);
}
#else


I have verified that, in this environment, the vCPU presented to the
guest has hyperthreading enabled,
but only presents a single hyperthread.
cpumask_weight(cpu_smt_mask(0) resolves to 1

This is backed up with the cpuinfo, and lscpu output, as well

Results of /proc/cpuinfo for cpu0:

~$ cat /proc/cpuinfo | head -27
processor   : 0
vendor_id   : GenuineIntel
cpu family  : 6
model   : 63
model name  : Intel(R) Xeon(R) CPU E5-2697 v3 @ 2.60GHz
stepping: 2
microcode   : 0x2d
cpu MHz : 2599.732
cache size  : 35840 KB
physical id : 0
siblings: 4
core id : 0
cpu cores   : 4
apicid  : 0
initial apicid  : 0
fpu : yes
fpu_exception   : yes
cpuid level : 15
wp  : yes
flags   : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge
mca cmov pat pse36 clflush dts mmx fxsr sse sse2 ss ht syscall nx
pdpe1gb rdtscp lm constant_tsc arch_perfmon pebs bts nopl xtopology
tsc_reliable nonstop_tsc aperfmperf eagerfpu pni pclmulqdq ssse3 fma
cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes
xsave avx f16c rdrand hypervisor lahf_lm abm epb fsgsbase tsc_adjust
bmi1 avx2 smep bmi2 invpcid xsaveopt dtherm ida arat pln pts
bugs:
bogomips: 5199.99
clflush size: 64
cache_alignment : 64
address sizes   : 42 bits physical, 48 bits virtual
power management:

Results of "lscpu" :

~$ lscpu
Architecture:  x86_64
CPU op-mode(s):32-bit, 64-bit
Byte Order:Little Endian
CPU(s):4
On-line CPU(s) list:   0-3
Thread(s) per core:1
Core(s) per socket:4
Socket(s): 1
NUMA node(s):  1
Vendor ID: GenuineIntel
CPU family:6
Model: 63
Stepping:  2
CPU MHz:   2599.732
BogoMIPS:  5199.99
Hypervisor vendor: VMware
Virtualization type:   full
L1d cache: 32K
L1i cache: 32K
L2 cache:  256K
L3 cache:  35840K
NUMA node0 CPU(s): 0-3



Now - I suppose that we could just carry around a patch, to revert
this commit, whenever we wanted to update our kernel...but I'd prefer
to understand the problem better - since this is currently falling
into the category of "being able to have progress, or understanding,
but not necessarily both"


In advance of the question - the tip of the tree (v4.12 at an earlier
RC version) was tested, and at that time, no discernable difference
was noticed, from 4.9, WRT this performance regression in our tests.
However - this code remains unchanged AFAICT in v4.12


This is my first dip back into LKML in probably 4 years - so apologies
if this has been previously discussed. I tried to do my research ahead
of time - but either this has not been discussed, or my google-fu was
weak when attempting the search parameters.


Do you happen to know what might be happening here?



Thank you in advance, for any information that you may be able to provide


Ben Guthro
SimpliVity / Hewlett Packard Enterprise


[PATCH v8.1] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-30 Thread Ben Guthro
Register for the extended sleep callback from acpi.
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei 
Reviewed-by: Konrad Rzeszutek Wilk 
---
 arch/x86/kernel/tboot.c |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index addf7b5..91a4496 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -301,6 +301,15 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+   if (!tboot_enabled())
+   return 0;
+
+   pr_warning("tboot is not able to suspend on platforms with reduced 
hardware sleep (ACPIv5)");
+   return -ENODEV;
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +431,7 @@ static __init int tboot_late_init(void)
 #endif
 
acpi_os_set_prepare_sleep(_sleep);
+   acpi_os_set_prepare_extended_sleep(_extended_sleep);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-30 Thread Ben Guthro
Register for the extended sleep callback from acpi.
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei 
Reviewed-by: Konrad Rzeszutek Wilk 
---
 arch/x86/kernel/tboot.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index addf7b5..ade00c8 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+   if (!tboot_enabled())
+   return 0;
+
+   pr_warning("tboot is not able to suspend on platforms with"
+  " reduced hardware sleep (ACPIv5). Please contact"
+  " tboot-de...@lists.sourceforge.net mailing list.");
+   return -ENODEV;
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
acpi_os_set_prepare_sleep(_sleep);
+   acpi_os_set_prepare_extended_sleep(_extended_sleep);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 3/3] xen/acpi: notify xen when reduced hardware sleep is available

2013-07-30 Thread Ben Guthro
Make use of acpi_os_prepare_extended_sleep callback to notify xen
to make use of the reduced hardware sleep functionality

The xen hypervisor change underlying this is commit 62d1a69
("ACPI: support v5 (reduced HW) sleep interface") on the master
branch of git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Acked-by: Konrad Wilk 
---
 drivers/xen/acpi.c   |   41 ++
 include/xen/acpi.h   |8 ++--
 include/xen/interface/platform.h |7 ---
 3 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..90307c0 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,43 @@
 #include 
 #include 
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+static int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+   u32 val_a, u32 val_b,
+   bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt & 0x) || (pm1b_cnt & 0x)) {
-   WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-"Email xen-de...@lists.xensource.com  Thank you.\n", \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+"Using more than %u bits of sleep control values %#x/%#x!"
+"Email xen-de...@lists.xen.org - Thank you.\n", \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op();
return 1;
 }
+
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
+u32 pm1a_cnt, u32 pm1b_cnt)
+{
+   return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt,
+   pm1b_cnt, false);
+}
+
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+u32 val_a, u32 val_b)
+{
+   return xen_acpi_notify_hypervisor_state(sleep_state, val_a,
+   val_b, true);
+}
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 46aa3d1..4ddd7dc 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,10 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
 u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+u32 val_a, u32 val_b);
 
 static inline int xen_acpi_suspend_lowlevel(void)
 {
@@ -93,7 +95,9 @@ static inline void xen_acpi_sleep_register(void)
 {
if (xen_initial_domain()) {
acpi_os_set_prepare_sleep(
-   _acpi_notify_hypervisor_state);
+   _acpi_notify_hypervisor_sleep);
+   acpi_os_set_prepare_extended_sleep(
+   _acpi_notify_hypervisor_extended_sleep);
 
acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
}
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter

[PATCH v8 0/3] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-30 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a new callback to be added to acpica
to be called back during this reduced hardware sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The xen hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Richard L Maliszewski 
Cc: Gang Wei 
Cc: Shane Wang 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
so intermediate builds of partial patch series will not fail.
v6: Rebased to linux-pm linux-next branch
Added warning in tboot early return code
Added Reviewed-by lines
v7: Add separate acpi_os_prepare_extended_sleep() interface
Remove OSL acpica changes introduced in v4
v8: Return meaningful error code in tboot error path

Ben Guthro (3):
  x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for
extended sleep path
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |   12 +++
 drivers/acpi/acpica/hwesleep.c   |9 +
 drivers/acpi/osl.c   |   24 ++
 drivers/xen/acpi.c   |   41 ++
 include/linux/acpi.h |7 +++
 include/xen/acpi.h   |8 ++--
 include/xen/interface/platform.h |7 ---
 7 files changed, 90 insertions(+), 18 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 1/3] x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for extended sleep path

2013-07-30 Thread Ben Guthro
Like acpi_os_prepare_sleep, register a callback for use in systems like
tboot, and xen, which have system specific requirements outside of acpica.
This mirrors the functionality in acpi_os_prepare_sleep(), called from
acpi_hw_sleep()

Signed-off-by: Ben Guthro 
---
 drivers/acpi/acpica/hwesleep.c |9 +
 drivers/acpi/osl.c |   24 
 include/linux/acpi.h   |7 +++
 3 files changed, 40 insertions(+)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..4140768 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -43,6 +43,7 @@
  */
 
 #include 
+#include 
 #include "accommon.h"
 
 #define _COMPONENT  ACPI_HARDWARE
@@ -128,6 +129,14 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_extended_sleep(sleep_state,
+   acpi_gbl_sleep_type_a,
+   acpi_gbl_sleep_type_b);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 6ab2c35..a934950 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -79,6 +79,8 @@ extern char line_buf[80];
 
 static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
  u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_extended_sleep)(u8 sleep_state, u32 val_a,
+ u32 val_b);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1779,6 +1781,28 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 
sleep_state,
__acpi_os_prepare_sleep = func;
 }
 
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
+ u32 val_b)
+{
+   int rc = 0;
+   if (__acpi_os_prepare_extended_sleep)
+   rc = __acpi_os_prepare_extended_sleep(sleep_state,
+val_a, val_b);
+   if (rc < 0)
+   return AE_ERROR;
+   else if (rc > 0)
+   return AE_CTRL_SKIP;
+
+   return AE_OK;
+}
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+  u32 val_a, u32 val_b))
+{
+   __acpi_os_prepare_extended_sleep = func;
+}
+
+
 void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context,
void (*func)(struct work_struct *work))
 {
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba25..a5db4ae 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -481,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 
 acpi_status acpi_os_prepare_sleep(u8 sleep_state,
  u32 pm1a_control, u32 pm1b_control);
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+   u32 val_a,  u32 val_b));
+
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
+  u32 val_a, u32 val_b);
+
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 1/3] x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for extended sleep path

2013-07-30 Thread Ben Guthro
Like acpi_os_prepare_sleep, register a callback for use in systems like
tboot, and xen, which have system specific requirements outside of acpica.
This mirrors the functionality in acpi_os_prepare_sleep(), called from
acpi_hw_sleep()

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
---
 drivers/acpi/acpica/hwesleep.c |9 +
 drivers/acpi/osl.c |   24 
 include/linux/acpi.h   |7 +++
 3 files changed, 40 insertions(+)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..4140768 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -43,6 +43,7 @@
  */
 
 #include acpi/acpi.h
+#include linux/acpi.h
 #include accommon.h
 
 #define _COMPONENT  ACPI_HARDWARE
@@ -128,6 +129,14 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_extended_sleep(sleep_state,
+   acpi_gbl_sleep_type_a,
+   acpi_gbl_sleep_type_b);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 6ab2c35..a934950 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -79,6 +79,8 @@ extern char line_buf[80];
 
 static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
  u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_extended_sleep)(u8 sleep_state, u32 val_a,
+ u32 val_b);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1779,6 +1781,28 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 
sleep_state,
__acpi_os_prepare_sleep = func;
 }
 
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
+ u32 val_b)
+{
+   int rc = 0;
+   if (__acpi_os_prepare_extended_sleep)
+   rc = __acpi_os_prepare_extended_sleep(sleep_state,
+val_a, val_b);
+   if (rc  0)
+   return AE_ERROR;
+   else if (rc  0)
+   return AE_CTRL_SKIP;
+
+   return AE_OK;
+}
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+  u32 val_a, u32 val_b))
+{
+   __acpi_os_prepare_extended_sleep = func;
+}
+
+
 void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context,
void (*func)(struct work_struct *work))
 {
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba25..a5db4ae 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -481,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 
 acpi_status acpi_os_prepare_sleep(u8 sleep_state,
  u32 pm1a_control, u32 pm1b_control);
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+   u32 val_a,  u32 val_b));
+
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
+  u32 val_a, u32 val_b);
+
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 3/3] xen/acpi: notify xen when reduced hardware sleep is available

2013-07-30 Thread Ben Guthro
Make use of acpi_os_prepare_extended_sleep callback to notify xen
to make use of the reduced hardware sleep functionality

The xen hypervisor change underlying this is commit 62d1a69
(ACPI: support v5 (reduced HW) sleep interface) on the master
branch of git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Acked-by: Konrad Wilk konrad.w...@oracle.com
---
 drivers/xen/acpi.c   |   41 ++
 include/xen/acpi.h   |8 ++--
 include/xen/interface/platform.h |7 ---
 3 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..90307c0 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,43 @@
 #include asm/xen/hypercall.h
 #include asm/xen/hypervisor.h
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+static int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+   u32 val_a, u32 val_b,
+   bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt  0x) || (pm1b_cnt  0x)) {
-   WARN(1, Using more than 16bits of PM1A/B 0x%x/0x%x!
-Email xen-de...@lists.xensource.com  Thank you.\n, \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a  (~0  bits)) || (val_b  (~0  bits)),
+Using more than %u bits of sleep control values %#x/%#x!
+Email xen-de...@lists.xen.org - Thank you.\n, \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op(op);
return 1;
 }
+
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
+u32 pm1a_cnt, u32 pm1b_cnt)
+{
+   return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt,
+   pm1b_cnt, false);
+}
+
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+u32 val_a, u32 val_b)
+{
+   return xen_acpi_notify_hypervisor_state(sleep_state, val_a,
+   val_b, true);
+}
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 46aa3d1..4ddd7dc 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,10 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
 u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+u32 val_a, u32 val_b);
 
 static inline int xen_acpi_suspend_lowlevel(void)
 {
@@ -93,7 +95,9 @@ static inline void xen_acpi_sleep_register(void)
 {
if (xen_initial_domain()) {
acpi_os_set_prepare_sleep(
-   xen_acpi_notify_hypervisor_state);
+   xen_acpi_notify_hypervisor_sleep);
+   acpi_os_set_prepare_extended_sleep(
+   xen_acpi_notify_hypervisor_extended_sleep);
 
acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
}
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT

[PATCH v8 0/3] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-30 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a new callback to be added to acpica
to be called back during this reduced hardware sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The xen hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
Cc: Gang Wei gang@intel.com
Cc: Shane Wang shane.w...@intel.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
so intermediate builds of partial patch series will not fail.
v6: Rebased to linux-pm linux-next branch
Added warning in tboot early return code
Added Reviewed-by lines
v7: Add separate acpi_os_prepare_extended_sleep() interface
Remove OSL acpica changes introduced in v4
v8: Return meaningful error code in tboot error path

Ben Guthro (3):
  x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for
extended sleep path
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |   12 +++
 drivers/acpi/acpica/hwesleep.c   |9 +
 drivers/acpi/osl.c   |   24 ++
 drivers/xen/acpi.c   |   41 ++
 include/linux/acpi.h |7 +++
 include/xen/acpi.h   |8 ++--
 include/xen/interface/platform.h |7 ---
 7 files changed, 90 insertions(+), 18 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-30 Thread Ben Guthro
Register for the extended sleep callback from acpi.
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei gang@intel.com
Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
---
 arch/x86/kernel/tboot.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index addf7b5..ade00c8 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+   if (!tboot_enabled())
+   return 0;
+
+   pr_warning(tboot is not able to suspend on platforms with
+   reduced hardware sleep (ACPIv5). Please contact
+   tboot-de...@lists.sourceforge.net mailing list.);
+   return -ENODEV;
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
acpi_os_set_prepare_sleep(tboot_sleep);
+   acpi_os_set_prepare_extended_sleep(tboot_extended_sleep);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v8.1] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-30 Thread Ben Guthro
Register for the extended sleep callback from acpi.
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei gang@intel.com
Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
---
 arch/x86/kernel/tboot.c |   10 ++
 1 file changed, 10 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index addf7b5..91a4496 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -301,6 +301,15 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+   if (!tboot_enabled())
+   return 0;
+
+   pr_warning(tboot is not able to suspend on platforms with reduced 
hardware sleep (ACPIv5));
+   return -ENODEV;
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +431,7 @@ static __init int tboot_late_init(void)
 #endif
 
acpi_os_set_prepare_sleep(tboot_sleep);
+   acpi_os_set_prepare_extended_sleep(tboot_extended_sleep);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-29 Thread Ben Guthro


On 07/29/2013 04:21 PM, Rafael J. Wysocki wrote:
> On Monday, July 29, 2013 01:14:14 PM Ben Guthro wrote:
>> Register for the extended sleep callback from acpi.
>> As tboot currently does not support the reduced hardware sleep
>> interface, fail this extended call.
>>
>> Signed-off-by: Jan Beulich 
>> Signed-off-by: Ben Guthro 
>> Cc: tboot-de...@lists.sourceforge.net
>> Cc: Gang Wei 
>> Reviewed-by: Konrad Rzeszutek Wilk 
>> ---
>>  arch/x86/kernel/tboot.c |   12 
>>  1 file changed, 12 insertions(+)
>>
>> diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
>> index addf7b5..760f431 100644
>> --- a/arch/x86/kernel/tboot.c
>> +++ b/arch/x86/kernel/tboot.c
>> @@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 
>> pm1a_control, u32 pm1b_control)
>>  return 0;
>>  }
>>  
>> +static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
>> +{
>> +if (!tboot_enabled())
>> +return 0;
>> +
>> +pr_warning("tboot is not able to suspend on platforms with"
>> +   " reduced hardware sleep (ACPIv5). Please contact"
>> +   " tboot-de...@lists.sourceforge.net mailing list.");
>> +return -1;
> 
> Please use a meaningful error code here.  For example -ENODEV.

Would AE_NOT_IMPLEMENTED be more appropriate?

include/acpi/acexcep.h:
#define AE_NOT_IMPLEMENTED  EXCEP_ENV (0x000E)




> 
>> +}
>> +
>>  static atomic_t ap_wfs_count;
>>  
>>  static int tboot_wait_for_aps(int num_aps)
>> @@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
>>  #endif
>>  
>>  acpi_os_set_prepare_sleep(_sleep);
>> +acpi_os_set_prepare_extended_sleep(_extended_sleep);
>>  return 0;
>>  }
> 
> Thanks,
> Rafael
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 1/3] x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for extended sleep path

2013-07-29 Thread Ben Guthro
Like acpi_os_prepare_sleep, register a callback for use in systems like
tboot, and xen, which have system specific requirements outside of acpica.
This mirrors the functionality in acpi_os_prepare_sleep(), called from
acpi_hw_sleep()

Signed-off-by: Ben Guthro 
---
 drivers/acpi/acpica/hwesleep.c |9 +
 drivers/acpi/osl.c |   24 
 include/linux/acpi.h   |7 +++
 3 files changed, 40 insertions(+)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..4140768 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -43,6 +43,7 @@
  */
 
 #include 
+#include 
 #include "accommon.h"
 
 #define _COMPONENT  ACPI_HARDWARE
@@ -128,6 +129,14 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_extended_sleep(sleep_state,
+   acpi_gbl_sleep_type_a,
+   acpi_gbl_sleep_type_b);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 6ab2c35..a934950 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -79,6 +79,8 @@ extern char line_buf[80];
 
 static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
  u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_extended_sleep)(u8 sleep_state, u32 val_a,
+ u32 val_b);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1779,6 +1781,28 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 
sleep_state,
__acpi_os_prepare_sleep = func;
 }
 
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
+ u32 val_b)
+{
+   int rc = 0;
+   if (__acpi_os_prepare_extended_sleep)
+   rc = __acpi_os_prepare_extended_sleep(sleep_state,
+val_a, val_b);
+   if (rc < 0)
+   return AE_ERROR;
+   else if (rc > 0)
+   return AE_CTRL_SKIP;
+
+   return AE_OK;
+}
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+  u32 val_a, u32 val_b))
+{
+   __acpi_os_prepare_extended_sleep = func;
+}
+
+
 void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context,
void (*func)(struct work_struct *work))
 {
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba25..a5db4ae 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -481,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 
 acpi_status acpi_os_prepare_sleep(u8 sleep_state,
  u32 pm1a_control, u32 pm1b_control);
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+   u32 val_a,  u32 val_b));
+
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
+  u32 val_a, u32 val_b);
+
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 3/3] xen/acpi: notify xen when reduced hardware sleep is available

2013-07-29 Thread Ben Guthro
Make use of acpi_os_prepare_extended_sleep callback to notify xen
to make use of the reduced hardware sleep functionality

The xen hypervisor change underlying this is commit 62d1a69
("ACPI: support v5 (reduced HW) sleep interface") on the master
branch of git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Acked-by: Konrad Wilk 
---
 drivers/xen/acpi.c   |   41 ++
 include/xen/acpi.h   |8 ++--
 include/xen/interface/platform.h |7 ---
 3 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..90307c0 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,43 @@
 #include 
 #include 
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+static int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+   u32 val_a, u32 val_b,
+   bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt & 0x) || (pm1b_cnt & 0x)) {
-   WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-"Email xen-de...@lists.xensource.com  Thank you.\n", \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+"Using more than %u bits of sleep control values %#x/%#x!"
+"Email xen-de...@lists.xen.org - Thank you.\n", \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op();
return 1;
 }
+
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
+u32 pm1a_cnt, u32 pm1b_cnt)
+{
+   return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt,
+   pm1b_cnt, false);
+}
+
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+u32 val_a, u32 val_b)
+{
+   return xen_acpi_notify_hypervisor_state(sleep_state, val_a,
+   val_b, true);
+}
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 46aa3d1..4ddd7dc 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,10 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
 u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+u32 val_a, u32 val_b);
 
 static inline int xen_acpi_suspend_lowlevel(void)
 {
@@ -93,7 +95,9 @@ static inline void xen_acpi_sleep_register(void)
 {
if (xen_initial_domain()) {
acpi_os_set_prepare_sleep(
-   _acpi_notify_hypervisor_state);
+   _acpi_notify_hypervisor_sleep);
+   acpi_os_set_prepare_extended_sleep(
+   _acpi_notify_hypervisor_extended_sleep);
 
acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
}
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter

[PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-29 Thread Ben Guthro
Register for the extended sleep callback from acpi.
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei 
Reviewed-by: Konrad Rzeszutek Wilk 
---
 arch/x86/kernel/tboot.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index addf7b5..760f431 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+   if (!tboot_enabled())
+   return 0;
+
+   pr_warning("tboot is not able to suspend on platforms with"
+  " reduced hardware sleep (ACPIv5). Please contact"
+  " tboot-de...@lists.sourceforge.net mailing list.");
+   return -1;
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
acpi_os_set_prepare_sleep(_sleep);
+   acpi_os_set_prepare_extended_sleep(_extended_sleep);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 0/3] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-29 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a new callback to be added to acpica
to be called back during this reduced hardware sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The xen hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Richard L Maliszewski 
Cc: Gang Wei 
Cc: Shane Wang 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
so intermediate builds of partial patch series will not fail.
v6: Rebased to linux-pm linux-next branch
Added warning in tboot early return code
Added Reviewed-by lines
v7: Add separate acpi_os_prepare_extended_sleep() interface
Remove OSL acpica changes introduced in v4

Ben Guthro (3):
  x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for
extended sleep path
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |   12 +++
 drivers/acpi/acpica/hwesleep.c   |9 +
 drivers/acpi/osl.c   |   24 ++
 drivers/xen/acpi.c   |   41 ++
 include/linux/acpi.h |7 +++
 include/xen/acpi.h   |8 ++--
 include/xen/interface/platform.h |7 ---
 7 files changed, 90 insertions(+), 18 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 0/3] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-29 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a new callback to be added to acpica
to be called back during this reduced hardware sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The xen hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
Cc: Gang Wei gang@intel.com
Cc: Shane Wang shane.w...@intel.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
so intermediate builds of partial patch series will not fail.
v6: Rebased to linux-pm linux-next branch
Added warning in tboot early return code
Added Reviewed-by lines
v7: Add separate acpi_os_prepare_extended_sleep() interface
Remove OSL acpica changes introduced in v4

Ben Guthro (3):
  x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for
extended sleep path
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |   12 +++
 drivers/acpi/acpica/hwesleep.c   |9 +
 drivers/acpi/osl.c   |   24 ++
 drivers/xen/acpi.c   |   41 ++
 include/linux/acpi.h |7 +++
 include/xen/acpi.h   |8 ++--
 include/xen/interface/platform.h |7 ---
 7 files changed, 90 insertions(+), 18 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 3/3] xen/acpi: notify xen when reduced hardware sleep is available

2013-07-29 Thread Ben Guthro
Make use of acpi_os_prepare_extended_sleep callback to notify xen
to make use of the reduced hardware sleep functionality

The xen hypervisor change underlying this is commit 62d1a69
(ACPI: support v5 (reduced HW) sleep interface) on the master
branch of git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Acked-by: Konrad Wilk konrad.w...@oracle.com
---
 drivers/xen/acpi.c   |   41 ++
 include/xen/acpi.h   |8 ++--
 include/xen/interface/platform.h |7 ---
 3 files changed, 38 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..90307c0 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,43 @@
 #include asm/xen/hypercall.h
 #include asm/xen/hypervisor.h
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+static int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+   u32 val_a, u32 val_b,
+   bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt  0x) || (pm1b_cnt  0x)) {
-   WARN(1, Using more than 16bits of PM1A/B 0x%x/0x%x!
-Email xen-de...@lists.xensource.com  Thank you.\n, \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a  (~0  bits)) || (val_b  (~0  bits)),
+Using more than %u bits of sleep control values %#x/%#x!
+Email xen-de...@lists.xen.org - Thank you.\n, \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op(op);
return 1;
 }
+
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
+u32 pm1a_cnt, u32 pm1b_cnt)
+{
+   return xen_acpi_notify_hypervisor_state(sleep_state, pm1a_cnt,
+   pm1b_cnt, false);
+}
+
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+u32 val_a, u32 val_b)
+{
+   return xen_acpi_notify_hypervisor_state(sleep_state, val_a,
+   val_b, true);
+}
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 46aa3d1..4ddd7dc 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,10 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
+int xen_acpi_notify_hypervisor_sleep(u8 sleep_state,
 u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_extended_sleep(u8 sleep_state,
+u32 val_a, u32 val_b);
 
 static inline int xen_acpi_suspend_lowlevel(void)
 {
@@ -93,7 +95,9 @@ static inline void xen_acpi_sleep_register(void)
 {
if (xen_initial_domain()) {
acpi_os_set_prepare_sleep(
-   xen_acpi_notify_hypervisor_state);
+   xen_acpi_notify_hypervisor_sleep);
+   acpi_os_set_prepare_extended_sleep(
+   xen_acpi_notify_hypervisor_extended_sleep);
 
acpi_suspend_lowlevel = xen_acpi_suspend_lowlevel;
}
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT

[PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-29 Thread Ben Guthro
Register for the extended sleep callback from acpi.
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei gang@intel.com
Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
---
 arch/x86/kernel/tboot.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index addf7b5..760f431 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
return 0;
 }
 
+static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
+{
+   if (!tboot_enabled())
+   return 0;
+
+   pr_warning(tboot is not able to suspend on platforms with
+   reduced hardware sleep (ACPIv5). Please contact
+   tboot-de...@lists.sourceforge.net mailing list.);
+   return -1;
+}
+
 static atomic_t ap_wfs_count;
 
 static int tboot_wait_for_aps(int num_aps)
@@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
 #endif
 
acpi_os_set_prepare_sleep(tboot_sleep);
+   acpi_os_set_prepare_extended_sleep(tboot_extended_sleep);
return 0;
 }
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v7 1/3] x86/acpi: Introduce acpi_os_prepare_extended_sleep callback for extended sleep path

2013-07-29 Thread Ben Guthro
Like acpi_os_prepare_sleep, register a callback for use in systems like
tboot, and xen, which have system specific requirements outside of acpica.
This mirrors the functionality in acpi_os_prepare_sleep(), called from
acpi_hw_sleep()

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
---
 drivers/acpi/acpica/hwesleep.c |9 +
 drivers/acpi/osl.c |   24 
 include/linux/acpi.h   |7 +++
 3 files changed, 40 insertions(+)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..4140768 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -43,6 +43,7 @@
  */
 
 #include acpi/acpi.h
+#include linux/acpi.h
 #include accommon.h
 
 #define _COMPONENT  ACPI_HARDWARE
@@ -128,6 +129,14 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_extended_sleep(sleep_state,
+   acpi_gbl_sleep_type_a,
+   acpi_gbl_sleep_type_b);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 6ab2c35..a934950 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -79,6 +79,8 @@ extern char line_buf[80];
 
 static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
  u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_extended_sleep)(u8 sleep_state, u32 val_a,
+ u32 val_b);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1779,6 +1781,28 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 
sleep_state,
__acpi_os_prepare_sleep = func;
 }
 
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state, u32 val_a,
+ u32 val_b)
+{
+   int rc = 0;
+   if (__acpi_os_prepare_extended_sleep)
+   rc = __acpi_os_prepare_extended_sleep(sleep_state,
+val_a, val_b);
+   if (rc  0)
+   return AE_ERROR;
+   else if (rc  0)
+   return AE_CTRL_SKIP;
+
+   return AE_OK;
+}
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+  u32 val_a, u32 val_b))
+{
+   __acpi_os_prepare_extended_sleep = func;
+}
+
+
 void alloc_acpi_hp_work(acpi_handle handle, u32 type, void *context,
void (*func)(struct work_struct *work))
 {
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba25..a5db4ae 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -481,6 +481,13 @@ void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 
 acpi_status acpi_os_prepare_sleep(u8 sleep_state,
  u32 pm1a_control, u32 pm1b_control);
+
+void acpi_os_set_prepare_extended_sleep(int (*func)(u8 sleep_state,
+   u32 val_a,  u32 val_b));
+
+acpi_status acpi_os_prepare_extended_sleep(u8 sleep_state,
+  u32 val_a, u32 val_b);
+
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v7 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-29 Thread Ben Guthro


On 07/29/2013 04:21 PM, Rafael J. Wysocki wrote:
 On Monday, July 29, 2013 01:14:14 PM Ben Guthro wrote:
 Register for the extended sleep callback from acpi.
 As tboot currently does not support the reduced hardware sleep
 interface, fail this extended call.

 Signed-off-by: Jan Beulich jbeul...@suse.com
 Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
 Cc: tboot-de...@lists.sourceforge.net
 Cc: Gang Wei gang@intel.com
 Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
 ---
  arch/x86/kernel/tboot.c |   12 
  1 file changed, 12 insertions(+)

 diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
 index addf7b5..760f431 100644
 --- a/arch/x86/kernel/tboot.c
 +++ b/arch/x86/kernel/tboot.c
 @@ -301,6 +301,17 @@ static int tboot_sleep(u8 sleep_state, u32 
 pm1a_control, u32 pm1b_control)
  return 0;
  }
  
 +static int tboot_extended_sleep(u8 sleep_state, u32 val_a, u32 val_b)
 +{
 +if (!tboot_enabled())
 +return 0;
 +
 +pr_warning(tboot is not able to suspend on platforms with
 +reduced hardware sleep (ACPIv5). Please contact
 +tboot-de...@lists.sourceforge.net mailing list.);
 +return -1;
 
 Please use a meaningful error code here.  For example -ENODEV.

Would AE_NOT_IMPLEMENTED be more appropriate?

include/acpi/acexcep.h:
#define AE_NOT_IMPLEMENTED  EXCEP_ENV (0x000E)




 
 +}
 +
  static atomic_t ap_wfs_count;
  
  static int tboot_wait_for_aps(int num_aps)
 @@ -422,6 +433,7 @@ static __init int tboot_late_init(void)
  #endif
  
  acpi_os_set_prepare_sleep(tboot_sleep);
 +acpi_os_set_prepare_extended_sleep(tboot_extended_sleep);
  return 0;
  }
 
 Thanks,
 Rafael
 
 
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-27 Thread Ben Guthro


On Jul 27, 2013, at 9:51 AM, "Rafael J. Wysocki"  wrote:

> On Thursday, June 27, 2013 11:01:58 AM Ben Guthro wrote:
>> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
>> reduced hardware sleep support, and the two changes didn't get
>> synchronized: The new code doesn't call the hook function (if so
>> requested). Fix this, requiring a boolean parameter to be added to the
>> hook function to distinguish "extended" from "legacy" sleep.
>> 
>> This requires adjusting TXT, but the adjustments only go as far as
>> failing the extended mode call (since, looking at the TXT interface,
>> there doesn't even appear to be precautions to deal with that
>> alternative interface).
>> 
>> The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
>> v5 (reduced HW) sleep interface") on the master branch of
>> git://xenbits.xen.org/xen.git.
>> 
>> Signed-off-by: Ben Guthro 
>> Signed-off-by: Jan Beulich 
>> Cc: Richard L Maliszewski 
>> Cc: Gang Wei 
>> Cc: Shane Wang 
>> Cc: Bob Moore 
>> Cc: Rafaell J. Wysocki 
>> Cc: linux-a...@vger.kernel.org
>> Cc: tboot-de...@lists.sourceforge.net 
>> 
>> v2: Extend description to include reference to hypervisor side change
>> v3: Split into multiple patches, separating subsystems
>>Remove bool parameters, in favor of u8
>> v4: Remove linux/acpi.h dependencies
>>Further patch split to break out acpica from OSL
>>More bool vs u8 fixes
>> 
>> Ben Guthro (5):
>>  acpi: Remove need to include linux/acpi.h in common acpica code
>>  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
>>  acpi: Adjust linux acpi OS functions to new extended parameter
>>  x86/tboot: Fail extended mode reduced hardware sleep
>>  xen/acpi: notify xen when reduced hardware sleep is available
> 
> The ongoing discussion means to me that the ACPICA maintainers don't want
> acpi_os_prepare_sleep() and quite frankly I understand them, because ACPICA
> is about implementing the spec and not about things beyond it.
> 
> This means that patch [1/5] goes away.
> 
> That said, at the same time we need to address the problem at hand, which
> is to make Xen work with the reduced HW sleep.
> 
> For that, I don't honestly think that modifying acpi_os_prepare_sleep() the
> way the patchset is doing it is appropriate and the change of the meaning of
> the arguments is simply disgusting.
> 
> To me, it would be much cleaner to add acpi_os_prepare_extended_sleep()
> specifically to be called by acpi_hw_extended_sleep() and make tboot and Xen
> use that.
> 
> This way or another, we'll need to live with one more divergence between the
> upstream ACPICA and the Linux ACPICA code because of that, but that'd be just
> a few added lines in acpi_hw_extended_sleep(), so I suppose it wouldn't be
> such a big deal.
> 

Ok, thank you for the review, and being open to addressing the problem at hand, 
without a full architecture rework (not to say that that discussion is not also 
needed)

I will try to make some time next week to rework the patch set to address these 
concerns, and submit a new series. 

Thanks
Ben



> Thanks,
> Rafael
> 
> 
> -- 
> I speak only for myself.
> Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-27 Thread Ben Guthro


On Jul 27, 2013, at 9:51 AM, Rafael J. Wysocki r...@sisk.pl wrote:

 On Thursday, June 27, 2013 11:01:58 AM Ben Guthro wrote:
 In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
 reduced hardware sleep support, and the two changes didn't get
 synchronized: The new code doesn't call the hook function (if so
 requested). Fix this, requiring a boolean parameter to be added to the
 hook function to distinguish extended from legacy sleep.
 
 This requires adjusting TXT, but the adjustments only go as far as
 failing the extended mode call (since, looking at the TXT interface,
 there doesn't even appear to be precautions to deal with that
 alternative interface).
 
 The hypervisor change underlying this is commit 62d1a69 (ACPI: support
 v5 (reduced HW) sleep interface) on the master branch of
 git://xenbits.xen.org/xen.git.
 
 Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
 Signed-off-by: Jan Beulich jbeul...@suse.com
 Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
 Cc: Gang Wei gang@intel.com
 Cc: Shane Wang shane.w...@intel.com
 Cc: Bob Moore robert.mo...@intel.com
 Cc: Rafaell J. Wysocki r...@sisk.pl
 Cc: linux-a...@vger.kernel.org
 Cc: tboot-de...@lists.sourceforge.net 
 
 v2: Extend description to include reference to hypervisor side change
 v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
 v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
 
 Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi: Adjust linux acpi OS functions to new extended parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available
 
 The ongoing discussion means to me that the ACPICA maintainers don't want
 acpi_os_prepare_sleep() and quite frankly I understand them, because ACPICA
 is about implementing the spec and not about things beyond it.
 
 This means that patch [1/5] goes away.
 
 That said, at the same time we need to address the problem at hand, which
 is to make Xen work with the reduced HW sleep.
 
 For that, I don't honestly think that modifying acpi_os_prepare_sleep() the
 way the patchset is doing it is appropriate and the change of the meaning of
 the arguments is simply disgusting.
 
 To me, it would be much cleaner to add acpi_os_prepare_extended_sleep()
 specifically to be called by acpi_hw_extended_sleep() and make tboot and Xen
 use that.
 
 This way or another, we'll need to live with one more divergence between the
 upstream ACPICA and the Linux ACPICA code because of that, but that'd be just
 a few added lines in acpi_hw_extended_sleep(), so I suppose it wouldn't be
 such a big deal.
 

Ok, thank you for the review, and being open to addressing the problem at hand, 
without a full architecture rework (not to say that that discussion is not also 
needed)

I will try to make some time next week to rework the patch set to address these 
concerns, and submit a new series. 

Thanks
Ben



 Thanks,
 Rafael
 
 
 -- 
 I speak only for myself.
 Rafael J. Wysocki, Intel Open Source Technology Center.
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-24 Thread Ben Guthro

On Jul 24, 2013, at 9:01 PM, "Zheng, Lv" 
 wrote:

>> From: Moore, Robert
>> Sent: Wednesday, July 24, 2013 10:39 PM
>> 
>> I haven't found a high-level description of "acpi_os_prepare_sleep", perhaps 
>> I
>> missed it.
> 
> If we take a look at the declaration of this new OSL API, its name is 
> acpi_os_prepare_sleep, but originally it only hacks two registers' values.
> It is more like a Xen only hacking logic rather than an OSL API from ACPICA's 
> perspective.

The feature was introduced by Intel, for tboot, not Xen.
As pointed out by Konrad - If you implemented tboot on another OS, like 
Solaris, etc - this would be necessary.

> So the API declaration is just looking ugly to ACPICA, this has prevented 
> this OSL API from being back ported to ACPICA for long time.
> If ACPICA merged this codes, then it could be very hard for ACPICA to do any 
> future enhancement to modify the logic in the 
> acpi_hw_legacy_sleep/acpi_hw_extended_sleep.
> Thus this is not clean for ACPICA, it will introduce unwanted software 
> entropy to ACPICA.
> 
> This patchset enhances the OSL API, but doesn't make it cleaner, and just add 
> a new parameter, it is a hack on top of the original hack.

The original hack, as you call it is abstracted away in other parts of ACPICA, 
in all of the acpi_os_* code, if I read it correctly.
I'm not sure what makes this any different.

> IMO, from ACPICA's perspective, the OSL API should be designed to be re-used 
> by any other OSPMs and might have more meaningful function declaration to 
> ACPICA.
> OSPM codes like Xen can implement this OSL API.  The Xen only hacking logic 
> should be put inside the OSL API implementation.
> 

Again - not just for Xen.

> Hers is just a suggestion and I don't know if this can work for Xen:
> 
> status = acpi_os_prepare_sleep(u8 sleep_state);
> if (ACPI_SKIP(status))
> ...
> 
> And export:
> 1. acpi_gbl_sleep_type_a/acpi_gbl_sleep_type_b
> 2. acpi_gbl_reduced_hardware
> 3. acpi_hw_get_bit_register_info
> to be used by acpi_os_prepare_sleep.
> At least you can just copy the logic in the 
> acpi_hw_legacy_sleep/acpi_hw_extended_sleep to the acpi_os_prepare_sleep.
> That kind of complexity is Xen's complexity, you shouldn't move this 
> complexity to ACPICA just because you want Xen side codes to be simpler.
> If Xen and tboot already have knowledge about above what will actually happen 
> to the "sleep_state", we don't need to export them.

I'm sorry, I don't follow you here.

I moved no complexity into ACPICA in order to make Xen simpler.
In fact, I am arguing for the simpler interface, and smaller change in ACPICA.
It merely needs to also happen in the new reduced hardware sleep path, as it is 
broken for existing systems...and indeed would also be broken for the tboot 
path.




> 
> This way might be better for both parties.
> 
> Thanks and best regards
> -Lv
> 
> 
>> 
>> Can someone point me to the overall description of this change and why it is
>> being considered?
>> 
>> Thanks,
>> Bob
>> 
>> 
>>> -Original Message-
>>> From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
>>> Sent: Wednesday, July 24, 2013 6:23 AM
>>> To: Moore, Robert
>>> Cc: Zheng, Lv; Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki;
>>> linux-kernel@vger.kernel.org; linux-a...@vger.kernel.org; xen-
>>> de...@lists.xen.org
>>> Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
>>> reduced hardware sleep path
>>> 
>>> On 07/24/2013 09:18 AM, Moore, Robert wrote:
>>>> I have not looked closely at this, but we typically do things like
>>>> this
>>> in ACPICA so that they only need to be implemented once to support all
>>> of the various acpica-hosted operating systems - linux, solaris,
>>> hp-ux, apple, freebsd, etc. -- even if they could be implemented
>>> "cleaner" in some way on any given host.
>>> 
>>> Even when the resulting "simplification" results in reduced functionality?
>>> 
>>> Maybe I am misunderstanding the suggestion...but it sounded like it
>>> was basically to mimic the traditional behavior, and mask out the
>>> reduced hardware capabilities on these system types.
>>> 
>>> It seems to me that if the system supports the reduced hardware ACPI
>>> sleep, you would want to make use of it...
>>> 
>>> 
>>> 
>>>> 
>>>> 
>>>> 
>>>>> -----Original Message-
>>>>> From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
>>>>> Sent: W

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-24 Thread Ben Guthro


On 07/24/2013 10:38 AM, Moore, Robert wrote:
> I haven't found a high-level description of "acpi_os_prepare_sleep", perhaps 
> I missed it.
> 
> Can someone point me to the overall description of this change and why it is 
> being considered?

Hi Bob,

For this series, the v6 of this series does a decent job of what it is
trying to accomplish:
https://lkml.org/lkml/2013/7/1/205

However, I recognize that this does not really describe *why*
acpi_os_prepare_sleep is necessary to begin with. For that, we need to
go back a little more.

The summary for the series that introduced it is a good description, of
the reasons it is necessary:
http://lkml.indiana.edu/hypermail/linux/kernel/1112.2/00450.html

In summary though - in the case of Xen (and I believe this is also true
in tboot) a value inappropriate for a VM (which dom0 is a special case
of) was being written to cr3, and the physical machine would never come
out of S3.

This mechanism gives an os specific hook to do something else down at
the lower levels, while still being able to take advantage of the large
amount of OS independent code in ACPICA.

I hope that this helps to clear up matters.
If not, I'm happy to go into greater detail on any point, or get others
involved if I cannot field the question appropriately.

Thaks for your time
Ben

> 
> Thanks,
> Bob
> 
> 
>> -Original Message-
>> From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
>> Sent: Wednesday, July 24, 2013 6:23 AM
>> To: Moore, Robert
>> Cc: Zheng, Lv; Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki;
>> linux-kernel@vger.kernel.org; linux-a...@vger.kernel.org; xen-
>> de...@lists.xen.org
>> Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
>> reduced hardware sleep path
>>
>> On 07/24/2013 09:18 AM, Moore, Robert wrote:
>>> I have not looked closely at this, but we typically do things like this
>> in ACPICA so that they only need to be implemented once to support all of
>> the various acpica-hosted operating systems - linux, solaris, hp-ux,
>> apple, freebsd, etc. -- even if they could be implemented "cleaner" in
>> some way on any given host.
>>
>> Even when the resulting "simplification" results in reduced functionality?
>>
>> Maybe I am misunderstanding the suggestion...but it sounded like it was
>> basically to mimic the traditional behavior, and mask out the reduced
>> hardware capabilities on these system types.
>>
>> It seems to me that if the system supports the reduced hardware ACPI
>> sleep, you would want to make use of it...
>>
>>
>>
>>>
>>>
>>>
>>>> -Original Message-
>>>> From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
>>>> Sent: Wednesday, July 24, 2013 5:01 AM
>>>> To: Zheng, Lv
>>>> Cc: Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki; linux-
>>>> ker...@vger.kernel.org; linux-a...@vger.kernel.org; xen-
>>>> de...@lists.xen.org; Moore, Robert
>>>> Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
>>>> reduced hardware sleep path
>>>>
>>>>
>>>>
>>>> On 07/24/2013 02:24 AM, Zheng, Lv wrote:
>>>>> Hi,
>>>>>
>>>>> Sorry for the delayed response.
>>>>>
>>>>>> From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
>>>>>> Sent: Tuesday, July 02, 2013 7:43 PM
>>>>>>
>>>>>>
>>>>>> On 07/02/2013 02:19 AM, Zheng, Lv wrote:
>>>>>>> Thanks for your efforts!
>>>>>>>
>>>>>>> I wonder if it is possible to remove the argument - "u8 extended"
>>>>>>> and convert
>>>>>> "pm1a_control, pm1b_control" into some u8 values that are
>>>>>> equivalent to "acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b" in the
>>>>>> legacy sleep
>>>> path.
>>>>>>> It can also simplify Xen codes.
>>>>>>
>>>>>> Thanks for your time to review this.
>>>>>>
>>>>>> I'm not sure that this simplifies things. I think that, in fact, it
>>>>>> would make them quite a bit more complicated, but perhaps I
>>>> misunderstand.
>>>>>>
>>>>>> Is it not preferred to use the reduced hardware sleep, over the old
>>>> method?
>>>>>> While these register definitions may be equivalent below, doing the
>>>>>> translation in lin

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-24 Thread Ben Guthro
On 07/24/2013 09:18 AM, Moore, Robert wrote:
> I have not looked closely at this, but we typically do things like this in 
> ACPICA so that they only need to be implemented once to support all of the 
> various acpica-hosted operating systems - linux, solaris, hp-ux, apple, 
> freebsd, etc. -- even if they could be implemented "cleaner" in some way on 
> any given host.

Even when the resulting "simplification" results in reduced functionality?

Maybe I am misunderstanding the suggestion...but it sounded like it was
basically to mimic the traditional behavior, and mask out the reduced
hardware capabilities on these system types.

It seems to me that if the system supports the reduced hardware ACPI
sleep, you would want to make use of it...



> 
> 
> 
>> -Original Message-
>> From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
>> Sent: Wednesday, July 24, 2013 5:01 AM
>> To: Zheng, Lv
>> Cc: Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki; linux-
>> ker...@vger.kernel.org; linux-a...@vger.kernel.org; xen-
>> de...@lists.xen.org; Moore, Robert
>> Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
>> reduced hardware sleep path
>>
>>
>>
>> On 07/24/2013 02:24 AM, Zheng, Lv wrote:
>>> Hi,
>>>
>>> Sorry for the delayed response.
>>>
>>>> From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
>>>> Sent: Tuesday, July 02, 2013 7:43 PM
>>>>
>>>>
>>>> On 07/02/2013 02:19 AM, Zheng, Lv wrote:
>>>>> Thanks for your efforts!
>>>>>
>>>>> I wonder if it is possible to remove the argument - "u8 extended"
>>>>> and convert
>>>> "pm1a_control, pm1b_control" into some u8 values that are equivalent
>>>> to "acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b" in the legacy sleep
>> path.
>>>>> It can also simplify Xen codes.
>>>>
>>>> Thanks for your time to review this.
>>>>
>>>> I'm not sure that this simplifies things. I think that, in fact, it
>>>> would make them quite a bit more complicated, but perhaps I
>> misunderstand.
>>>>
>>>> Is it not preferred to use the reduced hardware sleep, over the old
>> method?
>>>> While these register definitions may be equivalent below, doing the
>>>> translation in linux, only to translate them back again at a lower
>> layer seems unnecessary.
>>>>
>>>
>>> Yes, it would require tboot layer to be able to be aware of how such
>> fields locate in the PM registers.
>>> So I think you can pass the register address of the field and the field
>> name/value pair to the tboot, this could simplify things, no lower layer
>> effort will be needed.
>>> Please don't worry about the case that a register field could be split
>> into PM1a and PM1b, it could be a hardware design issue.
>>> IMO, one field should always be in one register, either PM1a or PM1b.
>>> Or there could be hardware issues cannot be addressed by the ACPICA
>> architecture (something like natural atomicity).
>>> But maybe I'm wrong.
>>
>> Again, I don't think this simplifies things, but complicates them
>> unnecessarily. Converting the reduced hardware sleep to the legacy sleep
>> seems like it would be an unnecessary layer of translation.
>>
>> The interface now simply passes the information from ACPICA down to the
>> lower layers (xen, tboot) - and then lets them worry about the reduced
>> hardware implementation.
>>
>> FWIW, xen has shipped with this implemetation, and enterprise kernels
>> using the traditional xen kernel (like Suse) are making use of it.
>>
>> It may benefit tboot, in this case, but not Xen.
>>
>> I personally see it as an undesirable complication.
>>
>> Best regards,
>> Ben
>>
>>>
>>> Thanks and best regards
>>> -Lv
>>>
>>>> The hypervisor knows how to deal with both the reduced hardware sleep
>>>> as well as the legacy sleep path - it merely need to distinguish
>>>> these two paths, when performing the hypercall.
>>>>
>>>> Since there are two paths through the higher level ACPICA code - that
>>>> in hwsleep.c, and hwesleep.c - there needs to be some distinction
>>>> between the two paths, when calling through to the lower level
>>>> acpi_os_prepare_sleep() call.
>>>>
>>>> An alternate method would be to create another interface named
>>

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-24 Thread Ben Guthro


On 07/24/2013 02:24 AM, Zheng, Lv wrote:
> Hi,
> 
> Sorry for the delayed response.
> 
>> From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
>> Sent: Tuesday, July 02, 2013 7:43 PM
>>
>>
>> On 07/02/2013 02:19 AM, Zheng, Lv wrote:
>>> Thanks for your efforts!
>>>
>>> I wonder if it is possible to remove the argument - "u8 extended" and 
>>> convert
>> "pm1a_control, pm1b_control" into some u8 values that are equivalent to
>> "acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b" in the legacy sleep path.
>>> It can also simplify Xen codes.
>>
>> Thanks for your time to review this.
>>
>> I'm not sure that this simplifies things. I think that, in fact, it would 
>> make them
>> quite a bit more complicated, but perhaps I misunderstand.
>>
>> Is it not preferred to use the reduced hardware sleep, over the old method?
>> While these register definitions may be equivalent below, doing the 
>> translation
>> in linux, only to translate them back again at a lower layer seems 
>> unnecessary.
>>
> 
> Yes, it would require tboot layer to be able to be aware of how such fields 
> locate in the PM registers.
> So I think you can pass the register address of the field and the field 
> name/value pair to the tboot, this could simplify things, no lower layer 
> effort will be needed.
> Please don't worry about the case that a register field could be split into 
> PM1a and PM1b, it could be a hardware design issue.
> IMO, one field should always be in one register, either PM1a or PM1b.
> Or there could be hardware issues cannot be addressed by the ACPICA 
> architecture (something like natural atomicity).
> But maybe I'm wrong.

Again, I don't think this simplifies things, but complicates them
unnecessarily. Converting the reduced hardware sleep to the legacy sleep
seems like it would be an unnecessary layer of translation.

The interface now simply passes the information from ACPICA down to the
lower layers (xen, tboot) - and then lets them worry about the reduced
hardware implementation.

FWIW, xen has shipped with this implemetation, and enterprise kernels
using the traditional xen kernel (like Suse) are making use of it.

It may benefit tboot, in this case, but not Xen.

I personally see it as an undesirable complication.

Best regards,
Ben

> 
> Thanks and best regards
> -Lv
> 
>> The hypervisor knows how to deal with both the reduced hardware sleep as
>> well as the legacy sleep path - it merely need to distinguish these two 
>> paths,
>> when performing the hypercall.
>>
>> Since there are two paths through the higher level ACPICA code - that in
>> hwsleep.c, and hwesleep.c - there needs to be some distinction between the
>> two paths, when calling through to the lower level
>> acpi_os_prepare_sleep() call.
>>
>> An alternate method would be to create another interface named
>> acpi_os_prepare_esleep() which would do the equivalent of this patch series,
>> with an "extended" parameter hidden from upper level interfaces.
>>
>> This, however, would also add another function to include/acpi/acpiosxf.h -
>> which, I thought was undesirable, in the impression that I got from Bob 
>> Moore,
>> and Rafael Wysocki (though, please correct me on this point, if I have
>> misunderstood)
>>
>> Best Regards
>>
>> Ben
>>
>>>
>>> As in ACPI specification, the bit definitions between the legacy sleep 
>>> registers
>> and the extended sleep registers are equivalent.
>>>
>>> The legacy sleep register definition:
>>> Table 4-16 PM1 Status Registers Fixed Hardware Feature Status Bits -
>>> WAK_STS(bit 15) Table 4-18 PM1 Control Registers Fixed Hardware
>>> Feature Control Bits - SLP_TYPx (bit 10-12), SLP_EN (bit 13)
>>>
>>> The extended sleep register definition:
>>> Table 4-24 Sleep Control Register - SLP_TYPx (3 bits from offset 2), SLP_EN 
>>> (1
>> bit from offset 5), here 10-8 = 2, and 13-8 = 5, this definition is 
>> equivalent to
>> Table 4-18.
>>> Table 4-25 Sleep Status Register - WAK_STS (1 bit 7), 15-8 = 7, this 
>>> definition is
>> equivalent to Table 4-16.
>>>
>>> Thanks and best regards
>>> -Lv
>>>
>>>> -Original Message-
>>>> From: linux-acpi-ow...@vger.kernel.org
>>>> [mailto:linux-acpi-ow...@vger.kernel.org] On Behalf Of Ben Guthro
>>>> Sent: Wednesday, June 26, 2013 10:06 PM
>>>> To: Konrad Rzeszutek Wilk; Jan Beulich; Rafaell J . Wysocki;
>>>> li

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-24 Thread Ben Guthro

On Jul 24, 2013, at 9:01 PM, Zheng, Lv lv.zh...@intel.com
 wrote:

 From: Moore, Robert
 Sent: Wednesday, July 24, 2013 10:39 PM
 
 I haven't found a high-level description of acpi_os_prepare_sleep, perhaps 
 I
 missed it.
 
 If we take a look at the declaration of this new OSL API, its name is 
 acpi_os_prepare_sleep, but originally it only hacks two registers' values.
 It is more like a Xen only hacking logic rather than an OSL API from ACPICA's 
 perspective.

The feature was introduced by Intel, for tboot, not Xen.
As pointed out by Konrad - If you implemented tboot on another OS, like 
Solaris, etc - this would be necessary.

 So the API declaration is just looking ugly to ACPICA, this has prevented 
 this OSL API from being back ported to ACPICA for long time.
 If ACPICA merged this codes, then it could be very hard for ACPICA to do any 
 future enhancement to modify the logic in the 
 acpi_hw_legacy_sleep/acpi_hw_extended_sleep.
 Thus this is not clean for ACPICA, it will introduce unwanted software 
 entropy to ACPICA.
 
 This patchset enhances the OSL API, but doesn't make it cleaner, and just add 
 a new parameter, it is a hack on top of the original hack.

The original hack, as you call it is abstracted away in other parts of ACPICA, 
in all of the acpi_os_* code, if I read it correctly.
I'm not sure what makes this any different.

 IMO, from ACPICA's perspective, the OSL API should be designed to be re-used 
 by any other OSPMs and might have more meaningful function declaration to 
 ACPICA.
 OSPM codes like Xen can implement this OSL API.  The Xen only hacking logic 
 should be put inside the OSL API implementation.
 

Again - not just for Xen.

 Hers is just a suggestion and I don't know if this can work for Xen:
 
 status = acpi_os_prepare_sleep(u8 sleep_state);
 if (ACPI_SKIP(status))
 ...
 
 And export:
 1. acpi_gbl_sleep_type_a/acpi_gbl_sleep_type_b
 2. acpi_gbl_reduced_hardware
 3. acpi_hw_get_bit_register_info
 to be used by acpi_os_prepare_sleep.
 At least you can just copy the logic in the 
 acpi_hw_legacy_sleep/acpi_hw_extended_sleep to the acpi_os_prepare_sleep.
 That kind of complexity is Xen's complexity, you shouldn't move this 
 complexity to ACPICA just because you want Xen side codes to be simpler.
 If Xen and tboot already have knowledge about above what will actually happen 
 to the sleep_state, we don't need to export them.

I'm sorry, I don't follow you here.

I moved no complexity into ACPICA in order to make Xen simpler.
In fact, I am arguing for the simpler interface, and smaller change in ACPICA.
It merely needs to also happen in the new reduced hardware sleep path, as it is 
broken for existing systems...and indeed would also be broken for the tboot 
path.




 
 This way might be better for both parties.
 
 Thanks and best regards
 -Lv
 
 
 
 Can someone point me to the overall description of this change and why it is
 being considered?
 
 Thanks,
 Bob
 
 
 -Original Message-
 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Wednesday, July 24, 2013 6:23 AM
 To: Moore, Robert
 Cc: Zheng, Lv; Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki;
 linux-kernel@vger.kernel.org; linux-a...@vger.kernel.org; xen-
 de...@lists.xen.org
 Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
 reduced hardware sleep path
 
 On 07/24/2013 09:18 AM, Moore, Robert wrote:
 I have not looked closely at this, but we typically do things like
 this
 in ACPICA so that they only need to be implemented once to support all
 of the various acpica-hosted operating systems - linux, solaris,
 hp-ux, apple, freebsd, etc. -- even if they could be implemented
 cleaner in some way on any given host.
 
 Even when the resulting simplification results in reduced functionality?
 
 Maybe I am misunderstanding the suggestion...but it sounded like it
 was basically to mimic the traditional behavior, and mask out the
 reduced hardware capabilities on these system types.
 
 It seems to me that if the system supports the reduced hardware ACPI
 sleep, you would want to make use of it...
 
 
 
 
 
 
 -Original Message-
 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Wednesday, July 24, 2013 5:01 AM
 To: Zheng, Lv
 Cc: Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki; linux-
 ker...@vger.kernel.org; linux-a...@vger.kernel.org; xen-
 de...@lists.xen.org; Moore, Robert
 Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook
 in reduced hardware sleep path
 
 
 
 On 07/24/2013 02:24 AM, Zheng, Lv wrote:
 Hi,
 
 Sorry for the delayed response.
 
 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Tuesday, July 02, 2013 7:43 PM
 
 
 On 07/02/2013 02:19 AM, Zheng, Lv wrote:
 Thanks for your efforts!
 
 I wonder if it is possible to remove the argument - u8 extended
 and convert
 pm1a_control, pm1b_control into some u8 values that are
 equivalent to acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b in
 the legacy sleep
 path.
 It can also

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-24 Thread Ben Guthro


On 07/24/2013 02:24 AM, Zheng, Lv wrote:
 Hi,
 
 Sorry for the delayed response.
 
 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Tuesday, July 02, 2013 7:43 PM


 On 07/02/2013 02:19 AM, Zheng, Lv wrote:
 Thanks for your efforts!

 I wonder if it is possible to remove the argument - u8 extended and 
 convert
 pm1a_control, pm1b_control into some u8 values that are equivalent to
 acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b in the legacy sleep path.
 It can also simplify Xen codes.

 Thanks for your time to review this.

 I'm not sure that this simplifies things. I think that, in fact, it would 
 make them
 quite a bit more complicated, but perhaps I misunderstand.

 Is it not preferred to use the reduced hardware sleep, over the old method?
 While these register definitions may be equivalent below, doing the 
 translation
 in linux, only to translate them back again at a lower layer seems 
 unnecessary.

 
 Yes, it would require tboot layer to be able to be aware of how such fields 
 locate in the PM registers.
 So I think you can pass the register address of the field and the field 
 name/value pair to the tboot, this could simplify things, no lower layer 
 effort will be needed.
 Please don't worry about the case that a register field could be split into 
 PM1a and PM1b, it could be a hardware design issue.
 IMO, one field should always be in one register, either PM1a or PM1b.
 Or there could be hardware issues cannot be addressed by the ACPICA 
 architecture (something like natural atomicity).
 But maybe I'm wrong.

Again, I don't think this simplifies things, but complicates them
unnecessarily. Converting the reduced hardware sleep to the legacy sleep
seems like it would be an unnecessary layer of translation.

The interface now simply passes the information from ACPICA down to the
lower layers (xen, tboot) - and then lets them worry about the reduced
hardware implementation.

FWIW, xen has shipped with this implemetation, and enterprise kernels
using the traditional xen kernel (like Suse) are making use of it.

It may benefit tboot, in this case, but not Xen.

I personally see it as an undesirable complication.

Best regards,
Ben

 
 Thanks and best regards
 -Lv
 
 The hypervisor knows how to deal with both the reduced hardware sleep as
 well as the legacy sleep path - it merely need to distinguish these two 
 paths,
 when performing the hypercall.

 Since there are two paths through the higher level ACPICA code - that in
 hwsleep.c, and hwesleep.c - there needs to be some distinction between the
 two paths, when calling through to the lower level
 acpi_os_prepare_sleep() call.

 An alternate method would be to create another interface named
 acpi_os_prepare_esleep() which would do the equivalent of this patch series,
 with an extended parameter hidden from upper level interfaces.

 This, however, would also add another function to include/acpi/acpiosxf.h -
 which, I thought was undesirable, in the impression that I got from Bob 
 Moore,
 and Rafael Wysocki (though, please correct me on this point, if I have
 misunderstood)

 Best Regards

 Ben


 As in ACPI specification, the bit definitions between the legacy sleep 
 registers
 and the extended sleep registers are equivalent.

 The legacy sleep register definition:
 Table 4-16 PM1 Status Registers Fixed Hardware Feature Status Bits -
 WAK_STS(bit 15) Table 4-18 PM1 Control Registers Fixed Hardware
 Feature Control Bits - SLP_TYPx (bit 10-12), SLP_EN (bit 13)

 The extended sleep register definition:
 Table 4-24 Sleep Control Register - SLP_TYPx (3 bits from offset 2), SLP_EN 
 (1
 bit from offset 5), here 10-8 = 2, and 13-8 = 5, this definition is 
 equivalent to
 Table 4-18.
 Table 4-25 Sleep Status Register - WAK_STS (1 bit 7), 15-8 = 7, this 
 definition is
 equivalent to Table 4-16.

 Thanks and best regards
 -Lv

 -Original Message-
 From: linux-acpi-ow...@vger.kernel.org
 [mailto:linux-acpi-ow...@vger.kernel.org] On Behalf Of Ben Guthro
 Sent: Wednesday, June 26, 2013 10:06 PM
 To: Konrad Rzeszutek Wilk; Jan Beulich; Rafaell J . Wysocki;
 linux-kernel@vger.kernel.org; linux-a...@vger.kernel.org;
 xen-de...@lists.xen.org
 Cc: Ben Guthro; Moore, Robert
 Subject: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
 reduced hardware sleep path

 In version 3.4 acpi_os_prepare_sleep() got introduced in parallel
 with reduced hardware sleep support, and the two changes didn't get
 synchronized: The new code doesn't call the hook function (if so
 requested). Fix this, requiring a parameter to be added to the hook
 function to distinguish extended from legacy sleep.

 Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
 Signed-off-by: Jan Beulich jbeul...@suse.com
 Cc: Bob Moore robert.mo...@intel.com
 Cc: Rafaell J. Wysocki r...@sisk.pl
 Cc: linux-a...@vger.kernel.org
 ---
   drivers/acpi/acpica/hwesleep.c |8 
   drivers/acpi/acpica/hwsleep.c  |2 +-
   drivers/acpi/osl.c |   16

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-24 Thread Ben Guthro
On 07/24/2013 09:18 AM, Moore, Robert wrote:
 I have not looked closely at this, but we typically do things like this in 
 ACPICA so that they only need to be implemented once to support all of the 
 various acpica-hosted operating systems - linux, solaris, hp-ux, apple, 
 freebsd, etc. -- even if they could be implemented cleaner in some way on 
 any given host.

Even when the resulting simplification results in reduced functionality?

Maybe I am misunderstanding the suggestion...but it sounded like it was
basically to mimic the traditional behavior, and mask out the reduced
hardware capabilities on these system types.

It seems to me that if the system supports the reduced hardware ACPI
sleep, you would want to make use of it...



 
 
 
 -Original Message-
 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Wednesday, July 24, 2013 5:01 AM
 To: Zheng, Lv
 Cc: Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki; linux-
 ker...@vger.kernel.org; linux-a...@vger.kernel.org; xen-
 de...@lists.xen.org; Moore, Robert
 Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
 reduced hardware sleep path



 On 07/24/2013 02:24 AM, Zheng, Lv wrote:
 Hi,

 Sorry for the delayed response.

 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Tuesday, July 02, 2013 7:43 PM


 On 07/02/2013 02:19 AM, Zheng, Lv wrote:
 Thanks for your efforts!

 I wonder if it is possible to remove the argument - u8 extended
 and convert
 pm1a_control, pm1b_control into some u8 values that are equivalent
 to acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b in the legacy sleep
 path.
 It can also simplify Xen codes.

 Thanks for your time to review this.

 I'm not sure that this simplifies things. I think that, in fact, it
 would make them quite a bit more complicated, but perhaps I
 misunderstand.

 Is it not preferred to use the reduced hardware sleep, over the old
 method?
 While these register definitions may be equivalent below, doing the
 translation in linux, only to translate them back again at a lower
 layer seems unnecessary.


 Yes, it would require tboot layer to be able to be aware of how such
 fields locate in the PM registers.
 So I think you can pass the register address of the field and the field
 name/value pair to the tboot, this could simplify things, no lower layer
 effort will be needed.
 Please don't worry about the case that a register field could be split
 into PM1a and PM1b, it could be a hardware design issue.
 IMO, one field should always be in one register, either PM1a or PM1b.
 Or there could be hardware issues cannot be addressed by the ACPICA
 architecture (something like natural atomicity).
 But maybe I'm wrong.

 Again, I don't think this simplifies things, but complicates them
 unnecessarily. Converting the reduced hardware sleep to the legacy sleep
 seems like it would be an unnecessary layer of translation.

 The interface now simply passes the information from ACPICA down to the
 lower layers (xen, tboot) - and then lets them worry about the reduced
 hardware implementation.

 FWIW, xen has shipped with this implemetation, and enterprise kernels
 using the traditional xen kernel (like Suse) are making use of it.

 It may benefit tboot, in this case, but not Xen.

 I personally see it as an undesirable complication.

 Best regards,
 Ben


 Thanks and best regards
 -Lv

 The hypervisor knows how to deal with both the reduced hardware sleep
 as well as the legacy sleep path - it merely need to distinguish
 these two paths, when performing the hypercall.

 Since there are two paths through the higher level ACPICA code - that
 in hwsleep.c, and hwesleep.c - there needs to be some distinction
 between the two paths, when calling through to the lower level
 acpi_os_prepare_sleep() call.

 An alternate method would be to create another interface named
 acpi_os_prepare_esleep() which would do the equivalent of this patch
 series, with an extended parameter hidden from upper level
 interfaces.

 This, however, would also add another function to
 include/acpi/acpiosxf.h - which, I thought was undesirable, in the
 impression that I got from Bob Moore, and Rafael Wysocki (though,
 please correct me on this point, if I have
 misunderstood)

 Best Regards

 Ben


 As in ACPI specification, the bit definitions between the legacy
 sleep registers
 and the extended sleep registers are equivalent.

 The legacy sleep register definition:
 Table 4-16 PM1 Status Registers Fixed Hardware Feature Status Bits -
 WAK_STS(bit 15) Table 4-18 PM1 Control Registers Fixed Hardware
 Feature Control Bits - SLP_TYPx (bit 10-12), SLP_EN (bit 13)

 The extended sleep register definition:
 Table 4-24 Sleep Control Register - SLP_TYPx (3 bits from offset 2),
 SLP_EN (1
 bit from offset 5), here 10-8 = 2, and 13-8 = 5, this definition is
 equivalent to Table 4-18.
 Table 4-25 Sleep Status Register - WAK_STS (1 bit 7), 15-8 = 7, this
 definition is
 equivalent to Table 4-16.

 Thanks and best regards

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-24 Thread Ben Guthro


On 07/24/2013 10:38 AM, Moore, Robert wrote:
 I haven't found a high-level description of acpi_os_prepare_sleep, perhaps 
 I missed it.
 
 Can someone point me to the overall description of this change and why it is 
 being considered?

Hi Bob,

For this series, the v6 of this series does a decent job of what it is
trying to accomplish:
https://lkml.org/lkml/2013/7/1/205

However, I recognize that this does not really describe *why*
acpi_os_prepare_sleep is necessary to begin with. For that, we need to
go back a little more.

The summary for the series that introduced it is a good description, of
the reasons it is necessary:
http://lkml.indiana.edu/hypermail/linux/kernel/1112.2/00450.html

In summary though - in the case of Xen (and I believe this is also true
in tboot) a value inappropriate for a VM (which dom0 is a special case
of) was being written to cr3, and the physical machine would never come
out of S3.

This mechanism gives an os specific hook to do something else down at
the lower levels, while still being able to take advantage of the large
amount of OS independent code in ACPICA.

I hope that this helps to clear up matters.
If not, I'm happy to go into greater detail on any point, or get others
involved if I cannot field the question appropriately.

Thaks for your time
Ben

 
 Thanks,
 Bob
 
 
 -Original Message-
 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Wednesday, July 24, 2013 6:23 AM
 To: Moore, Robert
 Cc: Zheng, Lv; Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki;
 linux-kernel@vger.kernel.org; linux-a...@vger.kernel.org; xen-
 de...@lists.xen.org
 Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
 reduced hardware sleep path

 On 07/24/2013 09:18 AM, Moore, Robert wrote:
 I have not looked closely at this, but we typically do things like this
 in ACPICA so that they only need to be implemented once to support all of
 the various acpica-hosted operating systems - linux, solaris, hp-ux,
 apple, freebsd, etc. -- even if they could be implemented cleaner in
 some way on any given host.

 Even when the resulting simplification results in reduced functionality?

 Maybe I am misunderstanding the suggestion...but it sounded like it was
 basically to mimic the traditional behavior, and mask out the reduced
 hardware capabilities on these system types.

 It seems to me that if the system supports the reduced hardware ACPI
 sleep, you would want to make use of it...






 -Original Message-
 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Wednesday, July 24, 2013 5:01 AM
 To: Zheng, Lv
 Cc: Konrad Rzeszutek Wilk; Jan Beulich; Rafael J . Wysocki; linux-
 ker...@vger.kernel.org; linux-a...@vger.kernel.org; xen-
 de...@lists.xen.org; Moore, Robert
 Subject: Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in
 reduced hardware sleep path



 On 07/24/2013 02:24 AM, Zheng, Lv wrote:
 Hi,

 Sorry for the delayed response.

 From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
 Sent: Tuesday, July 02, 2013 7:43 PM


 On 07/02/2013 02:19 AM, Zheng, Lv wrote:
 Thanks for your efforts!

 I wonder if it is possible to remove the argument - u8 extended
 and convert
 pm1a_control, pm1b_control into some u8 values that are
 equivalent to acpi_gbl_sleep_type_a, acpi_gbl_sleep_type_b in the
 legacy sleep
 path.
 It can also simplify Xen codes.

 Thanks for your time to review this.

 I'm not sure that this simplifies things. I think that, in fact, it
 would make them quite a bit more complicated, but perhaps I
 misunderstand.

 Is it not preferred to use the reduced hardware sleep, over the old
 method?
 While these register definitions may be equivalent below, doing the
 translation in linux, only to translate them back again at a lower
 layer seems unnecessary.


 Yes, it would require tboot layer to be able to be aware of how such
 fields locate in the PM registers.
 So I think you can pass the register address of the field and the
 field
 name/value pair to the tboot, this could simplify things, no lower
 layer effort will be needed.
 Please don't worry about the case that a register field could be
 split
 into PM1a and PM1b, it could be a hardware design issue.
 IMO, one field should always be in one register, either PM1a or PM1b.
 Or there could be hardware issues cannot be addressed by the ACPICA
 architecture (something like natural atomicity).
 But maybe I'm wrong.

 Again, I don't think this simplifies things, but complicates them
 unnecessarily. Converting the reduced hardware sleep to the legacy
 sleep seems like it would be an unnecessary layer of translation.

 The interface now simply passes the information from ACPICA down to
 the lower layers (xen, tboot) - and then lets them worry about the
 reduced hardware implementation.

 FWIW, xen has shipped with this implemetation, and enterprise kernels
 using the traditional xen kernel (like Suse) are making use of it.

 It may benefit tboot, in this case, but not Xen

Re: [Xen-devel] [PATCH v6 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-22 Thread Ben Guthro
On Mon, Jul 8, 2013 at 9:08 AM, Ben Guthro  wrote:
>
>
> On 07/08/2013 09:10 AM, Rafael J. Wysocki wrote:
>> On Sunday, July 07, 2013 08:13:15 PM Ben Guthro wrote:
>>> On Mon, Jul 1, 2013 at 7:48 AM, Ben Guthro  
>>> wrote:
>>>> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
>>>> reduced hardware sleep support, and the two changes didn't get
>>>> synchronized: The new code doesn't call the hook function (if so
>>>> requested). Fix this, requiring a boolean parameter to be added to the
>>>> hook function to distinguish "extended" from "legacy" sleep.
>>>>
>>>> This requires adjusting TXT, but the adjustments only go as far as
>>>> failing the extended mode call (since, looking at the TXT interface,
>>>> there doesn't even appear to be precautions to deal with that
>>>> alternative interface).
>>>>
>>>> The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
>>>> v5 (reduced HW) sleep interface") on the master branch of
>>>> git://xenbits.xen.org/xen.git.
>>>>
>>>> Signed-off-by: Jan Beulich 
>>>> Signed-off-by: Ben Guthro 
>>>> Cc: Richard L Maliszewski 
>>>> Cc: Gang Wei 
>>>> Cc: Shane Wang 
>>>> Cc: Bob Moore 
>>>> Cc: Rafael J. Wysocki 
>>>> Cc: linux-a...@vger.kernel.org
>>>> Cc: tboot-de...@lists.sourceforge.net
>>>>
>>>> v2: Extend description to include reference to hypervisor side change
>>>> v3: Split into multiple patches, separating subsystems
>>>> Remove bool parameters, in favor of u8
>>>> v4: Remove linux/acpi.h dependencies
>>>> Further patch split to break out acpica from OSL
>>>> More bool vs u8 fixes
>>>> v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
>>>> so intermediate builds of partial patch series will not fail.
>>>> v6: Rebased to linux-pm linux-next branch
>>>> Added warning in tboot early return code
>>>> Added Reviewed-by lines
>>>>
>>>> Ben Guthro (5):
>>>>   acpi: Remove need to include linux/acpi.h in common acpica code
>>>>   acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
>>>>   acpi/xen/tboot: Adjust linux acpi OS functions to new extended
>>>> parameter
>>>>   x86/tboot: Fail extended mode reduced hardware sleep
>>>>   xen/acpi: notify xen when reduced hardware sleep is available
>>>
>>> Rafael, Bob -
>>>
>>> Is this version of the series something that you may consider taking?
>>> If not - is there something specific you would like to see addressed?
>>
>> Well, I'm afraid you need to give us some more time to process that,
>> sorry.
>
> My apologies - I know it is a busy time during the merge window. I did
> not mean to seem impatient.
>
> With the volume of things on the mailing list, I merely wanted to try to
> avoid the series getting buried. If a week is too frequent to re-bump a
> series, do you have a set of recommendations of how to best interact
> with your workflow?

Rafael (et al.)

I never heard back on this point of how you prefer your workflow to
proceed - that is, if I haven't heard anything in a couple weeks -
should I try to re-bump the thread?

Since this was sent around the time of the merge window, I realize
there were other things to occupy people's time.
Now that rc2 is out - I'm hoping that the dust has settled a bit, such
that there may be a cycle, or two to review this series.

Thanks for your time

Ben

>
> I'm just trying to balance people's time to review such things, with the
> volume of the list.
>
> Thanks for your time.
>
> Ben
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v6 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-22 Thread Ben Guthro
On Mon, Jul 8, 2013 at 9:08 AM, Ben Guthro benjamin.gut...@citrix.com wrote:


 On 07/08/2013 09:10 AM, Rafael J. Wysocki wrote:
 On Sunday, July 07, 2013 08:13:15 PM Ben Guthro wrote:
 On Mon, Jul 1, 2013 at 7:48 AM, Ben Guthro benjamin.gut...@citrix.com 
 wrote:
 In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
 reduced hardware sleep support, and the two changes didn't get
 synchronized: The new code doesn't call the hook function (if so
 requested). Fix this, requiring a boolean parameter to be added to the
 hook function to distinguish extended from legacy sleep.

 This requires adjusting TXT, but the adjustments only go as far as
 failing the extended mode call (since, looking at the TXT interface,
 there doesn't even appear to be precautions to deal with that
 alternative interface).

 The hypervisor change underlying this is commit 62d1a69 (ACPI: support
 v5 (reduced HW) sleep interface) on the master branch of
 git://xenbits.xen.org/xen.git.

 Signed-off-by: Jan Beulich jbeul...@suse.com
 Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
 Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
 Cc: Gang Wei gang@intel.com
 Cc: Shane Wang shane.w...@intel.com
 Cc: Bob Moore robert.mo...@intel.com
 Cc: Rafael J. Wysocki r...@sisk.pl
 Cc: linux-a...@vger.kernel.org
 Cc: tboot-de...@lists.sourceforge.net

 v2: Extend description to include reference to hypervisor side change
 v3: Split into multiple patches, separating subsystems
 Remove bool parameters, in favor of u8
 v4: Remove linux/acpi.h dependencies
 Further patch split to break out acpica from OSL
 More bool vs u8 fixes
 v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
 so intermediate builds of partial patch series will not fail.
 v6: Rebased to linux-pm linux-next branch
 Added warning in tboot early return code
 Added Reviewed-by lines

 Ben Guthro (5):
   acpi: Remove need to include linux/acpi.h in common acpica code
   acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
   acpi/xen/tboot: Adjust linux acpi OS functions to new extended
 parameter
   x86/tboot: Fail extended mode reduced hardware sleep
   xen/acpi: notify xen when reduced hardware sleep is available

 Rafael, Bob -

 Is this version of the series something that you may consider taking?
 If not - is there something specific you would like to see addressed?

 Well, I'm afraid you need to give us some more time to process that,
 sorry.

 My apologies - I know it is a busy time during the merge window. I did
 not mean to seem impatient.

 With the volume of things on the mailing list, I merely wanted to try to
 avoid the series getting buried. If a week is too frequent to re-bump a
 series, do you have a set of recommendations of how to best interact
 with your workflow?

Rafael (et al.)

I never heard back on this point of how you prefer your workflow to
proceed - that is, if I haven't heard anything in a couple weeks -
should I try to re-bump the thread?

Since this was sent around the time of the merge window, I realize
there were other things to occupy people's time.
Now that rc2 is out - I'm hoping that the dust has settled a bit, such
that there may be a cycle, or two to review this series.

Thanks for your time

Ben


 I'm just trying to balance people's time to review such things, with the
 volume of the list.

 Thanks for your time.

 Ben
 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v6 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-08 Thread Ben Guthro


On 07/08/2013 09:10 AM, Rafael J. Wysocki wrote:
> On Sunday, July 07, 2013 08:13:15 PM Ben Guthro wrote:
>> On Mon, Jul 1, 2013 at 7:48 AM, Ben Guthro  
>> wrote:
>>> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
>>> reduced hardware sleep support, and the two changes didn't get
>>> synchronized: The new code doesn't call the hook function (if so
>>> requested). Fix this, requiring a boolean parameter to be added to the
>>> hook function to distinguish "extended" from "legacy" sleep.
>>>
>>> This requires adjusting TXT, but the adjustments only go as far as
>>> failing the extended mode call (since, looking at the TXT interface,
>>> there doesn't even appear to be precautions to deal with that
>>> alternative interface).
>>>
>>> The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
>>> v5 (reduced HW) sleep interface") on the master branch of
>>> git://xenbits.xen.org/xen.git.
>>>
>>> Signed-off-by: Jan Beulich 
>>> Signed-off-by: Ben Guthro 
>>> Cc: Richard L Maliszewski 
>>> Cc: Gang Wei 
>>> Cc: Shane Wang 
>>> Cc: Bob Moore 
>>> Cc: Rafael J. Wysocki 
>>> Cc: linux-a...@vger.kernel.org
>>> Cc: tboot-de...@lists.sourceforge.net
>>>
>>> v2: Extend description to include reference to hypervisor side change
>>> v3: Split into multiple patches, separating subsystems
>>> Remove bool parameters, in favor of u8
>>> v4: Remove linux/acpi.h dependencies
>>> Further patch split to break out acpica from OSL
>>> More bool vs u8 fixes
>>> v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
>>> so intermediate builds of partial patch series will not fail.
>>> v6: Rebased to linux-pm linux-next branch
>>> Added warning in tboot early return code
>>> Added Reviewed-by lines
>>>
>>> Ben Guthro (5):
>>>   acpi: Remove need to include linux/acpi.h in common acpica code
>>>   acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
>>>   acpi/xen/tboot: Adjust linux acpi OS functions to new extended
>>> parameter
>>>   x86/tboot: Fail extended mode reduced hardware sleep
>>>   xen/acpi: notify xen when reduced hardware sleep is available
>>
>> Rafael, Bob -
>>
>> Is this version of the series something that you may consider taking?
>> If not - is there something specific you would like to see addressed?
> 
> Well, I'm afraid you need to give us some more time to process that,
> sorry.

My apologies - I know it is a busy time during the merge window. I did
not mean to seem impatient.

With the volume of things on the mailing list, I merely wanted to try to
avoid the series getting buried. If a week is too frequent to re-bump a
series, do you have a set of recommendations of how to best interact
with your workflow?

I'm just trying to balance people's time to review such things, with the
volume of the list.

Thanks for your time.

Ben
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v6 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-08 Thread Ben Guthro


On 07/08/2013 09:10 AM, Rafael J. Wysocki wrote:
 On Sunday, July 07, 2013 08:13:15 PM Ben Guthro wrote:
 On Mon, Jul 1, 2013 at 7:48 AM, Ben Guthro benjamin.gut...@citrix.com 
 wrote:
 In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
 reduced hardware sleep support, and the two changes didn't get
 synchronized: The new code doesn't call the hook function (if so
 requested). Fix this, requiring a boolean parameter to be added to the
 hook function to distinguish extended from legacy sleep.

 This requires adjusting TXT, but the adjustments only go as far as
 failing the extended mode call (since, looking at the TXT interface,
 there doesn't even appear to be precautions to deal with that
 alternative interface).

 The hypervisor change underlying this is commit 62d1a69 (ACPI: support
 v5 (reduced HW) sleep interface) on the master branch of
 git://xenbits.xen.org/xen.git.

 Signed-off-by: Jan Beulich jbeul...@suse.com
 Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
 Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
 Cc: Gang Wei gang@intel.com
 Cc: Shane Wang shane.w...@intel.com
 Cc: Bob Moore robert.mo...@intel.com
 Cc: Rafael J. Wysocki r...@sisk.pl
 Cc: linux-a...@vger.kernel.org
 Cc: tboot-de...@lists.sourceforge.net

 v2: Extend description to include reference to hypervisor side change
 v3: Split into multiple patches, separating subsystems
 Remove bool parameters, in favor of u8
 v4: Remove linux/acpi.h dependencies
 Further patch split to break out acpica from OSL
 More bool vs u8 fixes
 v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
 so intermediate builds of partial patch series will not fail.
 v6: Rebased to linux-pm linux-next branch
 Added warning in tboot early return code
 Added Reviewed-by lines

 Ben Guthro (5):
   acpi: Remove need to include linux/acpi.h in common acpica code
   acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
   acpi/xen/tboot: Adjust linux acpi OS functions to new extended
 parameter
   x86/tboot: Fail extended mode reduced hardware sleep
   xen/acpi: notify xen when reduced hardware sleep is available

 Rafael, Bob -

 Is this version of the series something that you may consider taking?
 If not - is there something specific you would like to see addressed?
 
 Well, I'm afraid you need to give us some more time to process that,
 sorry.

My apologies - I know it is a busy time during the merge window. I did
not mean to seem impatient.

With the volume of things on the mailing list, I merely wanted to try to
avoid the series getting buried. If a week is too frequent to re-bump a
series, do you have a set of recommendations of how to best interact
with your workflow?

I'm just trying to balance people's time to review such things, with the
volume of the list.

Thanks for your time.

Ben
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v6 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-07 Thread Ben Guthro
On Mon, Jul 1, 2013 at 7:48 AM, Ben Guthro  wrote:
> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
> reduced hardware sleep support, and the two changes didn't get
> synchronized: The new code doesn't call the hook function (if so
> requested). Fix this, requiring a boolean parameter to be added to the
> hook function to distinguish "extended" from "legacy" sleep.
>
> This requires adjusting TXT, but the adjustments only go as far as
> failing the extended mode call (since, looking at the TXT interface,
> there doesn't even appear to be precautions to deal with that
> alternative interface).
>
> The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
> v5 (reduced HW) sleep interface") on the master branch of
> git://xenbits.xen.org/xen.git.
>
> Signed-off-by: Jan Beulich 
> Signed-off-by: Ben Guthro 
> Cc: Richard L Maliszewski 
> Cc: Gang Wei 
> Cc: Shane Wang 
> Cc: Bob Moore 
> Cc: Rafael J. Wysocki 
> Cc: linux-a...@vger.kernel.org
> Cc: tboot-de...@lists.sourceforge.net
>
> v2: Extend description to include reference to hypervisor side change
> v3: Split into multiple patches, separating subsystems
> Remove bool parameters, in favor of u8
> v4: Remove linux/acpi.h dependencies
> Further patch split to break out acpica from OSL
> More bool vs u8 fixes
> v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
> so intermediate builds of partial patch series will not fail.
> v6: Rebased to linux-pm linux-next branch
> Added warning in tboot early return code
> Added Reviewed-by lines
>
> Ben Guthro (5):
>   acpi: Remove need to include linux/acpi.h in common acpica code
>   acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
>   acpi/xen/tboot: Adjust linux acpi OS functions to new extended
> parameter
>   x86/tboot: Fail extended mode reduced hardware sleep
>   xen/acpi: notify xen when reduced hardware sleep is available

Rafael, Bob -

Is this version of the series something that you may consider taking?
If not - is there something specific you would like to see addressed?

Thanks for your time.


Ben

>
>  arch/x86/kernel/tboot.c  |9 -
>  drivers/acpi/acpica/hwesleep.c   |7 +++
>  drivers/acpi/acpica/hwsleep.c|3 +--
>  drivers/acpi/osl.c   |   16 
>  drivers/xen/acpi.c   |   26 +-
>  include/acpi/acpiosxf.h  |6 ++
>  include/linux/acpi.h |9 +++--
>  include/xen/acpi.h   |4 ++--
>  include/xen/interface/platform.h |7 ---
>  9 files changed, 52 insertions(+), 35 deletions(-)
>
> --
> 1.7.9.5
>
>
> ___
> Xen-devel mailing list
> xen-de...@lists.xen.org
> http://lists.xen.org/xen-devel
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [Xen-devel] [PATCH v6 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-07 Thread Ben Guthro
On Mon, Jul 1, 2013 at 7:48 AM, Ben Guthro benjamin.gut...@citrix.com wrote:
 In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
 reduced hardware sleep support, and the two changes didn't get
 synchronized: The new code doesn't call the hook function (if so
 requested). Fix this, requiring a boolean parameter to be added to the
 hook function to distinguish extended from legacy sleep.

 This requires adjusting TXT, but the adjustments only go as far as
 failing the extended mode call (since, looking at the TXT interface,
 there doesn't even appear to be precautions to deal with that
 alternative interface).

 The hypervisor change underlying this is commit 62d1a69 (ACPI: support
 v5 (reduced HW) sleep interface) on the master branch of
 git://xenbits.xen.org/xen.git.

 Signed-off-by: Jan Beulich jbeul...@suse.com
 Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
 Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
 Cc: Gang Wei gang@intel.com
 Cc: Shane Wang shane.w...@intel.com
 Cc: Bob Moore robert.mo...@intel.com
 Cc: Rafael J. Wysocki r...@sisk.pl
 Cc: linux-a...@vger.kernel.org
 Cc: tboot-de...@lists.sourceforge.net

 v2: Extend description to include reference to hypervisor side change
 v3: Split into multiple patches, separating subsystems
 Remove bool parameters, in favor of u8
 v4: Remove linux/acpi.h dependencies
 Further patch split to break out acpica from OSL
 More bool vs u8 fixes
 v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
 so intermediate builds of partial patch series will not fail.
 v6: Rebased to linux-pm linux-next branch
 Added warning in tboot early return code
 Added Reviewed-by lines

 Ben Guthro (5):
   acpi: Remove need to include linux/acpi.h in common acpica code
   acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
   acpi/xen/tboot: Adjust linux acpi OS functions to new extended
 parameter
   x86/tboot: Fail extended mode reduced hardware sleep
   xen/acpi: notify xen when reduced hardware sleep is available

Rafael, Bob -

Is this version of the series something that you may consider taking?
If not - is there something specific you would like to see addressed?

Thanks for your time.


Ben


  arch/x86/kernel/tboot.c  |9 -
  drivers/acpi/acpica/hwesleep.c   |7 +++
  drivers/acpi/acpica/hwsleep.c|3 +--
  drivers/acpi/osl.c   |   16 
  drivers/xen/acpi.c   |   26 +-
  include/acpi/acpiosxf.h  |6 ++
  include/linux/acpi.h |9 +++--
  include/xen/acpi.h   |4 ++--
  include/xen/interface/platform.h |7 ---
  9 files changed, 52 insertions(+), 35 deletions(-)

 --
 1.7.9.5


 ___
 Xen-devel mailing list
 xen-de...@lists.xen.org
 http://lists.xen.org/xen-devel
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-02 Thread Ben Guthro



On 07/02/2013 02:19 AM, Zheng, Lv wrote:

Thanks for your efforts!

I wonder if it is possible to remove the argument - "u8 extended" and convert "pm1a_control, 
pm1b_control" into some u8 values that are equivalent to "acpi_gbl_sleep_type_a, 
acpi_gbl_sleep_type_b" in the legacy sleep path.
It can also simplify Xen codes.


Thanks for your time to review this.

I'm not sure that this simplifies things. I think that, in fact, it 
would make them quite a bit more complicated, but perhaps I misunderstand.


Is it not preferred to use the reduced hardware sleep, over the old 
method? While these register definitions may be equivalent below, doing 
the translation in linux, only to translate them back again at a lower 
layer seems unnecessary.


The hypervisor knows how to deal with both the reduced hardware sleep as 
well as the legacy sleep path - it merely need to distinguish these two 
paths, when performing the hypercall.


Since there are two paths through the higher level ACPICA code - that in 
hwsleep.c, and hwesleep.c - there needs to be some distinction between 
the two paths, when calling through to the lower level 
acpi_os_prepare_sleep() call.


An alternate method would be to create another interface named 
acpi_os_prepare_esleep() which would do the equivalent of this patch 
series, with an "extended" parameter hidden from upper level interfaces.


This, however, would also add another function to 
include/acpi/acpiosxf.h - which, I thought was undesirable, in the 
impression that I got from Bob Moore, and Rafael Wysocki (though, please 
correct me on this point, if I have misunderstood)


Best Regards

Ben



As in ACPI specification, the bit definitions between the legacy sleep 
registers and the extended sleep registers are equivalent.

The legacy sleep register definition:
Table 4-16 PM1 Status Registers Fixed Hardware Feature Status Bits - 
WAK_STS(bit 15)
Table 4-18 PM1 Control Registers Fixed Hardware Feature Control Bits - SLP_TYPx 
(bit 10-12), SLP_EN (bit 13)

The extended sleep register definition:
Table 4-24 Sleep Control Register - SLP_TYPx (3 bits from offset 2), SLP_EN (1 
bit from offset 5), here 10-8 = 2, and 13-8 = 5, this definition is equivalent 
to Table 4-18.
Table 4-25 Sleep Status Register - WAK_STS (1 bit 7), 15-8 = 7, this definition 
is equivalent to Table 4-16.

Thanks and best regards
-Lv


-Original Message-
From: linux-acpi-ow...@vger.kernel.org
[mailto:linux-acpi-ow...@vger.kernel.org] On Behalf Of Ben Guthro
Sent: Wednesday, June 26, 2013 10:06 PM
To: Konrad Rzeszutek Wilk; Jan Beulich; Rafaell J . Wysocki;
linux-kernel@vger.kernel.org; linux-a...@vger.kernel.org;
xen-de...@lists.xen.org
Cc: Ben Guthro; Moore, Robert
Subject: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced
hardware sleep path

In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

Signed-off-by: Ben Guthro 
Signed-off-by: Jan Beulich 
Cc: Bob Moore 
Cc: Rafaell J. Wysocki 
Cc: linux-a...@vger.kernel.org
---
  drivers/acpi/acpica/hwesleep.c |8 
  drivers/acpi/acpica/hwsleep.c  |2 +-
  drivers/acpi/osl.c |   16 
  include/linux/acpi.h   |   10 +-
  4 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..6834dd7 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -43,6 +43,7 @@
   */

  #include 
+#include 
  #include "accommon.h"

  #define _COMPONENT  ACPI_HARDWARE
@@ -128,6 +129,13 @@ acpi_status acpi_hw_extended_sleep(u8
sleep_state)

ACPI_FLUSH_CPU_CACHE();

+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, true);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..a93c299 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -153,7 +153,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();

status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, false);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..3fc

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-02 Thread Ben Guthro



On 07/02/2013 02:19 AM, Zheng, Lv wrote:

Thanks for your efforts!

I wonder if it is possible to remove the argument - u8 extended and convert pm1a_control, 
pm1b_control into some u8 values that are equivalent to acpi_gbl_sleep_type_a, 
acpi_gbl_sleep_type_b in the legacy sleep path.
It can also simplify Xen codes.


Thanks for your time to review this.

I'm not sure that this simplifies things. I think that, in fact, it 
would make them quite a bit more complicated, but perhaps I misunderstand.


Is it not preferred to use the reduced hardware sleep, over the old 
method? While these register definitions may be equivalent below, doing 
the translation in linux, only to translate them back again at a lower 
layer seems unnecessary.


The hypervisor knows how to deal with both the reduced hardware sleep as 
well as the legacy sleep path - it merely need to distinguish these two 
paths, when performing the hypercall.


Since there are two paths through the higher level ACPICA code - that in 
hwsleep.c, and hwesleep.c - there needs to be some distinction between 
the two paths, when calling through to the lower level 
acpi_os_prepare_sleep() call.


An alternate method would be to create another interface named 
acpi_os_prepare_esleep() which would do the equivalent of this patch 
series, with an extended parameter hidden from upper level interfaces.


This, however, would also add another function to 
include/acpi/acpiosxf.h - which, I thought was undesirable, in the 
impression that I got from Bob Moore, and Rafael Wysocki (though, please 
correct me on this point, if I have misunderstood)


Best Regards

Ben



As in ACPI specification, the bit definitions between the legacy sleep 
registers and the extended sleep registers are equivalent.

The legacy sleep register definition:
Table 4-16 PM1 Status Registers Fixed Hardware Feature Status Bits - 
WAK_STS(bit 15)
Table 4-18 PM1 Control Registers Fixed Hardware Feature Control Bits - SLP_TYPx 
(bit 10-12), SLP_EN (bit 13)

The extended sleep register definition:
Table 4-24 Sleep Control Register - SLP_TYPx (3 bits from offset 2), SLP_EN (1 
bit from offset 5), here 10-8 = 2, and 13-8 = 5, this definition is equivalent 
to Table 4-18.
Table 4-25 Sleep Status Register - WAK_STS (1 bit 7), 15-8 = 7, this definition 
is equivalent to Table 4-16.

Thanks and best regards
-Lv


-Original Message-
From: linux-acpi-ow...@vger.kernel.org
[mailto:linux-acpi-ow...@vger.kernel.org] On Behalf Of Ben Guthro
Sent: Wednesday, June 26, 2013 10:06 PM
To: Konrad Rzeszutek Wilk; Jan Beulich; Rafaell J . Wysocki;
linux-kernel@vger.kernel.org; linux-a...@vger.kernel.org;
xen-de...@lists.xen.org
Cc: Ben Guthro; Moore, Robert
Subject: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced
hardware sleep path

In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish extended from legacy sleep.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Signed-off-by: Jan Beulich jbeul...@suse.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafaell J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
---
  drivers/acpi/acpica/hwesleep.c |8 
  drivers/acpi/acpica/hwsleep.c  |2 +-
  drivers/acpi/osl.c |   16 
  include/linux/acpi.h   |   10 +-
  4 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..6834dd7 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -43,6 +43,7 @@
   */

  #include acpi/acpi.h
+#include linux/acpi.h
  #include accommon.h

  #define _COMPONENT  ACPI_HARDWARE
@@ -128,6 +129,13 @@ acpi_status acpi_hw_extended_sleep(u8
sleep_state)

ACPI_FLUSH_CPU_CACHE();

+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, true);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..a93c299 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -153,7 +153,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();

status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, false);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c

[PATCH v6 4/5] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-01 Thread Ben Guthro
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei 
Reviewed-by: Konrad Rzeszutek Wilk 
---
 arch/x86/kernel/tboot.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index d578c9c..76c284f 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -285,6 +285,12 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control,
if (!tboot_enabled())
return 0;
 
+   if (extended)
+   if (WARN(extended,"tboot is not able to suspend on platforms with"
+   " reduced hardware sleep (ACPIv5). Please contact"
+   " tboot-de...@lists.sourceforge.net mailing list."))
+   return -1;
+
tboot_copy_fadt(_gbl_FADT);
tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-01 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: linux-a...@vger.kernel.org
Reviewed-by: Konrad Rzeszutek Wilk 
---
 drivers/acpi/acpica/hwesleep.c |7 +++
 drivers/acpi/acpica/hwsleep.c  |2 +-
 include/acpi/acpiosxf.h|4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..69b3e15 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, TRUE);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 867b947..cf78157 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();
 
status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, FALSE);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 7b402f2..3dc5ffa6 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
 /*
  * ACPI sleep preparation
  */
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 
 #endif /* __ACPIOSXF_H__ */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 5/5] xen/acpi: notify xen when reduced hardware sleep is available

2013-07-01 Thread Ben Guthro
Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Acked-by: Konrad Wilk 
---
 drivers/xen/acpi.c   |   25 -
 include/xen/acpi.h   |3 +--
 include/xen/interface/platform.h |7 ---
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 36d2be1..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,27 @@
 #include 
 #include 
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt & 0x) || (pm1b_cnt & 0x)) {
-   WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-"Email xen-de...@lists.xensource.com  Thank you.\n", \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+"Using more than %u bits of sleep control values %#x/%#x!"
+"Email xen-de...@lists.xen.org - Thank you.\n", \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op();
return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 8656055..7770b66 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 bool extended);
 
 static inline int xen_acpi_suspend_lowlevel(void)
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 3/5] acpi/xen/tboot: Adjust linux acpi OS functions to new extended parameter

2013-07-01 Thread Ben Guthro
Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: Gang Wei 
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net
Acked-by: Konrad Rzeszutek Wilk 
---
 arch/x86/kernel/tboot.c |3 ++-
 drivers/acpi/osl.c  |   16 
 drivers/xen/acpi.c  |3 ++-
 include/linux/acpi.h|6 +++---
 include/xen/acpi.h  |3 ++-
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..d578c9c 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  bool extended)
 {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 6ab2c35..0fe91d5 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ bool extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1758,13 +1758,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
 {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc < 0)
return AE_ERROR;
else if (rc > 0)
@@ -1773,8 +1773,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended))
 {
__acpi_os_prepare_sleep = func;
 }
diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..36d2be1 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -36,7 +36,8 @@
 #include 
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+u32 pm1a_cnt, u32 pm1b_cnt,
+bool extended)
 {
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 5d5a47b..a78ebc0 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -476,8 +476,8 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #endif /* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended));
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -487,7 +487,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 46aa3d1..8656055 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -76,7 +76,8 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 }
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd);
+u32 pm1a_cnt, u32 pm1b_cnd,
+bool extended);
 
 static inline int xen_acpi_suspend_lowlevel(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line &quo

[PATCH v6 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-01 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Richard L Maliszewski 
Cc: Gang Wei 
Cc: Shane Wang 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
so intermediate builds of partial patch series will not fail.
v6: Rebased to linux-pm linux-next branch
Added warning in tboot early return code
    Added Reviewed-by lines

Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi/xen/tboot: Adjust linux acpi OS functions to new extended
parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |9 -
 drivers/acpi/acpica/hwesleep.c   |7 +++
 drivers/acpi/acpica/hwsleep.c|3 +--
 drivers/acpi/osl.c   |   16 
 drivers/xen/acpi.c   |   26 +-
 include/acpi/acpiosxf.h  |6 ++
 include/linux/acpi.h |9 +++--
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 9 files changed, 52 insertions(+), 35 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 1/5] acpi: Remove need to include linux/acpi.h in common acpica code

2013-07-01 Thread Ben Guthro
Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro 
Cc: Rafael J. Wysocki 
Cc: Bob Moore 
Reviewed-by: Konrad Rzeszutek Wilk 
---
 drivers/acpi/acpica/hwsleep.c |1 -
 include/acpi/acpiosxf.h   |6 ++
 include/linux/acpi.h  |3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include 
-#include 
 #include "accommon.h"
 
 #define _COMPONENT  ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 64b8c76..7b402f2 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+ u32 pm1a_control, u32 pm1b_control);
+
 #endif /* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba25..5d5a47b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -478,9 +478,6 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
   u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 1/5] acpi: Remove need to include linux/acpi.h in common acpica code

2013-07-01 Thread Ben Guthro
Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: Bob Moore robert.mo...@intel.com
Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
---
 drivers/acpi/acpica/hwsleep.c |1 -
 include/acpi/acpiosxf.h   |6 ++
 include/linux/acpi.h  |3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include acpi/acpi.h
-#include linux/acpi.h
 #include accommon.h
 
 #define _COMPONENT  ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 64b8c76..7b402f2 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+ u32 pm1a_control, u32 pm1b_control);
+
 #endif /* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 353ba25..5d5a47b 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -478,9 +478,6 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
   u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-07-01 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish extended from legacy sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
Cc: Gang Wei gang@intel.com
Cc: Shane Wang shane.w...@intel.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
so intermediate builds of partial patch series will not fail.
v6: Rebased to linux-pm linux-next branch
Added warning in tboot early return code
Added Reviewed-by lines

Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi/xen/tboot: Adjust linux acpi OS functions to new extended
parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |9 -
 drivers/acpi/acpica/hwesleep.c   |7 +++
 drivers/acpi/acpica/hwsleep.c|3 +--
 drivers/acpi/osl.c   |   16 
 drivers/xen/acpi.c   |   26 +-
 include/acpi/acpiosxf.h  |6 ++
 include/linux/acpi.h |9 +++--
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 9 files changed, 52 insertions(+), 35 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 3/5] acpi/xen/tboot: Adjust linux acpi OS functions to new extended parameter

2013-07-01 Thread Ben Guthro
Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: Gang Wei gang@intel.com
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net
Acked-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
---
 arch/x86/kernel/tboot.c |3 ++-
 drivers/acpi/osl.c  |   16 
 drivers/xen/acpi.c  |3 ++-
 include/linux/acpi.h|6 +++---
 include/xen/acpi.h  |3 ++-
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..d578c9c 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  bool extended)
 {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index 6ab2c35..0fe91d5 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ bool extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1758,13 +1758,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
 {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc  0)
return AE_ERROR;
else if (rc  0)
@@ -1773,8 +1773,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended))
 {
__acpi_os_prepare_sleep = func;
 }
diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..36d2be1 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -36,7 +36,8 @@
 #include asm/xen/hypervisor.h
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+u32 pm1a_cnt, u32 pm1b_cnt,
+bool extended)
 {
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 5d5a47b..a78ebc0 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -476,8 +476,8 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #endif /* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended));
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -487,7 +487,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 
 #if defined(CONFIG_ACPI)  defined(CONFIG_PM_RUNTIME)
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 46aa3d1..8656055 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -76,7 +76,8 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 }
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd);
+u32 pm1a_cnt, u32 pm1b_cnd,
+bool extended

[PATCH v6 5/5] xen/acpi: notify xen when reduced hardware sleep is available

2013-07-01 Thread Ben Guthro
Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Acked-by: Konrad Wilk konrad.w...@oracle.com
---
 drivers/xen/acpi.c   |   25 -
 include/xen/acpi.h   |3 +--
 include/xen/interface/platform.h |7 ---
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 36d2be1..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,27 @@
 #include asm/xen/hypercall.h
 #include asm/xen/hypervisor.h
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt  0x) || (pm1b_cnt  0x)) {
-   WARN(1, Using more than 16bits of PM1A/B 0x%x/0x%x!
-Email xen-de...@lists.xensource.com  Thank you.\n, \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a  (~0  bits)) || (val_b  (~0  bits)),
+Using more than %u bits of sleep control values %#x/%#x!
+Email xen-de...@lists.xen.org - Thank you.\n, \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op(op);
return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 8656055..7770b66 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 bool extended);
 
 static inline int xen_acpi_suspend_lowlevel(void)
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 4/5] x86/tboot: Fail extended mode reduced hardware sleep

2013-07-01 Thread Ben Guthro
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei gang@intel.com
Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
---
 arch/x86/kernel/tboot.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index d578c9c..76c284f 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -285,6 +285,12 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control,
if (!tboot_enabled())
return 0;
 
+   if (extended)
+   if (WARN(extended,tboot is not able to suspend on platforms with
+reduced hardware sleep (ACPIv5). Please contact
+tboot-de...@lists.sourceforge.net mailing list.))
+   return -1;
+
tboot_copy_fadt(acpi_gbl_FADT);
tboot-acpi_sinfo.pm1a_cnt_val = pm1a_control;
tboot-acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v6 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-07-01 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish extended from legacy sleep.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
Reviewed-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com
---
 drivers/acpi/acpica/hwesleep.c |7 +++
 drivers/acpi/acpica/hwsleep.c  |2 +-
 include/acpi/acpiosxf.h|4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..69b3e15 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, TRUE);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 867b947..cf78157 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();
 
status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, FALSE);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 7b402f2..3dc5ffa6 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
 /*
  * ACPI sleep preparation
  */
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 
 #endif /* __ACPIOSXF_H__ */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-28 Thread Ben Guthro



On 06/28/2013 12:03 PM, Konrad Rzeszutek Wilk wrote:

On Fri, Jun 28, 2013 at 09:46:22AM -0400, Ben Guthro wrote:

Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: linux-a...@vger.kernel.org
---
  arch/x86/kernel/tboot.c |3 ++-
  drivers/acpi/osl.c  |   16 
  drivers/xen/acpi.c  |3 ++-
  include/linux/acpi.h|6 +++---
  include/xen/acpi.h  |3 ++-


Since they touch the Xen files, please also include

Acked-by: Konrad Rzeszutek Wilk 

thought you should rebase this on top of Rafael's linux-next
as it won't apply cleanly on top v3.10-rc7.


Actually, it does apply cleanly on top of v3.10-rc7.

However, I'll pull Rafael's linux-next, and rebase on that.





  5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..d578c9c 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
  }

-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  bool extended)
  {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..0251c9b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
  extern char line_buf[80];
  #endif/*ENABLE_DEBUGGER */

-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ bool extended);

  static acpi_osd_handler acpi_irq_handler;
  static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
  }

-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
  {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc < 0)
return AE_ERROR;
else if (rc > 0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
  }

-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended))
  {
__acpi_os_prepare_sleep = func;
  }
diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..36d2be1 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -36,7 +36,8 @@
  #include 

  int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+u32 pm1a_cnt, u32 pm1b_cnt,
+bool extended)
  {
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 709a2f2..26f9996 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
  #endif/* !CONFIG_ACPI */

  #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended));
  #ifdef CONFIG_X86
  void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
  #else
@@ -488,7 +488,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
  }
  #endif /* CONFIG_X86 */
  #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
  #endif

  #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..9f7e2e6 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -76,7 +76,8 @@ static inline int xen_acpi_get_pxm

[PATCH v5 1/5] acpi: Remove need to include linux/acpi.h in common acpica code

2013-06-28 Thread Ben Guthro
Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro 
Cc: Rafael J. Wysocki 
Cc: Bob Moore 
---
 drivers/acpi/acpica/hwsleep.c |1 -
 include/acpi/acpiosxf.h   |6 ++
 include/linux/acpi.h  |3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include 
-#include 
 #include "accommon.h"
 
 #define _COMPONENT  ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5b3d2bd..c68b779 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+ u32 pm1a_control, u32 pm1b_control);
+
 #endif /* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..709a2f2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
   u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep

2013-06-28 Thread Ben Guthro
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei 
---
 arch/x86/kernel/tboot.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index d578c9c..57383b2 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -285,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control,
if (!tboot_enabled())
return 0;
 
+   if (extended)
+   return -1;
+
tboot_copy_fadt(_gbl_FADT);
tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-28 Thread Ben Guthro
Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: linux-a...@vger.kernel.org
---
 arch/x86/kernel/tboot.c |3 ++-
 drivers/acpi/osl.c  |   16 
 drivers/xen/acpi.c  |3 ++-
 include/linux/acpi.h|6 +++---
 include/xen/acpi.h  |3 ++-
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..d578c9c 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  bool extended)
 {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..0251c9b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ bool extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
 {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc < 0)
return AE_ERROR;
else if (rc > 0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended))
 {
__acpi_os_prepare_sleep = func;
 }
diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..36d2be1 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -36,7 +36,8 @@
 #include 
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+u32 pm1a_cnt, u32 pm1b_cnt,
+bool extended)
 {
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 709a2f2..26f9996 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #endif /* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended));
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -488,7 +488,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..9f7e2e6 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -76,7 +76,8 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 }
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd);
+u32 pm1a_cnt, u32 pm1b_cnd,
+bool extended);
 
 static inline void xen_acpi_sleep_register(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel

[PATCH v5 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-06-28 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Richard L Maliszewski 
Cc: Gang Wei 
Cc: Shane Wang 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
so intermediate builds of partial patch series will not fail.

Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi: Adjust linux acpi OS functions to new extended parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |6 +-
 drivers/acpi/acpica/hwesleep.c   |7 +++
 drivers/acpi/acpica/hwsleep.c|3 +--
 drivers/acpi/osl.c   |   16 
 drivers/xen/acpi.c   |   26 +-
 include/acpi/acpiosxf.h  |6 ++
 include/linux/acpi.h |9 +++--
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 9 files changed, 49 insertions(+), 35 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-06-28 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Bob Moore 
Cc: Rafael J. Wysocki 
Cc: linux-a...@vger.kernel.org
---
 drivers/acpi/acpica/hwesleep.c |7 +++
 drivers/acpi/acpica/hwsleep.c  |2 +-
 include/acpi/acpiosxf.h|4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..69b3e15 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, TRUE);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 867b947..cf78157 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();
 
status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, FALSE);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index c68b779..51d0f78 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
 /*
  * ACPI sleep preparation
  */
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 
 #endif /* __ACPIOSXF_H__ */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 5/5] xen/acpi: notify xen when reduced hardware sleep is available

2013-06-28 Thread Ben Guthro
Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Konrad Wilk 
---
 drivers/xen/acpi.c   |   25 -
 include/xen/acpi.h   |3 +--
 include/xen/interface/platform.h |7 ---
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 36d2be1..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,27 @@
 #include 
 #include 
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt & 0x) || (pm1b_cnt & 0x)) {
-   WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-"Email xen-de...@lists.xensource.com  Thank you.\n", \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+"Using more than %u bits of sleep control values %#x/%#x!"
+"Email xen-de...@lists.xen.org - Thank you.\n", \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op();
return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 9f7e2e6..a2d5667 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 bool extended);
 
 static inline void xen_acpi_sleep_register(void)
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 5/5] xen/acpi: notify xen when reduced hardware sleep is available

2013-06-28 Thread Ben Guthro
Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Konrad Wilk konrad.w...@oracle.com
---
 drivers/xen/acpi.c   |   25 -
 include/xen/acpi.h   |3 +--
 include/xen/interface/platform.h |7 ---
 3 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 36d2be1..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,28 +35,27 @@
 #include asm/xen/hypercall.h
 #include asm/xen/hypervisor.h
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt  0x) || (pm1b_cnt  0x)) {
-   WARN(1, Using more than 16bits of PM1A/B 0x%x/0x%x!
-Email xen-de...@lists.xensource.com  Thank you.\n, \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a  (~0  bits)) || (val_b  (~0  bits)),
+Using more than %u bits of sleep control values %#x/%#x!
+Email xen-de...@lists.xen.org - Thank you.\n, \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op(op);
return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 9f7e2e6..a2d5667 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,7 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd,
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
 bool extended);
 
 static inline void xen_acpi_sleep_register(void)
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-06-28 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish extended from legacy sleep.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
---
 drivers/acpi/acpica/hwesleep.c |7 +++
 drivers/acpi/acpica/hwsleep.c  |2 +-
 include/acpi/acpiosxf.h|4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..69b3e15 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, TRUE);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 867b947..cf78157 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();
 
status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, FALSE);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index c68b779..51d0f78 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
 /*
  * ACPI sleep preparation
  */
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 
 #endif /* __ACPIOSXF_H__ */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-06-28 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish extended from legacy sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
Cc: Gang Wei gang@intel.com
Cc: Shane Wang shane.w...@intel.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes
v5: Fix build of consumers of acpi_os_prepare_sleep() interface change,
so intermediate builds of partial patch series will not fail.

Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi: Adjust linux acpi OS functions to new extended parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |6 +-
 drivers/acpi/acpica/hwesleep.c   |7 +++
 drivers/acpi/acpica/hwsleep.c|3 +--
 drivers/acpi/osl.c   |   16 
 drivers/xen/acpi.c   |   26 +-
 include/acpi/acpiosxf.h  |6 ++
 include/linux/acpi.h |9 +++--
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 9 files changed, 49 insertions(+), 35 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-28 Thread Ben Guthro
Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
---
 arch/x86/kernel/tboot.c |3 ++-
 drivers/acpi/osl.c  |   16 
 drivers/xen/acpi.c  |3 ++-
 include/linux/acpi.h|6 +++---
 include/xen/acpi.h  |3 ++-
 5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..d578c9c 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  bool extended)
 {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..0251c9b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ bool extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
 {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc  0)
return AE_ERROR;
else if (rc  0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended))
 {
__acpi_os_prepare_sleep = func;
 }
diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..36d2be1 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -36,7 +36,8 @@
 #include asm/xen/hypervisor.h
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+u32 pm1a_cnt, u32 pm1b_cnt,
+bool extended)
 {
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 709a2f2..26f9996 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #endif /* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended));
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -488,7 +488,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 
 #if defined(CONFIG_ACPI)  defined(CONFIG_PM_RUNTIME)
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..9f7e2e6 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -76,7 +76,8 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
 }
 
 int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd);
+u32 pm1a_cnt, u32 pm1b_cnd,
+bool extended);
 
 static inline void xen_acpi_sleep_register(void)
 {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe

[PATCH v5 4/5] x86/tboot: Fail extended mode reduced hardware sleep

2013-06-28 Thread Ben Guthro
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei gang@intel.com
---
 arch/x86/kernel/tboot.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index d578c9c..57383b2 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -285,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control,
if (!tboot_enabled())
return 0;
 
+   if (extended)
+   return -1;
+
tboot_copy_fadt(acpi_gbl_FADT);
tboot-acpi_sinfo.pm1a_cnt_val = pm1a_control;
tboot-acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v5 1/5] acpi: Remove need to include linux/acpi.h in common acpica code

2013-06-28 Thread Ben Guthro
Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: Bob Moore robert.mo...@intel.com
---
 drivers/acpi/acpica/hwsleep.c |1 -
 include/acpi/acpiosxf.h   |6 ++
 include/linux/acpi.h  |3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include acpi/acpi.h
-#include linux/acpi.h
 #include accommon.h
 
 #define _COMPONENT  ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5b3d2bd..c68b779 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+ u32 pm1a_control, u32 pm1b_control);
+
 #endif /* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..709a2f2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
   u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v5 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-28 Thread Ben Guthro



On 06/28/2013 12:03 PM, Konrad Rzeszutek Wilk wrote:

On Fri, Jun 28, 2013 at 09:46:22AM -0400, Ben Guthro wrote:

Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafael J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
---
  arch/x86/kernel/tboot.c |3 ++-
  drivers/acpi/osl.c  |   16 
  drivers/xen/acpi.c  |3 ++-
  include/linux/acpi.h|6 +++---
  include/xen/acpi.h  |3 ++-


Since they touch the Xen files, please also include

Acked-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com

thought you should rebase this on top of Rafael's linux-next
as it won't apply cleanly on top v3.10-rc7.


Actually, it does apply cleanly on top of v3.10-rc7.

However, I'll pull Rafael's linux-next, and rebase on that.





  5 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..d578c9c 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
  }

-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  bool extended)
  {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..0251c9b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
  extern char line_buf[80];
  #endif/*ENABLE_DEBUGGER */

-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ bool extended);

  static acpi_osd_handler acpi_irq_handler;
  static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
  }

-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
  {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc  0)
return AE_ERROR;
else if (rc  0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
  }

-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended))
  {
__acpi_os_prepare_sleep = func;
  }
diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..36d2be1 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -36,7 +36,8 @@
  #include asm/xen/hypervisor.h

  int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+u32 pm1a_cnt, u32 pm1b_cnt,
+bool extended)
  {
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 709a2f2..26f9996 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
  #endif/* !CONFIG_ACPI */

  #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended));
  #ifdef CONFIG_X86
  void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
  #else
@@ -488,7 +488,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
  }
  #endif /* CONFIG_X86 */
  #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
  #endif

  #if defined(CONFIG_ACPI)  defined(CONFIG_PM_RUNTIME)
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..9f7e2e6 100644

Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-27 Thread Ben Guthro



On 06/27/2013 04:19 PM, Moore, Robert wrote:

I'm the ACPICA owner.



Apologies, I should have looked that up when Rafael asked for you to be 
CC'ed



The issue I have is that acpi_os_prepare_sleep causes a divergence between the raw ACPICA 
source code and the "linux" version of the ACPICA code.



Understood. The v2 version of this patchset was discussed with Jan 
Beulich here:


http://www.gossamer-threads.com/lists/xen/devel/274507

In this thread, Rafael suggests that these changes be made, and 
submitted through linux-acpi, with he, and you CC'ed.


This is more of a cleanup effort to existing functionality, that did not 
get coordinated. That is, as the comment indicates, in linux 3.4, 
reduced hardware sleep was introduced as part of ACPIv5. In parallel, 
acpi_os_prepare_sleep() was also introduced, to allow for subsystems 
such as Xen, and tboot to take advantage of the vast majority of ACPICA, 
but hook some low level capabilities via function pointer, to do the 
specific things for those subsystems.


Rafael rightly pointed out that inclusion of linux/acpi.h in ACPICA code 
is wrong, and we should make efforts to avoid doing so. This patch is to 
clean this up, and also to extend the functionality to also go down the 
same path for the reduced hardware sleep path, passing that "extended" 
flag down to that subsystem, so that it might make use of it at the very 
low levels.


All efforts are being made to reduce the amount of churn in ACPICA, 
since it is an upstream project to linux.



If it is possible to implement the functionality that is needed without changes 
to ACPICA, then that would be best. If not, we are willing to integrate this 
interface into ACPICA. However, this has an impact on all operating systems 
that use ACPICA, so this is always the last resort.



I am unaware of a way to take advantage of the infrastructure that 
ACPICA provides, and also do that which is necessary to make it work in 
Xen / tboot without these hooks.


It would be greatly appreciated if you would consider this new interface 
for inclusion.


Thanks for your time.

Ben




Bob



-Original Message-----
From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
Sent: Thursday, June 27, 2013 9:13 AM
To: Moore, Robert
Cc: Jan Beulich; Zheng, Lv; Box, David E; Brown, Len; xen-
de...@lists.xen.org; Konrad Rzeszutek Wilk; Rafaell J . Wysocki; linux-
a...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new
extended parameter



On 06/27/2013 11:59 AM, Moore, Robert wrote:

I have not seen a discussion of the details on this, so can someone

explain to me just why acpi_os_prepare_sleep is needed, what does it do,
and why these changes are being made to ACPICA code?

Hi Bob,

I'm not familiar with your background here, so I apologize if I am stating
obvious things below.

acpi_os_prepare_sleep() has been in the acpica code for some time now,
allowing for OS specific hooks to account for differences between OS
architectures.

Specifically, it has been in since:

commit 09f98a825a821f7a3f1b162f9ed023f37213a63b
Author: Tang Liang 
Date:   Fri Dec 9 10:05:54 2011 +0800

 x86, acpi, tboot: Have a ACPI os prepare sleep instead of calling
tboot_sleep.

 The ACPI suspend path makes a call to tboot_sleep right before
 it writes the PM1A, PM1B values. We replace the direct call to
 tboot via an registration callback similar to __acpi_register_gsi.

 CC: Len Brown 
 Acked-by: Joseph Cihula 
 Acked-by: Rafael J. Wysocki 
 [v1: Added __attribute__ ((unused))]
 [v2: Introduced a wrapper instead of changing tboot_sleep return
values]
 [v3: Added return value AE_CTRL_SKIP for acpi_os_sleep_prepare]
 Signed-off-by: Tang Liang 
 [v1: Fix compile issues on IA64 and PPC64]
 [v2: Fix where __acpi_os_prepare_sleep==NULL and did not go in sleep
properly]
 Signed-off-by: Konrad Rzeszutek Wilk 



In this case, the Xen hypervisor, and not linux needs to actually put the
system into S3, so this hook gives the architecture to do so.

This change does not introduce this functionality, but simply moves the
code around into the proper locations, such that the acpica code no longer
need to include linux specific headers.

I hope this helps.
If you have specific questions, please let me know.

Regards,
Ben



Thanks,
Bob



-Original Message-
From: Jan Beulich [mailto:jbeul...@suse.com]
Sent: Thursday, June 27, 2013 8:12 AM
To: Ben Guthro
Cc: Moore, Robert; xen-de...@lists.xen.org; Konrad Rzeszutek Wilk;
Rafaell J . Wysocki; linux-a...@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to
new extended parameter


On 27.06.13 at 17:02, Ben Guthro  wrote:

Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich 
Signed-off-by:

Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-27 Thread Ben Guthro


On 06/27/2013 11:59 AM, Moore, Robert wrote:
> I have not seen a discussion of the details on this, so can someone explain 
> to me just why acpi_os_prepare_sleep is needed, what does it do, and why 
> these changes are being made to ACPICA code?

Hi Bob,

I'm not familiar with your background here, so I apologize if I am stating 
obvious things below.

acpi_os_prepare_sleep() has been in the acpica code for some time now, allowing 
for OS specific hooks to account for differences between OS architectures.

Specifically, it has been in since:

commit 09f98a825a821f7a3f1b162f9ed023f37213a63b
Author: Tang Liang 
Date:   Fri Dec 9 10:05:54 2011 +0800

x86, acpi, tboot: Have a ACPI os prepare sleep instead of calling 
tboot_sleep.

The ACPI suspend path makes a call to tboot_sleep right before
it writes the PM1A, PM1B values. We replace the direct call to
tboot via an registration callback similar to __acpi_register_gsi.

CC: Len Brown 
Acked-by: Joseph Cihula 
Acked-by: Rafael J. Wysocki 
[v1: Added __attribute__ ((unused))]
[v2: Introduced a wrapper instead of changing tboot_sleep return values]
[v3: Added return value AE_CTRL_SKIP for acpi_os_sleep_prepare]
Signed-off-by: Tang Liang 
[v1: Fix compile issues on IA64 and PPC64]
[v2: Fix where __acpi_os_prepare_sleep==NULL and did not go in sleep 
properly]
Signed-off-by: Konrad Rzeszutek Wilk 



In this case, the Xen hypervisor, and not linux needs to actually put the 
system into S3, so this hook gives the architecture to do so.

This change does not introduce this functionality, but simply moves the code 
around into the proper locations, such that the acpica code no longer need to 
include linux specific headers.

I hope this helps.
If you have specific questions, please let me know.

Regards,
Ben

> 
> Thanks,
> Bob
> 
> 
>> -Original Message-
>> From: Jan Beulich [mailto:jbeul...@suse.com]
>> Sent: Thursday, June 27, 2013 8:12 AM
>> To: Ben Guthro
>> Cc: Moore, Robert; xen-de...@lists.xen.org; Konrad Rzeszutek Wilk; Rafaell
>> J . Wysocki; linux-a...@vger.kernel.org; linux-kernel@vger.kernel.org
>> Subject: Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new
>> extended parameter
>>
>>>>> On 27.06.13 at 17:02, Ben Guthro  wrote:
>>> Change the function definitions of acpi_os_prepare_sleep() and
>>> acpi_os_set_prepare_sleep() to pass along the new extended sleep
>>> parameter.
>>>
>>> Signed-off-by: Jan Beulich 
>>> Signed-off-by: Ben Guthro 
>>> Cc: Bob Moore 
>>> Cc: Rafaell J. Wysocki 
>>> Cc: linux-a...@vger.kernel.org
>>> ---
>>>   drivers/acpi/osl.c   |   16 
>>>   include/linux/acpi.h |6 +++---
>>>   2 files changed, 11 insertions(+), 11 deletions(-)
>>>
>>> diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index
>>> e721863..0251c9b 100644
>>> --- a/drivers/acpi/osl.c
>>> +++ b/drivers/acpi/osl.c
>>> @@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);  extern char
>>> line_buf[80];
>>>   #endif/*ENABLE_DEBUGGER */
>>>
>>> -static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
>>> - u32 pm1b_ctrl);
>>> +static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32
>> val_b,
>>> + bool extended);
>>
>> So from here till patch 5 the build will be half broken because of the
>> type mismatches? I think at least the types of the consumers need to be
>> changed in this patch; leaving the meat of the Xen change to patch 4 is
>> perhaps fine.
>>
>> Jan
>>
>>>
>>>   static acpi_osd_handler acpi_irq_handler;  static void
>>> *acpi_irq_context; @@ -1757,13 +1757,13 @@ acpi_status
>>> acpi_os_terminate(void)
>>> return AE_OK;
>>>   }
>>>
>>> -acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
>>> - u32 pm1b_control)
>>> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
>>> + u8 extended)
>>>   {
>>> int rc = 0;
>>> if (__acpi_os_prepare_sleep)
>>> -   rc = __acpi_os_prepare_sleep(sleep_state,
>>> -pm1a_control, pm1b_control);
>>> +   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
>>> +extended);
>>> if (rc < 0)
>>> return AE_ERROR;
>>> else if (

[PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-27 Thread Ben Guthro
Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Bob Moore 
Cc: Rafaell J. Wysocki 
Cc: linux-a...@vger.kernel.org
---
 drivers/acpi/osl.c   |   16 
 include/linux/acpi.h |6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..0251c9b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ bool extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
 {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc < 0)
return AE_ERROR;
else if (rc > 0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended))
 {
__acpi_os_prepare_sleep = func;
 }
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 709a2f2..26f9996 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #endif /* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended));
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -488,7 +488,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-06-27 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Ben Guthro 
Signed-off-by: Jan Beulich 
Cc: Richard L Maliszewski 
Cc: Gang Wei 
Cc: Shane Wang 
Cc: Bob Moore 
Cc: Rafaell J. Wysocki 
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
    More bool vs u8 fixes

Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi: Adjust linux acpi OS functions to new extended parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |6 +-
 drivers/acpi/acpica/hwesleep.c   |7 +++
 drivers/acpi/acpica/hwsleep.c|3 +--
 drivers/acpi/osl.c   |   16 
 drivers/xen/acpi.c   |   26 +-
 include/acpi/acpiosxf.h  |6 ++
 include/linux/acpi.h |9 +++--
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 9 files changed, 49 insertions(+), 35 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-06-27 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Bob Moore 
Cc: Rafaell J. Wysocki 
Cc: linux-a...@vger.kernel.org
---
 drivers/acpi/acpica/hwesleep.c |7 +++
 drivers/acpi/acpica/hwsleep.c  |2 +-
 include/acpi/acpiosxf.h|4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..69b3e15 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, TRUE);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 867b947..cf78157 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();
 
status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, FALSE);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index c68b779..51d0f78 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
 /*
  * ACPI sleep preparation
  */
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 
 #endif /* __ACPIOSXF_H__ */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 4/5] x86/tboot: Fail extended mode reduced hardware sleep

2013-06-27 Thread Ben Guthro
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei 
---
 arch/x86/kernel/tboot.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..57383b2 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  bool extended)
 {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
@@ -284,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
if (!tboot_enabled())
return 0;
 
+   if (extended)
+   return -1;
+
tboot_copy_fadt(_gbl_FADT);
tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 1/5] acpi: Remove need to include linux/acpi.h in common acpica code

2013-06-27 Thread Ben Guthro
Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro 
Cc: Rafaell J. Wysocki 
Cc: Bob Moore 
---
 drivers/acpi/acpica/hwsleep.c |1 -
 include/acpi/acpiosxf.h   |6 ++
 include/linux/acpi.h  |3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include 
-#include 
 #include "accommon.h"
 
 #define _COMPONENT  ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5b3d2bd..c68b779 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+ u32 pm1a_control, u32 pm1b_control);
+
 #endif /* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..709a2f2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
   u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 5/5] xen/acpi: notify xen when reduced hardware sleep is available

2013-06-27 Thread Ben Guthro
Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich 
Signed-off-by: Ben Guthro 
Cc: Konrad Wilk 
---
 drivers/xen/acpi.c   |   26 +-
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,27 +35,27 @@
 #include 
 #include 
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
+bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt & 0x) || (pm1b_cnt & 0x)) {
-   WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-"Email xen-de...@lists.xensource.com  Thank you.\n", \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+"Using more than %u bits of sleep control values %#x/%#x!"
+"Email xen-de...@lists.xen.org - Thank you.\n", \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op();
return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..a2d5667 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,8 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
+bool extended);
 
 static inline void xen_acpi_sleep_register(void)
 {
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 4/5] x86/tboot: Fail extended mode reduced hardware sleep

2013-06-27 Thread Ben Guthro
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei gang@intel.com
---
 arch/x86/kernel/tboot.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..57383b2 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  bool extended)
 {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
@@ -284,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
if (!tboot_enabled())
return 0;
 
+   if (extended)
+   return -1;
+
tboot_copy_fadt(acpi_gbl_FADT);
tboot-acpi_sinfo.pm1a_cnt_val = pm1a_control;
tboot-acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 1/5] acpi: Remove need to include linux/acpi.h in common acpica code

2013-06-27 Thread Ben Guthro
Move the definition of acpi_os_prepare_sleep into the OS services layer header,
and remove the include of linux/acpi.h from common acpica code.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Rafaell J. Wysocki r...@sisk.pl
Cc: Bob Moore robert.mo...@intel.com
---
 drivers/acpi/acpica/hwsleep.c |1 -
 include/acpi/acpiosxf.h   |6 ++
 include/linux/acpi.h  |3 ---
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..867b947 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -43,7 +43,6 @@
  */
 
 #include acpi/acpi.h
-#include linux/acpi.h
 #include accommon.h
 
 #define _COMPONENT  ACPI_HARDWARE
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index 5b3d2bd..c68b779 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -276,4 +276,10 @@ char *acpi_os_get_next_filename(void *dir_handle);
 
 void acpi_os_close_directory(void *dir_handle);
 
+/*
+ * ACPI sleep preparation
+ */
+acpi_status acpi_os_prepare_sleep(u8 sleep_state,
+ u32 pm1a_control, u32 pm1b_control);
+
 #endif /* __ACPIOSXF_H__ */
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..709a2f2 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -479,9 +479,6 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #ifdef CONFIG_ACPI
 void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
   u32 pm1a_ctrl,  u32 pm1b_ctrl));
-
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 5/5] xen/acpi: notify xen when reduced hardware sleep is available

2013-06-27 Thread Ben Guthro
Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Konrad Wilk konrad.w...@oracle.com
---
 drivers/xen/acpi.c   |   26 +-
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..371dade 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,27 +35,27 @@
 #include asm/xen/hypercall.h
 #include asm/xen/hypervisor.h
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
+bool extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt  0x) || (pm1b_cnt  0x)) {
-   WARN(1, Using more than 16bits of PM1A/B 0x%x/0x%x!
-Email xen-de...@lists.xensource.com  Thank you.\n, \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a  (~0  bits)) || (val_b  (~0  bits)),
+Using more than %u bits of sleep control values %#x/%#x!
+Email xen-de...@lists.xen.org - Thank you.\n, \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op(op);
return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..a2d5667 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,8 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
+bool extended);
 
 static inline void xen_acpi_sleep_register(void)
 {
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 0/5] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-06-27 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish extended from legacy sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Signed-off-by: Jan Beulich jbeul...@suse.com
Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
Cc: Gang Wei gang@intel.com
Cc: Shane Wang shane.w...@intel.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafaell J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8
v4: Remove linux/acpi.h dependencies
Further patch split to break out acpica from OSL
More bool vs u8 fixes

Ben Guthro (5):
  acpi: Remove need to include linux/acpi.h in common acpica code
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  acpi: Adjust linux acpi OS functions to new extended parameter
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |6 +-
 drivers/acpi/acpica/hwesleep.c   |7 +++
 drivers/acpi/acpica/hwsleep.c|3 +--
 drivers/acpi/osl.c   |   16 
 drivers/xen/acpi.c   |   26 +-
 include/acpi/acpiosxf.h  |6 ++
 include/linux/acpi.h |9 +++--
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 9 files changed, 49 insertions(+), 35 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 2/5] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-06-27 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish extended from legacy sleep.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafaell J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
---
 drivers/acpi/acpica/hwesleep.c |7 +++
 drivers/acpi/acpica/hwsleep.c  |2 +-
 include/acpi/acpiosxf.h|4 ++--
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..69b3e15 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -128,6 +128,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, TRUE);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index 867b947..cf78157 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -152,7 +152,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();
 
status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, FALSE);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/include/acpi/acpiosxf.h b/include/acpi/acpiosxf.h
index c68b779..51d0f78 100644
--- a/include/acpi/acpiosxf.h
+++ b/include/acpi/acpiosxf.h
@@ -279,7 +279,7 @@ void acpi_os_close_directory(void *dir_handle);
 /*
  * ACPI sleep preparation
  */
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 
 #endif /* __ACPIOSXF_H__ */
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-27 Thread Ben Guthro
Change the function definitions of acpi_os_prepare_sleep() and
acpi_os_set_prepare_sleep() to pass along the new extended sleep
parameter.

Signed-off-by: Jan Beulich jbeul...@suse.com
Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafaell J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
---
 drivers/acpi/osl.c   |   16 
 include/linux/acpi.h |6 +++---
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..0251c9b 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ bool extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
 {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc  0)
return AE_ERROR;
else if (rc  0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended))
 {
__acpi_os_prepare_sleep = func;
 }
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 709a2f2..26f9996 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,8 +477,8 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #endif /* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, bool extended));
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -488,7 +488,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 
 #if defined(CONFIG_ACPI)  defined(CONFIG_PM_RUNTIME)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-27 Thread Ben Guthro


On 06/27/2013 11:59 AM, Moore, Robert wrote:
 I have not seen a discussion of the details on this, so can someone explain 
 to me just why acpi_os_prepare_sleep is needed, what does it do, and why 
 these changes are being made to ACPICA code?

Hi Bob,

I'm not familiar with your background here, so I apologize if I am stating 
obvious things below.

acpi_os_prepare_sleep() has been in the acpica code for some time now, allowing 
for OS specific hooks to account for differences between OS architectures.

Specifically, it has been in since:

commit 09f98a825a821f7a3f1b162f9ed023f37213a63b
Author: Tang Liang liang.t...@oracle.com
Date:   Fri Dec 9 10:05:54 2011 +0800

x86, acpi, tboot: Have a ACPI os prepare sleep instead of calling 
tboot_sleep.

The ACPI suspend path makes a call to tboot_sleep right before
it writes the PM1A, PM1B values. We replace the direct call to
tboot via an registration callback similar to __acpi_register_gsi.

CC: Len Brown len.br...@intel.com
Acked-by: Joseph Cihula joseph.cih...@intel.com
Acked-by: Rafael J. Wysocki r...@sisk.pl
[v1: Added __attribute__ ((unused))]
[v2: Introduced a wrapper instead of changing tboot_sleep return values]
[v3: Added return value AE_CTRL_SKIP for acpi_os_sleep_prepare]
Signed-off-by: Tang Liang liang.t...@oracle.com
[v1: Fix compile issues on IA64 and PPC64]
[v2: Fix where __acpi_os_prepare_sleep==NULL and did not go in sleep 
properly]
Signed-off-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com



In this case, the Xen hypervisor, and not linux needs to actually put the 
system into S3, so this hook gives the architecture to do so.

This change does not introduce this functionality, but simply moves the code 
around into the proper locations, such that the acpica code no longer need to 
include linux specific headers.

I hope this helps.
If you have specific questions, please let me know.

Regards,
Ben

 
 Thanks,
 Bob
 
 
 -Original Message-
 From: Jan Beulich [mailto:jbeul...@suse.com]
 Sent: Thursday, June 27, 2013 8:12 AM
 To: Ben Guthro
 Cc: Moore, Robert; xen-de...@lists.xen.org; Konrad Rzeszutek Wilk; Rafaell
 J . Wysocki; linux-a...@vger.kernel.org; linux-kernel@vger.kernel.org
 Subject: Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new
 extended parameter

 On 27.06.13 at 17:02, Ben Guthro benjamin.gut...@citrix.com wrote:
 Change the function definitions of acpi_os_prepare_sleep() and
 acpi_os_set_prepare_sleep() to pass along the new extended sleep
 parameter.

 Signed-off-by: Jan Beulich jbeul...@suse.com
 Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
 Cc: Bob Moore robert.mo...@intel.com
 Cc: Rafaell J. Wysocki r...@sisk.pl
 Cc: linux-a...@vger.kernel.org
 ---
   drivers/acpi/osl.c   |   16 
   include/linux/acpi.h |6 +++---
   2 files changed, 11 insertions(+), 11 deletions(-)

 diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index
 e721863..0251c9b 100644
 --- a/drivers/acpi/osl.c
 +++ b/drivers/acpi/osl.c
 @@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);  extern char
 line_buf[80];
   #endif/*ENABLE_DEBUGGER */

 -static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
 - u32 pm1b_ctrl);
 +static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32
 val_b,
 + bool extended);

 So from here till patch 5 the build will be half broken because of the
 type mismatches? I think at least the types of the consumers need to be
 changed in this patch; leaving the meat of the Xen change to patch 4 is
 perhaps fine.

 Jan


   static acpi_osd_handler acpi_irq_handler;  static void
 *acpi_irq_context; @@ -1757,13 +1757,13 @@ acpi_status
 acpi_os_terminate(void)
 return AE_OK;
   }

 -acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
 - u32 pm1b_control)
 +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
 + u8 extended)
   {
 int rc = 0;
 if (__acpi_os_prepare_sleep)
 -   rc = __acpi_os_prepare_sleep(sleep_state,
 -pm1a_control, pm1b_control);
 +   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
 +extended);
 if (rc  0)
 return AE_ERROR;
 else if (rc  0)
 @@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8
 sleep_state, u32 pm1a_control,
 return AE_OK;
   }

 -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 -  u32 pm1a_ctrl, u32 pm1b_ctrl))
 +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
 +  u32 val_b, bool extended))
   {
 __acpi_os_prepare_sleep = func;
   }
 diff --git a/include/linux/acpi.h b/include/linux/acpi.h index
 709a2f2..26f9996 100644
 --- a/include/linux/acpi.h
 +++ b

Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new extended parameter

2013-06-27 Thread Ben Guthro



On 06/27/2013 04:19 PM, Moore, Robert wrote:

I'm the ACPICA owner.



Apologies, I should have looked that up when Rafael asked for you to be 
CC'ed



The issue I have is that acpi_os_prepare_sleep causes a divergence between the raw ACPICA 
source code and the linux version of the ACPICA code.



Understood. The v2 version of this patchset was discussed with Jan 
Beulich here:


http://www.gossamer-threads.com/lists/xen/devel/274507

In this thread, Rafael suggests that these changes be made, and 
submitted through linux-acpi, with he, and you CC'ed.


This is more of a cleanup effort to existing functionality, that did not 
get coordinated. That is, as the comment indicates, in linux 3.4, 
reduced hardware sleep was introduced as part of ACPIv5. In parallel, 
acpi_os_prepare_sleep() was also introduced, to allow for subsystems 
such as Xen, and tboot to take advantage of the vast majority of ACPICA, 
but hook some low level capabilities via function pointer, to do the 
specific things for those subsystems.


Rafael rightly pointed out that inclusion of linux/acpi.h in ACPICA code 
is wrong, and we should make efforts to avoid doing so. This patch is to 
clean this up, and also to extend the functionality to also go down the 
same path for the reduced hardware sleep path, passing that extended 
flag down to that subsystem, so that it might make use of it at the very 
low levels.


All efforts are being made to reduce the amount of churn in ACPICA, 
since it is an upstream project to linux.



If it is possible to implement the functionality that is needed without changes 
to ACPICA, then that would be best. If not, we are willing to integrate this 
interface into ACPICA. However, this has an impact on all operating systems 
that use ACPICA, so this is always the last resort.



I am unaware of a way to take advantage of the infrastructure that 
ACPICA provides, and also do that which is necessary to make it work in 
Xen / tboot without these hooks.


It would be greatly appreciated if you would consider this new interface 
for inclusion.


Thanks for your time.

Ben




Bob



-Original Message-
From: Ben Guthro [mailto:benjamin.gut...@citrix.com]
Sent: Thursday, June 27, 2013 9:13 AM
To: Moore, Robert
Cc: Jan Beulich; Zheng, Lv; Box, David E; Brown, Len; xen-
de...@lists.xen.org; Konrad Rzeszutek Wilk; Rafaell J . Wysocki; linux-
a...@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to new
extended parameter



On 06/27/2013 11:59 AM, Moore, Robert wrote:

I have not seen a discussion of the details on this, so can someone

explain to me just why acpi_os_prepare_sleep is needed, what does it do,
and why these changes are being made to ACPICA code?

Hi Bob,

I'm not familiar with your background here, so I apologize if I am stating
obvious things below.

acpi_os_prepare_sleep() has been in the acpica code for some time now,
allowing for OS specific hooks to account for differences between OS
architectures.

Specifically, it has been in since:

commit 09f98a825a821f7a3f1b162f9ed023f37213a63b
Author: Tang Liang liang.t...@oracle.com
Date:   Fri Dec 9 10:05:54 2011 +0800

 x86, acpi, tboot: Have a ACPI os prepare sleep instead of calling
tboot_sleep.

 The ACPI suspend path makes a call to tboot_sleep right before
 it writes the PM1A, PM1B values. We replace the direct call to
 tboot via an registration callback similar to __acpi_register_gsi.

 CC: Len Brown len.br...@intel.com
 Acked-by: Joseph Cihula joseph.cih...@intel.com
 Acked-by: Rafael J. Wysocki r...@sisk.pl
 [v1: Added __attribute__ ((unused))]
 [v2: Introduced a wrapper instead of changing tboot_sleep return
values]
 [v3: Added return value AE_CTRL_SKIP for acpi_os_sleep_prepare]
 Signed-off-by: Tang Liang liang.t...@oracle.com
 [v1: Fix compile issues on IA64 and PPC64]
 [v2: Fix where __acpi_os_prepare_sleep==NULL and did not go in sleep
properly]
 Signed-off-by: Konrad Rzeszutek Wilk konrad.w...@oracle.com



In this case, the Xen hypervisor, and not linux needs to actually put the
system into S3, so this hook gives the architecture to do so.

This change does not introduce this functionality, but simply moves the
code around into the proper locations, such that the acpica code no longer
need to include linux specific headers.

I hope this helps.
If you have specific questions, please let me know.

Regards,
Ben



Thanks,
Bob



-Original Message-
From: Jan Beulich [mailto:jbeul...@suse.com]
Sent: Thursday, June 27, 2013 8:12 AM
To: Ben Guthro
Cc: Moore, Robert; xen-de...@lists.xen.org; Konrad Rzeszutek Wilk;
Rafaell J . Wysocki; linux-a...@vger.kernel.org;
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v4 3/5] acpi: Adjust linux acpi OS functions to
new extended parameter


On 27.06.13 at 17:02, Ben Guthro benjamin.gut...@citrix.com wrote:

Change the function definitions of acpi_os_prepare_sleep

Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-06-26 Thread Ben Guthro
On Wed, Jun 26, 2013 at 10:41 AM, Jan Beulich  wrote:
>>>> On 26.06.13 at 16:06, Ben Guthro  wrote:
>> In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
>> reduced hardware sleep support, and the two changes didn't get
>> synchronized: The new code doesn't call the hook function (if so
>> requested). Fix this, requiring a parameter to be added to the
>> hook function to distinguish "extended" from "legacy" sleep.
>>
>> Signed-off-by: Ben Guthro 
>> Signed-off-by: Jan Beulich 
>
> I think these are intended to reflect the flow of things, so
> should be reversed (also in the other patches).
>
>> --- a/drivers/acpi/acpica/hwesleep.c
>> +++ b/drivers/acpi/acpica/hwesleep.c
>> @@ -43,6 +43,7 @@
>>   */
>>
>>  #include 
>> +#include 
>
> This also got complaints, so I'd be very surprised if they took it now.

I did see these complaints in the last version.
However, the file drivers/acpi/acpica/hwsleep.c contains this include,
and has since

commit 09f98a825a821f7a3f1b162f9ed023f37213a63b
Author: Tang Liang 
Date:   Fri Dec 9 10:05:54 2011 +0800

So since this is the extended sleep file, vs the standard one - I
don't see why such a restriction would be placed on the former, but
not the latter.

I would look for some guidance here from the ACPI guys, for how to handle this.

>
>>  #include "accommon.h"
>>
>>  #define _COMPONENT  ACPI_HARDWARE
>> @@ -128,6 +129,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
>>
>>   ACPI_FLUSH_CPU_CACHE();
>>
>> + status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
>> +acpi_gbl_sleep_type_b, true);
>
> Without using "bool", using "true" and "false" is wrong (should
> be TRUE and FALSE afaict).

Thanks, I overlooked that.
I'll fix it for the next version.

>
>> --- a/drivers/acpi/acpica/hwsleep.c
>> +++ b/drivers/acpi/acpica/hwsleep.c
>> @@ -153,7 +153,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
>>   ACPI_FLUSH_CPU_CACHE();
>>
>>   status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
>> -pm1b_control);
>> +pm1b_control, false);
>
> Same here.
ack.

>
>>   if (ACPI_SKIP(status))
>>   return_ACPI_STATUS(AE_OK);
>>   if (ACPI_FAILURE(status))
>
> And the split point ought to be here - everything below doesn't
> modify ACPI CA code. Which in particular means that ...

OK.

>
>> --- a/include/linux/acpi.h
>> +++ b/include/linux/acpi.h
>> @@ -477,11 +477,11 @@ static inline bool acpi_driver_match_device(struct 
>> device *dev,
>>  #endif   /* !CONFIG_ACPI */
>>
>>  #ifdef CONFIG_ACPI
>> -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
>> -u32 pm1a_ctrl,  u32 pm1b_ctrl));
>> +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
>> +u32 val_b, u8 extended));
>>
>> -acpi_status acpi_os_prepare_sleep(u8 sleep_state,
>> -   u32 pm1a_control, u32 pm1b_control);
>> +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
>> +   u8 extended);
>
> ... this needs to be moved elsewhere (under include/acpi/), but the
> two incarnations of acpi_os_set_prepare_sleep() should presumably
> remain here.

If my comment above about hwsleep.c holds, would this be necessary?

Thanks for the review.

Ben

>
> Jan
>
>>  #ifdef CONFIG_X86
>>  void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
>>  #else
>> @@ -491,7 +491,7 @@ static inline void 
>> arch_reserve_mem_area(acpi_physical_address addr,
>>  }
>>  #endif /* CONFIG_X86 */
>>  #else
>> -#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while 
>> (0)
>> +#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
>>  #endif
>>
>>  #if defined(CONFIG_ACPI) && defined(CONFIG_PM_RUNTIME)
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-06-26 Thread Ben Guthro
On Wed, Jun 26, 2013 at 10:44 AM, Jan Beulich  wrote:
>>>> On 26.06.13 at 16:06, Ben Guthro  wrote:
>> --- a/arch/x86/kernel/tboot.c
>> +++ b/arch/x86/kernel/tboot.c
>> @@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
>> *fadt)
>>   offsetof(struct acpi_table_facs, firmware_waking_vector);
>>  }
>>
>> -static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
>> +static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
>> +u8 extended)
>
> I don't see why this couldn't remain "bool" - the only complain was
> that ACPI CA shouldn't use it.
>
> Jan

I changed it, in order to keep the prototypes consistent.
Having the function pointer be defined with one signature in the
acpica code, and another in the os implementation seems like a
maintenance problem.

Ben

>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-06-26 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

Signed-off-by: Ben Guthro 
Signed-off-by: Jan Beulich 
Cc: Bob Moore 
Cc: Rafaell J. Wysocki 
Cc: linux-a...@vger.kernel.org
---
 drivers/acpi/acpica/hwesleep.c |8 
 drivers/acpi/acpica/hwsleep.c  |2 +-
 drivers/acpi/osl.c |   16 
 include/linux/acpi.h   |   10 +-
 4 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..6834dd7 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -43,6 +43,7 @@
  */
 
 #include 
+#include 
 #include "accommon.h"
 
 #define _COMPONENT  ACPI_HARDWARE
@@ -128,6 +129,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, true);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..a93c299 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -153,7 +153,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();
 
status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, false);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..3fc2801 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
 {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc < 0)
return AE_ERROR;
else if (rc > 0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, u8 extended))
 {
__acpi_os_prepare_sleep = func;
 }
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..de99022 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,11 +477,11 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #endif /* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, u8 extended));
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -491,7 +491,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
 #endif
 

[PATCH v3 3/3] xen/acpi: notify xen when reduced hardware sleep is available

2013-06-26 Thread Ben Guthro
Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Ben Guthro 
Signed-off-by: Jan Beulich 
Cc: Konrad Wilk 
---
 drivers/xen/acpi.c   |   26 +-
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..f4e12dc 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,27 +35,27 @@
 #include 
 #include 
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
+u8 extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt & 0x) || (pm1b_cnt & 0x)) {
-   WARN(1, "Using more than 16bits of PM1A/B 0x%x/0x%x!"
-"Email xen-de...@lists.xensource.com  Thank you.\n", \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a & (~0 << bits)) || (val_b & (~0 << bits)),
+"Using more than %u bits of sleep control values %#x/%#x!"
+"Email xen-de...@lists.xen.org - Thank you.\n", \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op();
return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..55bf8423f 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,8 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
+u8 extended);
 
 static inline void xen_acpi_sleep_register(void)
 {
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-06-26 Thread Ben Guthro
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Ben Guthro 
Signed-off-by: Jan Beulich 
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei 
---
 arch/x86/kernel/tboot.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..016fbb8 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  u8 extended)
 {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
@@ -284,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
if (!tboot_enabled())
return 0;
 
+   if (extended)
+   return -1;
+
tboot_copy_fadt(_gbl_FADT);
tboot->acpi_sinfo.pm1a_cnt_val = pm1a_control;
tboot->acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 0/3] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-06-26 Thread Ben Guthro
I have volunteered to take over the efforts of Jan Beulich in getting
this patch series upstreamed. His original submission text is below,
along with the v3 modifications.


In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish "extended" from "legacy" sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 ("ACPI: support
v5 (reduced HW) sleep interface") on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Ben Guthro 
Signed-off-by: Jan Beulich 
Cc: Richard L Maliszewski 
Cc: Gang Wei 
Cc: Shane Wang 
Cc: Bob Moore 
Cc: Rafaell J. Wysocki 
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8

Ben Guthro (3):
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |6 +-
 drivers/acpi/acpica/hwesleep.c   |8 
 drivers/acpi/acpica/hwsleep.c|2 +-
 drivers/acpi/osl.c   |   16 
 drivers/xen/acpi.c   |   26 +-
 include/linux/acpi.h |   10 +-
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 8 files changed, 46 insertions(+), 33 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-06-26 Thread Ben Guthro
As tboot currently does not support the reduced hardware sleep
interface, fail this extended call.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Signed-off-by: Jan Beulich jbeul...@suse.com
Cc: tboot-de...@lists.sourceforge.net
Cc: Gang Wei gang@intel.com
---
 arch/x86/kernel/tboot.c |6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/arch/x86/kernel/tboot.c b/arch/x86/kernel/tboot.c
index f84fe00..016fbb8 100644
--- a/arch/x86/kernel/tboot.c
+++ b/arch/x86/kernel/tboot.c
@@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
*fadt)
offsetof(struct acpi_table_facs, firmware_waking_vector);
 }
 
-static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
+static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
+  u8 extended)
 {
static u32 acpi_shutdown_map[ACPI_S_STATE_COUNT] = {
/* S0,1,2: */ -1, -1, -1,
@@ -284,6 +285,9 @@ static int tboot_sleep(u8 sleep_state, u32 pm1a_control, 
u32 pm1b_control)
if (!tboot_enabled())
return 0;
 
+   if (extended)
+   return -1;
+
tboot_copy_fadt(acpi_gbl_FADT);
tboot-acpi_sinfo.pm1a_cnt_val = pm1a_control;
tboot-acpi_sinfo.pm1b_cnt_val = pm1b_control;
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 0/3] Xen/ACPI: support sleep state entering on hardware reduced systems

2013-06-26 Thread Ben Guthro
I have volunteered to take over the efforts of Jan Beulich in getting
this patch series upstreamed. His original submission text is below,
along with the v3 modifications.


In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a boolean parameter to be added to the
hook function to distinguish extended from legacy sleep.

This requires adjusting TXT, but the adjustments only go as far as
failing the extended mode call (since, looking at the TXT interface,
there doesn't even appear to be precautions to deal with that
alternative interface).

The hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Signed-off-by: Jan Beulich jbeul...@suse.com
Cc: Richard L Maliszewski richard.l.maliszew...@intel.com
Cc: Gang Wei gang@intel.com
Cc: Shane Wang shane.w...@intel.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafaell J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
Cc: tboot-de...@lists.sourceforge.net 

v2: Extend description to include reference to hypervisor side change
v3: Split into multiple patches, separating subsystems
Remove bool parameters, in favor of u8

Ben Guthro (3):
  acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path
  x86/tboot: Fail extended mode reduced hardware sleep
  xen/acpi: notify xen when reduced hardware sleep is available

 arch/x86/kernel/tboot.c  |6 +-
 drivers/acpi/acpica/hwesleep.c   |8 
 drivers/acpi/acpica/hwsleep.c|2 +-
 drivers/acpi/osl.c   |   16 
 drivers/xen/acpi.c   |   26 +-
 include/linux/acpi.h |   10 +-
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 8 files changed, 46 insertions(+), 33 deletions(-)

-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 3/3] xen/acpi: notify xen when reduced hardware sleep is available

2013-06-26 Thread Ben Guthro
Make use of acpi_os_prepare_sleep extended parameter to notify xen
to make use of the reduced hardware sleep functionality

The hypervisor change underlying this is commit 62d1a69 (ACPI: support
v5 (reduced HW) sleep interface) on the master branch of
git://xenbits.xen.org/xen.git.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Signed-off-by: Jan Beulich jbeul...@suse.com
Cc: Konrad Wilk konrad.w...@oracle.com
---
 drivers/xen/acpi.c   |   26 +-
 include/xen/acpi.h   |4 ++--
 include/xen/interface/platform.h |7 ---
 3 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/drivers/xen/acpi.c b/drivers/xen/acpi.c
index 119d42a..f4e12dc 100644
--- a/drivers/xen/acpi.c
+++ b/drivers/xen/acpi.c
@@ -35,27 +35,27 @@
 #include asm/xen/hypercall.h
 #include asm/xen/hypervisor.h
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnt)
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
+u8 extended)
 {
+   unsigned int bits = extended ? 8 : 16;
+
struct xen_platform_op op = {
.cmd = XENPF_enter_acpi_sleep,
.interface_version = XENPF_INTERFACE_VERSION,
-   .u = {
-   .enter_acpi_sleep = {
-   .pm1a_cnt_val = (u16)pm1a_cnt,
-   .pm1b_cnt_val = (u16)pm1b_cnt,
-   .sleep_state = sleep_state,
-   },
+   .u.enter_acpi_sleep = {
+   .val_a = (u16)val_a,
+   .val_b = (u16)val_b,
+   .sleep_state = sleep_state,
+   .flags = extended ? XENPF_ACPI_SLEEP_EXTENDED : 0,
},
};
 
-   if ((pm1a_cnt  0x) || (pm1b_cnt  0x)) {
-   WARN(1, Using more than 16bits of PM1A/B 0x%x/0x%x!
-Email xen-de...@lists.xensource.com  Thank you.\n, \
-pm1a_cnt, pm1b_cnt);
+   if (WARN((val_a  (~0  bits)) || (val_b  (~0  bits)),
+Using more than %u bits of sleep control values %#x/%#x!
+Email xen-de...@lists.xen.org - Thank you.\n, \
+bits, val_a, val_b))
return -1;
-   }
 
HYPERVISOR_dom0_op(op);
return 1;
diff --git a/include/xen/acpi.h b/include/xen/acpi.h
index 68d73d0..55bf8423f 100644
--- a/include/xen/acpi.h
+++ b/include/xen/acpi.h
@@ -75,8 +75,8 @@ static inline int xen_acpi_get_pxm(acpi_handle h)
return -ENXIO;
 }
 
-int xen_acpi_notify_hypervisor_state(u8 sleep_state,
-u32 pm1a_cnt, u32 pm1b_cnd);
+int xen_acpi_notify_hypervisor_state(u8 sleep_state, u32 val_a, u32 val_b,
+u8 extended);
 
 static inline void xen_acpi_sleep_register(void)
 {
diff --git a/include/xen/interface/platform.h b/include/xen/interface/platform.h
index c57d5f6..f1331e3 100644
--- a/include/xen/interface/platform.h
+++ b/include/xen/interface/platform.h
@@ -152,10 +152,11 @@ DEFINE_GUEST_HANDLE_STRUCT(xenpf_firmware_info_t);
 #define XENPF_enter_acpi_sleep51
 struct xenpf_enter_acpi_sleep {
/* IN variables */
-   uint16_t pm1a_cnt_val;  /* PM1a control value. */
-   uint16_t pm1b_cnt_val;  /* PM1b control value. */
+   uint16_t val_a; /* PM1a control / sleep type A. */
+   uint16_t val_b; /* PM1b control / sleep type B. */
uint32_t sleep_state;   /* Which state to enter (Sn). */
-   uint32_t flags; /* Must be zero. */
+#define XENPF_ACPI_SLEEP_EXTENDED 0x0001
+   uint32_t flags; /* XENPF_ACPI_SLEEP_*. */
 };
 DEFINE_GUEST_HANDLE_STRUCT(xenpf_enter_acpi_sleep_t);
 
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-06-26 Thread Ben Guthro
In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
reduced hardware sleep support, and the two changes didn't get
synchronized: The new code doesn't call the hook function (if so
requested). Fix this, requiring a parameter to be added to the
hook function to distinguish extended from legacy sleep.

Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
Signed-off-by: Jan Beulich jbeul...@suse.com
Cc: Bob Moore robert.mo...@intel.com
Cc: Rafaell J. Wysocki r...@sisk.pl
Cc: linux-a...@vger.kernel.org
---
 drivers/acpi/acpica/hwesleep.c |8 
 drivers/acpi/acpica/hwsleep.c  |2 +-
 drivers/acpi/osl.c |   16 
 include/linux/acpi.h   |   10 +-
 4 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/drivers/acpi/acpica/hwesleep.c b/drivers/acpi/acpica/hwesleep.c
index 5e5f762..6834dd7 100644
--- a/drivers/acpi/acpica/hwesleep.c
+++ b/drivers/acpi/acpica/hwesleep.c
@@ -43,6 +43,7 @@
  */
 
 #include acpi/acpi.h
+#include linux/acpi.h
 #include accommon.h
 
 #define _COMPONENT  ACPI_HARDWARE
@@ -128,6 +129,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)
 
ACPI_FLUSH_CPU_CACHE();
 
+   status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
+  acpi_gbl_sleep_type_b, true);
+   if (ACPI_SKIP(status))
+   return_ACPI_STATUS(AE_OK);
+   if (ACPI_FAILURE(status))
+   return_ACPI_STATUS(status);
+
/*
 * Set the SLP_TYP and SLP_EN bits.
 *
diff --git a/drivers/acpi/acpica/hwsleep.c b/drivers/acpi/acpica/hwsleep.c
index e3828cc..a93c299 100644
--- a/drivers/acpi/acpica/hwsleep.c
+++ b/drivers/acpi/acpica/hwsleep.c
@@ -153,7 +153,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
ACPI_FLUSH_CPU_CACHE();
 
status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
-  pm1b_control);
+  pm1b_control, false);
if (ACPI_SKIP(status))
return_ACPI_STATUS(AE_OK);
if (ACPI_FAILURE(status))
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c
index e721863..3fc2801 100644
--- a/drivers/acpi/osl.c
+++ b/drivers/acpi/osl.c
@@ -77,8 +77,8 @@ EXPORT_SYMBOL(acpi_in_debugger);
 extern char line_buf[80];
 #endif /*ENABLE_DEBUGGER */
 
-static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 pm1a_ctrl,
- u32 pm1b_ctrl);
+static int (*__acpi_os_prepare_sleep)(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 
 static acpi_osd_handler acpi_irq_handler;
 static void *acpi_irq_context;
@@ -1757,13 +1757,13 @@ acpi_status acpi_os_terminate(void)
return AE_OK;
 }
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 pm1a_control,
- u32 pm1b_control)
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended)
 {
int rc = 0;
if (__acpi_os_prepare_sleep)
-   rc = __acpi_os_prepare_sleep(sleep_state,
-pm1a_control, pm1b_control);
+   rc = __acpi_os_prepare_sleep(sleep_state, val_a, val_b,
+extended);
if (rc  0)
return AE_ERROR;
else if (rc  0)
@@ -1772,8 +1772,8 @@ acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 
pm1a_control,
return AE_OK;
 }
 
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl, u32 pm1b_ctrl))
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, u8 extended))
 {
__acpi_os_prepare_sleep = func;
 }
diff --git a/include/linux/acpi.h b/include/linux/acpi.h
index 17b5b59..de99022 100644
--- a/include/linux/acpi.h
+++ b/include/linux/acpi.h
@@ -477,11 +477,11 @@ static inline bool acpi_driver_match_device(struct device 
*dev,
 #endif /* !CONFIG_ACPI */
 
 #ifdef CONFIG_ACPI
-void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
-  u32 pm1a_ctrl,  u32 pm1b_ctrl));
+void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
+  u32 val_b, u8 extended));
 
-acpi_status acpi_os_prepare_sleep(u8 sleep_state,
- u32 pm1a_control, u32 pm1b_control);
+acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
+ u8 extended);
 #ifdef CONFIG_X86
 void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
 #else
@@ -491,7 +491,7 @@ static inline void 
arch_reserve_mem_area(acpi_physical_address addr,
 }
 #endif /* CONFIG_X86 */
 #else
-#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while (0)
+#define

Re: [PATCH v3 2/3] x86/tboot: Fail extended mode reduced hardware sleep

2013-06-26 Thread Ben Guthro
On Wed, Jun 26, 2013 at 10:44 AM, Jan Beulich jbeul...@suse.com wrote:
 On 26.06.13 at 16:06, Ben Guthro benjamin.gut...@citrix.com wrote:
 --- a/arch/x86/kernel/tboot.c
 +++ b/arch/x86/kernel/tboot.c
 @@ -273,7 +273,8 @@ static void tboot_copy_fadt(const struct acpi_table_fadt 
 *fadt)
   offsetof(struct acpi_table_facs, firmware_waking_vector);
  }

 -static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control)
 +static int tboot_sleep(u8 sleep_state, u32 pm1a_control, u32 pm1b_control,
 +u8 extended)

 I don't see why this couldn't remain bool - the only complain was
 that ACPI CA shouldn't use it.

 Jan

I changed it, in order to keep the prototypes consistent.
Having the function pointer be defined with one signature in the
acpica code, and another in the os implementation seems like a
maintenance problem.

Ben


 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH v3 1/3] acpi: Call acpi_os_prepare_sleep hook in reduced hardware sleep path

2013-06-26 Thread Ben Guthro
On Wed, Jun 26, 2013 at 10:41 AM, Jan Beulich jbeul...@suse.com wrote:
 On 26.06.13 at 16:06, Ben Guthro benjamin.gut...@citrix.com wrote:
 In version 3.4 acpi_os_prepare_sleep() got introduced in parallel with
 reduced hardware sleep support, and the two changes didn't get
 synchronized: The new code doesn't call the hook function (if so
 requested). Fix this, requiring a parameter to be added to the
 hook function to distinguish extended from legacy sleep.

 Signed-off-by: Ben Guthro benjamin.gut...@citrix.com
 Signed-off-by: Jan Beulich jbeul...@suse.com

 I think these are intended to reflect the flow of things, so
 should be reversed (also in the other patches).

 --- a/drivers/acpi/acpica/hwesleep.c
 +++ b/drivers/acpi/acpica/hwesleep.c
 @@ -43,6 +43,7 @@
   */

  #include acpi/acpi.h
 +#include linux/acpi.h

 This also got complaints, so I'd be very surprised if they took it now.

I did see these complaints in the last version.
However, the file drivers/acpi/acpica/hwsleep.c contains this include,
and has since

commit 09f98a825a821f7a3f1b162f9ed023f37213a63b
Author: Tang Liang liang.t...@oracle.com
Date:   Fri Dec 9 10:05:54 2011 +0800

So since this is the extended sleep file, vs the standard one - I
don't see why such a restriction would be placed on the former, but
not the latter.

I would look for some guidance here from the ACPI guys, for how to handle this.


  #include accommon.h

  #define _COMPONENT  ACPI_HARDWARE
 @@ -128,6 +129,13 @@ acpi_status acpi_hw_extended_sleep(u8 sleep_state)

   ACPI_FLUSH_CPU_CACHE();

 + status = acpi_os_prepare_sleep(sleep_state, acpi_gbl_sleep_type_a,
 +acpi_gbl_sleep_type_b, true);

 Without using bool, using true and false is wrong (should
 be TRUE and FALSE afaict).

Thanks, I overlooked that.
I'll fix it for the next version.


 --- a/drivers/acpi/acpica/hwsleep.c
 +++ b/drivers/acpi/acpica/hwsleep.c
 @@ -153,7 +153,7 @@ acpi_status acpi_hw_legacy_sleep(u8 sleep_state)
   ACPI_FLUSH_CPU_CACHE();

   status = acpi_os_prepare_sleep(sleep_state, pm1a_control,
 -pm1b_control);
 +pm1b_control, false);

 Same here.
ack.


   if (ACPI_SKIP(status))
   return_ACPI_STATUS(AE_OK);
   if (ACPI_FAILURE(status))

 And the split point ought to be here - everything below doesn't
 modify ACPI CA code. Which in particular means that ...

OK.


 --- a/include/linux/acpi.h
 +++ b/include/linux/acpi.h
 @@ -477,11 +477,11 @@ static inline bool acpi_driver_match_device(struct 
 device *dev,
  #endif   /* !CONFIG_ACPI */

  #ifdef CONFIG_ACPI
 -void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state,
 -u32 pm1a_ctrl,  u32 pm1b_ctrl));
 +void acpi_os_set_prepare_sleep(int (*func)(u8 sleep_state, u32 val_a,
 +u32 val_b, u8 extended));

 -acpi_status acpi_os_prepare_sleep(u8 sleep_state,
 -   u32 pm1a_control, u32 pm1b_control);
 +acpi_status acpi_os_prepare_sleep(u8 sleep_state, u32 val_a, u32 val_b,
 +   u8 extended);

 ... this needs to be moved elsewhere (under include/acpi/), but the
 two incarnations of acpi_os_set_prepare_sleep() should presumably
 remain here.

If my comment above about hwsleep.c holds, would this be necessary?

Thanks for the review.

Ben


 Jan

  #ifdef CONFIG_X86
  void arch_reserve_mem_area(acpi_physical_address addr, size_t size);
  #else
 @@ -491,7 +491,7 @@ static inline void 
 arch_reserve_mem_area(acpi_physical_address addr,
  }
  #endif /* CONFIG_X86 */
  #else
 -#define acpi_os_set_prepare_sleep(func, pm1a_ctrl, pm1b_ctrl) do { } while 
 (0)
 +#define acpi_os_set_prepare_sleep(func, val_a, val_b, ext) do { } while (0)
  #endif

  #if defined(CONFIG_ACPI)  defined(CONFIG_PM_RUNTIME)


 --
 To unsubscribe from this list: send the line unsubscribe linux-kernel in
 the body of a message to majord...@vger.kernel.org
 More majordomo info at  http://vger.kernel.org/majordomo-info.html
 Please read the FAQ at  http://www.tux.org/lkml/
--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


  1   2   >