From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: KVM's PIT and PIC programming question Date: Thu, 20 Aug 2009 20:41:13 +0300 Message-ID: <4A8D8AB9.1030707@redhat.com> References: <4158487B9DEE0647BA23911D1C22795712DF668F5B@orsmsx501.amr.corp.intel.com> <4A8D0944.10901@redhat.com> <4158487B9DEE0647BA23911D1C22795712DF6691C5@orsmsx501.amr.corp.intel.com> <4A8D69CA.9060905@redhat.com> <4158487B9DEE0647BA23911D1C22795712DF6692C5@orsmsx501.amr.corp.intel.com> <4A8D872E.8020905@redhat.com> <4158487B9DEE0647BA23911D1C22795712DF669344@orsmsx501.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: "kvm@vger.kernel.org" To: "Saksena, Abhishek" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:11051 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751684AbZHTRkn (ORCPT ); Thu, 20 Aug 2009 13:40:43 -0400 In-Reply-To: <4158487B9DEE0647BA23911D1C22795712DF669344@orsmsx501.amr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On 08/20/2009 08:36 PM, Saksena, Abhishek wrote: > Thnaks, > > So just programming of PIC (8259) should do the trick. Do I have to care about IOAPIC or LAPIC programming? You mentioned lapic is disabled by default, what about IOAPIC. > > The ioapic will not have any vectors programmed so it will do nothing. > I see in x86.c > > case KVM_CREATE_IRQCHIP: > r = -ENOMEM; > kvm->arch.vpic = kvm_create_pic(kvm); > if (kvm->arch.vpic) { > r = kvm_ioapic_init(kvm); > if (r) { > kfree(kvm->arch.vpic); > kvm->arch.vpic = NULL; > goto out; > } > } else > goto out; > break; > > > so ioapic is created. > > > > I have enabled all the interrupts in 8259s correctly > > > PIC Programming of master and slave 8259s > ;; PIC > mov al, #0x00 > out 0x21, AL ;master pic: all IRQs unmasked > out 0xA1, AL ;slave pic: all IRQs unmasked > > > PIT Programming > > SET_INT_VECTOR(0x08, #0xF000, #int08_handler) > mov al, #0x34 ; timer0: binary count, 16bit count, mode 2 > out 0x43, al > mov al, #0x00 ; maximum count of 0000H = 18.2Hz > out 0x40, al > out 0x40, al > > But still not see PIT interrupts or Timer ISR being called! > > I suggest adding printk()s (or trace_printk()s) in stragtegic places to see what's going on. It can be either a guest programming error or host bug. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.