From mboxrd@z Thu Jan 1 00:00:00 1970 From: Muli Ben-Yehuda Subject: Re: [PATCH 0/4][VTD] kvm vt-d support kernel changes Date: Thu, 12 Jun 2008 15:08:03 +0300 Message-ID: <20080612120803.GK7468@il.ibm.com> References: <1FE6DD409037234FAB833C420AA843EC018831C6@orsmsx424.amr.corp.intel.com> <20080610125329.GJ7307@il.ibm.com> <1FE6DD409037234FAB833C420AA843EC0188380B@orsmsx424.amr.corp.intel.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org, Amit Shah , Ben-Ami Yassour1 , Avi Kivity , Anthony Liguori , Chris Wright , "Han, Weidong" To: "Kay, Allen M" Return-path: Received: from mtagate7.uk.ibm.com ([195.212.29.140]:10420 "EHLO mtagate7.uk.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1760037AbYFLMJG (ORCPT ); Thu, 12 Jun 2008 08:09:06 -0400 Received: from d06nrmr1407.portsmouth.uk.ibm.com (d06nrmr1407.portsmouth.uk.ibm.com [9.149.38.185]) by mtagate7.uk.ibm.com (8.13.8/8.13.8) with ESMTP id m5CC89jM602996 for ; Thu, 12 Jun 2008 12:08:09 GMT Received: from d06av01.portsmouth.uk.ibm.com (d06av01.portsmouth.uk.ibm.com [9.149.37.212]) by d06nrmr1407.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v9.0) with ESMTP id m5CC89tq1835040 for ; Thu, 12 Jun 2008 13:08:09 +0100 Received: from d06av01.portsmouth.uk.ibm.com (loopback [127.0.0.1]) by d06av01.portsmouth.uk.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m5CC88eT010967 for ; Thu, 12 Jun 2008 13:08:09 +0100 Content-Disposition: inline In-Reply-To: <1FE6DD409037234FAB833C420AA843EC0188380B@orsmsx424.amr.corp.intel.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Jun 10, 2008 at 12:45:30PM -0700, Kay, Allen M wrote: > Muli, > > The userpsace branch is located at: > > git.kernel.org/pub/scm/linux/kernel/git/amit/kvm-userspace.git vtd > > I forgot to send out the userspace patch last night. :-) Thanks Allen. I am trying to get the latest rev to work with the irq injection method rather than irq chip. Amit's latest code overloads KVM_ASSIGN_PCI_PT_DEV to inform the host kernel of guest IRQ changes, so we either need something like the attachd patch to not map the guest multiple times, or we need to introduce KVM_PCI_PT_DEV_IRQ_CHANGE in additino to KVM_ASSIGN_PCI_PT_DEV. diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 1b50ba3..2d61375 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -305,6 +305,14 @@ static int kvm_vm_ioctl_pci_pt_dev(struct kvm *kvm, goto out_free; } } + + if (kvm_intel_iommu_found()) { + r = kvm_iommu_map_guest(kvm, pci_pt_dev); + if (r) + goto out_free; + } + write_lock_irqsave(&kvm_pci_pt_lock, flags); INIT_WORK(&match->pt_dev.int_work.work, kvm_pci_pt_work_fn); @@ -1962,11 +1970,6 @@ long kvm_arch_vm_ioctl(struct file *filp, r = kvm_vm_ioctl_pci_pt_dev(kvm, &pci_pt_dev); if (r) goto out; - if (kvm_intel_iommu_found()) { - r = kvm_iommu_map_guest(kvm, &pci_pt_dev); - if (r) - goto out; - } break; } case KVM_GET_PIT: { Cheers, Muli