From mboxrd@z Thu Jan 1 00:00:00 1970 From: Muli Ben-Yehuda Subject: Re: [PATCH 5/6] device assignment: support for assigning PCI devices to guests Date: Wed, 29 Oct 2008 12:25:50 +0200 Message-ID: <20081029102550.GO6737@il.ibm.com> References: <1225188410-2222-1-git-send-email-muli@il.ibm.com> <1225188410-2222-2-git-send-email-muli@il.ibm.com> <1225188410-2222-3-git-send-email-muli@il.ibm.com> <1225188410-2222-4-git-send-email-muli@il.ibm.com> <1225188410-2222-5-git-send-email-muli@il.ibm.com> <1225188410-2222-6-git-send-email-muli@il.ibm.com> <490733B5.5010102@codemonkey.ws> <20081028155305.GE6737@il.ibm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: avi@redhat.com, kvm@vger.kernel.org, weidong.han@intel.com, Ben-Ami Yassour1 , amit.shah@redhat.com, allen.m.kay@intel.com To: Anthony Liguori Return-path: Received: from mtagate8.de.ibm.com ([195.212.29.157]:54459 "EHLO mtagate8.de.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753436AbYJ2K1n (ORCPT ); Wed, 29 Oct 2008 06:27:43 -0400 Received: from d12nrmr1607.megacenter.de.ibm.com (d12nrmr1607.megacenter.de.ibm.com [9.149.167.49]) by mtagate8.de.ibm.com (8.13.8/8.13.8) with ESMTP id m9TAQi03381794 for ; Wed, 29 Oct 2008 10:26:44 GMT Received: from d12av02.megacenter.de.ibm.com (d12av02.megacenter.de.ibm.com [9.149.165.228]) by d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with ESMTP id m9TAQgEd114730 for ; Wed, 29 Oct 2008 11:26:43 +0100 Received: from d12av02.megacenter.de.ibm.com (loopback [127.0.0.1]) by d12av02.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id m9TAQYJs022454 for ; Wed, 29 Oct 2008 11:26:35 +0100 Content-Disposition: inline In-Reply-To: <20081028155305.GE6737@il.ibm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Tue, Oct 28, 2008 at 05:53:05PM +0200, Muli Ben-Yehuda wrote: > On Tue, Oct 28, 2008 at 10:45:57AM -0500, Anthony Liguori wrote: > > >> +ifeq ($(USE_KVM), 1) > >> +OBJS+= device-assignment.o > >> +endif > > > > I don't think you want to build this on PPC so I think you need a > > stronger check. > > Good point. How about checking TARGET_BASE_ARCH = i386? Turns out this stanza is already enclosed in exactly that. > >> +#ifdef KVM_CAP_IOMMU > >> + /* We always enable the IOMMU if present > >> + * (or when not disabled on the command line) > >> + */ > >> + r = kvm_check_extension(kvm_context, KVM_CAP_IOMMU); > >> + if (r && !disable_iommu) > >> + assigned_dev_data.flags |= KVM_DEV_ASSIGN_ENABLE_IOMMU; > >> +#endif > >> + r = kvm_assign_pci_device(kvm_context, &assigned_dev_data); > >> + if (r < 0) { > >> + fprintf(stderr, "Could not notify kernel about " > >> + "assigned device \"%s\"\n", e_dev_name); > >> + perror("register_real_device"); > >> + goto out; > >> + } > >> + } > >> > > > > You still succeed if KVM_CAP_DEVICE_ASSIGNMENT isn't defined? > > That means a newer userspace compiled on an older kernel will > > silently fail if they try to do device assignment. There's > > probably no reason to build this file if KVM_CAP_DEVICE_ASSIGNMENT > > isn't defined (see how the in-kernel PIT gets conditionally build > > depending on whether that cap is available). > > Ok, I'll take a look at this. I reworked it per your suggestion so that device assignment is a kvm only feature for now. I am pretty sure Amit intended for the patches to support device assignment without kvm too, but getting rid of it did make things simpler. cheers, Muli -- The First Workshop on I/O Virtualization (WIOV '08) Dec 2008, San Diego, CA, http://www.usenix.org/wiov08/ <-> SYSTOR 2009---The Israeli Experimental Systems Conference http://www.haifa.il.ibm.com/conferences/systor2009/