rpms/kvm/F-9 kvm-acpi-do-not-ovflw.patch, 1.1, 1.2 kvm-acpi-do-not-wrap.patch, 1.1, 1.2 kvm-extboot.patch, 1.1, 1.2 kvm.spec, 1.58, 1.59

Glauber Costa glommer at fedoraproject.org
Thu Aug 28 15:40:43 UTC 2008


Author: glommer

Update of /cvs/pkgs/rpms/kvm/F-9
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv32615

Modified Files:
	kvm.spec 
Added Files:
	kvm-acpi-do-not-ovflw.patch kvm-acpi-do-not-wrap.patch 
	kvm-extboot.patch 
Log Message:
Fixes #459778
Fixes #452355



kvm-acpi-do-not-ovflw.patch:

Index: kvm-acpi-do-not-ovflw.patch
===================================================================
RCS file: kvm-acpi-do-not-ovflw.patch
diff -N kvm-acpi-do-not-ovflw.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ kvm-acpi-do-not-ovflw.patch	28 Aug 2008 15:40:12 -0000	1.2
@@ -0,0 +1,24 @@
+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:

Index: kvm-acpi-do-not-wrap.patch
===================================================================
RCS file: kvm-acpi-do-not-wrap.patch
diff -N kvm-acpi-do-not-wrap.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ kvm-acpi-do-not-wrap.patch	28 Aug 2008 15:40:12 -0000	1.2
@@ -0,0 +1,138 @@
+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;

kvm-extboot.patch:

Index: kvm-extboot.patch
===================================================================
RCS file: kvm-extboot.patch
diff -N kvm-extboot.patch
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ kvm-extboot.patch	28 Aug 2008 15:40:12 -0000	1.2
@@ -0,0 +1,153 @@
+commit f4483969eaa53a74263c8c55e5cf0a41ff97e2aa
+Author: H. Peter Anvin <hpa at zytor.com>
+Date:   Fri Jul 18 11:22:59 2008 -0700
+
+    kvm: extboot: don't use interrupt vectors $0x2b and $0x2c
+    
+    extboot's use of interrupt vectors $0x2b and $0x2c is unsafe, as these
+    interrupt vectors fall in the OS-use range (0x20-0x3f).  Furthermore,
+    it's unnecessary: we can keep a local pointer instead of hooking
+    another interrupt as long as we can write to our own segment.
+    
+    Make the extboot segment writable, and use local variables to hold the
+    old link pointers.
+    
+    If this turns out to cause problems, we should probably switch to
+    using vectors in the 0xc0-0xef range, and/or other BIOS-reserved
+    memory.
+    
+    Signed-off-by: H. Peter Anvin <hpa at zytor.com>
+    Signed-off-by: Avi Kivity <avi at qumranet.com>
+
+diff --git a/extboot/extboot.S b/extboot/extboot.S
+index 9eb9333..2630abb 100644
+--- a/extboot/extboot.S
++++ b/extboot/extboot.S
+@@ -25,45 +25,36 @@
+ _start:
+ 	.short 0xaa55
+ 	.byte (_end - _start) / 512
+-	push %ax
+-	push %bx
+-	push %cx
+-	push %dx
++	push %eax
+ 	push %ds
+ 
+ 	/* setup ds so we can access the IVT */
+ 	xor %ax, %ax
+ 	mov %ax, %ds
+ 
+-	/* save old int 19 at int 2b */
+-	mov $(0x19 * 4), %bx
+-	mov 0(%bx), %ax
+-	mov 2(%bx), %cx
+-
+-	mov $(0x2b * 4), %bx
+-	mov %ax, 0(%bx)
+-	mov %cx, 2(%bx)
++	/* save old int 19 */
++	mov (0x19*4), %eax
++	mov %eax, %cs:old_int19
+ 
+ 	/* install out int 19 handler */
+-	mov $(0x19 * 4), %bx
+-	mov $int19_handler, %ax
+-	mov %ax, 0(%bx)
+-	mov %cs, 2(%bx)
++	movw $int19_handler, (0x19*4)
++	mov %cs, (0x19*4+2)
+ 
+ 	pop %ds
+-	pop %dx
+-	pop %cx
+-	pop %bx
+-	pop %ax
++	pop %eax
+ 	lret
+ 
+ int19_handler:
+-	push %ax
++	push %eax
+ 	push %bx
+ 	push %cx
+ 	push %dx
+ 	push %ds
+ 
++	/* setup ds to access IVT */
++	xor %ax, %ax
++	mov %ax, %ds
++
+ 	movw $0x404, %dx
+ 	inb %dx, %al
+ 	cmp $1, %al
+@@ -73,25 +64,13 @@ int19_handler:
+ 	jmp 3f
+ 
+ 1: /* hook int13: intb(0x404) == 1 */
+-	/* setup ds to access IVT */
+-	xor %ax, %ax
+-	mov %ax, %ds
+-
+ 	/* save old int 13 to int 2c */
+-	mov $(0x13 * 4), %bx
+-	mov 0(%bx), %ax
+-	mov 2(%bx), %cx
+-
+-	mov $(0x2c * 4), %bx
+-	mov %ax, 0(%bx)
+-	mov %cx, 2(%bx)
++	mov (0x13*4), %eax
++	mov %eax, %cs:old_int13
+ 
+ 	/* install our int 13 handler */
+-	mov $(0x13 * 4), %bx
+-	mov $int13_handler, %ax
+-
+-	mov %ax, 0(%bx)
+-	mov %cs, 2(%bx)
++	movw $int13_handler, (0x13*4)
++	mov %cs, (0x13*4+2)
+ 	jmp 3f
+ 
+ 2: /* linux boot: intb(0x404) == 2 */
+@@ -107,12 +86,16 @@ int19_handler:
+ 	ljmp $0x9000 + 0x20, $0
+ 
+ 3: /* fall through: inb(0x404) == 0 */
++	/* restore previous int $0x19 handler */
++	mov %cs:old_int19,%eax
++	mov %eax,(0x19*4)
++	
+ 	pop %ds
+ 	pop %dx
+ 	pop %cx
+ 	pop %bx
+-	pop %ax
+-	int $0x2b
++	pop %eax
++	ljmpw *%cs:old_int19
+ 
+ #define FLAGS_CF	0x01
+ 
+@@ -640,8 +623,7 @@ terminate_disk_emulation:
+ int13_handler:
+ 	cmp $0x80, %dl
+ 	je 1f
+-	int $0x2c
+-	iret
++	ljmpw *%cs:old_int13
+ 1:
+ 	cmp $0x0, %ah
+ 	jne 1f
+@@ -701,5 +683,10 @@ int13_handler:
+ 	int $0x18  /* boot failed */
+ 	iret
+ 
++/* Variables */
++.align 4, 0
++old_int13:	.long 0
++old_int19:	.long 0
++	
+ .align 512, 0
+ _end:


Index: kvm.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kvm/F-9/kvm.spec,v
retrieving revision 1.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- kvm.spec	27 May 2008 13:28:35 -0000	1.58
+++ kvm.spec	28 Aug 2008 15:40:12 -0000	1.59
@@ -1,7 +1,7 @@
 Summary: Kernel-based Virtual Machine
 Name: kvm
 Version: 65
-Release: 7%{?dist}
+Release: 8%{?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}-extboot.patch
+Patch9: %{name}-acpi-do-not-wrap.patch
+Patch10: %{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,9 @@
 %patch5 -p1
 %patch6 -p1
 %patch7 -p1
+%patch8 -p1
+%patch9 -p1
+%patch10 -p1
 
 %build
 # we need to install the data bits in a different path
@@ -105,6 +111,10 @@
 %{_sysconfdir}/sysconfig/modules/%{name}.modules
 
 %changelog
+* Thu Aug 28 2008 Glauber Costa <gcosta at redhat.com> - 65-8.fc9
+- Fixes #459778
+- Fixes #452355
+
 * Tue May 27 2008 Glauber Costa <gcosta at redhat.com> - 65-7.fc9
 - Fix the build
 




More information about the fedora-extras-commits mailing list