From nobody Thu May 2 17:41:25 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=1576871537; cv=none; d=zohomail.com; s=zohoarc; b=gjJqAXB5+IR7X5UY0LqPxXa4C0SRzN51oCNwekSE46NbFPH/hl8tJ7rPrgNvo3woxqMP1bf9ZDHIDENzk4A/v9pHjgk1pJAFRCvM2jzbkr+gcgmnkmUPQyFRhZtluE/WayqX4qp+vH/aREkkPI4UTpOJLMs3EH/WgZZCXBjpstI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576871537; 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=4e4a108cEHSeumFC97eayZ614UbIbeAuqeec1EcBFyc=; b=cn89jeXbhRuaUa3L9euBHVpqvsuXY3CvTZVATExUfWgB3HGykJCDDSLduMna53CuHCu6k0qqoJNp7GO6Ia9r7TVJOuFGjbIDFzVVt8wwdquEz+FxSMlH6WIHQI9MUjhdZfwfx1CW6rneJQNLzyPOZNLYiR/6CAM23ENAKnS+GV0= 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 1576871537630279.2614066879155; Fri, 20 Dec 2019 11:52:17 -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 1iiOJO-0005Cc-Gu; Fri, 20 Dec 2019 19:51:46 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iiOJN-0005CL-CC for xen-devel@lists.xenproject.org; Fri, 20 Dec 2019 19:51:45 +0000 Received: from mail-wr1-x444.google.com (unknown [2a00:1450:4864:20::444]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 23e34a10-2362-11ea-88e7-bc764e2007e4; Fri, 20 Dec 2019 19:51:40 +0000 (UTC) Received: by mail-wr1-x444.google.com with SMTP id t2so10555764wrr.1 for ; Fri, 20 Dec 2019 11:51:40 -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 a184sm11006287wmf.29.2019.12.20.11.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 11:51:39 -0800 (PST) X-Inumbo-ID: 23e34a10-2362-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=kliZfpMRblOg+5N9KtFg91zHiX9yUIzN4cQEjEjRgcI=; b=oG25thehJRS0ABATMGFFDCGBLyvLB3DMo3gmC14agWj3hX/ja+ox8pjbkvGfHebqc4 RCml4oweJXInO1BoPFnNkSGhtbQhS+ctrWyPv1xjurSwGYL1QOQM4B6eAZDNRb2vemsC S62l82kUKNEce6mNaGbCQhwhmxV3t0iC5Q0kbwtbNJn3LzE0G3ca39ORo51WDeYftCoS 24xnUhdWp0sQ/fLMT79je4o5UuinhKE9M2EW+JvMfsVD3PFlLi6fxHn+zUTGttWgvU4d 4atDe+B/vfaJThVdoW1sbpvi7PEvHaXATikUyVf+4Hb4yYWNDnBcFFrWPgRJBvk7xKgu BcRg== 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=kliZfpMRblOg+5N9KtFg91zHiX9yUIzN4cQEjEjRgcI=; b=g+vkpdjcuUN9ESppRyzcE3NPkSU60WZT1sHyD9MK/rRLJRxPBj/V+p5X7zd3KDyWIW uAHRHbUGWDLaCvvetU+u7W1dWorPFUv11PuPM4N+rwwSJMbYYTMDS1QOzzJ76L8GkldR sTjWFF0XrGZr5Xl2bKMw8sc+zJoK5Q+fQImnV9yrd1jph3StmH57GlctwqivQvuf0391 HBAVitLctMcCUJWFnk2zr/U0CT85IMXu53Ys+0YmJUD+ODh/k+LbATlXb2O9SA6x5m2a TF+7Odn5zd11bO932Rsm097Mdywnx6PIeNdyM6oyxe+rCx+ys3zW+QLv9BVQCV52DD+W unQg== X-Gm-Message-State: APjAAAXlJrDkX9wKuiHqlRFEAPM916knZWxaLXBp/y6ihjYciA0Cx++2 IWYvhL7sIElr3VL8bo0syoqvcHXx X-Google-Smtp-Source: APXvYqyjELWoDS+ni9bx/6mkUeSOM8/9hse/1Uh2/b/08obU3AjXXm5Y3hpuZhe5FU4AeVmHPK5pig== X-Received: by 2002:a5d:49c7:: with SMTP id t7mr16488068wrs.369.1576871499839; Fri, 20 Dec 2019 11:51:39 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Fri, 20 Dec 2019 19:51:32 +0000 Message-Id: <20191220195135.20130-2-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191220195135.20130-1-liuwe@microsoft.com> References: <20191220195135.20130-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 1/4] x86/viridian: drop duplicate defines from private.h and viridian.c 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) Also add HVCALL_EXT_CALL_QUERY_CAPABILITIES to hyperv-tlfs.h. HvGetPartitionID was never used in code so just dropped it. No functional change intended. Signed-off-by: Wei Liu --- xen/arch/x86/hvm/viridian/private.h | 66 ------------------------- xen/arch/x86/hvm/viridian/viridian.c | 29 +++-------- xen/include/asm-x86/guest/hyperv-tlfs.h | 1 + 3 files changed, 8 insertions(+), 88 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/private.h b/xen/arch/x86/hvm/viridia= n/private.h index c272c34cda..958a2814c2 100644 --- a/xen/arch/x86/hvm/viridian/private.h +++ b/xen/arch/x86/hvm/viridian/private.h @@ -5,72 +5,6 @@ =20 #include =20 -/* Viridian MSR numbers. */ -#define HV_X64_MSR_GUEST_OS_ID 0x40000000 -#define HV_X64_MSR_HYPERCALL 0x40000001 -#define HV_X64_MSR_VP_INDEX 0x40000002 -#define HV_X64_MSR_RESET 0x40000003 -#define HV_X64_MSR_VP_RUNTIME 0x40000010 -#define HV_X64_MSR_TIME_REF_COUNT 0x40000020 -#define HV_X64_MSR_REFERENCE_TSC 0x40000021 -#define HV_X64_MSR_TSC_FREQUENCY 0x40000022 -#define HV_X64_MSR_APIC_FREQUENCY 0x40000023 -#define HV_X64_MSR_EOI 0x40000070 -#define HV_X64_MSR_ICR 0x40000071 -#define HV_X64_MSR_TPR 0x40000072 -#define HV_X64_MSR_VP_ASSIST_PAGE 0x40000073 -#define HV_X64_MSR_SCONTROL 0x40000080 -#define HV_X64_MSR_SVERSION 0x40000081 -#define HV_X64_MSR_SIEFP 0x40000082 -#define HV_X64_MSR_SIMP 0x40000083 -#define HV_X64_MSR_EOM 0x40000084 -#define HV_X64_MSR_SINT0 0x40000090 -#define HV_X64_MSR_SINT1 0x40000091 -#define HV_X64_MSR_SINT2 0x40000092 -#define HV_X64_MSR_SINT3 0x40000093 -#define HV_X64_MSR_SINT4 0x40000094 -#define HV_X64_MSR_SINT5 0x40000095 -#define HV_X64_MSR_SINT6 0x40000096 -#define HV_X64_MSR_SINT7 0x40000097 -#define HV_X64_MSR_SINT8 0x40000098 -#define HV_X64_MSR_SINT9 0x40000099 -#define HV_X64_MSR_SINT10 0x4000009A -#define HV_X64_MSR_SINT11 0x4000009B -#define HV_X64_MSR_SINT12 0x4000009C -#define HV_X64_MSR_SINT13 0x4000009D -#define HV_X64_MSR_SINT14 0x4000009E -#define HV_X64_MSR_SINT15 0x4000009F -#define HV_X64_MSR_STIMER0_CONFIG 0x400000B0 -#define HV_X64_MSR_STIMER0_COUNT 0x400000B1 -#define HV_X64_MSR_STIMER1_CONFIG 0x400000B2 -#define HV_X64_MSR_STIMER1_COUNT 0x400000B3 -#define HV_X64_MSR_STIMER2_CONFIG 0x400000B4 -#define HV_X64_MSR_STIMER2_COUNT 0x400000B5 -#define HV_X64_MSR_STIMER3_CONFIG 0x400000B6 -#define HV_X64_MSR_STIMER3_COUNT 0x400000B7 -#define HV_X64_MSR_POWER_STATE_TRIGGER_C1 0x400000C1 -#define HV_X64_MSR_POWER_STATE_TRIGGER_C2 0x400000C2 -#define HV_X64_MSR_POWER_STATE_TRIGGER_C3 0x400000C3 -#define HV_X64_MSR_POWER_STATE_CONFIG_C1 0x400000D1 -#define HV_X64_MSR_POWER_STATE_CONFIG_C2 0x400000D2 -#define HV_X64_MSR_POWER_STATE_CONFIG_C3 0x400000D3 -#define HV_X64_MSR_STATS_PARTITION_RETAIL_PAGE 0x400000E0 -#define HV_X64_MSR_STATS_PARTITION_INTERNAL_PAGE 0x400000E1 -#define HV_X64_MSR_STATS_VP_RETAIL_PAGE 0x400000E2 -#define HV_X64_MSR_STATS_VP_INTERNAL_PAGE 0x400000E3 -#define HV_X64_MSR_GUEST_IDLE 0x400000F0 -#define HV_X64_MSR_SYNTH_DEBUG_CONTROL 0x400000F1 -#define HV_X64_MSR_SYNTH_DEBUG_STATUS 0x400000F2 -#define HV_X64_MSR_SYNTH_DEBUG_SEND_BUFFER 0x400000F3 -#define HV_X64_MSR_SYNTH_DEBUG_RECEIVE_BUFFER 0x400000F4 -#define HV_X64_MSR_SYNTH_DEBUG_PENDING_BUFFER 0x400000F5 -#define HV_X64_MSR_CRASH_P0 0x40000100 -#define HV_X64_MSR_CRASH_P1 0x40000101 -#define HV_X64_MSR_CRASH_P2 0x40000102 -#define HV_X64_MSR_CRASH_P3 0x40000103 -#define HV_X64_MSR_CRASH_P4 0x40000104 -#define HV_X64_MSR_CRASH_CTL 0x40000105 - int viridian_synic_wrmsr(struct vcpu *v, uint32_t idx, uint64_t val); int viridian_synic_rdmsr(const struct vcpu *v, uint32_t idx, uint64_t *val= ); =20 diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridi= an/viridian.c index 4b06b78a27..341592f054 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -19,22 +20,6 @@ =20 #include "private.h" =20 -/* Viridian Hypercall Status Codes. */ -#define HV_STATUS_SUCCESS 0x0000 -#define HV_STATUS_INVALID_HYPERCALL_CODE 0x0002 -#define HV_STATUS_INVALID_PARAMETER 0x0005 - -/* Viridian Hypercall Codes. */ -#define HvFlushVirtualAddressSpace 0x0002 -#define HvFlushVirtualAddressList 0x0003 -#define HvNotifyLongSpinWait 0x0008 -#define HvSendSyntheticClusterIpi 0x000b -#define HvGetPartitionId 0x0046 -#define HvExtCallQueryCapabilities 0x8001 - -/* Viridian Hypercall Flags. */ -#define HV_FLUSH_ALL_PROCESSORS 1 - /* Viridian Partition Privilege Flags */ typedef struct { /* Access to virtual MSRs */ @@ -214,7 +199,7 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32= _t leaf, /* * This value is the recommended number of attempts to try to * acquire a spinlock before notifying the hypervisor via the - * HvNotifyLongSpinWait hypercall. + * HVCALL_NOTIFY_LONG_SPIN_WAIT hypercall. */ res->b =3D viridian_spinlock_retry_count; break; @@ -583,7 +568,7 @@ int viridian_hypercall(struct cpu_user_regs *regs) =20 switch ( input.call_code ) { - case HvNotifyLongSpinWait: + case HVCALL_NOTIFY_LONG_SPIN_WAIT: /* * See section 14.5.1 of the specification. */ @@ -591,8 +576,8 @@ int viridian_hypercall(struct cpu_user_regs *regs) status =3D HV_STATUS_SUCCESS; break; =20 - case HvFlushVirtualAddressSpace: - case HvFlushVirtualAddressList: + case HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE: + case HVCALL_FLUSH_VIRTUAL_ADDRESS_LIST: { struct { uint64_t address_space; @@ -632,7 +617,7 @@ int viridian_hypercall(struct cpu_user_regs *regs) break; } =20 - case HvSendSyntheticClusterIpi: + case HVCALL_SEND_IPI: { struct vcpu *v; uint32_t vector; @@ -695,7 +680,7 @@ int viridian_hypercall(struct cpu_user_regs *regs) gprintk(XENLOG_WARNING, "unimplemented hypercall %04x\n", input.call_code); /* Fallthrough. */ - case HvExtCallQueryCapabilities: + case HVCALL_EXT_CALL_QUERY_CAPABILITIES: /* * This hypercall seems to be erroneously issued by Windows * despite EnableExtendedHypercalls not being set in CPUID leaf 2. diff --git a/xen/include/asm-x86/guest/hyperv-tlfs.h b/xen/include/asm-x86/= guest/hyperv-tlfs.h index ccd9850b27..b128807b2c 100644 --- a/xen/include/asm-x86/guest/hyperv-tlfs.h +++ b/xen/include/asm-x86/guest/hyperv-tlfs.h @@ -374,6 +374,7 @@ struct hv_tsc_emulation_status { #define HVCALL_SIGNAL_EVENT 0x005d #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_SPACE 0x00af #define HVCALL_FLUSH_GUEST_PHYSICAL_ADDRESS_LIST 0x00b0 +#define HVCALL_EXT_CALL_QUERY_CAPABILITIES 0x8001 =20 #define HV_X64_MSR_VP_ASSIST_PAGE_ENABLE 0x00000001 #define HV_X64_MSR_VP_ASSIST_PAGE_ADDRESS_SHIFT 12 --=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 17:41:25 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=1576871541; cv=none; d=zohomail.com; s=zohoarc; b=c0L2RdQIkV4R0D+CsalCbH41FJxEPmj1/kmpWmtkCk1QnqGXWUq02t+x6IVsutpcuoIrObBuA0ha/qOLcBqfmccTk47Ffpx9kBJ3peR/Dwmr7Ad7932iyElmg5rx4O/vRx9mshcYd4Hr0350Tza+xCvzrAJ7vUHXyO0iMud/+7c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576871541; 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=oSX8OFzf9uQMnt3pAogClBfm9lqdBDlTrcIPp3/NjAE=; b=kvctELRIUuDDrePKDjLbcu8P/ysdY8vJUOOUTFVhn0n+j5Hz9pyqIXqUKhNZoqmBKtXWhl9ha575TvrVssz2uVNKKqLBOFse2TI6aq+lFm3x0ZwuDqHYoJKg5jtiScj+9z2JqzZZQHr1qn575gFiq8ffgMQC51/KJYZq11pxSvk= 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 1576871541148351.2382433767285; Fri, 20 Dec 2019 11:52:21 -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 1iiOJT-0005EA-Pm; Fri, 20 Dec 2019 19:51:51 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iiOJS-0005Dp-CO for xen-devel@lists.xenproject.org; Fri, 20 Dec 2019 19:51:50 +0000 Received: from mail-wr1-x442.google.com (unknown [2a00:1450:4864:20::442]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 24652dbe-2362-11ea-88e7-bc764e2007e4; Fri, 20 Dec 2019 19:51:41 +0000 (UTC) Received: by mail-wr1-x442.google.com with SMTP id d16so10505399wre.10 for ; Fri, 20 Dec 2019 11:51: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 a184sm11006287wmf.29.2019.12.20.11.51.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 11:51:40 -0800 (PST) X-Inumbo-ID: 24652dbe-2362-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=p63vANUUHWEiaTG5fEa7etsoj01L2p/h59chGd1If3w=; b=WvrmGTxkUZLbvsTmPoOjsQ7aNTFj99Yc9qsu72SmuE37wjzSsP0dk356wAc2carLgV 2CtbtZcLOVRMAbWfVOoNqVTqvkM6v1rNufVdpzoIZ1V2DA8pK4AqMXSZbm1KNQ2IGszd DY3cO3VFvDjlbsY7eUx3cVGMpN8QUtV0PRYPlflgqtpG2kyb7iH+bp34lIZgHZn7GSD6 BtwIRuZGZYNmWOS8TURS1AwJYR5Fgz5vqL4TvBr9klYWtjl0plltBY0WI8Ylt9kSn4BW hBARswRsPkkoym/5v4VDtdAm9DNR7M/FE4PWKH0VcJRnAh6YPuVq8ov326G/MXzHSexE Y1uQ== 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=p63vANUUHWEiaTG5fEa7etsoj01L2p/h59chGd1If3w=; b=a7xaM49prkBlbfpdz78uagYySITv/M1LO/uYygGTY2hF4zCmkRuw34dw4HatgcROQB VsraYmeziJFdfvlHch5KlJgL9AmgSb6PQqifk+oDA6pLQNoY6BOeDqXCa6nCn9NTUy7V 6C30cSOfk7vQGFCcJBeFJpOcaVv2XOaprMA/nH88q7kha+ka2oCY3fqAH7Sk5JcYxbsB qrQOal6du6t8iAQx+j1tUk/saTYG/utdP1IbBpg5CZU9CSMqiq4NJ+DPC3RQ2HkZtc4y 6U0mx3hi+2WtTA8sGSXormWFwcX5jZh4TQOmBreH0+uq20d531e4mR4w+s1q1RaecyTg Nzaw== X-Gm-Message-State: APjAAAUOmJ6+UNl8JbFsHKP2Afcl0aQMSw2cIgGTfleNU1GnIAY7aJbT 7fDYYP1YGaY9m66WKhXQ4wLAPxGW X-Google-Smtp-Source: APXvYqw2prC6ibEdVfsX3UNHDe+TFEYmtnkAVF+mTWOBh8bEfgvQDlNCrkm3OKy+E4BolihQtcuA5g== X-Received: by 2002:a05:6000:1142:: with SMTP id d2mr15998129wrx.253.1576871500770; Fri, 20 Dec 2019 11:51:40 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Fri, 20 Dec 2019 19:51:33 +0000 Message-Id: <20191220195135.20130-3-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191220195135.20130-1-liuwe@microsoft.com> References: <20191220195135.20130-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 2/4] x86/viridian: drop private copy of HV_REFERENCE_TSC_PAGE in time.c 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 the one defined in hyperv-tlfs.h instead. No functional change intended. Signed-off-by: Wei Liu --- xen/arch/x86/hvm/viridian/time.c | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/t= ime.c index 6ddca29b29..32e79bbcc4 100644 --- a/xen/arch/x86/hvm/viridian/time.c +++ b/xen/arch/x86/hvm/viridian/time.c @@ -13,19 +13,11 @@ =20 #include #include +#include #include =20 #include "private.h" =20 -typedef struct _HV_REFERENCE_TSC_PAGE -{ - uint32_t TscSequence; - uint32_t Reserved1; - uint64_t TscScale; - int64_t TscOffset; - uint64_t Reserved2[509]; -} HV_REFERENCE_TSC_PAGE, *PHV_REFERENCE_TSC_PAGE; - static void update_reference_tsc(const struct domain *d, bool initialize) { struct viridian_domain *vd =3D d->arch.hvm.viridian; @@ -61,7 +53,7 @@ static void update_reference_tsc(const struct domain *d, = bool initialize) * violate the spec. and rely on a value of 0 to indicate that this * enlightenment should no longer be used. */ - p->TscSequence =3D 0; + p->tsc_sequence =3D 0; =20 printk(XENLOG_G_INFO "d%d: VIRIDIAN REFERENCE_TSC: invalidated\n", d->domain_id); @@ -79,15 +71,15 @@ static void update_reference_tsc(const struct domain *d= , bool initialize) * The offset value is calculated on restore after migration and * ensures that Windows will not see a large jump in ReferenceTime. */ - p->TscScale =3D ((10000ul << 32) / d->arch.tsc_khz) << 32; - p->TscOffset =3D trc->off; + p->tsc_scale =3D ((10000ul << 32) / d->arch.tsc_khz) << 32; + p->tsc_offset =3D trc->off; smp_wmb(); =20 - seq =3D p->TscSequence + 1; + seq =3D p->tsc_sequence + 1; if ( seq =3D=3D 0xFFFFFFFF || seq =3D=3D 0 ) /* Avoid both 'invalid' v= alues */ seq =3D 1; =20 - p->TscSequence =3D seq; + p->tsc_sequence =3D seq; } =20 /* --=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 17:41:25 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=1576871545; cv=none; d=zohomail.com; s=zohoarc; b=M2gij8PTl2IgQLelmzubLo1ZSVzFMRagrqfVlhCe+L+miXJrDQag04CIW0JTepdfAcCNyderkoTVeUi3U6LXCoZhWTh8LNFXXOSC6J90awghhWYDMgruPTAHMWCdcgA7gMYfrTI8zNvzKLYKhy4/opVsrCwoD90nJQ+GoJd4LnE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576871545; 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=qKznf90w5/CAEjBGYPk9F7qGa4isGbXpJlq6lC4oI1o=; b=PgbMdsj1ziDJ0V4IG2VuggkPPm02OyFhQYhrCnWGcXvWh78uSvZ1cIxoLyIan5Zvo7SGmAuPP43sdAuZhbrmMVaCYAFmjly2fPc5UjIUYcezb5HegwOl/gy/6Nf7o1pFCbHOouN9mu50rMuFY148ZupKmLwuHnNWQrLoztzalcY= 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 1576871545166741.7102299140084; Fri, 20 Dec 2019 11:52:25 -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 1iiOJY-0005Fv-3M; Fri, 20 Dec 2019 19:51:56 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iiOJX-0005Fb-Cv for xen-devel@lists.xenproject.org; Fri, 20 Dec 2019 19:51:55 +0000 Received: from mail-wm1-x344.google.com (unknown [2a00:1450:4864:20::344]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 24fbc5b2-2362-11ea-88e7-bc764e2007e4; Fri, 20 Dec 2019 19:51:42 +0000 (UTC) Received: by mail-wm1-x344.google.com with SMTP id 20so10285717wmj.4 for ; Fri, 20 Dec 2019 11:51: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 a184sm11006287wmf.29.2019.12.20.11.51.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 11:51:41 -0800 (PST) X-Inumbo-ID: 24fbc5b2-2362-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=oKZN/wLj0zIyBHSMJP0Pr97AVDWgdWD3HmHzj4XKRDM=; b=R2e3vhA2BVf38bNkDC6p5fSZQ1YgryIIrrdeontJZhXR+oH6o45aWQD/7wVKjePDRs 7oHJ2bX8wJCc9yN1N4CySxL17vFky85X8+aJSOhsMchENgfnXrS4WbBUHOACflse+u3/ pnBRritcowdJD2qZxSe4hocth4vZdpKxAauBxpPl0+9+rpnmtmI3vHlk5rFluqlfHPnA MggJco25FflczTkgWm6Dn9kC/QCw2BHhfRLR2Z5jDAXp6ANcekfQGKZ+tIX9TDA2K4xD WzbOGwOLzbPK0BwNJwqV4fEtLwMREpev1skMhOwn4gf50umQY1IN/TNMleszyM0+qOne vsVg== 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=oKZN/wLj0zIyBHSMJP0Pr97AVDWgdWD3HmHzj4XKRDM=; b=G2+spj4VS1qAJge7WSVnZ/zW0CwxOF0z1EKONz6Avtq5udZzMlv8bT4WCeeowvEehd jdzUgw8XUlho+soGMDItVh+V6fNtlNo500h5oFv+v4v4fTrUMfCl0CuTIVA0t1VYXhZE 3vFZsE180uVVpSN0vNBE7I0LviqyXxdYMVPCv0WdvVHMjrpUBzmRuP4FX6Zrk3iWAnh4 0X27x+tPq8DE+5w9pqSIIWksUmLRVAOrzmMkB3xeogWJkTUTClWkbO6cblIq7LsE6GLY VjcPJUr9aVGxzCCPM3ybegTavOpPkRRj0//vYxNKWLzgHK2Hmb8Rnvi9BOoO9DXXKBkN HEIg== X-Gm-Message-State: APjAAAWbm1MXvJcFJEzhCEy8A8Q+5BnN/8ewZdu3H79QRD+w896wHuz2 KJIGFcYK4+0CHc4CtKo3/mGCOOBc X-Google-Smtp-Source: APXvYqyiPoHMqqFFG4lo8fAXsnK4k2XGj80fQ+TcMt3BZ4QyheBROn3xcy/1YV8NkgvZbfYR3PLbXw== X-Received: by 2002:a05:600c:2046:: with SMTP id p6mr18442661wmg.110.1576871501709; Fri, 20 Dec 2019 11:51:41 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Fri, 20 Dec 2019 19:51:34 +0000 Message-Id: <20191220195135.20130-4-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191220195135.20130-1-liuwe@microsoft.com> References: <20191220195135.20130-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 3/4] x86: provide and use hv_tsc_scale 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 Hyper-V clock source and Xen's own viridian code need the same functionality. Move the function in viridian/time.c to hyperv.h and use it in both places. No functional change. Signed-off-by: Wei Liu --- xen/arch/x86/hvm/viridian/time.c | 30 ++-------------------------- xen/arch/x86/time.c | 7 +------ xen/include/asm-x86/guest/hyperv.h | 32 ++++++++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 36 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/t= ime.c index 32e79bbcc4..6b2d745f3a 100644 --- a/xen/arch/x86/hvm/viridian/time.c +++ b/xen/arch/x86/hvm/viridian/time.c @@ -13,6 +13,7 @@ =20 #include #include +#include #include #include =20 @@ -82,33 +83,6 @@ static void update_reference_tsc(const struct domain *d,= bool initialize) p->tsc_sequence =3D seq; } =20 -/* - * The specification says: "The partition reference time is computed - * by the following formula: - * - * ReferenceTime =3D ((VirtualTsc * TscScale) >> 64) + TscOffset - * - * The multiplication is a 64 bit multiplication, which results in a - * 128 bit number which is then shifted 64 times to the right to obtain - * the high 64 bits." - */ -static uint64_t scale_tsc(uint64_t tsc, uint64_t scale, int64_t offset) -{ - uint64_t result; - - /* - * Quadword MUL takes an implicit operand in RAX, and puts the result - * in RDX:RAX. Because we only want the result of the multiplication - * after shifting right by 64 bits, we therefore only need the content - * of RDX. - */ - asm ( "mulq %[scale]" - : "+a" (tsc), "=3Dd" (result) - : [scale] "rm" (scale) ); - - return result + offset; -} - static uint64_t trc_val(const struct domain *d, int64_t offset) { uint64_t tsc, scale; @@ -116,7 +90,7 @@ static uint64_t trc_val(const struct domain *d, int64_t = offset) tsc =3D hvm_get_guest_tsc(pt_global_vcpu_target(d)); scale =3D ((10000ul << 32) / d->arch.tsc_khz) << 32; =20 - return scale_tsc(tsc, scale, offset); + return hv_scale_tsc(tsc, scale, offset); } =20 static void time_ref_count_freeze(const struct domain *d) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index bbcc9b10b8..d21875de9e 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -725,12 +725,7 @@ static inline uint64_t read_hyperv_timer(void) =20 } while ( tsc_page->tsc_sequence !=3D seq ); =20 - /* ret =3D ((tsc * scale) >> 64) + offset; */ - asm ( "mul %[scale]; add %[offset], %[ret]" - : "+a" (tsc), [ret] "=3D&d" (ret) - : [scale] "rm" (scale), [offset] "rm" (offset) ); - - return ret; + return hv_scale_tsc(tsc, scale, offset); } =20 static struct platform_timesource __initdata plt_hyperv_timer =3D diff --git a/xen/include/asm-x86/guest/hyperv.h b/xen/include/asm-x86/guest= /hyperv.h index cc21b9abfc..c7a7f32bd5 100644 --- a/xen/include/asm-x86/guest/hyperv.h +++ b/xen/include/asm-x86/guest/hyperv.h @@ -19,10 +19,38 @@ #ifndef __X86_GUEST_HYPERV_H__ #define __X86_GUEST_HYPERV_H__ =20 -#ifdef CONFIG_HYPERV_GUEST - #include =20 +/* + * The specification says: "The partition reference time is computed + * by the following formula: + * + * ReferenceTime =3D ((VirtualTsc * TscScale) >> 64) + TscOffset + * + * The multiplication is a 64 bit multiplication, which results in a + * 128 bit number which is then shifted 64 times to the right to obtain + * the high 64 bits." + */ +static inline uint64_t hv_scale_tsc(uint64_t tsc, uint64_t scale, + int64_t offset) +{ + uint64_t result; + + /* + * Quadword MUL takes an implicit operand in RAX, and puts the result + * in RDX:RAX. Because we only want the result of the multiplication + * after shifting right by 64 bits, we therefore only need the content + * of RDX. + */ + asm ( "mulq %[scale]" + : "+a" (tsc), "=3Dd" (result) + : [scale] "rm" (scale) ); + + return result + offset; +} + +#ifdef CONFIG_HYPERV_GUEST + #include =20 struct ms_hyperv_info { --=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 17:41:25 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=1576871555; cv=none; d=zohomail.com; s=zohoarc; b=FWfeUXI4Fl/Q9JDOoaCZWyHm58hGVQJtFxpJELegeBPkqjZJjZvNTLBhztWxAEQHC2sefEkfKFJRrly0aOi77y7qUZiPvkkTACIKq/doFsR6Hdb6fidGSZAo94w/3BvND9HQRGu6kwnU/3DsufGFf1ElFmE7k6a7Ej1QDbqLo+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576871555; 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=mjjcqGlTzz/WUSWvhHmO7GY7JLlsXNU0mUthMNhwAk4=; b=RQ09/4G7UZr0GaRJfF+XlNZelSK9RxGAzsonkRIMVHkF74iLKH14jT5MVF9sutRd+WW2ZqKYokgH+fu2u3FrOyTjXLOT3yyKBk2HLF22k6kQgn+0Fp9eiOJ+bNUVvsOIds7NHGPTt7tEAcDqe/l9QoL1LN2k9ao7XW6tGU1haCI= 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 1576871555241737.038620133699; Fri, 20 Dec 2019 11:52:35 -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 1iiOJd-0005Iq-K8; Fri, 20 Dec 2019 19:52:01 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iiOJc-0005I9-Cx for xen-devel@lists.xenproject.org; Fri, 20 Dec 2019 19:52:00 +0000 Received: from mail-wm1-x343.google.com (unknown [2a00:1450:4864:20::343]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 2577aca4-2362-11ea-a1e1-bc764e2007e4; Fri, 20 Dec 2019 19:51:43 +0000 (UTC) Received: by mail-wm1-x343.google.com with SMTP id d139so10215512wmd.0 for ; Fri, 20 Dec 2019 11:51: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 a184sm11006287wmf.29.2019.12.20.11.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 11:51:42 -0800 (PST) X-Inumbo-ID: 2577aca4-2362-11ea-a1e1-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=ENSa39ODblgiZaftP8Kk0EjckN+kVjfxs00LYiEa0zA=; b=U8P866uOz7wW6yMjmX+KQO4Cbs2YsHrD/rKMTWN2CAssIxCTFvmnA1g64FJiyjoyGh Tacyf3/OCvRrqYuXip6BWu0v4NSQoiJ+u6CK9kDueWOA/O4NKDQkWlXzEQw3gsweZvY8 r9exl1Syw7/UFVd6IOeltC6u/jTF917M36y/xdqXVMW+UQIqm//tcXG5cjj/jrCsYT7Y axT3Fy0bfKf/N1LZ60s3Qyb5pFGqiPRDGF7uZOBWQAl8HR5rpInzRvF8vRdU5//qSQdi UDxROdtf7fWXf3svctOY7pHWGEg+fnbYdNrmThBaOYDldOn1mEBUf/cacB2ULxiOhaVt UHpA== 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=ENSa39ODblgiZaftP8Kk0EjckN+kVjfxs00LYiEa0zA=; b=QkBnQSw9tujjvnmg2SjPB5R81KD7C3qgT0qr1hTc1KppkH71soV++HD8mHm4nl5x5x xWUORljF8NRBkKX0/e7IOIMDdcILk976lMHSCRxd0cfmuxIsDnv1yG9xjjKC6yguUQvb M5awJ5ll3jW6MY0ErmUPPtIMgL/uybttw67X2i+Q+lYsVmKMZLoZRzlO3Qw2F3InDSDj WshtYm8hmeUkytUeCgu9dVFzscO70dQKs7TkHf4eRSeLBI0VOrhDmoN5PY1maRhSjwGy lcZGLbQKl/qsW+iwnf/dNcdky6K/VJ8Q0LnmHziAEpTa4bWOdDvVOEZpsw0VnI51Nq7r hPxA== X-Gm-Message-State: APjAAAVa+6L6yxMv8RvEDyUgmVfLIOmbRzHz+tvfYSHuq77aVSeudv1P 4cRqOpKoRiNz1AI2LUyvk3zrAfJQ X-Google-Smtp-Source: APXvYqyhTOshxtscHAnLQKLSBEE7LGzhnvOTkOx32FfoyDXPy/XviJahrWjyuTex90Ckma9YejH66w== X-Received: by 2002:a7b:cc98:: with SMTP id p24mr17624019wma.139.1576871502578; Fri, 20 Dec 2019 11:51:42 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Fri, 20 Dec 2019 19:51:35 +0000 Message-Id: <20191220195135.20130-5-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191220195135.20130-1-liuwe@microsoft.com> References: <20191220195135.20130-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 4/4] x86: move viridian_guest_os_id_msr to hyperv-tlfs.h 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) Suggested-by: Paul Durrant Signed-off-by: Wei Liu --- xen/arch/x86/hvm/viridian/viridian.c | 2 +- xen/include/asm-x86/guest/hyperv-tlfs.h | 13 +++++++++++++ xen/include/asm-x86/hvm/viridian.h | 18 +++--------------- 3 files changed, 17 insertions(+), 16 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/viridian.c b/xen/arch/x86/hvm/viridi= an/viridian.c index 341592f054..44c8e6cac6 100644 --- a/xen/arch/x86/hvm/viridian/viridian.c +++ b/xen/arch/x86/hvm/viridian/viridian.c @@ -218,7 +218,7 @@ void cpuid_viridian_leaves(const struct vcpu *v, uint32= _t leaf, =20 static void dump_guest_os_id(const struct domain *d) { - const union viridian_guest_os_id_msr *goi; + const union hv_guest_os_id *goi; =20 goi =3D &d->arch.hvm.viridian->guest_os_id; =20 diff --git a/xen/include/asm-x86/guest/hyperv-tlfs.h b/xen/include/asm-x86/= guest/hyperv-tlfs.h index b128807b2c..4402854c80 100644 --- a/xen/include/asm-x86/guest/hyperv-tlfs.h +++ b/xen/include/asm-x86/guest/hyperv-tlfs.h @@ -327,6 +327,19 @@ struct ms_hyperv_tsc_page { */ =20 #define HV_LINUX_VENDOR_ID 0x8100 +union hv_guest_os_id +{ + uint64_t raw; + struct + { + uint64_t build_number:16; + uint64_t service_pack:8; + uint64_t minor:8; + uint64_t major:8; + uint64_t os:8; + uint64_t vendor:16; + }; +}; =20 struct hv_reenlightenment_control { __u64 vector:8; diff --git a/xen/include/asm-x86/hvm/viridian.h b/xen/include/asm-x86/hvm/v= iridian.h index 010c8b58d4..cfbaede158 100644 --- a/xen/include/asm-x86/hvm/viridian.h +++ b/xen/include/asm-x86/hvm/viridian.h @@ -9,6 +9,8 @@ #ifndef __ASM_X86_HVM_VIRIDIAN_H__ #define __ASM_X86_HVM_VIRIDIAN_H__ =20 +#include + union viridian_page_msr { uint64_t raw; @@ -83,20 +85,6 @@ struct viridian_vcpu uint64_t crash_param[5]; }; =20 -union viridian_guest_os_id_msr -{ - uint64_t raw; - struct - { - uint64_t build_number:16; - uint64_t service_pack:8; - uint64_t minor:8; - uint64_t major:8; - uint64_t os:8; - uint64_t vendor:16; - }; -}; - struct viridian_time_ref_count { unsigned long flags; @@ -112,7 +100,7 @@ struct viridian_time_ref_count =20 struct viridian_domain { - union viridian_guest_os_id_msr guest_os_id; + union hv_guest_os_id guest_os_id; union viridian_page_msr hypercall_gpa; struct viridian_time_ref_count time_ref_count; struct viridian_page reference_tsc; --=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 17:41:25 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=1576876930; cv=none; d=zohomail.com; s=zohoarc; b=V4AXVXp91ZuTE2WB9MOkMgo97moTbJwm+L4qqWUN0jZcr52IxfzZPKLqK1LRDgXxeo9vymy25vXeki8131vN6pNT5ecZgV3x6oTuKW5eBd440gz7bGmC3BmfQ1HKGDiBuw/uigLtG49V9LsVah8G+OKcq1MElfiZuky9/N+Om0k= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1576876930; 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=+Kwb7PQosqwaCOUlw9GcC4d9TFO3xs5cgvYE1HBqnJg=; b=G4spbdfZVsxoH45//di2PcPxpF6jxmRNMbqmrxBe2FanxMRwwprcVmtSJSDPZuljJFUt65lilUp5GdHRr3Z/n8t6T/SqSjKSycDhFzs3MRnb3qJFjCaZcweiRxve2akcSp5ECAOBqk2ZyKSgshI8PVRsTVjEGqH9tpE87GaogRw= 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 1576876930594195.78398482899343; Fri, 20 Dec 2019 13:22:10 -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 1iiPhw-0004rZ-5p; Fri, 20 Dec 2019 21:21:12 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1iiPhu-0004rU-MK for xen-devel@lists.xenproject.org; Fri, 20 Dec 2019 21:21:10 +0000 Received: from mail-wm1-x341.google.com (unknown [2a00:1450:4864:20::341]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id a326f518-236e-11ea-a914-bc764e2007e4; Fri, 20 Dec 2019 21:21:08 +0000 (UTC) Received: by mail-wm1-x341.google.com with SMTP id d139so10360780wmd.0 for ; Fri, 20 Dec 2019 13:21:08 -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 x6sm10703200wmi.44.2019.12.20.13.21.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2019 13:21:06 -0800 (PST) X-Inumbo-ID: a326f518-236e-11ea-a914-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=4ffelIFJTzhSS9sw/VI5ijX/3laM20yZv6P8SPKhRj8=; b=eVRthahOHFw4grqzEG9ZnPqU4fjocBZ8ukAFYF9EwUSvs9ID9boSDoblOICvYcS5yx 2WJsSflqU9CPrt1APNsBPqmwicT6hcu68qyXruoQ5h0lgJf8vJMhlC1Gh6R7XsSOr6tU RsIxbu3o2RZmvjg2hTM4nboZHpBzR1pL2D6wDpUdtEozRHhyXsGQEk0dkjsv3ZtSihgZ qL3ahpima6eDYffqPezA92aIgPuSvFP14NClF1SZr65ERMy1WKUQRQWkVrh0ITxNRz13 YO7+OB5Tfq15ClpCQxnzuBgVtPLerjQ7GmhqyLR/0uAnX0yNCSIvSow9aQ3JAaj2v4S6 ZRIA== 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=4ffelIFJTzhSS9sw/VI5ijX/3laM20yZv6P8SPKhRj8=; b=naa5Fr/I47mLBivn3qWfkUin0ELmPFIJEVMRLCaItaWNeLlULW4SsK91bwFPuQd2zE wm4ID3EcT/bsZCObVw3B8y1H72h06rkuaPUoz2NfhIaweLxxkHu+ImFQOnn0aWB8tfHU Ho3H2IReltUWTBZFQN0v8Dsk43/Nvfwt9mPFYVqd1McuJHtlm1UoGSLX1XIxQsdYvOw9 ivysuE+QlT0oaBo+Y0dJAV2M92s/M2ugSt/smiuo+GkN/xBG3BbtBqrOEmAda18utoiC K7nSJ6k9/2QldJQB+UtogPeeHf45m2xrbA75Ob+AYV1P+vzw7P0j9vYOAxzZfunnliLN psXg== X-Gm-Message-State: APjAAAUu7HTOlH1jadkKDBhVak1m1f3xii6PBRUHFmeZqJoVWhc5gZC9 gKQ8p3TVbDrI7h6SE1LSXqs/gY6MJeU= X-Google-Smtp-Source: APXvYqxb0IctU0dgeXlvLrGhPpmZzCmyZmldE6IZc91VSgn726K8fcK/+ZU2nlyvE0TvsoFmsC+0zA== X-Received: by 2002:a1c:638a:: with SMTP id x132mr19851397wmb.43.1576876867391; Fri, 20 Dec 2019 13:21:07 -0800 (PST) From: Wei Liu X-Google-Original-From: Wei Liu To: Xen Development List Date: Fri, 20 Dec 2019 21:21:03 +0000 Message-Id: <20191220212103.4192-1-liuwe@microsoft.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20191220195135.20130-1-liuwe@microsoft.com> References: <20191220195135.20130-1-liuwe@microsoft.com> MIME-Version: 1.0 Subject: [Xen-devel] [PATCH 5/4] 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 | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/xen/arch/x86/hvm/viridian/time.c b/xen/arch/x86/hvm/viridian/t= ime.c index 6b2d745f3a..b8280a1a60 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,7 +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 */ + if ( seq =3D=3D 0 ) /* Avoid 'invalid' value */ seq =3D 1; =20 p->tsc_sequence =3D seq; --=20 2.20.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel