From nobody Tue Nov 26 21:38:20 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=1564481652; cv=none; d=zoho.com; s=zohoarc; b=m9okgpji1V5RZ442gC5p8ACuqmuTEahkMt9e+jPd+YYzrDrA4rb58M5SNNOv33wrOdv3OgHImWb+UiRaS5xHQHJOW0qESCO08e/czMyVJ+xxk2NPlA68kB+qMbdKJfEswC/Ww116x4W/eZ1rD9jFThbU0AwmFW8hgg57FD8mJIg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1564481652; 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=dgOUxejIomGllZQSGQFi3wVSzjsk2x0T0bMCA2n12Qs=; b=VTs2wq/EcHL7dXULCULntX4TMggnc6pxOLRKDYHk3r7ywYf5hMKx23vK9AXS+TyIXeeCH4F0LBC4HMG47xU1Mee88EXNoQhlLJFOoovD6yH5mvR3R6eh+zJ1N3twZSsFj+rzNWlwJPK6WEEOxnYTc8rhK7OaThR/seUm7OnL0y4= 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 1564481652556730.1615385284788; Tue, 30 Jul 2019 03:14:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0603EB2DC7; Tue, 30 Jul 2019 10:14:11 +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 CF76B5D6B2; Tue, 30 Jul 2019 10:14:10 +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 94281180BA9C; Tue, 30 Jul 2019 10:14:10 +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 x6UAE7oL002211 for ; Tue, 30 Jul 2019 06:14:07 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4D4AF6013A; Tue, 30 Jul 2019 10:14:07 +0000 (UTC) Received: from mx1.redhat.com (ext-mx03.extmail.prod.ext.phx2.redhat.com [10.5.110.27]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 451BC601A1 for ; Tue, 30 Jul 2019 10:14:01 +0000 (UTC) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (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 76A387FDE9 for ; Tue, 30 Jul 2019 10:14:01 +0000 (UTC) Received: by mail-wr1-f71.google.com with SMTP id w11so31552679wrl.7 for ; Tue, 30 Jul 2019 03:14:01 -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 o7sm34844155wru.58.2019.07.30.03.13.58 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 30 Jul 2019 03:13:58 -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=YNfO2F+fYA9nvyJFxnLoCrmfnDVLsZnKwukzH1pLXoI=; b=jlBue6tDHiWup6g4oRN2NpoLNsnJEj0zq0sqla5SBR//wcnAbZXOznx6/VnXajePY6 x9IYHQoF6i80wzEfs7hZVIQdVm1SRCqLU88ToVSF3k+cPa2cqLG6d5fLSsCTPlS1Zixx 9TDpZSPb3O1rqjI2lIAowZCFoU+4GP7TxRtSVXhJ1KD1hCWfo+vRm9GYyhLds/tXkFbm uPVOMWud6LbdcdgFpn+BA6MTvaE4L++4iebvhHir/gjaZB8ldPru5u6gVjx5TDvr4S80 QMRg53V8ZXXCZotN2d9ckdDdiN0NYAuFlu904oAD85tcxBADvmW+jjx8n5IdeXQfSMDY 3BJw== X-Gm-Message-State: APjAAAUvfc/afuhN2TjhbtsVaFeZPrqdwIlS+bVfkRbw9UrGyy8Z3HCl xie5aa9o63OURNtyQeeMVj6Bz1EG7cnyBcCNrB1+KgpF38Js1rLsiy9dzzGHMiNTQh2DnJOWeG2 wk3EyWxEP1TlYMfhrz84= X-Received: by 2002:a7b:c0d0:: with SMTP id s16mr89750345wmh.136.1564481639776; Tue, 30 Jul 2019 03:13:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqx4YA1rDKWhZ3B+uT26wiTKM8UH1DEK/VjI8HNqzcNUu8SuvpRDJ1WNcMe7GUvSKoT1VWOWSA== X-Received: by 2002:a7b:c0d0:: with SMTP id s16mr89750320wmh.136.1564481639482; Tue, 30 Jul 2019 03:13:59 -0700 (PDT) From: Vitaly Kuznetsov To: libvir-list@redhat.com Date: Tue, 30 Jul 2019 12:13:46 +0200 Message-Id: <20190730101348.4055-7-vkuznets@redhat.com> In-Reply-To: <20190730101348.4055-1-vkuznets@redhat.com> References: <20190730101348.4055-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 v2 6/8] conf: 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Tue, 30 Jul 2019 10:14:11 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Support 'Direct Mode' for Hyper-V Synthetic Timers in domain config. Make it 'stimer' enlightenment option as it is not a separate thing. Signed-off-by: Vitaly Kuznetsov --- docs/formatdomain.html.in | 10 +++--- docs/schemas/domaincommon.rng | 16 ++++++++- src/conf/domain_conf.c | 62 ++++++++++++++++++++++++++++++++++- src/conf/domain_conf.h | 1 + src/cpu/cpu_x86.c | 3 ++ src/cpu/cpu_x86_data.h | 2 ++ 6 files changed, 88 insertions(+), 6 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index f5c882141a..d778fc3f62 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -2033,7 +2033,9 @@ <vpindex state=3D'on'/> <runtime state=3D'on'/> <synic state=3D'on'/> - <stimer state=3D'on'/> + <stimer state=3D'on'> + <direct state=3D'on'/> + </stimer> <reset state=3D'on'/> <vendor_id state=3D'on' value=3D'KVM Hv'/> <frequencies state=3D'on'/> @@ -2148,9 +2150,9 @@ stimer - Enable SynIC timers - on, off - 1.3.3 (QEMU 2.6) + Enable SynIC timers, optionally with Direct Mode support + on, off; direct - on,off + 1.3.3 (QEMU 2.6), direct mode 5.6.0 (Q= EMU 4.1) reset diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index a0771da45b..6707dcc634 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5907,7 +5907,7 @@ - + @@ -5956,6 +5956,20 @@ =20 + + + + + + + + + + + + + + diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 0871f21494..98273ab62a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20383,6 +20383,39 @@ virDomainDefParseXML(xmlDocPtr xml, ctxt->node =3D node; } =20 + if (def->features[VIR_DOMAIN_HYPERV_STIMER] =3D=3D VIR_TRISTATE_SWITCH= _ON) { + int value; + if ((n =3D virXPathNodeSet("./features/hyperv/stimer/*", ctxt, &no= des)) < 0) + goto error; + + for (i =3D 0; i < n; i++) { + if (STRNEQ((const char *)nodes[i]->name, "direct")) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("unsupported Hyper-V stimer feature: %s"), + nodes[i]->name); + goto error; + } + + if (!(tmp =3D virXMLPropString(nodes[i], "state"))) { + virReportError(VIR_ERR_XML_ERROR, + _("missing 'state' attribute for " + "Hyper-V stimer '%s' feature"), "direct"); + goto error; + } + + if ((value =3D virTristateSwitchTypeFromString(tmp)) < 0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("invalid value of state argument " + "for Hyper-V stimer '%s' feature"), "dire= ct"); + goto error; + } + + VIR_FREE(tmp); + def->hyperv_stimer_direct =3D value; + } + VIR_FREE(nodes); + } + if (def->features[VIR_DOMAIN_FEATURE_KVM] =3D=3D VIR_TRISTATE_SWITCH_O= N) { int feature; int value; @@ -22607,6 +22640,17 @@ virDomainDefFeaturesCheckABIStability(virDomainDef= Ptr src, } } =20 + if (src->hyperv_features[VIR_DOMAIN_HYPERV_STIMER] =3D=3D VIR_TRISTATE= _SWITCH_ON) { + if (src->hyperv_stimer_direct !=3D dst->hyperv_stimer_direct) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("State of HyperV stimer direct feature differ= s: " + "source: '%s', destination: '%s'"), + virTristateSwitchTypeToString(src->hyperv_stime= r_direct), + virTristateSwitchTypeToString(dst->hyperv_stime= r_direct)); + return false; + } + } + /* kvm */ if (src->features[VIR_DOMAIN_FEATURE_KVM] =3D=3D VIR_TRISTATE_SWITCH_O= N) { for (i =3D 0; i < VIR_DOMAIN_KVM_LAST; i++) { @@ -28066,7 +28110,6 @@ virDomainDefFormatFeatures(virBufferPtr buf, case VIR_DOMAIN_HYPERV_VPINDEX: case VIR_DOMAIN_HYPERV_RUNTIME: case VIR_DOMAIN_HYPERV_SYNIC: - case VIR_DOMAIN_HYPERV_STIMER: case VIR_DOMAIN_HYPERV_RESET: case VIR_DOMAIN_HYPERV_FREQUENCIES: case VIR_DOMAIN_HYPERV_REENLIGHTENMENT: @@ -28085,6 +28128,23 @@ virDomainDefFormatFeatures(virBufferPtr buf, def->hyperv_spinlocks); break; =20 + case VIR_DOMAIN_HYPERV_STIMER: + if (def->hyperv_features[j] !=3D VIR_TRISTATE_SWITCH_O= N) { + virBufferAddLit(&childBuf, "/>\n"); + break; + } + if (def->hyperv_stimer_direct =3D=3D VIR_TRISTATE_SWIT= CH_ON) { + virBufferAddLit(&childBuf, ">\n"); + virBufferAdjustIndent(&childBuf, 2); + virBufferAddLit(&childBuf, "= \n"); + virBufferAdjustIndent(&childBuf, -2); + virBufferAddLit(&childBuf, "\n"); + } else { + virBufferAddLit(&childBuf, "/>\n"); + } + + break; + case VIR_DOMAIN_HYPERV_VENDOR_ID: if (def->hyperv_features[j] !=3D VIR_TRISTATE_SWITCH_O= N) { virBufferAddLit(&childBuf, "/>\n"); diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 8a4425df64..7a2a9e16c0 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2400,6 +2400,7 @@ struct _virDomainDef { int kvm_features[VIR_DOMAIN_KVM_LAST]; int msrs_features[VIR_DOMAIN_MSRS_LAST]; unsigned int hyperv_spinlocks; + int hyperv_stimer_direct; virGICVersion gic_version; virDomainHPTResizing hpt_resizing; unsigned long long hpt_maxpagesize; /* Stored in KiB */ diff --git a/src/cpu/cpu_x86.c b/src/cpu/cpu_x86.c index 8575915597..fbfd9a5bfa 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -102,6 +102,8 @@ KVM_FEATURE_DEF(VIR_CPU_x86_HV_IPI, 0x40000004, 0x00000400, 0x0); KVM_FEATURE_DEF(VIR_CPU_x86_HV_EVMCS, 0x40000004, 0x00004000, 0x0); +KVM_FEATURE_DEF(VIR_CPU_x86_HV_STIMER_DIRECT, + 0x40000003, 0x0, 0x00080000); =20 static virCPUx86Feature x86_kvm_features[] =3D { @@ -119,6 +121,7 @@ static virCPUx86Feature x86_kvm_features[] =3D KVM_FEATURE(VIR_CPU_x86_HV_TLBFLUSH), KVM_FEATURE(VIR_CPU_x86_HV_IPI), KVM_FEATURE(VIR_CPU_x86_HV_EVMCS), + KVM_FEATURE(VIR_CPU_x86_HV_STIMER_DIRECT), }; =20 typedef struct _virCPUx86Model virCPUx86Model; diff --git a/src/cpu/cpu_x86_data.h b/src/cpu/cpu_x86_data.h index cc0c93dff0..cebf3b6669 100644 --- a/src/cpu/cpu_x86_data.h +++ b/src/cpu/cpu_x86_data.h @@ -64,6 +64,8 @@ struct _virCPUx86MSR { #define VIR_CPU_x86_HV_IPI "hv-ipi" #define VIR_CPU_x86_HV_EVMCS "hv-evmcs" =20 +/* Hyper-V Synthetic Timer option */ +#define VIR_CPU_x86_HV_STIMER_DIRECT "hv-stimer-direct" =20 #define VIR_CPU_X86_DATA_INIT { 0 } =20 --=20 2.20.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list