From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:36907) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShhMB-00018t-Qm for qemu-devel@nongnu.org; Thu, 21 Jun 2012 09:23:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShhM5-0006Ma-5V for qemu-devel@nongnu.org; Thu, 21 Jun 2012 09:23:31 -0400 Received: from mail-yw0-f46.google.com ([209.85.213.46]:48178) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShhM5-0006MH-1D for qemu-devel@nongnu.org; Thu, 21 Jun 2012 09:23:25 -0400 Received: by yhmm54 with SMTP id m54so671203yhm.33 for ; Thu, 21 Jun 2012 06:23:23 -0700 (PDT) Message-ID: <4FE32048.9080906@codemonkey.ws> Date: Thu, 21 Jun 2012 08:23:20 -0500 From: Anthony Liguori MIME-Version: 1.0 References: <4FE29366.6050101@ozlabs.ru> <4FE2F912.1080904@suse.de> <4FE303A9.9010308@ozlabs.ru> <4FE31145.7040906@suse.de> <4FE31D53.5060700@ozlabs.ru> In-Reply-To: <4FE31D53.5060700@ozlabs.ru> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] hw/Makefile.objs question List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexey Kardashevskiy Cc: Paolo Bonzini , Alex Williamson , =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= , qemu-devel@nongnu.org On 06/21/2012 08:10 AM, Alexey Kardashevskiy wrote: > On 21/06/12 22:19, Andreas Färber wrote: >> Am 21.06.2012 13:21, schrieb Alexey Kardashevskiy: >>> On 21/06/12 20:36, Andreas Färber wrote: >>>> Am 21.06.2012 05:22, schrieb Alexey Kardashevskiy: >>>>> I am trying to compile the very last qemu with vfio_pci enabled. VFIO_PCI is added as below: >>>>> >>>>> ./configure: >>>>> >>>>> case "$target_arch2" in >>>>> i386|x86_64|ppc64) >>>>> if test "$vfio_pci" = "yes" -a "$target_softmmu" = "yes" ; then >>>>> echo "CONFIG_VFIO_PCI=y">> $config_target_mak >>>>> fi >>>>> esac >>>>> >>>>> >>>>> ./Makefile.target: >>>>> >>>>> # VFIO PCI device assignment >>>>> obj-$(CONFIG_VFIO_PCI) += vfio_pci.o >>>>> >>>>> >>>>> And it worked before. However it does not anymore as it seems that everything in hw/ (and vfio_pci.c >>>>> as well as is in hw/ and it is a device) can be only compiled via hw/Makefile.objs and >>>>> hw/ppc/Makefile.objs (my platform is POWER), it is ignored if to keep it as is. >>>>> >>>>> So I have to move "obj-$(CONFIG_VFIO_PCI) += vfio_pci.o" to hw/Makefile.objs (and change obj- to >>>>> hw-obj-) but the hw/Makefile.objs does not include (directly or indirectly) generated >>>>> ppc64-softmmu/config-target.mak with CONFIG_VFIO_PCI=y. >>>>> >>>>> What is the correct solution? >>>> >>>> If the file compiles the same for all three, put CONFIG_VFIO_PCI=y into >>>> default-configs/{i386,x86_64,ppc64}-softmmu.mak and do >>>> hw-obj-$(CONFIG_VFIO_PCI) += in hw/Makefile.objs. >>> >>> >>> It only compiles with ./configure --enable-vfio-pci which may or may not set CONFIG_VFIO_PCI to "y". >>> Your proposal makes it always "y" (for selected platforms). >> >> Apply some creativity, there's surely examples around. The question is >> whether the contents of vfio_pci.o changes or not. > > Applied already and gave up, this is why I am writing here :) > What would be a good example of a device which is enabled by configure script? We don't have a great way to do this. CONFIG_VIRTFS is the best example. You need three things: 1) a CONFIG_ variable set by configure (whether the user wants VFIO) 2) a CONFIG_ variable set by the target default-config/ whether the board supports VFIO. This could just be CONFIG_PCI btw. 3) a variable that you create in Makefile.objs that is only set if (1) && (2) are both set to y You can then use the variable from (3) to do obj-$(CONFIG_...) in the appropriate Makefiles.obj. Regards, Anthony Liguori > >> If not, then you only >> need to build it once in libhwX/, depending on $config_target_mak, and >> link to the appropriate targets. If it accesses CPU internals then it >> must be built per target. > > $config_target_mak points to ppc64-softmmu/config-target.mak, not in the root folder. > When executed in libhw64, it is not visible to makefile. > > >>>> Otherwise, add to hw/{i386,ppc}/Makefile.objs - or with Anthony's >>>> proposal from yesterday hw/Makefile.objs becomes possible, too. >>> >>> Again, it will be unconditional "y". >> >> No, in this case the condition would be set from configure as before, it >> only moves from Makefile.target to the appropriate Makefile.objs. >> Note that to limit it to ppc64 (as opposed to ppc) some additional ifeq >> check would be needed, as before. > > > >