From patchwork Sat Sep 16 00:30:53 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sean Christopherson X-Patchwork-Id: 13388053 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 E715ACD37B1 for ; Sat, 16 Sep 2023 01:46:13 +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:Reply-To:List-Subscribe:List-Help: List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID :References:Mime-Version:In-Reply-To:Date:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=Grg9YsXjAeg3NtufbZJEW9Qii/57s5+mT+QDWnQCIDA=; b=jQhxSPIh1FUiOG Ha4G/MlsD4rzMVdhYIJAcJNcOqSHg7l0Ufm8+rH11vmqjpKrksQQHsvvjJ39Q0bWbMcQtC/I0i3fD jWCOVoAfMadfK33wm34QZW8S9bmF0LQaVjUtIxLhQ/wiCjEp0gKRv+86fhlv0a01nP3HCobQGeNNB QacP0dlW2Ldmr5+pD3YDQ3EtGlBY6vHU/x5Y96N3YjnlhKH8NTG33COIoeNY7R+/qFNifzBFWC8iv kZqonpt4hg9Jyvg9YXlVp18xBZHzWrNyc/pbpAxTgSvKH1+ZrDQo0npl0jd5Dk7hM7EY5lupmc4AD XOs5AKhcRuMjb3i62mwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qhKNp-00BkJI-0p; Sat, 16 Sep 2023 01:46:05 +0000 Received: from mail-yw1-x114a.google.com ([2607:f8b0:4864:20::114a]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qhJDa-00BcMl-0t for linux-arm-kernel@lists.infradead.org; Sat, 16 Sep 2023 00:31:27 +0000 Received: by mail-yw1-x114a.google.com with SMTP id 00721157ae682-5925fb6087bso33959527b3.2 for ; Fri, 15 Sep 2023 17:31:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694824283; x=1695429083; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:from:to:cc:subject:date:message-id:reply-to; bh=CcWcgzjI/Sjr3SKdjnMS4CWAtaq/GpOs1NzqJV8HV48=; b=FYBuZ5fv+xw1oDV1tu9yPyM8sUVk9+f1yXuKbNlo1sQE1P7c1MS3zZKhVswyrJs2kR FkEq4d+MZeOlaMBwiiqh+GqG+TOCL269DunUZ4mDHZb5SxFMiw5o0XBM2JCRCdkSGXpi gDeq1BW1gBYsJD5xvj5J+zc+y9/eP1abH+14bfb4ndxfRmrSK/K3/giWDmALL2PYCS4i LPY4IbCYc5IH7BIPRYPy/TL6st0KeM+61d7YhwrD6k6STAxGKpt1FyURFb4hCQ+qq19i 1NV6C2wut/rkacQOBtcfA0yTSQAqirp/AGMFq7K/MmDGmKvfTcUAo+GhpLInCsq8iIuN QQ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694824283; x=1695429083; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:reply-to:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CcWcgzjI/Sjr3SKdjnMS4CWAtaq/GpOs1NzqJV8HV48=; b=oQfc2uu+PvvRB+nI9Ntvq/GgDTcf2YjfbHz0k8eKEv6/eD+lG3AL3zumHwCm4mmLDd kZdRJWMpcVR8yzDWw+UgS19UOVzsNTBkU7EcbzYoctTCIc6Dot8ujLMtL0Sk4nYh6jm3 DjP5PNsKKL9jnANxyZT7L1N00bG/1XfXXp+0O5p4qLfSIpuuRm2cKB/H8hiXanGrrErf y+DlTX7uB1dNki7Kt1+iReWz4WOZrcuLxXc7H4J1hqmUeSIfu8gjGAaxG1IzqVeqZ357 ew/J6BON3fbRoJ22G81jzsb+yxuax+0QumfuWRjVReNB3j9t97F/HneQTbYzoxdgHHei EQWA== X-Gm-Message-State: AOJu0YyYXLC8Ma2JI0LYUk5GjIq0gQ7eWeiXFhKWdo6FI0Dg/JY6LkFm e/346vKmjVVX6lNOJakyWdlo233OAFY= X-Google-Smtp-Source: AGHT+IEjplB8N3p+oR/7zKlMcxL9iCUBmO4vshw551ibG3RHlQehJcUKg5dHZyrgSIjo7xUVmV5xBYFOkj8= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a81:b612:0:b0:565:9bee:22e0 with SMTP id u18-20020a81b612000000b005659bee22e0mr85362ywh.0.1694824282871; Fri, 15 Sep 2023 17:31:22 -0700 (PDT) Date: Fri, 15 Sep 2023 17:30:53 -0700 In-Reply-To: <20230916003118.2540661-1-seanjc@google.com> Mime-Version: 1.0 References: <20230916003118.2540661-1-seanjc@google.com> X-Mailer: git-send-email 2.42.0.459.ge4e396fd5e-goog Message-ID: <20230916003118.2540661-2-seanjc@google.com> Subject: [PATCH 01/26] vfio: Wrap KVM helpers with CONFIG_KVM instead of CONFIG_HAVE_KVM From: Sean Christopherson To: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , Huacai Chen , Michael Ellerman , Anup Patel , Paul Walmsley , Palmer Dabbelt , Albert Ou , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Janosch Frank , Claudio Imbrenda , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, Peter Zijlstra , Arnaldo Carvalho de Melo , Sean Christopherson , Paolo Bonzini , Tony Krowiak , Halil Pasic , Jason Herne , Harald Freudenberger , Alex Williamson , Andy Lutomirski Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, linux-mips@vger.kernel.org, kvm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, kvm-riscv@lists.infradead.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Anish Ghulati , Venkatesh Srinivas , Andrew Thornton X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230915_173126_332653_9AE06D7F X-CRM114-Status: GOOD ( 13.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: , Reply-To: Sean Christopherson Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Wrap the helpers for getting references to KVM instances with a check on CONFIG_KVM being enabled, not on CONFIG_HAVE_KVM being defined. PPC does NOT select HAVE_KVM, despite obviously supporting KVM, and guarding code to get references to KVM based on whether or not the architecture supports KVM is nonsensical. Drop the guard around linux/kvm_host.h entirely, conditionally including a generic headers is completely unnecessary. Signed-off-by: Sean Christopherson Reviewed-by: Jason Gunthorpe Reviewed-by: Alex Williamson --- drivers/vfio/vfio.h | 2 +- drivers/vfio/vfio_main.c | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/vfio/vfio.h b/drivers/vfio/vfio.h index 307e3f29b527..c26d1ad68105 100644 --- a/drivers/vfio/vfio.h +++ b/drivers/vfio/vfio.h @@ -434,7 +434,7 @@ static inline void vfio_virqfd_exit(void) } #endif -#ifdef CONFIG_HAVE_KVM +#if IS_ENABLED(CONFIG_KVM) void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm); void vfio_device_put_kvm(struct vfio_device *device); #else diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index 40732e8ed4c6..80e39f7a6d8f 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -16,9 +16,7 @@ #include #include #include -#ifdef CONFIG_HAVE_KVM #include -#endif #include #include #include @@ -383,7 +381,7 @@ void vfio_unregister_group_dev(struct vfio_device *device) } EXPORT_SYMBOL_GPL(vfio_unregister_group_dev); -#ifdef CONFIG_HAVE_KVM +#if IS_ENABLED(CONFIG_KVM) void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm) { void (*pfn)(struct kvm *kvm);