From nobody Mon Feb 9 04:30:00 2026 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=1565071103; cv=none; d=zoho.com; s=zohoarc; b=R8e4N2HFfOHBdwyf/tpAOlD4Oww7aLjjczjOZFrGURbCANOH4XU3+HEEIsMN1BZx5q1UiivVK49YGN2qor0spAZ1QAYLZ7qtNqaA5gJe+Cx0tB1vraS4Y8+7lVuMzqIgJFEMEKcpJDPNKSBEIqROwEmEWK7e/avY/Vc+a/kEhDE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565071103; 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=hpIjYnhvzcPO+rxZ3o+G+H7XUCPfIBKeXgveY+rRI5E=; b=eSKl2AX8j4kfjMbQpG+u0aCU+4sO8GhJaTZoAPqETdDFD778kp2zIi/rATenwRsMc7vi+kYTNhnmeauWQEMMqGWgPE8Tz/fD+fdLhvJrn9wfUfh97ixjtE4T7OCzey8lqdr5puvh2be28PKNSHBn4t4aN0Tg0qdilvRhpNil0O4= 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 1565071103317433.42664279354574; Mon, 5 Aug 2019 22:58:23 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1A6F130BCB95; Tue, 6 Aug 2019 05:58:22 +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 E91ADA22F; Tue, 6 Aug 2019 05:58:21 +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 B05C7180B536; Tue, 6 Aug 2019 05:58:21 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x765qnih028164 for ; Tue, 6 Aug 2019 01:52:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 13E706012D; Tue, 6 Aug 2019 05:52:49 +0000 (UTC) Received: from mx1.redhat.com (ext-mx01.extmail.prod.ext.phx2.redhat.com [10.5.110.25]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C52F60127 for ; Tue, 6 Aug 2019 05:52:46 +0000 (UTC) Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (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 78748793D1 for ; Tue, 6 Aug 2019 05:52:46 +0000 (UTC) Received: by mail-wr1-f69.google.com with SMTP id f9so41722172wrq.14 for ; Mon, 05 Aug 2019 22:52:46 -0700 (PDT) Received: from vitty.brq.redhat.com (ip-89-176-127-93.net.upcbroadband.cz. [89.176.127.93]) by smtp.gmail.com with ESMTPSA id i66sm156446020wmi.11.2019.08.05.22.52.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 05 Aug 2019 22:52:44 -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=GcE69isUJL5RkdBCSPXEj+E3AGaMo9EQT2oDkINXtec=; b=O0aNawHHBExeZZ/sxN/tSFBcnf1fgbi68CgjsHBaMwgFOXq7ehtb3T8B5gh/XnuQvQ vyxvjCQfzZ2X2VHNiSiGB6jelGIDaCODUks7r2eA6vbO3LoD6Xp3yNbhDuC7fwM5Oz3s oyAFaWzJ1Mkv9lPfR/eMe8jIst2KM3W/taN6TS+LX609qoDr7A3YPnuXkAW/MF8i1vuo uv4h1fl/Qm7fVWGE+sY54B9Fd0DFwFXHXYMDxKgoZu5eodBdGBV5X7bPfLyqIEQjyo7x I01Gk0h+MYpIUNfzfi1uvtjpFtBvivUn9gqf8lmvs6Xcz6xgZTV1WZePC3SmDzG/gqwV TSZw== X-Gm-Message-State: APjAAAWdUsvxz1O57MQYjQ4DoNoO0BXVMSXAUSh45trAVg5PyTQOGFUK 1fEiWLJcHdCiPmpYL0Y/Y5jgtOP9tCRZfnfamy790mOd2N8wfixXlmYEVCCOiCJAQHL8vfDcnsq pY/qLrSunTUvs1zs40kg= X-Received: by 2002:a7b:ce18:: with SMTP id m24mr2259862wmc.126.1565070764951; Mon, 05 Aug 2019 22:52:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqwDXpzKoB+B6Ur1rz+2jsDse9CoKbTSRi5cK0bnTbbvCHFT4W2ED47HFs0z0NPyI/OZyDReNg== X-Received: by 2002:a7b:ce18:: with SMTP id m24mr2259833wmc.126.1565070764641; Mon, 05 Aug 2019 22:52:44 -0700 (PDT) From: Vitaly Kuznetsov To: libvir-list@redhat.com Date: Tue, 6 Aug 2019 07:52:35 +0200 Message-Id: <20190806055236.31837-5-vkuznets@redhat.com> In-Reply-To: <20190806055236.31837-1-vkuznets@redhat.com> References: <20190806055236.31837-1-vkuznets@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?J=C3=A1n=20Tomko?= , Nikolay Shirokovskiy Subject: [libvirt] [PATCH v3 4/5] 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.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Tue, 06 Aug 2019 05:58:22 +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 | 12 ++++++++---- src/qemu/qemu_process.c | 20 ++++++++++++++++++-- tests/qemuxml2argvdata/hyperv.args | 4 ++-- tests/qemuxml2argvdata/hyperv.xml | 4 +++- tests/qemuxml2xmloutdata/hyperv.xml | 4 +++- 5 files changed, 34 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index c8494de785..af913dba34 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -7152,10 +7152,10 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, } =20 if (def->features[VIR_DOMAIN_FEATURE_HYPERV] =3D=3D VIR_TRISTATE_SWITC= H_ON) { - const char *hvPrefix =3D "hv-"; + const char *hvDelimiter =3D "-"; =20 if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_CANONICAL_CPU_FEATURES)) - hvPrefix =3D "hv_"; + hvDelimiter =3D "_"; =20 for (i =3D 0; i < VIR_DOMAIN_HYPERV_LAST; i++) { switch ((virDomainHyperv) i) { @@ -7172,9 +7172,13 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, case VIR_DOMAIN_HYPERV_IPI: case VIR_DOMAIN_HYPERV_EVMCS: if (def->hyperv_features[i] =3D=3D VIR_TRISTATE_SWITCH_ON) - virBufferAsprintf(&buf, ",%s%s", - hvPrefix, + virBufferAsprintf(&buf, ",hv%s%s", + hvDelimiter, virDomainHypervTypeToString(i)); + if ((i =3D=3D VIR_DOMAIN_HYPERV_STIMER) && + (def->hyperv_stimer_direct =3D=3D VIR_TRISTATE_SWITCH_= ON)) + virBufferAsprintf(&buf, ",hv%sstimer%sdirect", hvDelim= iter, + hvDelimiter); break; =20 case VIR_DOMAIN_HYPERV_SPINLOCKS: diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 1ed56457b1..792fa33327 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, "hv-stimer-direct"); + 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.args b/tests/qemuxml2argvdata/hy= perv.args index 086adaa349..8040da9caa 100644 --- a/tests/qemuxml2argvdata/hyperv.args +++ b/tests/qemuxml2argvdata/hyperv.args @@ -12,8 +12,8 @@ QEMU_AUDIO_DRV=3Dnone \ -S \ -machine pc,accel=3Dtcg,usb=3Doff,dump-guest-core=3Doff \ -cpu 'qemu32,hv_relaxed,hv_vapic,hv-spinlocks=3D0x2fff,hv_vpindex,hv_runti= me,\ -hv_synic,hv_stimer,hv_reset,hv-vendor-id=3DKVM Hv,hv_frequencies,\ -hv_reenlightenment,hv_tlbflush,hv_ipi,hv_evmcs' \ +hv_synic,hv_stimer,hv_stimer_direct,hv_reset,hv-vendor-id=3DKVM Hv,\ +hv_frequencies,hv_reenlightenment,hv_tlbflush,hv_ipi,hv_evmcs' \ -m 214 \ -realtime mlock=3Doff \ -smp 6,sockets=3D6,cores=3D1,threads=3D1 \ diff --git a/tests/qemuxml2argvdata/hyperv.xml b/tests/qemuxml2argvdata/hyp= erv.xml index c6feaed528..ae0f934f76 100644 --- a/tests/qemuxml2argvdata/hyperv.xml +++ b/tests/qemuxml2argvdata/hyperv.xml @@ -17,7 +17,9 @@ - + + + diff --git a/tests/qemuxml2xmloutdata/hyperv.xml b/tests/qemuxml2xmloutdata= /hyperv.xml index 5510d3dfad..2e4b43d4c6 100644 --- a/tests/qemuxml2xmloutdata/hyperv.xml +++ b/tests/qemuxml2xmloutdata/hyperv.xml @@ -17,7 +17,9 @@ - + + + --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list