From nobody Thu Apr 25 16:52:27 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=1565361115; cv=none; d=zoho.com; s=zohoarc; b=OFYCDTAr8F3BZz8XtqzUh9u99zV3oiv/X7uJSi3Kirx44QtuKkmXutSXOdAabdAzwy1/rsX+RK+AX6xqiECGmUfd3EiKeDMG5j3xqWoAlPxUH4Ri99KssuoqET+SSqoVXeWFbkymt7sCttWyTo9Wb/Z6e6ZszSeNhqt98S7e0so= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1565361115; 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=R9YQ6NeCo+xbQCXfTNv6Fid0bYw+pu+73kz/MqZEJiQ=; b=BMN1Wk1VDwrFGfdwR9TPjydBO5Mmw1zgbh2AAIg1HdNcHhPKfN8RCy5uLOxkj0oICevnb91EO0jL5WrmEgeBcGtJm/fJiPYtPMa6LACRZaXJpyUaDYbRJAFclPNgMSCxtDIvtmXQvr/8lX+SZBmzh7opNX5E12GQDKhWQzS7ygM= 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 15653611150201012.8646481600597; Fri, 9 Aug 2019 07:31:55 -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 7AB13C08EC14; Fri, 9 Aug 2019 14:31:53 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C9C85D6A5; Fri, 9 Aug 2019 14:31:53 +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 6F2922551C; Fri, 9 Aug 2019 14:31:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x79EVnjb032096 for ; Fri, 9 Aug 2019 10:31:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id CD60C5D6A5; Fri, 9 Aug 2019 14:31:49 +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 C607861F44 for ; Fri, 9 Aug 2019 14:31:46 +0000 (UTC) Received: from mail-wr1-f70.google.com (mail-wr1-f70.google.com [209.85.221.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 93AB580F81 for ; Fri, 9 Aug 2019 14:31:46 +0000 (UTC) Received: by mail-wr1-f70.google.com with SMTP id f9so46716766wrq.14 for ; Fri, 09 Aug 2019 07:31:46 -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.43 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Fri, 09 Aug 2019 07:31: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=QnVoWUTOj2+xNZUDLDk6S69661Beg1fyJLuWdvGh+kM=; b=jOYGV6D00eDHdhig+EdLmzPONi9qB9EZGPrwATGYo38jZ6bGgoR/83O0nKOWtAltiH tnbrQNBL4X/SZN10UlsQm0RP5JQi6nQ0Vb0Z1NOld0nMSpp5NQHDS/qf/8aB0ufMgWjT RfCbPrdCGN6LzgYR7/DA4icaIeAvGvfHky8NSiQJpfa02K4eDPJsba+S2gBTus2T0FVi yINrcZuyvSF/27/+UaD5UkxS+iBvBt11rmmKMOFi+t5liyaiGvFfNJnGn9oNfn/LjPFW rX1cOGAN6E3c0uOOAx3lOKB54MaIK1MLDUpLJMLvmhmJCA3RLXZYm3lknxGYoSMPoSZ6 d53w== X-Gm-Message-State: APjAAAXGMRT4EAFuoV8GYkYT1erS8ROOBWV0rnSyLM//Cvb26ox59y6b iMb0sbmFBjpZwCeYAoQK4mTMhmwH65vO5cOhDMpfzdKvEUSxVP+1DMVLFKLfJGArCkKzjtDnHQy akXyImV2TCetAsOCvUV0= X-Received: by 2002:adf:9ccf:: with SMTP id h15mr25102039wre.241.1565361104983; Fri, 09 Aug 2019 07:31:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqxs9jIKK3uXLUAx46MzfqJGgaRhEUEI030tBRYku/HL9Wo+e5W4PTdk4A1/9pXB5GbrEphPLA== X-Received: by 2002:adf:9ccf:: with SMTP id h15mr25102001wre.241.1565361104725; Fri, 09 Aug 2019 07:31:44 -0700 (PDT) From: Vitaly Kuznetsov To: libvir-list@redhat.com Date: Fri, 9 Aug 2019 16:31:39 +0200 Message-Id: <20190809143141.17349-3-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.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Cc: =?UTF-8?q?J=C3=A1n=20Tomko?= , Nikolay Shirokovskiy Subject: [libvirt] [PATCH v4 2/4] 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-Type: text/plain; charset="utf-8" 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.31]); Fri, 09 Aug 2019 14:31:54 +0000 (UTC) Support 'Direct Mode' for Hyper-V Synthetic Timers in domain config. Make it 'stimer' enlightenment option as it is not a separate thing. Reviewed-by: J=C3=A1n Tomko 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..de577e5755 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.7.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 0456369d55..f56e850ade 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -20388,6 +20388,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; @@ -22612,6 +22645,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++) { @@ -28071,7 +28115,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: @@ -28090,6 +28133,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 57ca2a8ad1..8434f1fd0b 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 d2d9537c32..32b9836dd5 100644 --- a/src/cpu/cpu_x86.c +++ b/src/cpu/cpu_x86.c @@ -100,6 +100,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 { @@ -116,6 +118,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