[SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Gleb Natapov
WHQL complains otherwise.

Signed-off-by: Gleb Natapov 
diff --git a/src/acpi.c b/src/acpi.c
index 18830dc..27a78a8 100644
--- a/src/acpi.c
+++ b/src/acpi.c
@@ -259,8 +259,8 @@ build_fadt(int bdf)
 fadt->plvl2_lat = cpu_to_le16(0xfff); // C2 state not supported
 fadt->plvl3_lat = cpu_to_le16(0xfff); // C3 state not supported
 pci_init_device(fadt_init_tbl, bdf, fadt);
-/* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC */
-fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6));
+/* WBINVD + PROC_C1 + SLP_BUTTON + FIX_RTC + RTC_S4 */
+fadt->flags = cpu_to_le32((1 << 0) | (1 << 2) | (1 << 5) | (1 << 6) | (1 
<< 7));
 
 build_header((void*)fadt, FACP_SIGNATURE, sizeof(*fadt), 1);
 
--
Gleb.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Peter Stuge
Typo in subject.

Gleb Natapov wrote:
> WHQL complains otherwise.

Is there something further that should be activated, to actually
allow the wakeup to work? Hm, isn't S4 hibernate?


//Peter

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Gleb Natapov
On Sun, Jan 30, 2011 at 03:01:43PM +0100, Peter Stuge wrote:
> Typo in subject.
> 
> Gleb Natapov wrote:
> > WHQL complains otherwise.
> 
> Is there something further that should be activated, to actually
> allow the wakeup to work? Hm, isn't S4 hibernate?
> 
> 

Not in a bios. Qemu currently exits on S4 (hibernate to disk).  Restarting
it activates resume process. On real HW RTC may be programmed to initiate
resume at certain time. Since qemu process exits on S4 it is not clear
how to implement such functionality there.

--
Gleb.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Kevin O'Connor
On Sun, Jan 30, 2011 at 02:17:11PM +0200, Gleb Natapov wrote:
> WHQL complains otherwise.
> 
> Signed-off-by: Gleb Natapov 

Can you get this acked by one of the kvm/qemu maintainers?

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Peter Stuge
Gleb Natapov wrote:
> > > WHQL complains otherwise.
> > 
> > Is there something further that should be activated, to actually
> > allow the wakeup to work? Hm, isn't S4 hibernate?
> 
> Not in a bios. Qemu currently exits on S4 (hibernate to disk). Restarting
> it activates resume process. On real HW RTC may be programmed to initiate
> resume at certain time. Since qemu process exits on S4 it is not clear
> how to implement such functionality there.

All right, but that can be solved somewhere closer to QEMU. :) As you
know, SeaBIOS is also used outside QEMU, and maybe more action is
needed there.

If the capability is advertised to the OS then it's of course also
possible that the OS will try to use it. Does Windows e.g. rely on
BIOS or AML for setting the RTC that will presumably wake the system
up, or no?


//Peter

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Gleb Natapov
On Sun, Jan 30, 2011 at 09:29:57AM -0500, Kevin O'Connor wrote:
> On Sun, Jan 30, 2011 at 02:17:11PM +0200, Gleb Natapov wrote:
> > WHQL complains otherwise.
> > 
> > Signed-off-by: Gleb Natapov 
> 
> Can you get this acked by one of the kvm/qemu maintainers?
> 
Avi, Marcelo, Anthony can you look at it?

--
Gleb.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Kevin O'Connor
On Sun, Jan 30, 2011 at 03:30:43PM +0100, Peter Stuge wrote:
> Gleb Natapov wrote:
> > > > WHQL complains otherwise.
> > > 
> > > Is there something further that should be activated, to actually
> > > allow the wakeup to work? Hm, isn't S4 hibernate?
> > 
> > Not in a bios. Qemu currently exits on S4 (hibernate to disk). Restarting
> > it activates resume process. On real HW RTC may be programmed to initiate
> > resume at certain time. Since qemu process exits on S4 it is not clear
> > how to implement such functionality there.
> 
> All right, but that can be solved somewhere closer to QEMU. :) As you
> know, SeaBIOS is also used outside QEMU, and maybe more action is
> needed there.

The ACPI code in SeaBIOS is only used on emulators - it's all compiled
out on coreboot.

-Kevin

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Gleb Natapov
On Sun, Jan 30, 2011 at 05:08:18PM +0200, Avi Kivity wrote:
> On 01/30/2011 04:34 PM, Gleb Natapov wrote:
> >On Sun, Jan 30, 2011 at 09:29:57AM -0500, Kevin O'Connor wrote:
> >>  On Sun, Jan 30, 2011 at 02:17:11PM +0200, Gleb Natapov wrote:
> >>  >  WHQL complains otherwise.
> >>  >
> >>  >  Signed-off-by: Gleb Natapov
> >>
> >>  Can you get this acked by one of the kvm/qemu maintainers?
> >>
> >Avi, Marcelo, Anthony can you look at it?
> 
> Looks reasonable.  What does the guest need to do to get the RTC to
> wake up the machine?  We may need to add that to the DSDT.
> 
This patch was enough to make WHQL happy. I think Windows talks to RTC
directly, not via AML code.

> We also need to add a notification about this event, so management
> can make note of the wake up time and schedule a powerup.  We may
> also want to change the poweroff == exit() thing we do now.  But
> these are all qemu issues, not seabios.
> 
Yes. For now the only user of this functionality is WHQL. Just
restarting qemu immediately after exit worked well till now.

--
Gleb.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Gleb Natapov
On Sun, Jan 30, 2011 at 05:15:49PM +0200, Avi Kivity wrote:
> On 01/30/2011 05:13 PM, Gleb Natapov wrote:
> >On Sun, Jan 30, 2011 at 05:08:18PM +0200, Avi Kivity wrote:
> >>  On 01/30/2011 04:34 PM, Gleb Natapov wrote:
> >>  >On Sun, Jan 30, 2011 at 09:29:57AM -0500, Kevin O'Connor wrote:
> >>  >>   On Sun, Jan 30, 2011 at 02:17:11PM +0200, Gleb Natapov wrote:
> >>  >>   >   WHQL complains otherwise.
> >>  >>   >
> >>  >>   >   Signed-off-by: Gleb Natapov
> >>  >>
> >>  >>   Can you get this acked by one of the kvm/qemu maintainers?
> >>  >>
> >>  >Avi, Marcelo, Anthony can you look at it?
> >>
> >>  Looks reasonable.  What does the guest need to do to get the RTC to
> >>  wake up the machine?  We may need to add that to the DSDT.
> >>
> >This patch was enough to make WHQL happy. I think Windows talks to RTC
> >directly, not via AML code.
> 
> What does it do?  Set the alarm?  Is there a way to set the alarm,
> and not cause a wake up, or does the alarm have a 1:1 relationship
> with wakeup?
> 
According to ACPI spec guest needs to set RTC_EN in PM1x_EN register too.
If wakeup was caused by RTC alarm RTC_STS will be set in PM1x_STS register.
But all this has nothing to do with Seabios.

--
Gleb.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Avi Kivity

On 01/30/2011 05:23 PM, Gleb Natapov wrote:

On Sun, Jan 30, 2011 at 05:15:49PM +0200, Avi Kivity wrote:
>  On 01/30/2011 05:13 PM, Gleb Natapov wrote:
>  >On Sun, Jan 30, 2011 at 05:08:18PM +0200, Avi Kivity wrote:
>  >>   On 01/30/2011 04:34 PM, Gleb Natapov wrote:
>  >>   >On Sun, Jan 30, 2011 at 09:29:57AM -0500, Kevin O'Connor wrote:
>  >>   >>On Sun, Jan 30, 2011 at 02:17:11PM +0200, Gleb Natapov wrote:
>  >>   >>>WHQL complains otherwise.
>  >>   >>>
>  >>   >>>Signed-off-by: Gleb Natapov
>  >>   >>
>  >>   >>Can you get this acked by one of the kvm/qemu maintainers?
>  >>   >>
>  >>   >Avi, Marcelo, Anthony can you look at it?
>  >>
>  >>   Looks reasonable.  What does the guest need to do to get the RTC to
>  >>   wake up the machine?  We may need to add that to the DSDT.
>  >>
>  >This patch was enough to make WHQL happy. I think Windows talks to RTC
>  >directly, not via AML code.
>
>  What does it do?  Set the alarm?  Is there a way to set the alarm,
>  and not cause a wake up, or does the alarm have a 1:1 relationship
>  with wakeup?
>
According to ACPI spec guest needs to set RTC_EN in PM1x_EN register too.
If wakeup was caused by RTC alarm RTC_STS will be set in PM1x_STS register.
But all this has nothing to do with Seabios.


In theory a guest could check whether RTC alarm reboot is supported, if 
not it keeps awake, if it is it can set the alarm to sleep.  So if 
seabios lies it could break that guest.


However that's an unlikely scenario.

--
error compiling committee.c: too many arguments to function


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Avi Kivity

On 01/30/2011 05:13 PM, Gleb Natapov wrote:

On Sun, Jan 30, 2011 at 05:08:18PM +0200, Avi Kivity wrote:
>  On 01/30/2011 04:34 PM, Gleb Natapov wrote:
>  >On Sun, Jan 30, 2011 at 09:29:57AM -0500, Kevin O'Connor wrote:
>  >>   On Sun, Jan 30, 2011 at 02:17:11PM +0200, Gleb Natapov wrote:
>  >>   >   WHQL complains otherwise.
>  >>   >
>  >>   >   Signed-off-by: Gleb Natapov
>  >>
>  >>   Can you get this acked by one of the kvm/qemu maintainers?
>  >>
>  >Avi, Marcelo, Anthony can you look at it?
>
>  Looks reasonable.  What does the guest need to do to get the RTC to
>  wake up the machine?  We may need to add that to the DSDT.
>
This patch was enough to make WHQL happy. I think Windows talks to RTC
directly, not via AML code.


What does it do?  Set the alarm?  Is there a way to set the alarm, and 
not cause a wake up, or does the alarm have a 1:1 relationship with wakeup?


--
error compiling committee.c: too many arguments to function


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Gleb Natapov
On Sun, Jan 30, 2011 at 05:25:05PM +0200, Avi Kivity wrote:
> On 01/30/2011 05:23 PM, Gleb Natapov wrote:
> >On Sun, Jan 30, 2011 at 05:15:49PM +0200, Avi Kivity wrote:
> >>  On 01/30/2011 05:13 PM, Gleb Natapov wrote:
> >>  >On Sun, Jan 30, 2011 at 05:08:18PM +0200, Avi Kivity wrote:
> >>  >>   On 01/30/2011 04:34 PM, Gleb Natapov wrote:
> >>  >>   >On Sun, Jan 30, 2011 at 09:29:57AM -0500, Kevin O'Connor wrote:
> >>  >>   >>On Sun, Jan 30, 2011 at 02:17:11PM +0200, Gleb Natapov wrote:
> >>  >>   >>>WHQL complains otherwise.
> >>  >>   >>>
> >>  >>   >>>Signed-off-by: Gleb Natapov
> >>  >>   >>
> >>  >>   >>Can you get this acked by one of the kvm/qemu maintainers?
> >>  >>   >>
> >>  >>   >Avi, Marcelo, Anthony can you look at it?
> >>  >>
> >>  >>   Looks reasonable.  What does the guest need to do to get the RTC to
> >>  >>   wake up the machine?  We may need to add that to the DSDT.
> >>  >>
> >>  >This patch was enough to make WHQL happy. I think Windows talks to RTC
> >>  >directly, not via AML code.
> >>
> >>  What does it do?  Set the alarm?  Is there a way to set the alarm,
> >>  and not cause a wake up, or does the alarm have a 1:1 relationship
> >>  with wakeup?
> >>
> >According to ACPI spec guest needs to set RTC_EN in PM1x_EN register too.
> >If wakeup was caused by RTC alarm RTC_STS will be set in PM1x_STS register.
> >But all this has nothing to do with Seabios.
> 
> In theory a guest could check whether RTC alarm reboot is supported,
> if not it keeps awake, if it is it can set the alarm to sleep.  So
> if seabios lies it could break that guest.
> 
Theoretically possible.

> However that's an unlikely scenario.
> 
I think so too.

--
Gleb.

___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios


Re: [SeaBIOS] [PATCH] lest pretend that RTC can be used to wakeup from S4

2011-01-30 Thread Avi Kivity

On 01/30/2011 04:34 PM, Gleb Natapov wrote:

On Sun, Jan 30, 2011 at 09:29:57AM -0500, Kevin O'Connor wrote:
>  On Sun, Jan 30, 2011 at 02:17:11PM +0200, Gleb Natapov wrote:
>  >  WHQL complains otherwise.
>  >
>  >  Signed-off-by: Gleb Natapov
>
>  Can you get this acked by one of the kvm/qemu maintainers?
>
Avi, Marcelo, Anthony can you look at it?


Looks reasonable.  What does the guest need to do to get the RTC to wake 
up the machine?  We may need to add that to the DSDT.


We also need to add a notification about this event, so management can 
make note of the wake up time and schedule a powerup.  We may also want 
to change the poweroff == exit() thing we do now.  But these are all 
qemu issues, not seabios.


--
error compiling committee.c: too many arguments to function


___
SeaBIOS mailing list
SeaBIOS@seabios.org
http://www.seabios.org/mailman/listinfo/seabios