From patchwork Fri Sep 21 08:20:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roman Kagan X-Patchwork-Id: 10609339 Return-Path: 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 B7B8214DA for ; Fri, 21 Sep 2018 08:46:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A834E2DDA6 for ; Fri, 21 Sep 2018 08:46:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9AC5E2DDAB; Fri, 21 Sep 2018 08:46:15 +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 1D9EC2DDA6 for ; Fri, 21 Sep 2018 08:46:15 +0000 (UTC) Received: from localhost ([::1]:54526 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3H4o-00057Z-9P for patchwork-qemu-devel@patchwork.kernel.org; Fri, 21 Sep 2018 04:46:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48272) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g3GgO-0005Jp-FO for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:21:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g3GgN-0006OS-Fm for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:21:00 -0400 Received: from mail-am5eur02on0701.outbound.protection.outlook.com ([2a01:111:f400:fe07::701]:6116 helo=EUR02-AM5-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g3GgN-0006Hi-45 for qemu-devel@nongnu.org; Fri, 21 Sep 2018 04:20:59 -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=wsaBS7wWhWtse3v9YbFQ30ojySqO9vfaJeClT/4ncJk=; b=eIR+M5nSqzpkjyshdd0X3tIJCKiLkZoJ7MgYSjKvaDN++EuCWkBzPObxJnm01E2VUmNYBymhbHQn+zWn4sC/ucEBZz5HYTliYvhSLNt30TyAx8VTlqezXqi1w6e8uDODnHbgCKdOWUpjfEd7BMSCzOx9WGsbL6iCfGZo0qYecOI= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=rkagan@virtuozzo.com; Received: from rkaganb.sw.ru (185.231.240.5) by AM0PR08MB3585.eurprd08.prod.outlook.com (2603:10a6:208:e1::26) 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:20:56 +0000 From: Roman Kagan To: qemu-devel@nongnu.org Date: Fri, 21 Sep 2018 11:20:41 +0300 Message-Id: <20180921082041.29380-6-rkagan@virtuozzo.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180921082041.29380-1-rkagan@virtuozzo.com> References: <20180921082041.29380-1-rkagan@virtuozzo.com> MIME-Version: 1.0 X-Originating-IP: [185.231.240.5] X-ClientProxiedBy: DB6P18901CA0005.EURP189.PROD.OUTLOOK.COM (2603:10a6:4:16::15) To AM0PR08MB3585.eurprd08.prod.outlook.com (2603:10a6:208:e1::26) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cac2b7d1-2849-453d-6cea-08d61f9b283f X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(2017052603328)(7153060)(7193020); SRVR:AM0PR08MB3585; X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3585; 3:TqdQVgDnjBacjwrDk1PGyWyE2jd/wN0AnQ5pTKPfr9BY49p+rpLXjYs0MOa0UO6OpC/jAWmwaUcjnHZeLStwrVkrh9Bms21wf5cWcHmnA+JlKIaL2nvI3MlS0AcDncD5Blvbv+WaAxmTQHtZ/im84OGzet5XOmvaDIRSoTOk1y0+8Hr8kXOsI9dx75EPK9Pe1epLg+0yyFtpathHs3KyXqi+c7go5jUINK87c/IWHrzns+d1sTHe67u0gYBGidvl; 25:5kTNet0FQkbYTOgxrC7kPkYpkztnZ4M92bJEnqnSGX2IifsbL64OUYzmpKRTTAt0OcunqcZHmvnS/fOaCrC2gSnyDCwZWdfMqwH4mbx0YvVc/p77X3VfTtjzcGBybEOExnaXlhxAlgdvVV+OBuqk6R0ZRKrkpt0BN7dF2gAnM9SMTkZIxlCKqc9Qq43MOI0XOZVaDbd/OJnenUCKpxApwHXYooZ5CBjkVpnEnngJg3kldY/oOSXkZiiK0+AgBcveKDyLDqTZVYZThC/rqzfN1IfbEjG94y87bQRyrbZHBhZ4mV3DDq55OhIVPrdrnJAzZHTQ4m1p7WtCiPIYon1PDg==; 31:2fTFliFZrS49lfb+xayM4YI2344HGyvSbEGh7yCilPzZzF5Nim8DfyQSJeRq6h/YV4xdPpfds02SYlhBqtznpLiHslV8Linp9c5aCgDa3yPpn+Mx4IIOltyTwXrW42UGEtAoVBd5kuX2cRb7KDE6/dQ4iqBwdOqaYOXNiDJRsYvn6HgTd/ih4xtQGeJY1IJ0u37pe3lzJw3GRqA3vYE3ypHR2iPshV+paGGFq8lDq3E= X-MS-TrafficTypeDiagnostic: AM0PR08MB3585: X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3585; 20:CXqhtP+VaLmLlWQwmrTr/m6AIgfHIQINp//Y8f9/Z93yrezPxXWQot1pNAB6YIs+S+w+YSppLPcLxEcbg3/1FTffL85qhTPnY6tqX59GH5evtv/qJA0mUCFSZuhmhRZGl88eswjx0qZr1Nu+LZ6mvd2OKytHVekd9CXuvsCwGp7f9LhRqpDWu/vf8tIX49nx4j/Z75795y+fXnLSUI3wz1wm2oYFJBBAOYVK3+vOq8MuYdyd/xvkjz+4xpnoMgS5tInoS8MrDI1kqr6LFOmcxy/9PdvQdncqXVZeGv7CKOm2MLrnDwOIFt9mXXdU6STrivmd78uZ4Dse1V3GH6wNieEhJnZ3Y4p6q1c8vUsudHqxq3+D9CokECcc/z4HxXsoc62SOJxdnI48cAfaM21GJE/IQQDGuBbCM6WOp1PgIPVQfa+AgiFVziYrq6xvxD16Es9PK6S8ydQsV3roD1JKmTN8HPDqhu/Otu7Mi/jTJX5xS1wKchYKCaTpCmvclQnN; 4:sOeIx1xV2uCBxJCt/1W1U6mJU1jr8+5pvr3JCPIpLj7KJ8DElrKlNRkePB5UWeDbsuSDQo/jIND5/1qxrY0Piw5ScbR6liaE5Vg0MhX5LRg3xT9mFrCegN9fr9t9Rv4yNZx9Xi3j/BP+m3+hVpLlzABGPfyTFpkO4vXzCdQh3xI3Enwe/ja/nDeBHxZFrmjO51VB/5x7j7/xBSldY2F8SXdJa+C5M+qEsIiobPDPioJgPnxSCUVO5CebISZzP4OqUKgcvxsHzmoXneHJNYNEsg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(149027)(150027)(6041310)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(201708071742011)(7699051); SRVR:AM0PR08MB3585; BCL:0; PCL:0; RULEID:; SRVR:AM0PR08MB3585; X-Forefront-PRVS: 0802ADD973 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(376002)(346002)(366004)(396003)(136003)(39850400004)(189003)(199004)(86362001)(6666003)(4326008)(2906002)(16586007)(7736002)(305945005)(50466002)(50226002)(16526019)(52116002)(51416003)(478600001)(6506007)(956004)(2616005)(8676002)(186003)(476003)(6916009)(54906003)(3846002)(48376002)(25786009)(6116002)(26005)(2351001)(386003)(316002)(47776003)(14444005)(53936002)(5660300001)(36756003)(7416002)(105586002)(11346002)(66066001)(446003)(486006)(1076002)(6512007)(6486002)(68736007)(53416004)(81166006)(2361001)(97736004)(76176011)(8936002)(106356001)(81156014)(69596002); DIR:OUT; SFP:1102; SCL:1; SRVR:AM0PR08MB3585; 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; AM0PR08MB3585; 23:S+zoBKXIESlEAnUXWa8V3m6ZaYLUrhfDUQVAGlT21?= uQVn5ZeGqJ2ja53oAFegk+BjEJk/CtuY0QEY5L7gdhHfPR/Sx9IbeGLM10p/zp6xj1LXU3t7wQEXqbSyXRpyil84JctEfeZqccT6jsReqXPW7QIYFAtfWBQklrzcWEd5gZnzh0BRz0Xtq/EGX3n89hn+etG/72m+FdQ0HNpo7lv+NG1cMDlPwyKzA3tCjbCazASDEQkSNXsEhUr//SvgOGWP6/vTIkb+xr9xr5kqRCuqIDTGSO5zhE+jVp+K+WGV3ahu3kZLkZ7VtYcfCSc9+EB/XvIdaVsMmSdsFEm0sQXBWGZtJOHEhwiw4/tlw9tW0niRpdDqnUl1RrbB55PuQu6KE/1Wrlb2B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9U1VM4IAqqHvDs9fR/r0hwOgFt3K1yyrurgp1Wix1aezGiVldK+1w/nLTUcnFxLVZDwD5xSgqX2EadApXYxZktvyfC1MM1eLUoz3Dzj56DkaAmsCm7g38k/Zc5+VtBJL99S SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR08MB3585; 20:OPsIszxuQuna/UQcayVxxqmf2gO624gBGMmCIB9YDpAwRqM0Z5T4BcUCp3E61Oqfaw2tJXEepbAPjfyFNiwCiGPCAOHpFYymbt6we87KA7S+gDixSKM6XB0xpGgyM4gHq0TItYFqyDzprsb56ayOurOZg26fQdmANSBWLXkLZZk= X-OriginatorOrg: virtuozzo.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Sep 2018 08:20:56.4253 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cac2b7d1-2849-453d-6cea-08d61f9b283f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 0bc7f26d-0264-416e-a6fc-8352af79c58f X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR08MB3585 X-detected-operating-system: by eggs.gnu.org: Windows 7 or 8 [fuzzy] X-Received-From: 2a01:111:f400:fe07::701 Subject: [Qemu-devel] [PATCH 5/5] i386: add hyperv-stub for CONFIG_HYPERV=n X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Vijayabhaskar Balakrishna , Eduardo Habkost , Konrad Rzeszutek Wilk , "Michael S. Tsirkin" , Venu Busireddy , Liran Alon , Paolo Bonzini , Si-Wei Liu , Igor Mammedov , Boris Ostrovsky , Karl Heubaum Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP This will allow to build slightly leaner QEMU that supports some HyperV features of KVM (e.g. SynIC timers, PV spinlocks, APIC assists, etc.) but nothing else on the QEMU side. Signed-off-by: Roman Kagan --- target/i386/hyperv-stub.c | 33 +++++++++++++++++++++++++++++++++ target/i386/Makefile.objs | 4 +++- 2 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 target/i386/hyperv-stub.c diff --git a/target/i386/hyperv-stub.c b/target/i386/hyperv-stub.c new file mode 100644 index 0000000000..cba4ce774e --- /dev/null +++ b/target/i386/hyperv-stub.c @@ -0,0 +1,33 @@ +/* + * Stubs for CONFIG_HYPERV=n + * + * Copyright (c) 2015-2018 Virtuozzo International GmbH. + * + * This work is licensed under the terms of the GNU GPL, version 2 or later. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hyperv.h" + +int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit) +{ + switch (exit->type) { + case KVM_EXIT_HYPERV_SYNIC: + if (!cpu->hyperv_synic) { + return -1; + } + + /* + * Tracking the changes in the MSRs is unnecessary as there are no + * users for them beside save/load, which is handled nicely by the + * generic MSR save/load code + */ + return 0; + case KVM_EXIT_HYPERV_HCALL: + exit->u.hcall.result = HV_STATUS_INVALID_HYPERCALL_CODE; + return 0; + default: + return -1; + } +} diff --git a/target/i386/Makefile.objs b/target/i386/Makefile.objs index 04678f5503..ca85de79d3 100644 --- a/target/i386/Makefile.objs +++ b/target/i386/Makefile.objs @@ -4,7 +4,9 @@ obj-$(CONFIG_TCG) += bpt_helper.o cc_helper.o excp_helper.o fpu_helper.o obj-$(CONFIG_TCG) += int_helper.o mem_helper.o misc_helper.o mpx_helper.o obj-$(CONFIG_TCG) += seg_helper.o smm_helper.o svm_helper.o obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o monitor.o -obj-$(CONFIG_KVM) += kvm.o hyperv.o +obj-$(CONFIG_KVM) += kvm.o +obj-$(CONFIG_HYPERV) += hyperv.o +obj-$(call lnot,$(CONFIG_HYPERV)) += hyperv-stub.o obj-$(CONFIG_SEV) += sev.o obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o obj-$(call lnot,$(CONFIG_SEV)) += sev-stub.o