From patchwork Thu Dec 15 11:52:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Wang, Wei W" X-Patchwork-Id: 33580 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp305434wrn; Thu, 15 Dec 2022 04:00:13 -0800 (PST) X-Google-Smtp-Source: AA0mqf4qE/cqhB6r9x0XYWQMxcUfDci7G5JuvLyoQUEdhV+Ugc6KXO6jZyILnbd76tTpBtSln1Sc X-Received: by 2002:a05:6402:1641:b0:46c:aa8b:da5c with SMTP id s1-20020a056402164100b0046caa8bda5cmr27818584edx.33.1671105613230; Thu, 15 Dec 2022 04:00:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671105613; cv=none; d=google.com; s=arc-20160816; b=EIonI/qGojRgu4ZIBSjHVrvehekv+C1a0HDuzTuIyNd1+xbqfE2/ypvE5nTgelvPIu hWEi3RILVcKgwk+2hvAMoz/4Fu7q5AFKAkc80U/VBXxsKs6UAEbN8b/HfF3mOlJbEmGl 2rqF7ku2/T3fcst5Fj5KvJBOghOreP8co0b9FQhd1rV7cVjdOeWvgPrR1LDCYfQEY772 ESIS4dh+net8dxdFwaVblqmISGXkVsfLqfbOG4xf3IQ6fiVSm4PV6K6BoMAushqAGAZV 9c6PMl8DpDhy6oX23o0PjotOasarc+zyFE3nopalNMcRHDjTy6qZR9y0wftTOPT3EyrB 4zcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=EP9NC6+Eeh1IMvEUCY5JSjhY0jF7Osoi477P7/iLSjE=; b=0hvPMxxmFHcLMZIuWnECsXnizH+IntmVEE4yuLxn+f/ROmplNfWR6Onq6ez+Om4uVu 7TcqEexx1fGeQfhIzE7c6dj/79r3lO2yT7UuEmtC730wCZRhYVkpncOrdqqTl/S4xPl1 oktZiIQ0dKJsMeM/oca746iHll9OPuKKg+V+nS821FKxrTZtyC/s+VpT2mwNb/9J/eVv 8TvXMOW2z7VMo/EZCKhRZ9I1Ttdhw5EPMF8Mpx1Xs+B+r/QrbmWpSz8C4pfjFCiJjDDf G8LxwBDwkeRSBWbS8UlIYuO/H0SD83T0UQB34Uqq2NpbhHd4DwyikIQH3xn4buSxDN/S c66g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I43HxyMz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o8-20020a50fd88000000b0046a8fe6d173si13737902edt.456.2022.12.15.03.59.49; Thu, 15 Dec 2022 04:00:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=I43HxyMz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229815AbiLOLwP (ORCPT + 99 others); Thu, 15 Dec 2022 06:52:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229635AbiLOLwL (ORCPT ); Thu, 15 Dec 2022 06:52:11 -0500 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D86C81FFB7; Thu, 15 Dec 2022 03:52:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1671105130; x=1702641130; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=qKv8YzwKV8F4cKvrnTDTKO+eHs8skuBa0gr084Ivhzw=; b=I43HxyMz3m2qvosVlIBHsSN9eIKLe8H129/EhDnH8dSikLd7SEBEjlXW hIqRGLcS+70GvVMCQZW27AURxXFx8RYZasCIaEe+5eUadIbLc1GDYvxKh 1QrXUg893Znelv1xXR8faQIVHY2md0eiijsX65O/0yOBmevLhYsv245hI yGhUtJYOOJs5K2hC37gHL1rhy1aKqcOSMtD5hYgoNPhOUrflDOM4YM+oI qfjfZllQEWghDpz4wsiaa9vD6H4D2FJqeXw+Zcq9399hsbrKge9YYnFwS VWMbavedKaIrvXZhBc8p7wLBByXbHZ5bSw7gLBZ+jrVXw/G6iHWVTN3T4 Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="345743395" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="345743395" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 Dec 2022 03:52:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10561"; a="791606570" X-IronPort-AV: E=Sophos;i="5.96,247,1665471600"; d="scan'208";a="791606570" Received: from tdx-lm.sh.intel.com ([10.239.53.27]) by fmsmga001.fm.intel.com with ESMTP; 15 Dec 2022 03:52:09 -0800 From: Wei Wang To: pbonzini@redhat.com, seanjc@google.com Cc: kvm@vger.kernel.org, linux-kernel@vger.kernel.org, Wei Wang Subject: [PATCH v1] KVM: x86: add KVM_CAP_DEVICE_CTRL Date: Thu, 15 Dec 2022 19:52:07 +0800 Message-Id: <20221215115207.14784-1-wei.w.wang@intel.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham 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: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752281239584062639?= X-GMAIL-MSGID: =?utf-8?q?1752281239584062639?= KVM_CAP_DEVICE_CTRL allows userspace to create emulated device in KVM. For example, userspace VFIO implementation needs to create a kvm_device (i.e. KVM_DEV_TYPE_VFIO) on x86. So add the cap to allow userspace for such use cases. Signed-off-by: Wei Wang --- arch/x86/kvm/x86.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 69227f77b201..1cdc4469652c 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -4410,6 +4410,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long ext) case KVM_CAP_VAPIC: case KVM_CAP_ENABLE_CAP: case KVM_CAP_VM_DISABLE_NX_HUGE_PAGES: + case KVM_CAP_DEVICE_CTRL: r = 1; break; case KVM_CAP_EXIT_HYPERCALL: