From nobody Thu May 9 08:06:50 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) 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=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=templeofstupid.com) ARC-Seal: i=2; a=rsa-sha256; t=1675100761; cv=pass; d=zohomail.com; s=zohoarc; b=N7HVkNVUS7ukkdbMMghrSg0iJPuGA0ZGu1gBuU3zTDsgBJcRmLzbQhlLVYICL5Y7R8NIoTyQJ/OQtogWxOqlqwOIbApmnVKZFljiGFXUsgOqsj8KBzFwhbe4uleE07qzFrWOJJWbsV4Zk2LB1RD5l0DCZVM6eWloG4YpyKaTb98= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1675100761; h=Content-Type: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=lzWbg7pH2Qdroe4uerh/jh+EVVJsKlEREiv+gIZXp/4=; b=YAlzkqZKCenObc+RfiFRlwjD+ROPu328cEd9nkFVMu6bBEjzS9eDMLxY9C1xdJyst2qJdUaJZKkc+LJ46EdOqjmkWB6pzvSKBiPU7eOv5byPt1EInk3wFL25aJq0CcW6BuvL+hM09fHRGZIfMNc6AdBams8qyMpfQ9dODgNZAuQ= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=templeofstupid.com) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1675100758191512.7047174607335; Mon, 30 Jan 2023 09:45:58 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.487102.754577 (Exim 4.92) (envelope-from ) id 1pMYDT-0003EA-LT; Mon, 30 Jan 2023 17:45:15 +0000 Received: by outflank-mailman (output) from mailman id 487102.754577; Mon, 30 Jan 2023 17:45:15 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMYDT-0003Df-IA; Mon, 30 Jan 2023 17:45:15 +0000 Received: by outflank-mailman (input) for mailman id 487102; Mon, 30 Jan 2023 17:45:14 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pMYDS-00031n-H9 for xen-devel@lists.xenproject.org; Mon, 30 Jan 2023 17:45:14 +0000 Received: from bonobo.larch.relay.mailchannels.net (bonobo.larch.relay.mailchannels.net [23.83.213.22]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id d462c1cd-a0c5-11ed-8ba2-5fe241e16ab0; Mon, 30 Jan 2023 18:45:07 +0100 (CET) Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 660A95C2652 for ; Mon, 30 Jan 2023 17:45:04 +0000 (UTC) Received: from pdx1-sub0-mail-a304.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 20F7E5C22AC for ; Mon, 30 Jan 2023 17:45:03 +0000 (UTC) Received: from pdx1-sub0-mail-a304.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.116.179.68 (trex/6.7.1); Mon, 30 Jan 2023 17:45:04 +0000 Received: from kmjvbox (c-76-102-200-71.hsd1.ca.comcast.net [76.102.200.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kjlx@templeofstupid.com) by pdx1-sub0-mail-a304.dreamhost.com (Postfix) with ESMTPSA id 4P5Fv23cYtzS9 for ; Mon, 30 Jan 2023 09:45:02 -0800 (PST) Received: from johansen (uid 1000) (envelope-from kjlx@templeofstupid.com) id e0034 by kmjvbox (DragonFly Mail Agent v0.12); Mon, 30 Jan 2023 09:44:59 -0800 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d462c1cd-a0c5-11ed-8ba2-5fe241e16ab0 X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1675100703; a=rsa-sha256; cv=none; b=TrsAuql7YYd5WwaELsMFJyT20+05x1Vs+1TTMg+hWteoVNhAWBrrcFXxmL+JcXKac5FgI2 KpfLmxPZyGt1r9SovVmK6TVncc8fcwngR93Jq5g7oWxCaT0jgVUQ+lAiJlzK2OvcO116ui fWJ7SFGTd5I7ql4Xp1QLT+MGE4hNSHfcubF7ibOmWo5JMUXazub/w2BByBFTGvsulJS6mX Yp9VpKbVtrMf1Ip/aW/vPk/JWJLxkzvRQOJIOD2YVTMOm9O+6XvP6QUo0fwLK49RtRbUw4 TXp7h5xl/yX+WIoP+S/l0dDDmSNT/OZ8Hr0SFR+IT+bFp3zjnbU4Kp0DndtQUg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1675100703; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references:dkim-signature; bh=lzWbg7pH2Qdroe4uerh/jh+EVVJsKlEREiv+gIZXp/4=; b=E3tMINDvnoMbohYwJ2477XupHt22eo5PKXuXrCR80DCEOx6O3LtSpoKqYpU4NiSr/RvYAt r4cpur82sRhkJdBkIOFC/7Gi66WferqRwBCK3SM9C+Q8oICzA5CGBzIPGCgiMDnUeYAJbE V6mw+ksIgkXsy62qdb0SGeecvTs1vGQ7eyvAQyddDtewVg4mr+ChgDGZhn91JfEyBqrNCh jx7qO+h4ZCffvFpNK1LU3NCpDMNZhUlwfkgwaFgOa4TrU65P+nTr1yUEgdQAaKYTBzbroz 7YetaIDnEiEr9W0pxX/bLIvHwQ2mvbgfn/tKvqfZtdgjLFoRi9YmRb79+6T80Q== ARC-Authentication-Results: i=1; rspamd-5fb8f68d88-c76m6; auth=pass smtp.auth=dreamhost smtp.mailfrom=kjlx@templeofstupid.com X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com X-MC-Relay: Good X-MailChannels-SenderId: dreamhost|x-authsender|kjlx@templeofstupid.com X-MailChannels-Auth-Id: dreamhost X-Chief-Abortive: 6c1bbaf9559e6c5a_1675100704225_1603156238 X-MC-Loop-Signature: 1675100704225:1628132625 X-MC-Ingress-Time: 1675100704225 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=templeofstupid.com; s=dreamhost; t=1675100702; bh=lzWbg7pH2Qdroe4uerh/jh+EVVJsKlEREiv+gIZXp/4=; h=Date:From:To:Cc:Subject:Content-Type; b=XZIPzc7tWyRIsJ5Nl1A+WZvwQPUww3beix2acoBlBry7erf54qAkT87ly6BsCQeI+ GvE9ZnFpO3pHv7GIDqIKL09jDoyZTXXm5ZT+4TBeWHe7m6LTGVB2d/E1IRTeQWKswE rvLmm6awA85ljK3livi/ugFn2X7msalK1Od1WOYo= Date: Mon, 30 Jan 2023 09:44:59 -0800 From: Krister Johansen To: xen-devel@lists.xenproject.org Cc: Jan Beulich , Andrew Cooper , Roger Pau =?utf-8?B?TW9ubsOp?= , Wei Liu , Juergen Gross , Boris Ostrovsky , David Reaver Subject: [PATCH v4] xen/x86: public: add TSC defines for cpuid leaf 4 Message-ID: <20230130174459.GB2001@templeofstupid.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-ZohoMail-DKIM: fail (Signature length not correct: got 128 but was expecting 256) X-ZM-MESSAGEID: 1675100763358100002 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Cpuid leaf 4 contains information about how the state of the tsc, its mode, and some additional information. A commit that is queued for linux would like to use this to determine whether the tsc mode has been set to 'no emulation' in order to make some decisions about which clocksource is more reliable. Expose this information in the public API headers so that they can subsequently be imported into linux and used there. Link: https://lore.kernel.org/xen-devel/eda8d9f2-3013-1b68-0df8-64d7f13ee35= e@suse.com/ Link: https://lore.kernel.org/xen-devel/0835453d-9617-48d5-b2dc-77a2ac298ba= d@oracle.com/ Signed-off-by: Krister Johansen Reviewed-by: Jan Beulich --- v4 - Rename TSC_MODE_NEVER_EMULATE_TSC_AUX to TSC_MODE_PVRDTSCP (feedback fr= om Jan Buelich) v3 - Additional formating cleanups (feedback from Jan Buelich) - Ensure that TSC_MODE #defines match the names of those in time.h (feedb= ack from Jan Buelich) v2: - Fix whitespace between comment and #defines (feedback from Jan Beulich) - Add tsc mode 3: no emulate TSC_AUX (feedback from Jan Beulich) --- xen/include/public/arch-x86/cpuid.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/xen/include/public/arch-x86/cpuid.h b/xen/include/public/arch-= x86/cpuid.h index 7ecd16ae05..9d02f86564 100644 --- a/xen/include/public/arch-x86/cpuid.h +++ b/xen/include/public/arch-x86/cpuid.h @@ -72,6 +72,15 @@ * Sub-leaf 2: EAX: host tsc frequency in kHz */ =20 +#define XEN_CPUID_TSC_EMULATED (1u << 0) +#define XEN_CPUID_HOST_TSC_RELIABLE (1u << 1) +#define XEN_CPUID_RDTSCP_INSTR_AVAIL (1u << 2) + +#define XEN_CPUID_TSC_MODE_DEFAULT (0) +#define XEN_CPUID_TSC_MODE_ALWAYS_EMULATE (1u) +#define XEN_CPUID_TSC_MODE_NEVER_EMULATE (2u) +#define XEN_CPUID_TSC_MODE_PVRDTSCP (3u) + /* * Leaf 5 (0x40000x04) * HVM-specific features --=20 2.25.1