Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp319783rdb; Mon, 18 Sep 2023 16:49:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFxiB3pVpfq4RwFsPBUuGjCb+eulqXd/0d+iCpxbf9Yx4XDEAhKyoaXlZpdX2AKh/SkOND2 X-Received: by 2002:a05:6a00:2451:b0:68b:ee34:9729 with SMTP id d17-20020a056a00245100b0068bee349729mr9779326pfj.24.1695080966534; Mon, 18 Sep 2023 16:49:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695080966; cv=none; d=google.com; s=arc-20160816; b=hEYGgzSOdNEb7faVKrwbLpK0qvAVmeEoD7i4pL+imXdseXuKypddb3icGQWiTwiMkP deGn+W2upm+xiUlkFOedSvyrlHvQhPQJDIpUukneU87yzp9udFeMeum7x+WG1c93b446 llQ42JG4RYWyGZyrCGm2wdTTaGRQphXS9mAhQJPe/XlYaWRPchcHBcK4cgRdoj2yEM7v A4cAfnUVYih7SGTk+FUYl50NdyiOwvILkseqvl2J40Igl9kSriP3upVewAgxqRthYUXl 31Emr1WVmfbFONG5taoMG3dInBOpYyp6xj3J2PHcUerFnxeQX02r/ky9f9bovKDp+vB9 deqQ== 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:dkim-signature; bh=2U3xsG0fg5xdFpPmP8zowhEzmg+gfxwbZh9hlXMaF+c=; fh=AghDzVtIMQbD5leC+cJqzX02jv06w/vPh/87V9gVQzM=; b=rNyX+G+HPoc/ll7TVkrpUM/z0GFsVrce4SBpeNsf/Yyv4zUiaoYUvdUyamyXu71eTz VWArN/c+BwXXLl7ZEjuM/mAwpT/Ht/rvpND4ouYduJD8dplluzR72l8G7hncM6Xa8fSx DhKIsZ7IiKSzurFCVeTjJ+g9NLImgFQikI4/f+snxpMMYTOKxwIVY1CKUou0mSQK5u34 um+4R0YOvorjrSKjDD+UPpop3zmowNHYs6IfLYaNYGWUFktMGdm1VnyMfuHz7qxsuEP9 C8cfIOPmx7kvwRYhzNPMh4oMLxVlve6m4y5Ypd45hA4lHnlw4ye0tVFNqMkmdpM7Uc/O UODg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Xq+bULNz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id ef6-20020a056a002c8600b0068a3c575900si8662035pfb.84.2023.09.18.16.49.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Sep 2023 16:49:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=Xq+bULNz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (Postfix) with ESMTP id 259428041962; Mon, 18 Sep 2023 08:58:01 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229838AbjIRP54 (ORCPT + 99 others); Mon, 18 Sep 2023 11:57:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229815AbjIRP5y (ORCPT ); Mon, 18 Sep 2023 11:57:54 -0400 Received: from mail-pl1-x64a.google.com (mail-pl1-x64a.google.com [IPv6:2607:f8b0:4864:20::64a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2599BFE for ; Mon, 18 Sep 2023 08:56:12 -0700 (PDT) Received: by mail-pl1-x64a.google.com with SMTP id d9443c01a7336-1c4375c1406so22687275ad.1 for ; Mon, 18 Sep 2023 08:56:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1695052362; x=1695657162; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=2U3xsG0fg5xdFpPmP8zowhEzmg+gfxwbZh9hlXMaF+c=; b=Xq+bULNzXtlK9fQ1gwep/ALD5g9KBT8NdqTZAMyLJSUU0LH0IUGMKfe2VTQdNrHL5Y UfsG6Fx8+BGtX+P9MhPlJ87fVrPojrpieBn7WhVUHFk+Mcc6QFQuYMEljzOv3krULNmI WoUBThqa1u+YktUZmud48otH1zrunEhvv5FVfw0nrjvXJR8cwQ8yHM7bGuv3pXgztj03 iNxtXNA7emoYxaAwD4Yb8z7WaekcG/vOtAvipseGnNEWbJ3JxcikoGcP1dL7XUNtCSLw NA6nDlgsQD860uV4WUZzEgAcTocSVoZd3doqHpcpySL/ybGURSvz3fvSuf6KA9iCsMxj 8fzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1695052362; x=1695657162; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=2U3xsG0fg5xdFpPmP8zowhEzmg+gfxwbZh9hlXMaF+c=; b=BbJmsvjAzrJZznyAeOZ/yjGsfSGCZHt5zIcDdFXf9pkDrUc8eHsulHf89IBufgpYOR k9hAySkn31MjVMpfpugf1gUKUfp9ljLDNie3R6nY5jmBzyV4alhxxa6aNrwF1ZTuTite dVZilBKbOWdIDpLXvWXZjdaPWQxFCzb8OYGdpgIWKfsokq81OFlVWPa2WELTjT0ENt/w yjIsAOQ/dcvQiXfMIiSbLarvEfOjJ7RbVDuIcQf5k57+Z/vPREJ5QJZL1OoWMpX/HJtx yqnZPJb6ixplFo37eTXlxYZgTkgx20TbyfU7wrBCA9CnWRzsUdqX8KlTkVZwQXRihifE FgDw== X-Gm-Message-State: AOJu0YxAtrPWDvRPA7xHElnncW0xuFhRCKaBXwlaCpdQx2mt1zyNiWV2 wotfdpY7qZFwNQQ2B2wiGVg004laSIM= X-Received: from zagreus.c.googlers.com ([fda3:e722:ac3:cc00:7f:e700:c0a8:5c37]) (user=seanjc job=sendgmr) by 2002:a17:903:41c2:b0:1c1:fbec:bc39 with SMTP id u2-20020a17090341c200b001c1fbecbc39mr210522ple.4.1695052361665; Mon, 18 Sep 2023 08:52:41 -0700 (PDT) Date: Mon, 18 Sep 2023 08:52:40 -0700 In-Reply-To: <20230918152946.GJ13795@ziepe.ca> Mime-Version: 1.0 References: <20230916003118.2540661-1-seanjc@google.com> <20230916003118.2540661-7-seanjc@google.com> <20230918152946.GJ13795@ziepe.ca> Message-ID: Subject: Re: [PATCH 06/26] KVM: Drop CONFIG_KVM_VFIO and just look at KVM+VFIO From: Sean Christopherson To: Jason Gunthorpe Cc: 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 , Paolo Bonzini , Tony Krowiak , Halil Pasic , Jason Herne , Harald Freudenberger , Alex Williamson , Andy Lutomirski , 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="us-ascii" 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 lipwig.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 (lipwig.vger.email [0.0.0.0]); Mon, 18 Sep 2023 08:58:01 -0700 (PDT) On Mon, Sep 18, 2023, Jason Gunthorpe wrote: > On Fri, Sep 15, 2023 at 05:30:58PM -0700, Sean Christopherson wrote: > > Drop KVM's KVM_VFIO Kconfig, and instead compile in VFIO support if > > and only if VFIO itself is enabled. Similar to the recent change to have > > VFIO stop looking at HAVE_KVM, compiling in support for talking to VFIO > > just because the architecture supports VFIO is nonsensical. > > > > This fixes a bug where RISC-V doesn't select KVM_VFIO, i.e. would silently > > fail to do connect KVM and VFIO, even though RISC-V supports VFIO. The > > bug is benign as the only driver in all of Linux that actually uses the > > KVM reference provided by VFIO is KVM-GT, which is x86/Intel specific. > > Hmm, I recall that all the S390 drivers need it as well. > > static int vfio_ap_mdev_open_device(struct vfio_device *vdev) > { > struct ap_matrix_mdev *matrix_mdev = > container_of(vdev, struct ap_matrix_mdev, vdev); > > if (!vdev->kvm) > return -EINVAL; > > return vfio_ap_mdev_set_kvm(matrix_mdev, vdev->kvm); Ah, I missed that the KVM reference was routed through VFIO in that case. > I wonder if we should be making the VFIO drivers that need the kvm to > ask for it? 'select CONFIG_NEED_VFIO_KVM' or something? I wondered the same thing, if only to make it easier to track which drivers actually end up interacting directly with KVM. > Regardless, I fully agree with getting rid of the arch flag. > > Reviewed-by: Jason Gunthorpe > > > --- a/virt/kvm/Makefile.kvm > > +++ b/virt/kvm/Makefile.kvm > > @@ -6,7 +6,9 @@ > > KVM ?= ../../../virt/kvm > > > > kvm-y := $(KVM)/kvm_main.o $(KVM)/eventfd.o $(KVM)/binary_stats.o > > -kvm-$(CONFIG_KVM_VFIO) += $(KVM)/vfio.o > > +ifdef CONFIG_VFIO > > +kvm-y += $(KVM)/vfio.o > > +endif > > I wonder if kvm-m magically works in kbuild so you don't need the ifdef? Yeah, that should work, no idea why I added the ifdef.