From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sheng Yang Subject: Re: [PATCH 1/3] KVM: Ioctls for init MSI-X entry Date: Thu, 12 Feb 2009 14:28:48 +0800 Message-ID: <200902121428.48607.sheng@linux.intel.com> References: <1234339731-3195-1-git-send-email-sheng@linux.intel.com> <1234339731-3195-2-git-send-email-sheng@linux.intel.com> <4992C849.9020103@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mga12.intel.com ([143.182.124.36]:7059 "EHLO azsmga102.ch.intel.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750985AbZBLG2v (ORCPT ); Thu, 12 Feb 2009 01:28:51 -0500 In-Reply-To: <4992C849.9020103@redhat.com> Content-Disposition: inline Sender: kvm-owner@vger.kernel.org List-ID: On Wednesday 11 February 2009 20:44:57 Avi Kivity wrote: > Sheng Yang wrote: > > Introduce KVM_SET_MSIX_NR and KVM_SET_MSIX_ENTRY two ioctls. > > > > This two ioctls are used by userspace to specific guest device MSI-X > > entry number and correlate MSI-X entry with GSI during the initialization > > stage. > > > > MSI-X should be well initialzed before enabling. > > > > Don't support change MSI-X entry number for now. > > > > Signed-off-by: Sheng Yang > > --- > > include/linux/kvm.h | 14 +++++++ > > include/linux/kvm_host.h | 3 + > > virt/kvm/kvm_main.c | 96 > > ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 113 > > insertions(+), 0 deletions(-) > > > > diff --git a/include/linux/kvm.h b/include/linux/kvm.h > > index c1425ab..5200768 100644 > > --- a/include/linux/kvm.h > > +++ b/include/linux/kvm.h > > @@ -474,6 +474,8 @@ struct kvm_irq_routing { > > #define KVM_ASSIGN_IRQ _IOR(KVMIO, 0x70, \ > > struct kvm_assigned_irq) > > #define KVM_REINJECT_CONTROL _IO(KVMIO, 0x71) > > +#define KVM_SET_MSIX_NR _IOR(KVMIO, 0x72, struct kvm_assigned_msix_nr) > > +#define KVM_SET_MSIX_ENTRY _IOR(KVMIO, 0x73, struct > > kvm_assigned_msix_entry) > > > > /* > > * ioctls for vcpu fds > > @@ -594,4 +596,16 @@ struct kvm_assigned_irq { > > #define KVM_DEV_IRQ_ASSIGN_MSI_ACTION KVM_DEV_IRQ_ASSIGN_ENABLE_MSI > > #define KVM_DEV_IRQ_ASSIGN_ENABLE_MSI (1 << 0) > > > > +struct kvm_assigned_msix_nr { > > + __u32 assigned_dev_id; > > + __u16 entry_nr; > > +}; > > + > > +struct kvm_assigned_msix_entry { > > + __u32 assigned_dev_id; > > + __u32 gsi; > > + __u16 entry; > > + __u16 pos; > > +} > > I'm guessing the intent here is "msi-x number 'pos' on the host assigned > device will be injected to the guest as gsi 'gsi'"? What's the meaning > of 'entry' and 'pos'? Sorry for the ambiguous. "entry" is the index in device MSI-X table(including empty entry); "pos" is without the empty entry, and should be less than the total valid entry numbers that table have. "pos" is mostly a assistant here, I think it can be estimated. > > Both structures need better padding and some documentation. Of course. Would update the patches. -- regards Yang, Sheng