From nobody Tue Apr 23 18:21:25 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1565361123; cv=none; d=zoho.com; s=zohoarc; b=Y6cnZPslmXsnHXL3xCrmIGUgTMJz75Y36iDtUms/sPTIo0nJLw6HLMXZL8uUckDOGIf5bDxKZDmbGgH6HhqIoRXDf/fFCjRUboM6SkyRrZf0requMYB3eRRSPUHW6sIOZIXMLmPBIMGtFxa9dz9OwqCwtbAMI+0jXhnVN3gACw4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565361123; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=OCbg0XiPzZD1v/QS0Mw6r4j4VTcIk75gY43YqavB9S4=; b=WOPAqNd6dwphPD/Ph0/fah0aSsG8GVSTTRa7sWtAmIQZJTZ8hfSx5T8GnEp5glTeaPrXCmZJVdCPKlKzo+rP/4M4k8mowU1CHTuS36/ZzlzGIMZqDeE/5Gj5iAqo06bsR+s5S65hYoYuznH+3rhb81qKThZYORYGELy8Ppnv5WI= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1565361123472547.379663271817; Fri, 9 Aug 2019 07:32:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 241FD3172D94; Fri, 9 Aug 2019 14:32:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id ECB376CE52; Fri, 9 Aug 2019 14:32:01 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id A2634180085A; Fri, 9 Aug 2019 14:32:01 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x79EVx7D032175 for ; Fri, 9 Aug 2019 10:31:59 -0400 Received: by smtp.corp.redhat.com (Postfix) id E8C512619E; Fri, 9 Aug 2019 14:31:59 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DFE832632F for ; Fri, 9 Aug 2019 14:31:47 +0000 (UTC) Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 81ECE2F366F for ; Fri, 9 Aug 2019 14:31:47 +0000 (UTC) Received: by mail-wm1-f70.google.com with SMTP id y127so1372807wmd.0 for ; Fri, 09 Aug 2019 07:31:47 -0700 (PDT) Received: from vitty.brq.redhat.com (nat-pool-brq-t.redhat.com. [213.175.37.10]) by smtp.gmail.com with ESMTPSA id k1sm4732346wru.49.2019.08.09.07.31.44 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 07:31:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=TtmJ/cZqiIQtE0UVVjU0nmE//UGivANDQz63udfPpoo=; b=jYRDZ/FjBIlmj257gjv0sMR2OQJzA/EOINT8roOe4KHNPiUBgA4fbF7o5h8XXrGY3R oJfanbR25HuIn79GEuXCgSLJT7PTknqf0CV0iJBSSMwd9VLJ5KuLvJMYmn4LuBdMxtSn rHInrSMzU3YIPwLKBK2UNrBB09sCyW7g1kSTNr/C/dNINEpENUbMSbNlNjIjtlN9grzW BvFTK7naTxeLgxRIq+UQ+/CTKx5+8hZLRBY9DvtwSgKdeXJ1axCteEFcSh/hshsHHXp4 4R1j9ITi0FDX2W3uVyaBmVoiBV6w7Fj1sjhBI7ca4pxx3NciZLp3lbC3bysdgjCBzfQg z3lQ== X-Gm-Message-State: APjAAAXDKlUGwnUJOsmqaZU44kmLNsw4ISt1M20S2+V6anlkMczf/NCd Dwu2RS+jPkDszrSpHzm8Df/WVKxL2CwUAI6Uhiu2GAg/uBnGuiUJf+H+jdEXkrMjJceGGV7AKW7 qiX2sqGWWX8a4Ox9cPv0= X-Received: by 2002:a5d:55c2:: with SMTP id i2mr23796565wrw.96.1565361105848; Fri, 09 Aug 2019 07:31:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqzgEQRR5AsCx2Z9NbLATN4YOyuNohO2M6WmZ7m0mEyGoATTY8+9LIz9ClBb23yQl1DMKSTRgA== X-Received: by 2002:a5d:55c2:: with SMTP id i2mr23796544wrw.96.1565361105558; Fri, 09 Aug 2019 07:31:45 -0700 (PDT) From: Vitaly Kuznetsov To: libvir-list@redhat.com Date: Fri, 9 Aug 2019 16:31:40 +0200 Message-Id: <20190809143141.17349-4-vkuznets@redhat.com> In-Reply-To: <20190809143141.17349-1-vkuznets@redhat.com> References: <20190809143141.17349-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?J=C3=A1n=20Tomko?= , Nikolay Shirokovskiy Subject: [libvirt] [PATCH v4 3/4] qemu: add support for Direct Mode for Hyper-V Synthetic timers X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Fri, 09 Aug 2019 14:32:02 +0000 (UTC) Content-Type: text/plain; charset="utf-8" QEMU-4.1 supports 'Direct Mode' for Hyper-V synthetic timers (hv-stimer-direct CPU flag): Windows guests can request that timer expiration notifications are delivered as normal interrupts (and not VMBus messages). This is used by Hyper-V on KVM. Signed-off-by: Vitaly Kuznetsov Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 3 ++ src/qemu/qemu_process.c | 20 +++++++++-- .../hyperv-stimer-direct.x86_64-latest.args | 32 +++++++++++++++++ .../qemuxml2argvdata/hyperv-stimer-direct.xml | 33 +++++++++++++++++ tests/qemuxml2argvtest.c | 1 + .../hyperv-stimer-direct.xml | 35 +++++++++++++++++++ tests/qemuxml2xmltest.c | 1 + 7 files changed, 123 insertions(+), 2 deletions(-) create mode 100644 tests/qemuxml2argvdata/hyperv-stimer-direct.x86_64-late= st.args create mode 100644 tests/qemuxml2argvdata/hyperv-stimer-direct.xml create mode 100644 tests/qemuxml2xmloutdata/hyperv-stimer-direct.xml diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 71a36ff63a..9add21b929 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7175,6 +7175,9 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, virBufferAsprintf(&buf, ",%s%s", hvPrefix, virDomainHypervTypeToString(i)); + if ((i =3D=3D VIR_DOMAIN_HYPERV_STIMER) && + (def->hyperv_stimer_direct =3D=3D VIR_TRISTATE_SWITCH_= ON)) + virBufferAsprintf(&buf, ",%s", VIR_CPU_x86_HV_STIMER_D= IRECT); break; =20 case VIR_DOMAIN_HYPERV_SPINLOCKS: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1ed56457b1..7c6428ea75 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4112,10 +4112,26 @@ qemuProcessVerifyHypervFeatures(virDomainDefPtr def, rc =3D virCPUDataCheckFeature(cpu, cpuFeature); VIR_FREE(cpuFeature); =20 - if (rc < 0) + if (rc < 0) { return -1; - else if (rc =3D=3D 1) + } else if (rc =3D=3D 1) { + if (i =3D=3D VIR_DOMAIN_HYPERV_STIMER) { + if (def->hyperv_stimer_direct !=3D VIR_TRISTATE_SWITCH_ON) + continue; + + rc =3D virCPUDataCheckFeature(cpu, VIR_CPU_x86_HV_STIMER_D= IRECT); + if (rc < 0) + return -1; + else if (rc =3D=3D 1) + continue; + + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("host doesn't support hyperv stimer '%s' = feature"), + "direct"); + return -1; + } continue; + } =20 switch ((virDomainHyperv) i) { case VIR_DOMAIN_HYPERV_RELAXED: diff --git a/tests/qemuxml2argvdata/hyperv-stimer-direct.x86_64-latest.args= b/tests/qemuxml2argvdata/hyperv-stimer-direct.x86_64-latest.args new file mode 100644 index 0000000000..34e27c75f0 --- /dev/null +++ b/tests/qemuxml2argvdata/hyperv-stimer-direct.x86_64-latest.args @@ -0,0 +1,32 @@ +LC_ALL=3DC \ +PATH=3D/bin \ +HOME=3D/tmp/lib/domain--1-QEMUGuest1 \ +USER=3Dtest \ +LOGNAME=3Dtest \ +XDG_DATA_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.local/share \ +XDG_CACHE_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.cache \ +XDG_CONFIG_HOME=3D/tmp/lib/domain--1-QEMUGuest1/.config \ +QEMU_AUDIO_DRV=3Dnone \ +/usr/bin/qemu-system-i686 \ +-name guest=3DQEMUGuest1,debug-threads=3Don \ +-S \ +-object secret,id=3DmasterKey0,format=3Draw,\ +file=3D/tmp/lib/domain--1-QEMUGuest1/master-key.aes \ +-machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ +-cpu qemu32,hv-vpindex,hv-synic,hv-stimer,hv-stimer-direct \ +-m 214 \ +-overcommit mem-lock=3Doff \ +-smp 6,sockets=3D6,cores=3D1,threads=3D1 \ +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \ +-display none \ +-no-user-config \ +-nodefaults \ +-chardev socket,id=3Dcharmonitor,fd=3D1729,server,nowait \ +-mon chardev=3Dcharmonitor,id=3Dmonitor,mode=3Dcontrol \ +-rtc base=3Dutc \ +-no-shutdown \ +-boot strict=3Don \ +-device piix3-usb-uhci,id=3Dusb,bus=3Dpci.0,addr=3D0x1.0x2 \ +-sandbox on,obsolete=3Ddeny,elevateprivileges=3Ddeny,spawn=3Ddeny,\ +resourcecontrol=3Ddeny \ +-msg timestamp=3Don diff --git a/tests/qemuxml2argvdata/hyperv-stimer-direct.xml b/tests/qemuxm= l2argvdata/hyperv-stimer-direct.xml new file mode 100644 index 0000000000..9c865f5746 --- /dev/null +++ b/tests/qemuxml2argvdata/hyperv-stimer-direct.xml @@ -0,0 +1,33 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 6 + + hvm + + + + + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + + + + + + + diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4c3aeffe76..235efe0b06 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -914,6 +914,7 @@ mymain(void) DO_TEST_CAPS_LATEST("hyperv"); DO_TEST_CAPS_LATEST("hyperv-off"); DO_TEST_CAPS_LATEST("hyperv-panic"); + DO_TEST_CAPS_LATEST("hyperv-stimer-direct"); =20 DO_TEST("kvm-features", NONE); DO_TEST("kvm-features-off", NONE); diff --git a/tests/qemuxml2xmloutdata/hyperv-stimer-direct.xml b/tests/qemu= xml2xmloutdata/hyperv-stimer-direct.xml new file mode 100644 index 0000000000..806164beea --- /dev/null +++ b/tests/qemuxml2xmloutdata/hyperv-stimer-direct.xml @@ -0,0 +1,35 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 6 + + hvm + + + + + + + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-i686 + +
+ + + + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 525eb9a740..7e14125f97 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -289,6 +289,7 @@ mymain(void) DO_TEST("hyperv", NONE); DO_TEST("hyperv-off", NONE); DO_TEST("hyperv-panic", NONE); + DO_TEST("hyperv-stimer-direct", NONE); =20 DO_TEST("kvm-features", NONE); DO_TEST("kvm-features-off", NONE); --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list