From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51D7AE7D0A1 for ; Fri, 22 Sep 2023 00:01:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:References :In-Reply-To:Subject:To:From:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jSc8x15nsOmliR0rUGVikBKi159ZJK98/BE6ZPiRb4A=; b=z7KSzOZJW3Qil5 t/ouLppPzw19xUhfb1Z/pXLl+Kmyd7pt1MS47cNf05Dg/CluGDnfJwF5UzbLh0Z79HIS1raDt/4MK Urb/OETbDH7wr6yM8UvMCFsBD49vbLzOXTfAyrd7jGjL3hClro03IRi6zSq16e06poUek9BbPkNhY BxwktfN4sbEX+hbALhRbhCjFWy58FdZT3Ko3C3vGUU20kMTCo0wVBYYDYjBock5xM/Gj/6cKjgzra 80QrReRLjVM7DmA8L4tHE9b9PU5BqcZ7+zxBxEgGIhCQYctS2E+IAkRJwrKOU+IY72Sw0QmZj2YAi htEc/3oeaHGUB7PTXe5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qjTbR-007QmS-2L; Fri, 22 Sep 2023 00:01:01 +0000 Received: from gandalf.ozlabs.org ([150.107.74.76]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qjTbN-007Ql5-0f for linux-arm-kernel@lists.infradead.org; Fri, 22 Sep 2023 00:01:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ellerman.id.au; s=201909; t=1695340847; bh=R/VgVhr9X0HDtbhByU19PzH3x9CzJFuyVh93BLbm8XY=; h=From:To:Subject:In-Reply-To:References:Date:From; b=EUj1hKtv69g+9+nHaOHHtRLCs4SHBdba41Ptbk8nE0yB2aVWS47UCVmbCiEPRl3OS OOOmwbvjXOGRW4+l+Fl5Db4/dr1OmHm7MrwulVHxJbKTdyEHQ3NTGcdOMdEgeyjp8x Bnhvsybnbj7XLRupXWsVSvlbZl5l0MkRPAmNgCHLopPgDW88Klsc03QWfixcsMp1ds +aTlrZPTdD+D3j3dxUqa8Amstg4Jm6Ls7tDlHjwAmIJRs0+hlsAiHuqOW6oF7u3daV 6pJaAyNaWqCjBOraN+K5IIYx7vpYRHJKUfWFE2ALkjnpNdro2udTrbfcUvW8kYfIQr Wz7OBF1jOw3AQ== Received: from authenticated.ozlabs.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.ozlabs.org (Postfix) with ESMTPSA id 4RsC8Y0yCxz4x2b; Fri, 22 Sep 2023 10:00:45 +1000 (AEST) From: Michael Ellerman To: Jason Gunthorpe , Alexander Gordeev , Christian Borntraeger , Borislav Petkov , Catalin Marinas , Christophe Leroy , Dave Hansen , David Hildenbrand , Janosch Frank , Vasily Gorbik , Heiko Carstens , "H. Peter Anvin" , Claudio Imbrenda , James Morse , kvm@vger.kernel.org, kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-s390@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Marc Zyngier , Ingo Molnar , Nicholas Piggin , Oliver Upton , Paolo Bonzini , Sean Christopherson , Suzuki K Poulose , Sven Schnelle , Thomas Gleixner , Will Deacon , x86@kernel.org, Zenghui Yu Subject: Re: [PATCH rc] kvm: Prevent compiling virt/kvm/vfio.c unless VFIO is selected In-Reply-To: <0-v1-08396538817d+13c5-vfio_kvm_kconfig_jgg@nvidia.com> References: <0-v1-08396538817d+13c5-vfio_kvm_kconfig_jgg@nvidia.com> Date: Fri, 22 Sep 2023 10:00:44 +1000 Message-ID: <87leczm5zn.fsf@mail.lhotse> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230921_170057_556267_5268C694 X-CRM114-Status: GOOD ( 21.50 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Jason Gunthorpe writes: > There are a bunch of reported randconfig failures now because of this, > something like: > >>> arch/powerpc/kvm/../../../virt/kvm/vfio.c:89:7: warning: attribute declaration must precede definition [-Wignored-attributes] > fn = symbol_get(vfio_file_iommu_group); > ^ > include/linux/module.h:805:60: note: expanded from macro 'symbol_get' > #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak,visibility("hidden"))); &(x); }) > > It happens because the arch forces KVM_VFIO without knowing if VFIO is > even enabled. > > Split the kconfig so the arch selects the usual HAVE_KVM_ARCH_VFIO and > then KVM_VFIO is only enabled if the arch wants it and VFIO is turned on. > > Reported-by: kernel test robot > Closes: https://lore.kernel.org/oe-kbuild-all/202308251949.5IiaV0sz-lkp@intel.com/ > Closes: https://lore.kernel.org/oe-kbuild-all/202309030741.82aLACDG-lkp@intel.com/ > Closes: https://lore.kernel.org/oe-kbuild-all/202309110914.QLH0LU6L-lkp@intel.com/ > Cc: Nick Desaulniers > Fixes: c1cce6d079b8 ("vfio: Compile vfio_group infrastructure optionally") > Signed-off-by: Jason Gunthorpe > --- > arch/arm64/kvm/Kconfig | 2 +- > arch/powerpc/kvm/Kconfig | 2 +- > arch/s390/kvm/Kconfig | 2 +- > arch/x86/kvm/Kconfig | 2 +- > virt/kvm/Kconfig | 7 ++++++- > 5 files changed, 10 insertions(+), 5 deletions(-) > > Sean's large series will also address this: > > https://lore.kernel.org/kvm/20230916003118.2540661-7-seanjc@google.com/ > > I don't know if it is sever enough to fix in the rc cycle, but here is the > patch. Thanks for debugging this, I had seen it but hadn't got around to it. I think it's definitely worth fixing now. It's a pretty simple patch and it's still early in the rc cycle. Tested-by: Michael Ellerman cheers > diff --git a/arch/arm64/kvm/Kconfig b/arch/arm64/kvm/Kconfig > index 83c1e09be42e5b..7c43eaea51ce05 100644 > --- a/arch/arm64/kvm/Kconfig > +++ b/arch/arm64/kvm/Kconfig > @@ -28,7 +28,7 @@ menuconfig KVM > select KVM_MMIO > select KVM_GENERIC_DIRTYLOG_READ_PROTECT > select KVM_XFER_TO_GUEST_WORK > - select KVM_VFIO > + select HAVE_KVM_ARCH_VFIO > select HAVE_KVM_EVENTFD > select HAVE_KVM_IRQFD > select HAVE_KVM_DIRTY_RING_ACQ_REL > diff --git a/arch/powerpc/kvm/Kconfig b/arch/powerpc/kvm/Kconfig > index 902611954200df..b64824e4cbc1eb 100644 > --- a/arch/powerpc/kvm/Kconfig > +++ b/arch/powerpc/kvm/Kconfig > @@ -22,7 +22,7 @@ config KVM > select PREEMPT_NOTIFIERS > select HAVE_KVM_EVENTFD > select HAVE_KVM_VCPU_ASYNC_IOCTL > - select KVM_VFIO > + select HAVE_KVM_ARCH_VFIO > select IRQ_BYPASS_MANAGER > select HAVE_KVM_IRQ_BYPASS > select INTERVAL_TREE > diff --git a/arch/s390/kvm/Kconfig b/arch/s390/kvm/Kconfig > index 45fdf2a9b2e326..d206ad3a777d5d 100644 > --- a/arch/s390/kvm/Kconfig > +++ b/arch/s390/kvm/Kconfig > @@ -31,7 +31,7 @@ config KVM > select HAVE_KVM_IRQ_ROUTING > select HAVE_KVM_INVALID_WAKEUPS > select HAVE_KVM_NO_POLL > - select KVM_VFIO > + select HAVE_KVM_ARCH_VFIO > select INTERVAL_TREE > select MMU_NOTIFIER > help > diff --git a/arch/x86/kvm/Kconfig b/arch/x86/kvm/Kconfig > index ed90f148140dfe..8e70e693f90e30 100644 > --- a/arch/x86/kvm/Kconfig > +++ b/arch/x86/kvm/Kconfig > @@ -45,7 +45,7 @@ config KVM > select HAVE_KVM_NO_POLL > select KVM_XFER_TO_GUEST_WORK > select KVM_GENERIC_DIRTYLOG_READ_PROTECT > - select KVM_VFIO > + select HAVE_KVM_ARCH_VFIO > select INTERVAL_TREE > select HAVE_KVM_PM_NOTIFIER if PM > select KVM_GENERIC_HARDWARE_ENABLING > diff --git a/virt/kvm/Kconfig b/virt/kvm/Kconfig > index 484d0873061ca5..0bf34809e1bbfe 100644 > --- a/virt/kvm/Kconfig > +++ b/virt/kvm/Kconfig > @@ -59,9 +59,14 @@ config HAVE_KVM_MSI > config HAVE_KVM_CPU_RELAX_INTERCEPT > bool > > -config KVM_VFIO > +config HAVE_KVM_ARCH_VFIO > bool > > +config KVM_VFIO > + def_bool y > + depends on HAVE_KVM_ARCH_VFIO > + depends on VFIO > + > config HAVE_KVM_INVALID_WAKEUPS > bool > > > base-commit: 0bb80ecc33a8fb5a682236443c1e740d5c917d1d > -- > 2.42.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel