From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 09/11] KVM: Add assigned_device_msi_dispatch() Date: Sun, 23 Nov 2008 12:22:47 +0200 Message-ID: <49292EF7.5000707@redhat.com> References: <1227095114-13792-1-git-send-email-sheng@linux.intel.com> <1227095114-13792-10-git-send-email-sheng@linux.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: Sheng Yang Return-path: Received: from mx2.redhat.com ([66.187.237.31]:34933 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751579AbYKWKWu (ORCPT ); Sun, 23 Nov 2008 05:22:50 -0500 In-Reply-To: <1227095114-13792-10-git-send-email-sheng@linux.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: Sheng Yang wrote: > The function is used to dispatch MSI to lapic according to MSI message > address and message data. > > + > + deliver_bitmask = kvm_ioapic_get_delivery_bitmask(ioapic, > + dest_id, dest_mode); > + switch (delivery_mode) { > + case MSI_DATA_DELIVERY_LOWPRI: > + vcpu = kvm_get_lowest_prio_vcpu(ioapic->kvm, vector, > + deliver_bitmask); > + if (vcpu != NULL) > + kvm_apic_set_irq(vcpu, vector, trig_mode); > + else > + printk(KERN_INFO "kvm: null lowest priority vcpu!\n"); > + break; > + case MSI_DATA_DELIVERY_FIXED: > + for (vcpu_id = 0; deliver_bitmask != 0; vcpu_id++) { > + if (!(deliver_bitmask & (1 << vcpu_id))) > + continue; > + deliver_bitmask &= ~(1 << vcpu_id); > + vcpu = ioapic->kvm->vcpus[vcpu_id]; > + if (vcpu) > + kvm_apic_set_irq(vcpu, vector, trig_mode); > + } > + break; > + default: > This duplicates the ioapic code. That's fine for now, but eventually we'll want to refactor this. -- error compiling committee.c: too many arguments to function