From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] tpr optimization: clear the vapic area on boot Date: Tue, 16 Nov 2010 12:52:51 +0200 Message-ID: <4CE26283.7010304@redhat.com> References: <1289904577-32248-1-git-send-email-avi@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit To: Marcelo Tosatti , kvm@vger.kernel.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:1025 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934075Ab0KPKw6 (ORCPT ); Tue, 16 Nov 2010 05:52:58 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id oAGAqwlW014488 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 16 Nov 2010 05:52:58 -0500 In-Reply-To: <1289904577-32248-1-git-send-email-avi@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/16/2010 12:49 PM, Avi Kivity wrote: > If the option rom is loaded with rep/insb (as newer seabios versions do), then > the writes to the vapic area may be corrupted by the kernel. > > Fix by explicitly clearing the vapic area on option rom startup. > > Signed-off-by: Avi Kivity > --- > pc-bios/bios.bin | Bin 131072 -> 131072 bytes This bit was unintended. > diff --git a/pc-bios/optionrom/vapic.S b/pc-bios/optionrom/vapic.S > index afe98a9..3c8dcf1 100644 > --- a/pc-bios/optionrom/vapic.S > +++ b/pc-bios/optionrom/vapic.S > @@ -4,6 +4,17 @@ > _start: > .short 0xaa55 > .byte (_end - _start) / 512 > + # clear vapic area: firmware load using rep insb may cause > + # stale tpr/isr/irr data to corrupt the vapic area. > + push %es > + push %cs > + pop %es > + xor %ax, %ax > + mov $vapic_size/2, %cx > + lea vapic, %di > + cld > + rep stosw > + pop %es > mov $vapic_base, %ax > out %ax, $0x7e > lret This is the interesting part. -- error compiling committee.c: too many arguments to function