Message ID | 20230916003118.2540661-2-seanjc@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:612c:172:b0:3f2:4152:657d with SMTP id h50csp1508443vqi; Fri, 15 Sep 2023 23:29:52 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyYjqbAg7yy29g/UNnWax121oSNwIHwzlw4Tnwsgu2MK57wirIA8Ctb8vmBm8caUQymWI2 X-Received: by 2002:a17:902:684d:b0:1bc:224a:45c2 with SMTP id f13-20020a170902684d00b001bc224a45c2mr7099623pln.15.1694845792395; Fri, 15 Sep 2023 23:29:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694845792; cv=none; d=google.com; s=arc-20160816; b=d8ch8x8jkVsSZQp/gMFw9ZIZR6Znn1PqqxcNrKjxFQe03rFX+OeUAfCxQh3hS8vXkn sggJwTcHsFWtTpPGI/O+zeEiTFwVSiae2yVLgXCiq9PwTxcOckfH0E+uIpNosZte4aac q6IZFL9uzBn73uMn54bfIo4hHsDwnZ6Nkzp3MwKHGs+X0WeIZ7syfHQNi42gqcyBnd23 9FT/ToYNDX/P5pcQSIaBnVA9iX/cIZvIM7yc1RPd3WRyWoT4Kf3QLSxbCm7RMP4zZoMJ bRBuRZUnX6AQB0VY4MqL5RRFXclVlQBSJpRQnfTDVWiAvgGUVUgjTp/A2WEDrX2l8xp5 FbMQ== 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=CcWcgzjI/Sjr3SKdjnMS4CWAtaq/GpOs1NzqJV8HV48=; fh=kXSkXFacTVTlVHq0XnHvR0iN61knZqi7sPJIGv3JAWo=; b=zBklaa3FAerbp7NP0x/wmHa8UEjkrmcGetYNAvlVLuvRvN9kohSDOmRSSYA7eGKVW1 V9zNVULnCwel4aBYb/JGH+bVvGUvNE9SFG//V9au2cahL+9PZOEM3oFQcly+Ei+DpWXP BEsC9ix69t1yhiDOPHjo1v+MTl/jjn4933td1yPtbViORv61QF3Tx2PCea4XTYsH4T1k p8fRAw5jn65MjksRhyLp5SqL+FU7GTubfMLQ23w6xtAiTqTw3GZtA5fdFV6dQbyW7VEV v0zIyqHlJwN+ObjVR4fNxG3hZIdFtoFNY4sR66A9O8h6NMS5LzA7/eX1QU91dhDrV+EJ wk6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OuiUuscc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id b14-20020a170902650e00b001bbb56b34e8si4589044plk.432.2023.09.15.23.29.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 23:29:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=OuiUuscc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 465B881668BF; Fri, 15 Sep 2023 17:32:55 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238560AbjIPAcW (ORCPT <rfc822;realc9580@gmail.com> + 28 others); Fri, 15 Sep 2023 20:32:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49942 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238620AbjIPAcL (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 15 Sep 2023 20:32:11 -0400 Received: from mail-yw1-x1149.google.com (mail-yw1-x1149.google.com [IPv6:2607:f8b0:4864:20::1149]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B79C11BC1 for <linux-kernel@vger.kernel.org>; Fri, 15 Sep 2023 17:31:23 -0700 (PDT) Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-59b50b45481so34126557b3.1 for <linux-kernel@vger.kernel.org>; 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=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=CcWcgzjI/Sjr3SKdjnMS4CWAtaq/GpOs1NzqJV8HV48=; b=OuiUusccrI1dBz823+RYFHRz4umrPXI3ePQ4joT6b9h1bX+K5wr0pKY7/NAepdzJ+8 N0LPT7ScUngYtOsaCgIuR7i0NDFbd/iuyX/GrqTub/2H4g8mBRJ3BiCuT/2TOAwOI+cU 31c1gRAfBEXY5+SsEVVK2ewPce5CCjAGwumjaXeiPEVU4dwXIS052fKYD6sdA5hNbwNK qbKbpVfZxrbUEcdWAfvmCIASXx1xeaTzzZDXfGsA4bSki6ozzrhs6AIP0SLDD8UbOeSl uVwl7/q4+nHxHIghDOEdOOXBUrmqaOd95gA7v28rO2+NtD7uAdx8RfT83WmbxuPgeTO9 DIuQ== 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=tgeWtPngB4APmlaBGLkQk+jRVqZW1oDoQA4Pf2hXtB/1l7HjEDZvfHvNG8wmzGU0Df 3ilsDNMscQSEg9CKDRsJuDWEpge5XGFqNor+2LTXBnEB8IpoKyZJOXqpLutliIptyCKS bPhnhKanNlMCF7eOmFuH8RshvqCgxvMpUbmGy8mesKi6lYJqn4nxxT31YpkbEwY7GIz4 HqsJcdqATCx+3yzk2NsaQzyW8X1B91bxMmFChIdpiBA8ADhBnfM/iwNNHP7E4dVjosNY jxG97Mj6C+lZtRvXeghI0BLFrtzqVhkx5W7kXUb8mQ5GeSm3L/+DKzMuDjqUwQN9bWzJ wfcg== X-Gm-Message-State: AOJu0YxLk9yUCr353UsOUnnSGIbnZtyDyKRagMyTZIsbCWGyFqq1trmT ko1uv0y5rh196bMqy0njatlYpnysDbE= 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) Reply-To: Sean Christopherson <seanjc@google.com> 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 <seanjc@google.com> To: Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Marc Zyngier <maz@kernel.org>, Oliver Upton <oliver.upton@linux.dev>, Huacai Chen <chenhuacai@kernel.org>, Michael Ellerman <mpe@ellerman.id.au>, Anup Patel <anup@brainfault.org>, Paul Walmsley <paul.walmsley@sifive.com>, Palmer Dabbelt <palmer@dabbelt.com>, Albert Ou <aou@eecs.berkeley.edu>, Heiko Carstens <hca@linux.ibm.com>, Vasily Gorbik <gor@linux.ibm.com>, Alexander Gordeev <agordeev@linux.ibm.com>, Christian Borntraeger <borntraeger@linux.ibm.com>, Janosch Frank <frankja@linux.ibm.com>, Claudio Imbrenda <imbrenda@linux.ibm.com>, Thomas Gleixner <tglx@linutronix.de>, Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>, Dave Hansen <dave.hansen@linux.intel.com>, x86@kernel.org, Peter Zijlstra <peterz@infradead.org>, Arnaldo Carvalho de Melo <acme@kernel.org>, Sean Christopherson <seanjc@google.com>, Paolo Bonzini <pbonzini@redhat.com>, Tony Krowiak <akrowiak@linux.ibm.com>, Halil Pasic <pasic@linux.ibm.com>, Jason Herne <jjherne@linux.ibm.com>, Harald Freudenberger <freude@linux.ibm.com>, Alex Williamson <alex.williamson@redhat.com>, Andy Lutomirski <luto@kernel.org> 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 <aghulati@google.com>, Venkatesh Srinivas <venkateshs@chromium.org>, Andrew Thornton <andrewth@google.com> Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Fri, 15 Sep 2023 17:32:55 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1777174621879301093 X-GMAIL-MSGID: 1777174621879301093 |
Series |
KVM: vfio: Hide KVM internals from others
|
|
Commit Message
Sean Christopherson
Sept. 16, 2023, 12:30 a.m. UTC
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 <seanjc@google.com>
---
drivers/vfio/vfio.h | 2 +-
drivers/vfio/vfio_main.c | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
Comments
On Fri, Sep 15, 2023 at 05:30:53PM -0700, Sean Christopherson wrote: > 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 <seanjc@google.com> > --- > drivers/vfio/vfio.h | 2 +- > drivers/vfio/vfio_main.c | 4 +--- > 2 files changed, 2 insertions(+), 4 deletions(-) Reviewed-by: Jason Gunthorpe <jgg@nvidia.com> Jason
On Fri, 15 Sep 2023 17:30:53 -0700 Sean Christopherson <seanjc@google.com> wrote: > 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 <seanjc@google.com> > --- > drivers/vfio/vfio.h | 2 +- > drivers/vfio/vfio_main.c | 4 +--- > 2 files changed, 2 insertions(+), 4 deletions(-) Reviewed-by: Alex Williamson <alex.williamson@redhat.com> > 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 <linux/fs.h> > #include <linux/idr.h> > #include <linux/iommu.h> > -#ifdef CONFIG_HAVE_KVM > #include <linux/kvm_host.h> > -#endif > #include <linux/list.h> > #include <linux/miscdevice.h> > #include <linux/module.h> > @@ -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);
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 <linux/fs.h> #include <linux/idr.h> #include <linux/iommu.h> -#ifdef CONFIG_HAVE_KVM #include <linux/kvm_host.h> -#endif #include <linux/list.h> #include <linux/miscdevice.h> #include <linux/module.h> @@ -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);