From nobody Mon Feb 9 20:46:01 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1539898552363693.8316471401296; Thu, 18 Oct 2018 14:35:52 -0700 (PDT) Received: from localhost ([::1]:44873 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDFxP-0002vz-55 for importer@patchew.org; Thu, 18 Oct 2018 17:35:51 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48434) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gDEyc-0007hv-Do for qemu-devel@nongnu.org; Thu, 18 Oct 2018 16:33:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gDEyY-0006aA-IG for qemu-devel@nongnu.org; Thu, 18 Oct 2018 16:33:02 -0400 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40854) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gDEyY-0006ZI-8w for qemu-devel@nongnu.org; Thu, 18 Oct 2018 16:32:58 -0400 Received: by mail-wm1-x334.google.com with SMTP id z204-v6so1611720wmc.5 for ; Thu, 18 Oct 2018 13:32:57 -0700 (PDT) Received: from 640k.lan (dynamic-adsl-78-12-231-174.clienti.tiscali.it. [78.12.231.174]) by smtp.gmail.com with ESMTPSA id a12-v6sm14270952wrr.71.2018.10.18.13.32.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 Oct 2018 13:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=H1IMf5fO/8cIX7nkYTPxw2s4NDP5Jr7X5vdHobX0a04=; b=nwXtLhJJHXvjGBcrnfBv91HThd2gu9944dk6zSyKJPTnUqvTdHrhcHp15JzzX0uRqC r9ASbIx0Cic1pcAfD0k+bKsePI4gzDH2R1AJbLpPv7+IHm7c+KsLNuOWD+mhp97dOXI/ qYj1SEneMUDsVklNC3XrK2jtRLFmOhQ53jCc7CGnFZL34hbZxBVtWCoOxAs9Ck5ubsAM rppwzhm5o8jkdXH5WUmM3XvHonkcFDbjWWuqHOXQl4eAlFWDGKUvFe7Zy1rZ+VPKT411 ktYi8oVMg06ur/ehNLqgbEUveFORpcbu7+98a11W73RjU1DRUZGAeK0gFiR2tYD+Pikf IE5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=H1IMf5fO/8cIX7nkYTPxw2s4NDP5Jr7X5vdHobX0a04=; b=RofpJee25mGCn0kn26H7WBL7Ld4jQ3aZzsuNKRFOi+OYnMdusVEEPCKnsaqy2hMwfo cz9etcZk1qVIPmMzf0p0nI031F4dBApZMAUdWvMnVQAiBiInQXiWT7KdJKSilugmr9/h dZ2ZJKiDJVnO2FUyrdsM1J/W5w5O+bX08YAOITUmYHuEqK1q8XJPSUR6ssZYDwB0ye/X ZKyvQFJUVqMMW+LMY/qMDufZ+ey8tR1KFTPCNDoUkSHhS3qIWpjo0eJ0wMMqkhzPceyB WI61GWC+5y5m1jSVsqQD89j4LIpB9aC8urUKag0jY15et2lhfonmnXW2yur3muNaNsW2 +hnw== X-Gm-Message-State: AGRZ1gLpmkekoQudWH0n7wVaLJF8KKn32I+74cdFjKw2a/RQ1A3TqL4o Y5ysKxTGZ9ngkHLiYVev+V7RFPVh X-Google-Smtp-Source: ACcGV6154Jxjm8IVOR1UfNh8012HzCzPoEvXvzaFrz2OHMo7IFXHKSYKPTQfLZAnCRj3F6Qi+GI+mA== X-Received: by 2002:a1c:b20d:: with SMTP id b13-v6mr1817250wmf.141.1539894776732; Thu, 18 Oct 2018 13:32:56 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Thu, 18 Oct 2018 22:32:03 +0200 Message-Id: <1539894735-14232-37-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1539894735-14232-1-git-send-email-pbonzini@redhat.com> References: <1539894735-14232-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::334 Subject: [Qemu-devel] [PULL 36/48] 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: Roman Kagan Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDMRC_1 RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Roman Kagan 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 Message-Id: <20180921082041.29380-6-rkagan@virtuozzo.com> Signed-off-by: Paolo Bonzini --- target/i386/Makefile.objs | 17 ++++++++++------- target/i386/hyperv-stub.c | 35 +++++++++++++++++++++++++++++++++++ target/i386/hyperv.h | 2 ++ 3 files changed, 47 insertions(+), 7 deletions(-) create mode 100644 target/i386/hyperv-stub.c diff --git a/target/i386/Makefile.objs b/target/i386/Makefile.objs index 04678f5..32bf966 100644 --- a/target/i386/Makefile.objs +++ b/target/i386/Makefile.objs @@ -3,17 +3,20 @@ obj-$(CONFIG_TCG) +=3D translate.o obj-$(CONFIG_TCG) +=3D bpt_helper.o cc_helper.o excp_helper.o fpu_helper.o obj-$(CONFIG_TCG) +=3D int_helper.o mem_helper.o misc_helper.o mpx_helper.o obj-$(CONFIG_TCG) +=3D seg_helper.o smm_helper.o svm_helper.o -obj-$(CONFIG_SOFTMMU) +=3D machine.o arch_memory_mapping.o arch_dump.o mon= itor.o -obj-$(CONFIG_KVM) +=3D kvm.o hyperv.o -obj-$(CONFIG_SEV) +=3D sev.o +ifeq ($(CONFIG_SOFTMMU),y) +obj-y +=3D machine.o arch_memory_mapping.o arch_dump.o monitor.o +obj-$(CONFIG_KVM) +=3D kvm.o obj-$(call lnot,$(CONFIG_KVM)) +=3D kvm-stub.o -obj-$(call lnot,$(CONFIG_SEV)) +=3D sev-stub.o -# HAX support -ifdef CONFIG_WIN32 +obj-$(CONFIG_HYPERV) +=3D hyperv.o +obj-$(call lnot,$(CONFIG_HYPERV)) +=3D hyperv-stub.o +ifeq ($(CONFIG_WIN32),y) obj-$(CONFIG_HAX) +=3D hax-all.o hax-mem.o hax-windows.o endif -ifdef CONFIG_DARWIN +ifeq ($(CONFIG_DARWIN),y) obj-$(CONFIG_HAX) +=3D hax-all.o hax-mem.o hax-darwin.o obj-$(CONFIG_HVF) +=3D hvf/ endif obj-$(CONFIG_WHPX) +=3D whpx-all.o +endif +obj-$(CONFIG_SEV) +=3D sev.o +obj-$(call lnot,$(CONFIG_SEV)) +=3D sev-stub.o diff --git a/target/i386/hyperv-stub.c b/target/i386/hyperv-stub.c new file mode 100644 index 0000000..5919ba8 --- /dev/null +++ b/target/i386/hyperv-stub.c @@ -0,0 +1,35 @@ +/* + * Stubs for CONFIG_HYPERV=3Dn + * + * Copyright (c) 2015-2018 Virtuozzo International GmbH. + * + * This work is licensed under the terms of the GNU GPL, version 2 or late= r. + * See the COPYING file in the top-level directory. + */ + +#include "qemu/osdep.h" +#include "hyperv.h" + +#ifdef CONFIG_KVM +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 =3D HV_STATUS_INVALID_HYPERCALL_CODE; + return 0; + default: + return -1; + } +} +#endif diff --git a/target/i386/hyperv.h b/target/i386/hyperv.h index 5c49251..f0a27c3 100644 --- a/target/i386/hyperv.h +++ b/target/i386/hyperv.h @@ -18,6 +18,8 @@ #include "sysemu/kvm.h" #include "hw/hyperv/hyperv.h" =20 +#ifdef CONFIG_KVM int kvm_hv_handle_exit(X86CPU *cpu, struct kvm_hyperv_exit *exit); +#endif =20 #endif --=20 1.8.3.1