rpms/kvm/F-9 kvm-acpi-do-not-ovflw.patch, NONE, 1.1.2.1 kvm-acpi-do-not-wrap.patch, NONE, 1.1.2.1 kvm.spec, 1.58, 1.58.4.1
Glauber Costa
glommer at fedoraproject.org
Wed Aug 27 20:18:07 UTC 2008
Author: glommer
Update of /cvs/pkgs/rpms/kvm/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv21680
Modified Files:
Tag: private-glommer-acpi-branch
kvm.spec
Added Files:
Tag: private-glommer-acpi-branch
kvm-acpi-do-not-ovflw.patch kvm-acpi-do-not-wrap.patch
Log Message:
proposed fix for acpi problems
kvm-acpi-do-not-ovflw.patch:
--- NEW FILE kvm-acpi-do-not-ovflw.patch ---
commit a642216a60c083cfd5ac243a50acbc23236c8d4c
Author: Avi Kivity <avi at qumranet.com>
Date: Wed May 28 16:03:02 2008 +0300
kvm: qemu: revert "fix power management timer overflow handling"
The fix is bogus, causing sci to be deferred for longer and longer.
Noticed by Alex Williamson.
Signed-off-by: Avi Kivity <avi at qumranet.com>
diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index c305702..e3cd8d7 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -109,7 +109,6 @@ static void pm_update_sci(PIIX4PMState *s)
if ((s->pmen & TMROF_EN) && !(pmsts & TMROF_EN)) {
expire_time = muldiv64(s->tmr_overflow_time, ticks_per_sec, PM_FREQ);
qemu_mod_timer(s->tmr_timer, expire_time);
- s->tmr_overflow_time += 0x800000;
} else {
qemu_del_timer(s->tmr_timer);
}
kvm-acpi-do-not-wrap.patch:
--- NEW FILE kvm-acpi-do-not-wrap.patch ---
commit d102d750f397b543fe620a3c77a7e5e42c483865
Author: Avi Kivity <avi at qumranet.com>
Date: Wed Apr 23 12:59:43 2008 +0300
Revert "kvm: qemu: fix sci irq set when acpi timer about to wrap"
This reverts commit 6bb0805aeabd5c6ef5408f57c7da5ca6385dd0f5, which
kills system_powerdown.
Signed-off-by: Avi Kivity <avi at qumranet.com>
diff --git a/qemu/hw/acpi.c b/qemu/hw/acpi.c
index a7e5e26..c4419c4 100644
--- a/qemu/hw/acpi.c
+++ b/qemu/hw/acpi.c
@@ -54,15 +54,12 @@ typedef struct PIIX4PMState {
uint8_t smb_data[32];
uint8_t smb_index;
qemu_irq irq;
- int64_t pmtmr;
} PIIX4PMState;
#define RTC_EN (1 << 10)
#define PWRBTN_EN (1 << 8)
#define GBL_EN (1 << 5)
#define TMROF_EN (1 << 0)
-#define TIMER_OVERFLOW_CNT (1 << 23)
-#define TIMER_MASK 0xffffffLL
#define SCI_EN (1 << 0)
@@ -81,58 +78,47 @@ typedef struct PIIX4PMState {
PIIX4PMState *pm_state;
-static void update_pmtmr(PIIX4PMState *s)
-{
- int64_t pmtmr;
-
- pmtmr = muldiv64(qemu_get_clock(vm_clock), PM_FREQ, ticks_per_sec) & TIMER_MASK;
-
- if (!(s->pmsts & TMROF_EN)) {
- if ((pmtmr ^ s->pmtmr) & TIMER_OVERFLOW_CNT) {
- s->pmsts |= TMROF_EN;
- if (s->pmen & TMROF_EN)
- qemu_set_irq(s->irq, 1);
- } else {
- /* Calculate when the timer will neet to set the overflow bit again */
- uint64_t delta = TIMER_OVERFLOW_CNT - (pmtmr & (TIMER_OVERFLOW_CNT - 1));
-
- delta = muldiv64(delta, ticks_per_sec, PM_FREQ);
- qemu_mod_timer(s->tmr_timer, qemu_get_clock(vm_clock) + delta);
- }
- }
-
- s->pmtmr = pmtmr;
-}
-
static uint32_t get_pmtmr(PIIX4PMState *s)
{
- update_pmtmr(s);
- return s->pmtmr & TIMER_MASK;
+ uint32_t d;
+ d = muldiv64(qemu_get_clock(vm_clock), PM_FREQ, ticks_per_sec);
+ return d & 0xffffff;
}
-
static int get_pmsts(PIIX4PMState *s)
{
- /* Just increase the accurancy by double computing the timer value */
- update_pmtmr(s);
-
- return s->pmsts;
+ int64_t d;
+ int pmsts;
+ pmsts = s->pmsts;
+ d = muldiv64(qemu_get_clock(vm_clock), PM_FREQ, ticks_per_sec);
+ if (d >= s->tmr_overflow_time)
+ s->pmsts |= TMROF_EN;
+ return pmsts;
}
static void pm_update_sci(PIIX4PMState *s)
{
- int sci_level;
-
- sci_level = (((s->pmsts & s->pmen) &
- (RTC_EN | PWRBTN_EN | GBL_EN | TMROF_EN)) != 0);
- if (!sci_level)
- qemu_set_irq(s->irq, sci_level);
+ int sci_level, pmsts;
+ int64_t expire_time;
+
+ pmsts = get_pmsts(s);
+ sci_level = (((pmsts & s->pmen) &
+ (RTC_EN | PWRBTN_EN | GBL_EN | TMROF_EN)) != 0);
+ qemu_set_irq(s->irq, sci_level);
+ /* schedule a timer interruption if needed */
+ if ((s->pmen & TMROF_EN) && !(pmsts & TMROF_EN)) {
+ expire_time = muldiv64(s->tmr_overflow_time, ticks_per_sec, PM_FREQ);
+ qemu_mod_timer(s->tmr_timer, expire_time);
+ s->tmr_overflow_time += 0x800000;
+ } else {
+ qemu_del_timer(s->tmr_timer);
+ }
}
static void pm_tmr_timer(void *opaque)
{
PIIX4PMState *s = opaque;
- update_pmtmr(s);
+ pm_update_sci(s);
}
static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
@@ -141,9 +127,18 @@ static void pm_ioport_writew(void *opaque, uint32_t addr, uint32_t val)
addr &= 0x3f;
switch(addr) {
case 0x00:
- s->pmsts &= ~val;
- update_pmtmr(s);
- pm_update_sci(s);
+ {
+ int64_t d;
+ int pmsts;
+ pmsts = get_pmsts(s);
+ if (pmsts & val & TMROF_EN) {
+ /* if TMRSTS is reset, then compute the new overflow time */
+ d = muldiv64(qemu_get_clock(vm_clock), PM_FREQ, ticks_per_sec);
+ s->tmr_overflow_time = (d + 0x800000LL) & ~0x7fffffLL;
+ }
+ s->pmsts &= ~val;
+ pm_update_sci(s);
+ }
break;
case 0x02:
s->pmen = val;
Index: kvm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kvm/F-9/kvm.spec,v
retrieving revision 1.58
retrieving revision 1.58.4.1
diff -u -r1.58 -r1.58.4.1
--- kvm.spec 27 May 2008 13:28:35 -0000 1.58
+++ kvm.spec 27 Aug 2008 20:17:37 -0000 1.58.4.1
@@ -1,7 +1,7 @@
Summary: Kernel-based Virtual Machine
Name: kvm
Version: 65
-Release: 7%{?dist}
+Release: 8_private_glommer_acpi%{?dist}
License: GPLv2+ and LGPLv2+
Group: Development/Tools
URL: http://%{name}.sf.net
@@ -15,6 +15,9 @@
Patch5: %{name}-65-cirrus.patch
Patch6: %{name}-65-pty-rawmode.patch
Patch7: %{name}-cirrus-bitblt-overflow.patch
+Patch8: %{name}-acpi-do-not-wrap.patch
+Patch9: %{name}-acpi-do-not-ovflw.patch
+
# patches from upstream qemu
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: SDL-devel
@@ -51,6 +54,8 @@
%patch5 -p1
%patch6 -p1
%patch7 -p1
+%patch8 -p1
+%patch9 -p1
%build
# we need to install the data bits in a different path
More information about the fedora-extras-commits
mailing list