Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5135972rdb; Sat, 16 Sep 2023 04:42:08 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHvrXdeQ/6WsZIyHAZVXUhfJq7lZVsnzCV98FFvzPXuChc211W45TNOJrZEfRjhcnpA4pF0 X-Received: by 2002:a05:6358:913:b0:142:fb84:92e6 with SMTP id r19-20020a056358091300b00142fb8492e6mr3925278rwi.9.1694864528392; Sat, 16 Sep 2023 04:42:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694864528; cv=none; d=google.com; s=arc-20160816; b=fK5O7hc8cBwWdXJUT6F92QYWBNI+R67KDwkYxcj400ljtfBl9+52+yuDfDc0v+yl8c WWBQ3QEhsGc/UOoUSwE5PpdG1TfvdeTDz2bdbLl0EJVZMQtMx8kErmiibJ3UErQTaD5a hmPoYqGg5Oupg7MP3D7iL2blEP0nvs6N2S2E14ubea/R2llhshYNJoCbhiSqDOKcuGqQ y29KFnOVOgUc0kIGk14/6HquUhvi9V20Uiq6wt2G7RPt/e28Hw7ZMBCtEdqme0oy4DKR iXwKc74XqetwhRR9TFWO35MRJdEzFd8AEyHs8uxjhpsFB0vkC7nBU2UQKgb8Gf6+hf8o RVYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:reply-to:dkim-signature; bh=nWWn+h7amRZMBDw3vQNPHGAGWvxVaFdsCPW0ONMozkY=; fh=kXSkXFacTVTlVHq0XnHvR0iN61knZqi7sPJIGv3JAWo=; b=jVs1OyypfzXX/niT5pCDavhJCZjM0oqB7ic5WzqWelTB49z/XaRv7bOLcWfkFXFNzR pwKLFmROBfxuDJKkVi2buH6qKWpLAHmUS0WzszNcP4DnOV7omfgkbhblggu7pec2ZDdr hBHHJZNazxlcW1H0Deseum1L5e35qYxNYNeb4XeOKh7OaU+iRdO5H8ITZfKyCA4uuLRt v/13/2nUd2nkK+Pmg9A/jJ/d4qdImienS1pzaz1vEIZ91BE6F5z/fz+1gX4/JW3juyV+ kCKWHCQZ1aM3JBC6xNkFPOx4Cg5DE8rRmntIc1eMu4faSdDdCd+NCraSV24VeCRxjDyr 4tcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=iZkx+4Z1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id ck15-20020a056a00328f00b0068beee4922csi4938273pfb.23.2023.09.16.04.41.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 04:42:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=iZkx+4Z1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id EF66C80268F5; Fri, 15 Sep 2023 17:32:51 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238342AbjIPAcS (ORCPT + 99 others); Fri, 15 Sep 2023 20:32:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34172 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238668AbjIPAcP (ORCPT ); Fri, 15 Sep 2023 20:32:15 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 72A6D1BD4 for ; Fri, 15 Sep 2023 17:31:27 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-d7ea08906b3so3161807276.1 for ; Fri, 15 Sep 2023 17:31:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1694824286; x=1695429086; darn=vger.kernel.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=nWWn+h7amRZMBDw3vQNPHGAGWvxVaFdsCPW0ONMozkY=; b=iZkx+4Z1668sMxI2NjINFfskMHO4HshWvqApQj+yXolwCZslseI+2rqTps5ehLAbhe xACwkYE+MrnGahGR5lxszwUfirkQ1qDmLL0jvr4KxJYU8Xb6viI9iX4c1edff9cgGvuE g9DozZ8QgAycpWplDf24pZjIytOEO0yhT85jShSSJOl6iGDfVV5kbFjSlxVMjbWkJP2+ XEeW5U/2J0KXuWha1pVCmzPwol+60L7/9xnburMEzuMAVRG0oNFkDP/7y07ssELOaZoL 6UGWLPtm3AEAsip/b1wJ2c/YkWSRE4hy4F2NWAkmrJ+wFFtZm3gY0x4dgbrG/v5JCTsZ 1Hwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694824286; x=1695429086; 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=nWWn+h7amRZMBDw3vQNPHGAGWvxVaFdsCPW0ONMozkY=; b=dXh9uFQoeDpa1uR/g280dxcwooMphOzSMfNOTgRaNcdK/uzsOogHG1/iBmUDDnF0PB mJjF0u+jAoh+x+ENq6Ttlk9Iwz0jNSYx0eBnybglei6mFC70NEN5FLMG/eF/8lYslYjj LDzgCCEIiVAHIOSoCrTvdc6aDYBvqFrjDptnLaWargdyZiivuriGLALi1S4rSgpkzz2J 3VBVEMZuJhDL6kNb6XYDagF/FI9Era20wCLoBAbX3FWhWcFz63r0m0kOXOj511ZxFGfx r7uyOy4EGJiuHK7d/hEkU5OfRTFbwd8HXzX0OtYgmNZrcvKb7x/RmKlVMFDyk87psIYY c96A== X-Gm-Message-State: AOJu0YyKe9v42ozZaKGm2qkWgpHrum/FR7WjEUVcVY8xeeOLf0ZIjAhM BSSo8Zat8wggrXKg3JSbBIZR+yKS2Vo= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a05:6902:98b:b0:d81:5948:970 with SMTP id bv11-20020a056902098b00b00d8159480970mr72987ybb.13.1694824286666; Fri, 15 Sep 2023 17:31:26 -0700 (PDT) Reply-To: Sean Christopherson Date: Fri, 15 Sep 2023 17:30:55 -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-4-seanjc@google.com> Subject: [PATCH 03/26] virt: Declare and define vfio_file_set_kvm() iff CONFIG_KVM is enabled 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 Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.4 required=5.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Fri, 15 Sep 2023 17:32:52 -0700 (PDT) Hide vfio_file_set_kvm() and its unique helpers if KVM is not enabled, nothing else in the kernel (or out of the kernel) should be using a KVM specific helper. Signed-off-by: Sean Christopherson --- drivers/vfio/vfio_main.c | 2 +- include/linux/vfio.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/vfio_main.c b/drivers/vfio/vfio_main.c index 6368eed7b7b2..124cc88966a7 100644 --- a/drivers/vfio/vfio_main.c +++ b/drivers/vfio/vfio_main.c @@ -1352,7 +1352,6 @@ void vfio_device_put_kvm(struct vfio_device *device) clear: device->kvm = NULL; } -#endif static void vfio_device_file_set_kvm(struct file *file, struct kvm *kvm) { @@ -1388,6 +1387,7 @@ void vfio_file_set_kvm(struct file *file, struct kvm *kvm) vfio_device_file_set_kvm(file, kvm); } EXPORT_SYMBOL_GPL(vfio_file_set_kvm); +#endif /* * Sub-module support diff --git a/include/linux/vfio.h b/include/linux/vfio.h index 454e9295970c..e80955de266c 100644 --- a/include/linux/vfio.h +++ b/include/linux/vfio.h @@ -311,7 +311,9 @@ static inline bool vfio_file_has_dev(struct file *file, struct vfio_device *devi #endif bool vfio_file_is_valid(struct file *file); bool vfio_file_enforced_coherent(struct file *file); +#if IS_ENABLED(CONFIG_KVM) void vfio_file_set_kvm(struct file *file, struct kvm *kvm); +#endif #define VFIO_PIN_PAGES_MAX_ENTRIES (PAGE_SIZE/sizeof(unsigned long)) -- 2.42.0.459.ge4e396fd5e-goog