From nobody Thu May 2 09:55:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1577056908; cv=none; d=zohomail.com; s=zohoarc; b=jYROeoJz3Otha+z2uT+E5hpl7+1iEwaVkr7d44gwczCgFIVNQMj8WCKv2gOytNnJwtibUYpio75JbGtIlQqpaPMNfRRZ7S7xgpGXC2tEDycEYFxmac2fftwCJoCWSRejvXd5AEW625IL11fLsI2zq2g15oxumt2JOBGUMlUVkCQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577056908; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=iWtfi7lwL9HTEYMI0sS9MJ47eKyC9bY1YpebP1XxAsw=; b=W2d59eBHBZP+Gt6EMbfyv/W4LxYm/7uKXcCmH939Gc0YVhubf718xg8ZrsOciAvQlgKoQdfR9miMDt1kxqLGIEqZpJl4K4wExGWWu7Pil4JLK+x0jA0AOSo3AWzzOOy7YXHaqOHq4FFLHnId/U73/FCugRZ761MDBb3z9b7/48w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1577056908892577.3261505217333; Sun, 22 Dec 2019 15:21:48 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijAWl-0004Nc-PX; Sun, 22 Dec 2019 23:20:47 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijAWk-0004NX-Eh for xen-devel@lists.xenproject.org; Sun, 22 Dec 2019 23:20:46 +0000 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id abba8c04-2511-11ea-b6f1-bc764e2007e4; Sun, 22 Dec 2019 23:20:41 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id z3so14892700wru.3 for ; Sun, 22 Dec 2019 15:20:41 -0800 (PST) Received: from debian.mshome.net (38.163.200.146.dyn.plus.net. [146.200.163.38]) by smtp.gmail.com with ESMTPSA id h2sm19925613wrt.45.2019.12.22.15.20.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2019 15:20:40 -0800 (PST) X-Inumbo-ID: abba8c04-2511-11ea-b6f1-bc764e2007e4 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 :mime-version:content-transfer-encoding; bh=4iY5LVyaAwL0gYA7x7G9RR7noTcF6nrPiSr/rUqWtRQ=; b=dCepD/sP9qHmVqVOQviK+S0nwllSjCJr5ZSscJn61a3HYgXTAFPiS3U5lWae4Xxh+H qYsLYDUmQVK+GrmUeN64G3p2Lu+r9qg3eRJBWvlNbvyVT3mUpMQJqomH9UHL7qRK1c0N JgYxCLLxWoIj6fDgLjKFXuz6C1fmLWO8s2Lae06GcJ+urK7YC2jRtiE7aG+cGNZQ2Rme ZutYPzcGJonSyt2cbvoUxD84t1Kl+YFlq1Bb5ATE5hwUq09T/S7TWvyQ01Z4tlvaeyC2 KskW/FqQxozobdZ33QuQOaucOPe2ta/e2RI9cDv9eIX8Oru4GghaYlRzRtuaOSZhvJ3p rs1g== 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:mime-version:content-transfer-encoding; bh=4iY5LVyaAwL0gYA7x7G9RR7noTcF6nrPiSr/rUqWtRQ=; b=Df4ztu0L7kBvghxU8fBQLssxxFM5xBO9H5ylDeETsNOHbGTlVIOQM8ebzDwimmIq7K fi9rL5JxkjQMKpIwE64Sv/Bwjr3xPx4UdG4bqJaF71uz9YSHN2vTzUWg4LsrY10OqxtP BrqeVyBXbB6FnIUutD7KSKKoJ/SJgkKZYBqjpUewmuORRq28vTS6pY/82tBkbq6eGdzy GjIkTu5RVQHn70/AE+DlPA0YhfvESPKIjcKp/dD+Qf+nK4iDx28SHAQq1h/uZaZufOeF 4U/e6LaIwqYjuAWS6OTTJIYXif2W7MQLc9c+XEAa1XTdjbcMRQA3R5rawLDVTRgZfg7U 2lvA== X-Gm-Message-State: APjAAAUze0PbKUtp9M+Qn1A/l9wUBpXmI+Zq7w9KZ917B/IIzQwq2oSO 1CBenH5T+b7anz/zPxGq2wDFpsuB X-Google-Smtp-Source: APXvYqxXO5fkORIasCIKFsqEizwh2cBiqac6wBuGubs592SlPuRKzpR2UiXHGkHE5Qv+4kMAwhI2yQ== X-Received: by 2002:adf:e8ca:: with SMTP id k10mr27261504wrn.50.1577056840945; Sun, 22 Dec 2019 15:20:40 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sun, 22 Dec 2019 23:20:33 +0000 Message-Id: <20191222232035.31613-2-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191222232035.31613-1-liuwe@microsoft.com> References: <20191222232035.31613-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/3] x86/viridian: drop a wrong invalid value from reference TSC implementation X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Wei Liu , Paul Durrant , Andrew Cooper , Paul Durrant , Michael Kelley , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) The only invalid value mentioned in Hyper-V TLFS 5.0c is 0. Michael Kelley confirmed that 0xFFFFFFFF was never used [0]. [0] https://lists.xen.org/archives/html/xen-devel/2019-12/msg01564.html Signed-off-by: Wei Liu --- xen/arch/x86/hvm/viridian/time.c | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/t= ime.c index 6b2d745f3a..0f1cd9e208 100644 --- a/xen/arch/x86/hvm/viridian/time.c +++ b/xen/arch/x86/hvm/viridian/time.c @@ -45,14 +45,9 @@ static void update_reference_tsc(const struct domain *d,= bool initialize) if ( !host_tsc_is_safe() || d->arch.vtsc ) { /* - * The specification states that valid values of TscSequence range - * from 0 to 0xFFFFFFFE. The value 0xFFFFFFFF is used to indicate - * this mechanism is no longer a reliable source of time and that - * the VM should fall back to a different source. - * - * Server 2012 (6.2 kernel) and 2012 R2 (6.3 kernel) actually - * violate the spec. and rely on a value of 0 to indicate that this - * enlightenment should no longer be used. + * The value 0 is used to indicate this mechanism is no longer a + * reliable source of time and that the VM should fall back to a + * different source. */ p->tsc_sequence =3D 0; =20 @@ -77,10 +72,7 @@ static void update_reference_tsc(const struct domain *d,= bool initialize) smp_wmb(); =20 seq =3D p->tsc_sequence + 1; - if ( seq =3D=3D 0xFFFFFFFF || seq =3D=3D 0 ) /* Avoid both 'invalid' v= alues */ - seq =3D 1; - - p->tsc_sequence =3D seq; + p->tsc_sequence =3D seq ? seq : 1; /* Avoid 'invalid' value 0 */ } =20 static uint64_t trc_val(const struct domain *d, int64_t offset) --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu May 2 09:55:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1577056908; cv=none; d=zohomail.com; s=zohoarc; b=Q8n92uNbvsjJwZX17GIYTJ1j4Vf7QnbG6si2fDud0DpjgU8dNUY0jpGGZVx3qXKrVU5ByIn8YjBRZZvZwvU77d5MDQi4V3oqc0n8OUVmi0dnEUdBwECu3AJvoTnEBdyKihCJUO+bHmup0ALv21W4OW9uulSim762he6UY8HC+mY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577056908; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=GSyn+7DNXnuCcdu6n3k9iL4+ZOJRo6jIn61Wi9yH/RE=; b=PH66Mg6rIMcJ1V/HSd0OoHaq7/WS5aLKdUdwcm3ap+usHxbt5qdEbQdloiR2XnNYRgXvjGGLzoKVdFeyxS7hfQJp604/OsDeH+aE3yAGiU6PmYvRKAq/VBCaKGpDN5ug1Cy2wY3K9S3bb0EoadWKPtPqsWNoi1/jv72h8jnWPHY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1577056908671553.7137781484233; Sun, 22 Dec 2019 15:21:48 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijAWr-0004Nz-19; Sun, 22 Dec 2019 23:20:53 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijAWp-0004Ns-Ex for xen-devel@lists.xenproject.org; Sun, 22 Dec 2019 23:20:51 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id ac453b24-2511-11ea-b6f1-bc764e2007e4; Sun, 22 Dec 2019 23:20:42 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id u2so14570208wmc.3 for ; Sun, 22 Dec 2019 15:20:42 -0800 (PST) Received: from debian.mshome.net (38.163.200.146.dyn.plus.net. [146.200.163.38]) by smtp.gmail.com with ESMTPSA id h2sm19925613wrt.45.2019.12.22.15.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2019 15:20:41 -0800 (PST) X-Inumbo-ID: ac453b24-2511-11ea-b6f1-bc764e2007e4 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 :mime-version:content-transfer-encoding; bh=bZpuZmd6fIfuinL0mRo6fZJ/f9CPQalqM5bK+XV8b+4=; b=Q4DC7tfLLN24s9bEzQGjaAnYPGCPR3Y0BzWRgFV3McbLg8xTkks8s3beG53Ll2dM8I PX5N1N0ulo/yxiqFM0454SYuvrocH7FN3HC4TaSEojy1v8M5TrqoChRvLqPiIwFYQfRd BlQgSKaTy1kNSYzQrx3V9SoDV6mGtqVNYSMv+UMdJ8CJFt9jsOAH5J8dqaS6L8JCDiVs lN1+Ewy+InvG/dCIvPSCwbkU2tPclqSNRe+hSVZpENZaQZycSVyDOd9XBetM9+mN9UQW WtAwGsQBz/mjEN+BI3AVNR50spqUw1TEChvqYriaMOin5TRjGTc8foWVUWjoBC9HiVAV EJjA== 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:mime-version:content-transfer-encoding; bh=bZpuZmd6fIfuinL0mRo6fZJ/f9CPQalqM5bK+XV8b+4=; b=uAd1i3J4WSROF+YlfRt6HOTQ7+AXUh4iF8lAppuHI77c8KqEyE5mEyd1AwLmHUHZAH n4+ceoz7RYQAqpHmfOp8X5W6O7iVbiJ7wuymEPYdjSy91XfbBZku/3KO7etZls+vbRBz b4vL+XjNuJH1dB5H7R+DZ+RVMwXhuhqa1L6ThPBxEmUJzY1VyN6zlSUFp9wGWrh/H3da 8R7cxGRRd0geL2hYsfKeINAStfi0UhqgMs2BrIzeI7sMOo+WPCyGAbW8TwJH2tJeZLF2 annrnKhhss1Lo7Wnmdczg6ujC8N718BSrxD/OdX/X+8VfTRioe39G2UWH9UR1zJSnoFx Lyeg== X-Gm-Message-State: APjAAAWQa13dr/plKpMfrPs0eNCH8kx0dtfDTWAJHezSRlcL++FMyHkZ clAvDUiRq0pvi4Iy6dGxutImD/jD X-Google-Smtp-Source: APXvYqxxhCmZyarVg+GLhxA27BLoLKLkLDB1MlVnPVdow8T1ACK3j7eoaDrcSrqQr0o12ryD6DIDUA== X-Received: by 2002:a1c:b603:: with SMTP id g3mr27333377wmf.133.1577056841800; Sun, 22 Dec 2019 15:20:41 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sun, 22 Dec 2019 23:20:34 +0000 Message-Id: <20191222232035.31613-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191222232035.31613-1-liuwe@microsoft.com> References: <20191222232035.31613-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/3] x86/viridian: drop virdian_sint_msr X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Wei Liu , Paul Durrant , Andrew Cooper , Paul Durrant , Michael Kelley , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Use hv_synic_sint in hyperv-tlfs.h instead. This requires adding the missing "polling" member to hv_synic_sint. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/hvm/viridian/synic.c | 20 ++++++++++---------- xen/include/asm-x86/guest/hyperv-tlfs.h | 3 ++- xen/include/asm-x86/hvm/viridian.h | 16 +--------------- 3 files changed, 13 insertions(+), 26 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/synic.c b/xen/arch/x86/hvm/viridian/= synic.c index 54c62f843f..94a2b88733 100644 --- a/xen/arch/x86/hvm/viridian/synic.c +++ b/xen/arch/x86/hvm/viridian/synic.c @@ -143,7 +143,7 @@ int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, = uint64_t val) case HV_X64_MSR_SINT0 ... HV_X64_MSR_SINT15: { unsigned int sintx =3D idx - HV_X64_MSR_SINT0; - union viridian_sint_msr new, *vs =3D + union hv_synic_sint new, *vs =3D &array_access_nospec(vv->sint, sintx); uint8_t vector; =20 @@ -151,7 +151,7 @@ int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, = uint64_t val) return X86EMUL_EXCEPTION; =20 /* Vectors must be in the range 0x10-0xff inclusive */ - new.raw =3D val; + new.as_uint64 =3D val; if ( new.vector < 0x10 ) return X86EMUL_EXCEPTION; =20 @@ -256,13 +256,13 @@ int viridian_synic_rdmsr(const struct vcpu *v, uint32= _t idx, uint64_t *val) case HV_X64_MSR_SINT0 ... HV_X64_MSR_SINT15: { unsigned int sintx =3D idx - HV_X64_MSR_SINT0; - const union viridian_sint_msr *vs =3D + const union hv_synic_sint *vs =3D &array_access_nospec(vv->sint, sintx); =20 if ( !(viridian_feature_mask(d) & HVMPV_synic) ) return X86EMUL_EXCEPTION; =20 - *val =3D vs->raw; + *val =3D vs->as_uint64; break; } =20 @@ -284,7 +284,7 @@ int viridian_synic_vcpu_init(const struct vcpu *v) * initally masked. */ for ( i =3D 0; i < ARRAY_SIZE(vv->sint); i++ ) - vv->sint[i].mask =3D 1; + vv->sint[i].masked =3D 1; =20 /* Initialize the mapping array with invalid values */ for ( i =3D 0; i < ARRAY_SIZE(vv->vector_to_sintx); i++ ) @@ -321,7 +321,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, u= nsigned int sintx, uint64_t delivery) { struct viridian_vcpu *vv =3D v->arch.hvm.viridian; - const union viridian_sint_msr *vs =3D &vv->sint[sintx]; + const union hv_synic_sint *vs =3D &vv->sint[sintx]; struct hv_message *msg =3D vv->simp.ptr; struct { uint32_t TimerIndex; @@ -360,7 +360,7 @@ bool viridian_synic_deliver_timer_msg(struct vcpu *v, u= nsigned int sintx, BUILD_BUG_ON(sizeof(payload) > sizeof(msg->u.payload)); memcpy(msg->u.payload, &payload, sizeof(payload)); =20 - if ( !vs->mask ) + if ( !vs->masked ) vlapic_set_irq(vcpu_vlapic(v), vs->vector, 0); =20 return true; @@ -371,7 +371,7 @@ bool viridian_synic_is_auto_eoi_sint(const struct vcpu = *v, { const struct viridian_vcpu *vv =3D v->arch.hvm.viridian; unsigned int sintx =3D vv->vector_to_sintx[vector]; - const union viridian_sint_msr *vs =3D + const union hv_synic_sint *vs =3D &array_access_nospec(vv->sint, sintx); =20 if ( sintx >=3D ARRAY_SIZE(vv->sint) ) @@ -401,7 +401,7 @@ void viridian_synic_save_vcpu_ctxt(const struct vcpu *v, BUILD_BUG_ON(ARRAY_SIZE(vv->sint) !=3D ARRAY_SIZE(ctxt->sint_msr)); =20 for ( i =3D 0; i < ARRAY_SIZE(vv->sint); i++ ) - ctxt->sint_msr[i] =3D vv->sint[i].raw; + ctxt->sint_msr[i] =3D vv->sint[i].as_uint64; =20 ctxt->simp_msr =3D vv->simp.msr.raw; =20 @@ -430,7 +430,7 @@ void viridian_synic_load_vcpu_ctxt( { uint8_t vector; =20 - vv->sint[i].raw =3D ctxt->sint_msr[i]; + vv->sint[i].as_uint64 =3D ctxt->sint_msr[i]; =20 vector =3D vv->sint[i].vector; if ( vector < 0x10 ) diff --git a/xen/include/asm-x86/guest/hyperv-tlfs.h b/xen/include/asm-x86/= guest/hyperv-tlfs.h index 4402854c80..fe9fb232d0 100644 --- a/xen/include/asm-x86/guest/hyperv-tlfs.h +++ b/xen/include/asm-x86/guest/hyperv-tlfs.h @@ -819,7 +819,8 @@ union hv_synic_sint { u64 reserved1:8; u64 masked:1; u64 auto_eoi:1; - u64 reserved2:46; + u64 polling:1; + u64 reserved2:45; } __packed; }; =20 diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/v= iridian.h index cfbaede158..d694d83521 100644 --- a/xen/include/asm-x86/hvm/viridian.h +++ b/xen/include/asm-x86/hvm/viridian.h @@ -28,20 +28,6 @@ struct viridian_page void *ptr; }; =20 -union viridian_sint_msr -{ - uint64_t raw; - struct - { - uint64_t vector:8; - uint64_t reserved_preserved1:8; - uint64_t mask:1; - uint64_t auto_eoi:1; - uint64_t polling:1; - uint64_t reserved_preserved2:45; - }; -}; - union viridian_stimer_config_msr { uint64_t raw; @@ -77,7 +63,7 @@ struct viridian_vcpu uint64_t scontrol; uint64_t siefp; struct viridian_page simp; - union viridian_sint_msr sint[16]; + union hv_synic_sint sint[16]; uint8_t vector_to_sintx[256]; struct viridian_stimer stimer[4]; unsigned int stimer_enabled; --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel From nobody Thu May 2 09:55:01 2024 Delivered-To: importer@patchew.org Received-SPF: none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org ARC-Seal: i=1; a=rsa-sha256; t=1577056909; cv=none; d=zohomail.com; s=zohoarc; b=Oqb17eCwKmjsMJK9DQO0KzST/s0YmTl8Z+SngNynBvoeAsjAwNq9VC9srS97jmCdqNqg+jLPB3thTSKbpVWql3Nm/vMSolQoU7Y7dcFYlHOal2B0491IOTAHmfPh5tXAhKUDzBev8xPYwVCxExjQh6lzf1JYmt+COo6dciV9Zgs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1577056909; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Fb1uCJzQRjXHXY1tGF0/CbZ1iquuodzjfYJsSE91Gag=; b=FISO3nsROW2VCBbOoO8bhDplmjDKgofSAnvm8nJ0GUj8tRCrHKSUB6h1tsyIa2lqdTjcNOveKoiBdbuWIswqyxGRo9A0YtirUgBOf2T6BVx/DPKPjo3qs/P7MmGv8EKJRpbiEe9zKOET/2CqqvQo7tfTslmnoOXWXlb2+SsVTQc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=none (zohomail.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1577056909424191.21618423086443; Sun, 22 Dec 2019 15:21:49 -0800 (PST) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijAWw-0004PY-9V; Sun, 22 Dec 2019 23:20:58 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1ijAWu-0004P9-Ef for xen-devel@lists.xenproject.org; Sun, 22 Dec 2019 23:20:56 +0000 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id accb77ca-2511-11ea-88e7-bc764e2007e4; Sun, 22 Dec 2019 23:20:43 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id j42so14836332wrj.12 for ; Sun, 22 Dec 2019 15:20:43 -0800 (PST) Received: from debian.mshome.net (38.163.200.146.dyn.plus.net. [146.200.163.38]) by smtp.gmail.com with ESMTPSA id h2sm19925613wrt.45.2019.12.22.15.20.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 22 Dec 2019 15:20:42 -0800 (PST) X-Inumbo-ID: accb77ca-2511-11ea-88e7-bc764e2007e4 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 :mime-version:content-transfer-encoding; bh=0FuqPg6OicHWxmxledg/CsU4XQQ9Kjf4XPECo9VYLsw=; b=QI96+amyNQT37ZoWUJTXu9SxcZmtEO8C0BB5cz9YVSJRjocF/surQ899Kh47GRlqWo ffEbzmQmhjikSTnIhkxJGh897MYBI8pPf0tk8+6/Y5OrWt5tcRIIKP//Xy35R1wNWgjp dh+dmelE8ltFdu6sBg4Yb1wdNM6EpP5TdpSufYFUfeUcBtbxc28UT7Zsy4S2Q5PsNQ7f eBoLxbyOJTxhfHSfLTLcyRMamXmlxKVVYGCmEPGCOhBPmcNNsWMeF/Twq9k2YFpWspIL cSLl0EORMx8mz5DiARhXLxCYrC5ELhV43+bbii4jBeDJCAtqc79qmt5Zr0egw/gH0Zq2 QTfw== 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:mime-version:content-transfer-encoding; bh=0FuqPg6OicHWxmxledg/CsU4XQQ9Kjf4XPECo9VYLsw=; b=IKcqjQUbk+JLE1g+Ua0CO7GLQe5I6b4vb5s5FdGRjGiprlN2JQ08ZL1JkJuAARvJcx FWjXezGb77IghpD/YdpvTkdmweW4blbMSZwJp++p5eHDnGAQXqDAC3PIwrtran43TNOJ J/8HFbftn1a9VuakMsxmjU6THMNXLirKhBYiEdBzPca5ZN//iY+yXo7DAjuNVuJN3EvX YOh2trMX5tou5YY9p3VnrTPzqqTeqEkIsmGxvIcbpEWHayw7sabAiz1Gb9OyE0chpXw1 jEsqcHJn4Z0IluHFtpMc4Zqb4485EOZILsnp5kv+3TYJXJ+RaPb8drahb01o4ZuXdUIm tf0A== X-Gm-Message-State: APjAAAXldcHzmmh+Whdx5vTJCS/H1imG37vyBOCUGp0MaAKC4c5hvqTE vfcElViw3X0dweAE6BAL0zEJ0HWB X-Google-Smtp-Source: APXvYqyCS04af0H2GZWbuDL2vxFE/0q7xGQuYSaWZU8+iPR3UvXNMq9pKtBhjvR93EyXQ+Dm4s92NQ== X-Received: by 2002:adf:f103:: with SMTP id r3mr26168085wro.295.1577056842635; Sun, 22 Dec 2019 15:20:42 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Sun, 22 Dec 2019 23:20:35 +0000 Message-Id: <20191222232035.31613-4-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191222232035.31613-1-liuwe@microsoft.com> References: <20191222232035.31613-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/3] x86/viridian: drop viridian_stimer_config_msr X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Wei Liu , Wei Liu , Paul Durrant , Andrew Cooper , Paul Durrant , Michael Kelley , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) Use hv_stimer_config instead. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/hvm/viridian/time.c | 28 ++++++++++++++-------------- xen/include/asm-x86/hvm/viridian.h | 19 +------------------ 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/t= ime.c index 0f1cd9e208..3de5665c02 100644 --- a/xen/arch/x86/hvm/viridian/time.c +++ b/xen/arch/x86/hvm/viridian/time.c @@ -220,7 +220,7 @@ static void poll_stimer(struct vcpu *v, unsigned int st= imerx) * is disabled make sure the pending bit is cleared to avoid re- * polling. */ - if ( !vs->config.enabled ) + if ( !vs->config.enable ) { clear_bit(stimerx, &vv->stimer_pending); return; @@ -239,7 +239,7 @@ static void poll_stimer(struct vcpu *v, unsigned int st= imerx) if ( vs->config.periodic ) start_stimer(vs); else - vs->config.enabled =3D 0; + vs->config.enable =3D 0; } =20 void viridian_time_poll_timers(struct vcpu *v) @@ -285,7 +285,7 @@ static void time_vcpu_thaw(struct vcpu *v) { struct viridian_stimer *vs =3D &vv->stimer[i]; =20 - if ( vs->config.enabled ) + if ( vs->config.enable ) start_stimer(vs); } } @@ -355,12 +355,12 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx,= uint64_t val) =20 stop_stimer(vs); =20 - vs->config.raw =3D val; + vs->config.as_uint64 =3D val; =20 if ( !vs->config.sintx ) - vs->config.enabled =3D 0; + vs->config.enable =3D 0; =20 - if ( vs->config.enabled ) + if ( vs->config.enable ) start_stimer(vs); =20 break; @@ -383,11 +383,11 @@ int viridian_time_wrmsr(struct vcpu *v, uint32_t idx,= uint64_t val) vs->count =3D val; =20 if ( !vs->count ) - vs->config.enabled =3D 0; + vs->config.enable =3D 0; else if ( vs->config.auto_enable ) - vs->config.enabled =3D 1; + vs->config.enable =3D 1; =20 - if ( vs->config.enabled ) + if ( vs->config.enable ) start_stimer(vs); =20 break; @@ -454,7 +454,7 @@ int viridian_time_rdmsr(const struct vcpu *v, uint32_t = idx, uint64_t *val) unsigned int stimerx =3D (idx - HV_X64_MSR_STIMER0_CONFIG) / 2; const struct viridian_stimer *vs =3D &array_access_nospec(vv->stimer, stimerx); - union viridian_stimer_config_msr config =3D vs->config; + union hv_stimer_config config =3D vs->config; =20 if ( !(viridian_feature_mask(d) & HVMPV_stimer) ) return X86EMUL_EXCEPTION; @@ -464,9 +464,9 @@ int viridian_time_rdmsr(const struct vcpu *v, uint32_t = idx, uint64_t *val) * the enabled flag is clear. */ if ( !config.periodic && test_bit(stimerx, &vv->stimer_pending) ) - config.enabled =3D 0; + config.enable =3D 0; =20 - *val =3D config.raw; + *val =3D config.as_uint64; break; } =20 @@ -549,7 +549,7 @@ void viridian_time_save_vcpu_ctxt( { const struct viridian_stimer *vs =3D &vv->stimer[i]; =20 - ctxt->stimer_config_msr[i] =3D vs->config.raw; + ctxt->stimer_config_msr[i] =3D vs->config.as_uint64; ctxt->stimer_count_msr[i] =3D vs->count; } } @@ -564,7 +564,7 @@ void viridian_time_load_vcpu_ctxt( { struct viridian_stimer *vs =3D &vv->stimer[i]; =20 - vs->config.raw =3D ctxt->stimer_config_msr[i]; + vs->config.as_uint64 =3D ctxt->stimer_config_msr[i]; vs->count =3D ctxt->stimer_count_msr[i]; } } diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/v= iridian.h index d694d83521..d9138562e6 100644 --- a/xen/include/asm-x86/hvm/viridian.h +++ b/xen/include/asm-x86/hvm/viridian.h @@ -28,27 +28,10 @@ struct viridian_page void *ptr; }; =20 -union viridian_stimer_config_msr -{ - uint64_t raw; - struct - { - uint64_t enabled:1; - uint64_t periodic:1; - uint64_t lazy:1; - uint64_t auto_enable:1; - uint64_t vector:8; - uint64_t direct_mode:1; - uint64_t reserved_zero1:3; - uint64_t sintx:4; - uint64_t reserved_zero2:44; - }; -}; - struct viridian_stimer { struct vcpu *v; struct timer timer; - union viridian_stimer_config_msr config; + union hv_stimer_config config; uint64_t count; uint64_t expiration; bool started; --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel