From patchwork Wed Feb 22 17:54:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krister Johansen X-Patchwork-Id: 13149417 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6ECB1C64ED6 for ; Wed, 22 Feb 2023 17:55:23 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.499733.771016 (Exim 4.92) (envelope-from ) id 1pUtKP-00017q-Gr; Wed, 22 Feb 2023 17:54:53 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 499733.771016; Wed, 22 Feb 2023 17:54:53 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pUtKP-00017j-ED; Wed, 22 Feb 2023 17:54:53 +0000 Received: by outflank-mailman (input) for mailman id 499733; Wed, 22 Feb 2023 17:54:51 +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 1pUtKN-0000qN-Dp for xen-devel@lists.xenproject.org; Wed, 22 Feb 2023 17:54:51 +0000 Received: from beige.elm.relay.mailchannels.net (beige.elm.relay.mailchannels.net [23.83.212.16]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id fef0b3c7-b2d9-11ed-93b6-47a8fe42b414; Wed, 22 Feb 2023 18:54:49 +0100 (CET) Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id D3D513E109B for ; Wed, 22 Feb 2023 17:54:46 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 71AD63E16EA for ; Wed, 22 Feb 2023 17:54:46 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.116.179.67 (trex/6.7.1); Wed, 22 Feb 2023 17:54:46 +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-a306.dreamhost.com (Postfix) with ESMTPSA id 4PMP1d5LMsz14t for ; Wed, 22 Feb 2023 09:54:45 -0800 (PST) Received: from johansen (uid 1000) (envelope-from kjlx@templeofstupid.com) id e004a by kmjvbox (DragonFly Mail Agent v0.12); Wed, 22 Feb 2023 09:54:42 -0800 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: fef0b3c7-b2d9-11ed-93b6-47a8fe42b414 X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1677088486; a=rsa-sha256; cv=none; b=63+Wzl6aBa531tl++b0ez2kBBPnfvSmR1U3paRQGyxN98y0O6OP92cYBF2lR5ZZEZsUgan fB0zWbwPctZXpYaqJrenQutcV4/kpDkxk6uuUu50mmU91JN5YFLCPNfwMfq/jUxLi/mbS7 eoSv1QL4WS5EHUqTjCZ4/2BpZ/UR99OnIbNVAr6qWOYFSpwgf8Wu2YJAhTD2pUY281J0dp Xr05cSpGW3mFme/tmnPYZIjf4aYfC7fgn1WU++4Rl0Jrat0h4HfwhmCv6RDVwGXyEyYK8l XXVVVzgW5qL97/JY3XdYIcyAj4aS2kqF1ISOSUgKG4rxlqAiI7rng7xpxVl52g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1677088486; 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=jPLOaJx1XC+xepUu7FtXLYzyt2YPI1cX/q7Jp4OSr1s=; b=skRg/mcrOyzGQm0FL1h7oKwMmwDebYA2MST4Egm8WShxvESPe1l4fTiOvcpnjYlWYAXVrH dXjIjk+R4Xo9meW81cAoVIkLi8iVvbiIuBqCso2zkU2RhuMKvx8HdT/GUtyXF5kAo+aI73 M6uuKWqON/mHF5PH59N9Ia1MHCj8DaAbm/QttXJi0XC6quHOr71LrN0dXd0e53yMTASGhW paHtyFqPB7sM63+wFP+CyBdzljyvwqwwk0+uig30e5kY7sVHzZyvTW6aL8lWaH9FTmmj+s 1KVJcgILAerjpfcX/f6AiLvjBcVEkXv6VjkrA1IA3rTTp5ccH0MnwlJQH67t9Q== ARC-Authentication-Results: i=1; rspamd-9788b98bc-5fcpp; auth=pass smtp.auth=dreamhost smtp.mailfrom=kjlx@templeofstupid.com X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|kjlx@templeofstupid.com X-MailChannels-Auth-Id: dreamhost X-Macabre-Tart: 3a1cb88f046d65e9_1677088486703_666751592 X-MC-Loop-Signature: 1677088486703:994943487 X-MC-Ingress-Time: 1677088486702 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=templeofstupid.com; s=dreamhost; t=1677088485; bh=jPLOaJx1XC+xepUu7FtXLYzyt2YPI1cX/q7Jp4OSr1s=; h=Date:From:To:Cc:Subject:Content-Type; b=qdobVzsjR9zv6DZs/ZU+JlQIvIMABZGLWOYbRVtroNjbc4+MwJguWEWeMnrF0Cp+n gyLo1jZQeSTRi5y6uDlBdZ1ToVqbbFNaMxVqgSWzePjP0AK2N+YAgj/UzF5mEFIvTo DPXCiUhTXg4XfeSPA2n2I53qi0o3iQTxErDZ2PEU= Date: Wed, 22 Feb 2023 09:54:42 -0800 From: Krister Johansen To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Jan Beulich , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Marcelo Tosatti , Anthony Liguori , David Reaver , Brendan Gregg Subject: [PATCH linux-next v2 1/2] xen: update arch/x86/include/asm/xen/cpuid.h Message-ID: <94b9046dd0db3794f0633d134b7108508957758d.1677038165.git.kjlx@templeofstupid.com> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Update arch/x86/include/asm/xen/cpuid.h from the Xen tree to get newest definitions. This picks up some TSC mode definitions and comment formatting changes. Signed-off-by: Krister Johansen --- arch/x86/include/asm/xen/cpuid.h | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/arch/x86/include/asm/xen/cpuid.h b/arch/x86/include/asm/xen/cpuid.h index 6daa9b0c8d11..a3c29b1496c8 100644 --- a/arch/x86/include/asm/xen/cpuid.h +++ b/arch/x86/include/asm/xen/cpuid.h @@ -89,11 +89,21 @@ * Sub-leaf 2: EAX: host tsc frequency in kHz */ +#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 * Sub-leaf 0: EAX: Features * Sub-leaf 0: EBX: vcpu id (iff EAX has XEN_HVM_CPUID_VCPU_ID_PRESENT flag) + * Sub-leaf 0: ECX: domain id (iff EAX has XEN_HVM_CPUID_DOMID_PRESENT flag) */ #define XEN_HVM_CPUID_APIC_ACCESS_VIRT (1u << 0) /* Virtualized APIC registers */ #define XEN_HVM_CPUID_X2APIC_VIRT (1u << 1) /* Virtualized x2APIC accesses */ @@ -102,12 +112,16 @@ #define XEN_HVM_CPUID_VCPU_ID_PRESENT (1u << 3) /* vcpu id is present in EBX */ #define XEN_HVM_CPUID_DOMID_PRESENT (1u << 4) /* domid is present in ECX */ /* - * Bits 55:49 from the IO-APIC RTE and bits 11:5 from the MSI address can be - * used to store high bits for the Destination ID. This expands the Destination - * ID field from 8 to 15 bits, allowing to target APIC IDs up 32768. + * With interrupt format set to 0 (non-remappable) bits 55:49 from the + * IO-APIC RTE and bits 11:5 from the MSI address can be used to store + * high bits for the Destination ID. This expands the Destination ID + * field from 8 to 15 bits, allowing to target APIC IDs up 32768. */ #define XEN_HVM_CPUID_EXT_DEST_ID (1u << 5) -/* Per-vCPU event channel upcalls */ +/* + * Per-vCPU event channel upcalls work correctly with physical IRQs + * bound to event channels. + */ #define XEN_HVM_CPUID_UPCALL_VECTOR (1u << 6) /* From patchwork Wed Feb 22 17:54:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krister Johansen X-Patchwork-Id: 13149418 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DF142C636D6 for ; Wed, 22 Feb 2023 17:55:35 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.499736.771026 (Exim 4.92) (envelope-from ) id 1pUtKf-0001X8-P9; Wed, 22 Feb 2023 17:55:09 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 499736.771026; Wed, 22 Feb 2023 17:55:09 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pUtKf-0001X1-MT; Wed, 22 Feb 2023 17:55:09 +0000 Received: by outflank-mailman (input) for mailman id 499736; Wed, 22 Feb 2023 17:55:08 +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 1pUtKe-0000qN-O5 for xen-devel@lists.xenproject.org; Wed, 22 Feb 2023 17:55:08 +0000 Received: from bee.yew.relay.mailchannels.net (bee.yew.relay.mailchannels.net [23.83.220.14]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 08a50463-b2da-11ed-93b6-47a8fe42b414; Wed, 22 Feb 2023 18:55:06 +0100 (CET) Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 0C7123C0F14 for ; Wed, 22 Feb 2023 17:55:03 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 9C5503C121C for ; Wed, 22 Feb 2023 17:55:02 +0000 (UTC) Received: from pdx1-sub0-mail-a306.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.109.196.241 (trex/6.7.1); Wed, 22 Feb 2023 17:55:02 +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-a306.dreamhost.com (Postfix) with ESMTPSA id 4PMP1x3PjLz16n for ; Wed, 22 Feb 2023 09:55:00 -0800 (PST) Received: from johansen (uid 1000) (envelope-from kjlx@templeofstupid.com) id e004a by kmjvbox (DragonFly Mail Agent v0.12); Wed, 22 Feb 2023 09:54:56 -0800 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: 08a50463-b2da-11ed-93b6-47a8fe42b414 X-Sender-Id: dreamhost|x-authsender|kjlx@templeofstupid.com ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1677088502; a=rsa-sha256; cv=none; b=8Zs+e79PUTur1pKIYqSseh/3YYpctXHHUG3GycmJb7iEdHZwh3xiQDMtSw3iwF/ElWC1jO ommpNiCmt8bdjc7iNnX2CTPHMLCAbdi+LYaKSIxBMDe5HkXDzumqkVrAPXlcv5onCo1Fzf f8LDvD2nu498InMVOz/Z6qo1sTBiDkpazfoI2YHajI+mGWi78Fe5zrwzNIcUOIYdPrZTIY a3cBj+wZwi8xYxHjL8cvLGxwzj0g0Na20M8Ui32qu9qvz329/CZYo3j3CBaqGoTXav3gPc OhL+H6VrfvTq1W9uYyWLriSjXYDEmSyqpTt3h/hELvjchL4kI/KAyyk6nEY1wQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1677088502; 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=SFO62oAKLgPH71Y0Xq/5Q3j7DH6Nq6RDi9wLwjcluGc=; b=h8mVkyZHbUBEALiaIWjXcFZz/KPRxjmuORzreG3ZSTkVSFqX5ixXfASZAtdAy38jhyMvge 3hQqSabRrsfriX5TbsJiSpfAPdpWqCDVvCt4oQqYxintaQL31SdENyaZ2Z/+ge9mx4Bt+X vJ4gDwlb8X6P/P73dYWnWkSmxESDD4bFalo5+TL3t7qEXjw7WJukQKK0YEv1T00eK5gIxd e+FZbjPTUJzycm94qkwU99gXBlMB4eGtFkWLcalDZDGu2nZAXstKR80EF5j/c1Xp5jV3i7 RRicXhz2UReH2NlM7OqBO5gmIKcXWDUKLrxFzGC/ZRGW2SkvMOxgMzoz2VURZQ== ARC-Authentication-Results: i=1; rspamd-9788b98bc-pxv92; 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-Society-Bored: 028f1e1360e580b5_1677088502885_2835282340 X-MC-Loop-Signature: 1677088502885:1762775582 X-MC-Ingress-Time: 1677088502884 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=templeofstupid.com; s=dreamhost; t=1677088501; bh=SFO62oAKLgPH71Y0Xq/5Q3j7DH6Nq6RDi9wLwjcluGc=; h=Date:From:To:Cc:Subject:Content-Type; b=vTqKdTqV3fyyocP+64zXlj1tzc67az1mF0QlGIVA7FWxEvS4mSVL+7fk4t/2Fcwtf 2pU84jGzaNFXWp/Bzge0J21sWy4OU5ap/jKeZcu17zdwPCeVivDtpNouR+3TN6D9Wu Du4Fbz0DE1/+XUB7IPgSTi+etkSammTUibilmSYw= Date: Wed, 22 Feb 2023 09:54:56 -0800 From: Krister Johansen To: xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org Cc: Juergen Gross , Jan Beulich , Boris Ostrovsky , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Marcelo Tosatti , Anthony Liguori , David Reaver , Brendan Gregg Subject: [PATCH linux-next v2 2/2] x86/xen/time: cleanup xen_tsc_safe_clocksource Message-ID: References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: Modifies xen_tsc_safe_clocksource() to use newly defined constants from arch/x86/include/asm/xen/cpuid.h. This replaces a numeric value with XEN_CPUID_TSC_MODE_NEVER_EMULATE, and deletes a comment that is now self explanatory. There should be no change in the function's behavior. Signed-off-by: Krister Johansen --- arch/x86/xen/time.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c index 95140609c8a8..94056013a2a4 100644 --- a/arch/x86/xen/time.c +++ b/arch/x86/xen/time.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -495,11 +496,7 @@ static int __init xen_tsc_safe_clocksource(void) /* Leaf 4, sub-leaf 0 (0x40000x03) */ cpuid_count(xen_cpuid_base() + 3, 0, &eax, &ebx, &ecx, &edx); - /* tsc_mode = no_emulate (2) */ - if (ebx != 2) - return 0; - - return 1; + return ebx == XEN_CPUID_TSC_MODE_NEVER_EMULATE; } static void __init xen_time_init(void)