Message ID | 20180921082217.29481-9-rkagan@virtuozzo.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0C08714BD for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 21 Sep 2018 09:06:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF88929CAF for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 21 Sep 2018 09:06:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E1F212DBE4; Fri, 21 Sep 2018 09:06:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 7568229CAF for <patchwork-qemu-devel@patchwork.kernel.org>; Fri, 21 Sep 2018 09:06:38 +0000 (UTC) Received: from localhost ([::1]:54660 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org>) id 1g3HOX-0007tB-9m for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 05:06:37 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1g3Gi6-0006xs-KW for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:22:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1g3Gi4-0002O3-09 for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:22:46 -0400 Received: from mail-eopbgr70119.outbound.protection.outlook.com ([40.107.7.119]:27680 helo=EUR04-HE1-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from <rkagan@virtuozzo.com>) id 1g3Gi3-0002FC-Lx for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:22:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=virtuozzo.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=YDyrDD4lIelGwPlKQgr1Sm+T86tLFFf4SxZxVwg9nYg=; b=PrihhZH03pUu+bnBpuyVKAPj4goRGm3KzfcNTL0BFFxipl7u3jpuYJETs49nHaRrYMdOgRgCZWLY8Nrd/zhLXaw9aH+gQcOyAj8kll75/HzzlYvQp9SVbzpb26/XqrM+JQ2NKsjN+hkag9+CmIk6YRhicfSZZAXia0MjZMLiYMY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by AM0PR08MB3588.eurprd08.prod.outlook.com (2603:10a6:208:e1::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Fri, 21 Sep 2018 08:22:40 +0000 From: Roman Kagan <rkagan@virtuozzo.com> To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 11:22:15 +0300 Message-Id: <20180921082217.29481-9-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921082217.29481-1-rkagan@virtuozzo.com> References: <20180921082217.29481-1-rkagan@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: VI1P193CA0003.EURP193.PROD.OUTLOOK.COM (2603:10a6:800:bd::13) To AM0PR08MB3588.eurprd08.prod.outlook.com (2603:10a6:208:e1::30) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5f1ec611-6ac1-43bc-678f-08d61f9b6686 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3588; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3588; 3:Hhy5H5o/RTEykVJg/buWVjNT6wAjvPvz3dTGpxHw1fPN677kCLoKCvkSm59g++c7LjuvpsRe+eznPSMxV9C/BfXQDY7wNzs6sPkQGprGrYkVeeMv4uala/usf/QaR3cTziMQvrZ19y4HXUqpyKN1T2bTje6MDh78pr20Ij1RDONAn42oCNMfZGvQMDsSHOgsM9/aS0MdN/b0+ba6CSL9c7TCYFXCnIQ6dH3iwvXKrq03pMraMtzVKz+pq0jiYWMt; 25:Wo6Vg7W3f54EB9wApgemwukSMfrDT3rwL8aNGtBdWCyaHQZuNdT5Plt25oT2iKWwo4d2hVjxqWh4sWbAne5qHUW6bkDOQ7JtJ8YWRJtNSbf9gUVkPaJKjQwatIYKBOK9CBzvVK7gBNfro7XljyToLsvSMfd0vtkPmEYGrUDiITS/fc2ZpuZ2lSiO8nyisUu4yP/+jcHXwePSETxrnE87yt+WigusnhCxNMKyC2AiI73uOVxoOwfwjTdnYWkJlwduxUZGng9fnCZqfDFMcrjMIwIJ3V8NRdRz1ABcEl20MWZPQ0ZqahQWsT13bH2aTxVPHIjeW8skno+8vCDeKqpJ/w==; 31:rCjgKXkpd1WHWTr7BfY6ZnIK+g7n6ZvOJWo2Ptj202xO0pDK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<AM0PR08MB3588EADAF0375935EB6A11C2C9120@AM0PR08MB3588.eurprd08.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231355)(944501410)(52105095)(10201501046)(3002001)(149027)(150027)(6041310)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(201708071742011)(7699051); SRVR:AM0PR08MB3588; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3588; X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(346002)(136003)(396003)(39850400004)(366004)(376002)(189003)(199004)(6916009)(16526019)(5660300001)(36756003)(3846002)(54906003)(48376002)(6506007)(476003)(486006)(14444005)(52116002)(446003)(1076002)(76176011)(386003)(51416003)(186003)(6116002)(16586007)(2906002)(66066001)(6512007)(7416002)(50226002)(53936002)(25786009)(106356001)(53416004)(81166006)(47776003)(316002)(956004)(11346002)(2616005)(7736002)(8936002)(305945005)(8676002)(2351001)(105586002)(97736004)(4326008)(86362001)(6666003)(68736007)(478600001)(6486002)(2361001)(50466002)(26005)(69596002)(81156014); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3588; H:rkaganb.sw.ru; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: virtuozzo.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM0PR08MB3588; 23:SyLQ2lzh0RIh2bkshw9raEdN93t4UoFZQbeSLWtM0?= V23lq0HT2VG8aEqeSuNEqxKb2w2EpVYpZ053HNVa2for2K0VItoBBAPU2LDsNk0df5Q6xEJax8v524G5bxZNVkJBJuUpMeEGLyIMuznkEIS1uonicwsHh0B8XTuD5LKWPyh3P+Q3qK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l44b/izapTd8DAqIjIdig3TsIihEubksR0qYVQYNh6o+TeKs0S0bVe92k7GA5/17176nrdrnWHjts=; 7:K7j8p6aN1zMP2KKnwWHiKHZccIg2psK9XQhVB8cyjWeCFYf2XKnPv1Gf+lxcowMt0sf90U24g3DImDpCSvxIymjmQAVCi78wbjmWtPwSD1hjC3EqU/KGz8aLwfrCTdKJfzIPJ9xASQ4EduTIXmXzm9SVEvEUl4/cNCu/DBlU+1TytNwkNppiLV47DOhPBK4tltFkaTydcZa9TBE6yF3laHpPrpZavosT6XzBso0cI7CQGbuHR+V8Vkncg39LXEzP SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3588; 20:nQ68hGKPO0y21Qh3G2Yx1rNpqBXyerkl/YK2YVeOwZVGN84dsLfKsCbdoVphPSiM3bfz6+/u5QipmHxVSaIMHPY9MLmCfPaD3QAn/06bQvtYbsOw2kuZzvZMNa9HVaM5t2lTxKFmhQ4+qiqHvR+FZVfRMoDp8NKFE1x982xZRXg= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 08:22:40.8890 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5f1ec611-6ac1-43bc-678f-08d61f9b6686 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3588 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 40.107.7.119 Subject: [Qemu-devel] [PATCH 08/10] hyperv: add support for KVM_HYPERV_EVENTFD X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: <qemu-devel.nongnu.org> List-Unsubscribe: <https://lists.nongnu.org/mailman/options/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe> List-Archive: <http://lists.nongnu.org/archive/html/qemu-devel/> List-Post: <mailto:qemu-devel@nongnu.org> List-Help: <mailto:qemu-devel-request@nongnu.org?subject=help> List-Subscribe: <https://lists.nongnu.org/mailman/listinfo/qemu-devel>, <mailto:qemu-devel-request@nongnu.org?subject=subscribe> Cc: Vijayabhaskar Balakrishna <vijay.balakrishna@oracle.com>, Eduardo Habkost <ehabkost@redhat.com>, Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>, "Michael S. Tsirkin" <mst@redhat.com>, Venu Busireddy <venu.busireddy@oracle.com>, Liran Alon <liran.alon@oracle.com>, Paolo Bonzini <pbonzini@redhat.com>, Si-Wei Liu <si-wei.liu@oracle.com>, Igor Mammedov <imammedo@redhat.com>, Boris Ostrovsky <boris.ostrovsky@oracle.com>, Karl Heubaum <karl.heubaum@oracle.com> Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" <qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org> X-Virus-Scanned: ClamAV using ClamSMTP |
Series |
hyperv: add connection infrastructure
|
expand
|
diff --git a/hw/hyperv/hyperv.c b/hw/hyperv/hyperv.c index 5bb5126393..bf361de6f6 100644 --- a/hw/hyperv/hyperv.c +++ b/hw/hyperv/hyperv.c @@ -13,6 +13,7 @@ #include "exec/address-spaces.h" #include "sysemu/kvm.h" #include "qemu/bitops.h" +#include "qemu/error-report.h" #include "qemu/queue.h" #include "qemu/rcu.h" #include "qemu/rcu_queue.h" @@ -470,7 +471,7 @@ static void __attribute__((constructor)) hv_init(void) qemu_mutex_init(&handlers_mutex); } -int hyperv_set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier) +static int set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier) { int ret; EventFlagHandler *handler; @@ -503,6 +504,30 @@ unlock: return ret; } +static bool process_event_flags_userspace; + +int hyperv_set_event_flag_handler(uint32_t conn_id, EventNotifier *notifier) +{ + if (!process_event_flags_userspace && + !kvm_check_extension(kvm_state, KVM_CAP_HYPERV_EVENTFD)) { + process_event_flags_userspace = true; + + warn_report("Hyper-V event signaling is not supported by this kernel; " + "using slower userspace hypercall processing"); + } + + if (!process_event_flags_userspace) { + struct kvm_hyperv_eventfd hvevfd = { + .conn_id = conn_id, + .fd = notifier ? event_notifier_get_fd(notifier) : -1, + .flags = notifier ? 0 : KVM_HYPERV_EVENTFD_DEASSIGN, + }; + + return kvm_vm_ioctl(kvm_state, KVM_HYPERV_EVENTFD, &hvevfd); + } + return set_event_flag_handler(conn_id, notifier); +} + uint16_t hyperv_hcall_signal_event(uint64_t param, bool fast) { uint16_t ret;
When setting up a notifier for Hyper-V event connection, try to use the KVM-assisted one first, and fall back to userspace handling of the hypercall if the kernel doesn't provide the requested feature. Signed-off-by: Roman Kagan <rkagan@virtuozzo.com> --- hw/hyperv/hyperv.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)