[PATCH kvm-unit-tests] rtc: support the Q35 chipset

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Q35 resets the wakeup reasons at startup (it is a bug that i440FX
machine types do not do that, but it probably cannot be changed
for backwards compatibility reasons).

For the S3 test to work with the Q35 machine types, we have to
enable RTC wakeup manually.

Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
---
 x86/s3.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/x86/s3.c b/x86/s3.c
index a3d76a3..cef956e 100644
--- a/x86/s3.c
+++ b/x86/s3.c
@@ -1,5 +1,6 @@
 #include "libcflat.h"
 #include "x86/acpi.h"
+#include "asm/io.h"
 
 u32* find_resume_vector_addr(void)
 {
@@ -24,16 +25,14 @@ u32* find_resume_vector_addr(void)
 
 static inline int rtc_in(u8 reg)
 {
-    u8 x = reg;
-    asm volatile("outb %b1, $0x70; inb $0x71, %b0"
-		 : "=a"(x) : "0"(x));
-    return x;
+    outb(reg, 0x70);
+    return inb(0x71);
 }
 
 static inline void rtc_out(u8 reg, u8 val)
 {
-    asm volatile("outb %b1, $0x70; mov %b2, %b1; outb %b1, $0x71"
-		 : "=a"(reg) : "0"(reg), "ri"(val));
+    outb(reg, 0x70);
+    outb(val, 0x71);
 }
 
 extern char resume_start, resume_end;
@@ -51,6 +50,9 @@ int main(int argc, char **argv)
 		*resume_vec++ = *addr;
 	printf("copy resume code from %p\n", &resume_start);
 
+	printf("PM1a event registers at %x\n", fadt->pm1a_evt_blk);
+	outw(0x400, fadt->pm1a_evt_blk + 2);
+
 	/* Setup RTC alarm to wake up on the next second.  */
 	while ((rtc_in(RTC_REG_A) & REG_A_UIP) == 0);
 	while ((rtc_in(RTC_REG_A) & REG_A_UIP) != 0);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux