From patchwork Fri Jun 22 02:23:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Alexey Kardashevskiy X-Patchwork-Id: 166461 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 8DB77B6FC3 for ; Fri, 22 Jun 2012 12:24:09 +1000 (EST) Received: from localhost ([::1]:35891 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShtXb-0005JO-Dy for incoming@patchwork.ozlabs.org; Thu, 21 Jun 2012 22:24:07 -0400 Received: from eggs.gnu.org ([208.118.235.92]:53538) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShtXU-0005J3-Lq for qemu-devel@nongnu.org; Thu, 21 Jun 2012 22:24:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ShtXS-0000CQ-Ho for qemu-devel@nongnu.org; Thu, 21 Jun 2012 22:24:00 -0400 Received: from mail-pz0-f45.google.com ([209.85.210.45]:58505) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ShtXS-0000C7-8F for qemu-devel@nongnu.org; Thu, 21 Jun 2012 22:23:58 -0400 Received: by dadn2 with SMTP id n2so1733561dad.4 for ; Thu, 21 Jun 2012 19:23:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding :x-gm-message-state; bh=SpDYDRTwoSgP6DaeSrDb/bJGBbrs7LjVkHbcbNAExAg=; b=lKlQAQNk/6W0HAsbJ2OpecSt3iILH3wxAKqBYRbTxx/n970E0cuYC21z1qTQNYPBT2 CjM2C6lYcnwFCjgc2qUKHReH0DP9Z4Dt+kbSRNE+Dr0f5SYGmm5AmMYptIA1opOWbFdr 0lpJAf+vXsFqddSimF8w25SmQ6QV7rwS6VEokAahsy2vkW4q6uRVbTSMjNDOu7mgiIo+ sn1QIdHWQd07xCFsLHipvOkcd8K+oK3m3sZEmCOLdu/QoE8loPkToB4HE73kwIuLpKxF BCbLmvWaSUPK8e789s7jjmvprRKJMZI2WLNUv5ep4NyLTTI8ohJblAz/TMkDDp3waqtC zwhw== Received: by 10.68.194.169 with SMTP id hx9mr5180112pbc.8.1340331836038; Thu, 21 Jun 2012 19:23:56 -0700 (PDT) Received: from [10.61.2.175] (ibmaus65.lnk.telstra.net. [165.228.126.9]) by mx.google.com with ESMTPS id ua6sm37420624pbc.20.2012.06.21.19.23.52 (version=SSLv3 cipher=OTHER); Thu, 21 Jun 2012 19:23:55 -0700 (PDT) Message-ID: <4FE3D735.4060909@ozlabs.ru> Date: Fri, 22 Jun 2012 12:23:49 +1000 From: Alexey Kardashevskiy User-Agent: Mozilla/5.0 (X11; Linux i686; rv:12.0) Gecko/20120428 Thunderbird/12.0.1 MIME-Version: 1.0 To: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= References: <4FE29366.6050101@ozlabs.ru> <4FE2F912.1080904@suse.de> <4FE303A9.9010308@ozlabs.ru> <4FE31145.7040906@suse.de> <4FE31D53.5060700@ozlabs.ru> <4FE329EE.4020701@suse.de> In-Reply-To: <4FE329EE.4020701@suse.de> X-Gm-Message-State: ALoCoQlAF76GY/lpm/PrsZWp8Fh/qM+PzaVPGbHREPm1ngGiZHFovKphc7dTIPKaOO5HsLMIMyx6 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.45 Cc: Paolo Bonzini , Alex Williamson , qemu-devel@nongnu.org, Anthony Liguori , Alexander Graf Subject: Re: [Qemu-devel] hw/Makefile.objs question X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org On 22/06/12 00:04, Andreas Färber wrote: > Am 21.06.2012 15:10, schrieb Alexey Kardashevskiy: >> 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? > > You're missing my point: We need to know *where* the .o file needs to > go, then we can point you to appropriate examples. Making things depend > on configure options should be trivial from there. > > My understanding is that VFIO depends only on Linux/KVM support so I > don't understand why you'd be excluding VFIO for ppc. s390 has no PCI > AFAIU so that'd be okay. > >>> 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. > > Correct. You keep mixing up both approaches I named... > > *If* the file is built per target (hw/ppc64/Makefile.objs), then you can > use *-softmmu/config-target.mak and just need to use a different > Makefile than before. Aaaa. This is the case and this is what I did at the first place but I thought it was wrong. Ok. > *If* the file is built per libhw (hw/Makefile.objs), then you need one > option whether to compile it and another for whether to link it into a > particular target. > > You still haven't answered the question of which of these two cases > applies here, so I cannot say more than I already have. Anthony's 3) > elaborates on my briefly mentioned ifeq. 2 Alex: seems that now we should build qemu+vfio like below: > Andreas > >>>>> 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. thanks! diff --git a/Makefile.target b/Makefile.target index 9820ce5..54b0214 100644 --- a/Makefile.target +++ b/Makefile.target @@ -154,9 +154,6 @@ endif endif obj-$(CONFIG_IVSHMEM) += ivshmem.o -# VFIO PCI device assignment -obj-$(CONFIG_VFIO_PCI) += vfio_pci.o - # Hardware support ifeq ($(TARGET_ARCH), sparc64) obj-y += hw/sparc64/ diff --git a/configure b/configure index a48d84b..14e25e0 100755 --- a/configure +++ b/configure @@ -3735,12 +3735,9 @@ case "$target_arch2" in *) echo "CONFIG_NO_XEN=y" >> $config_target_mak esac -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 +if test "$vfio_pci" = "yes" -a "$target_softmmu" = "yes" ; then + echo "CONFIG_VFIO_PCI=y" >> $config_target_mak +fi case "$target_arch2" in i386|x86_64|ppcemb|ppc|ppc64|s390x) # Make sure the target and host cpus are compatible diff --git a/hw/i386/Makefile.objs b/hw/i386/Makefile.objs index d43f1df..647cf34 100644 --- a/hw/i386/Makefile.objs +++ b/hw/i386/Makefile.objs @@ -9,5 +9,7 @@ obj-y += pc_sysfw.o obj-$(CONFIG_XEN) += xen_platform.o xen_apic.o obj-$(CONFIG_KVM) += kvm/clock.o kvm/apic.o kvm/i8259.o kvm/ioapic.o kvm/i8254.o obj-$(CONFIG_SPICE) += qxl.o qxl-logger.o qxl-render.o +# VFIO PCI device assignment +obj-$(CONFIG_VFIO_PCI) += vfio_pci.o obj-y := $(addprefix ../,$(obj-y)) diff --git a/hw/ppc/Makefile.objs b/hw/ppc/Makefile.objs index f573a95..c46a049 100644 --- a/hw/ppc/Makefile.objs +++ b/hw/ppc/Makefile.objs @@ -25,4 +25,7 @@ obj-$(CONFIG_FDT) += ../device_tree.o # Xilinx PPC peripherals obj-y += xilinx_ethlite.o +# VFIO PCI device assignment +obj-$(CONFIG_VFIO_PCI) += vfio_pci.o + obj-y := $(addprefix ../,$(obj-y))