[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] x86/hpet: setup HPET even when disabled due to stopping in deep C states


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Tue, 26 Oct 2021 17:12:33 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uPWJh6qs7ggJoWdqKmPe85QWZtBPoSDuYY1GiEa4V8U=; b=jgVuFlKMfIWi2zi2Nw9qGSo4hauztSk/J05F58arQMzg4lMp1UkUrtWdDTpHdHqGK7nTJL5rHZvDBaiXMRp3LB6cp9n7dm4nzQfUtTgLkjW93ZuZrS+AYfyebEteG2T+6SCTclW+2/7DEA3Sw0Upa43oiev3/J8qLs8IXL08/yUb1ouWb90xKk5du/N60N3XxYBcqo+uAa4sVJyGY8qzZcTfhZZ+OI7HzAnzt396bOGCm955yQNCXOAbcaWg4TynxwBosoebjYxGse5DyeDBA3+fO8euvmzSLJawLFV1g+7mnx/n0taLujrgzOeSF3lJtEf4uNvZTMdD1r2JfKo5ag==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f8FrI25K6VN7YawKz6Aypq3Q3prGB1ftbqs41JojcenYdl7nPa7xjTlckLJo2LARtLwlGIk6XBDgfvQ7I36fBxV2qXAJGPwZoWYS1VSjKp1BIn4xjZAx5m6anaVDMNEQN/5PlmBL4sfdn+QizyTKD4FjFNBaGtP6fe8LvHR+GS9t/x+urDeLb+oveSwH6gAgy+QLthS9T1bgVZApFNW6LeZeSBGSVK85UVR8etYtAVmuORSLqfp9EfPba5GLgjtzLifUugHqwws6ADVk5XgHKEk0EkPqSixHE5olzZf1svi1GPHKL1HMsmqqNa5/KLLwU7dcQqAeDg3evrggmQjx9g==
  • Authentication-results: esa6.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Tue, 26 Oct 2021 15:13:02 +0000
  • Ironport-data: A9a23:RAvE0Kjafct+xj4M3GJbTr2EX161thcKZh0ujC45NGQN5FlHY01je htvDTyDbPyDMWegKo0gbd619xgBu5OBm9NqTlRvqCw0Eykb9cadCdqndUqhZCn6wu8v7a5EA 2fyTvGacajYm1eF/k/F3oAMKRCQ7InQLlbGILes1htZGEk0F0/NtTo5w7Rg29Yy34Dia++wk YiaT/P3aQfNNwFcagr424rbwP+4lK2v0N+wlgVWicFj5DcypVFMZH4sDfjZw0/DaptVBoaHq 9Prl9lVyI97EyAFUbtJmp6jGqEDryW70QKm0hK6UID66vROS7BbPg/W+5PwZG8O4whlkeydx /1U6JufSC0bEZb8nac9cD56UC1cM/xvreqvzXiX6aR/zmXDenrohf5vEFs3LcsT/eMf7WNmr KJCbmpXN1ba2rzwkOnTpupE36zPKOHxO4wSoDd4xCzxBvc6W5HTBa7N4Le02R9t2JkWTamDN 6L1bxJkTwnjXEMRIWtMBYkmtuGxpmDQLidh/Qf9Sa0fvDGIkV0ZPKLWGMXRUsyHQ4NShEnwj mDM8nn9AxoaHMeC0jfD+XWp7sffkCW+VI8MGbmQ8v9xnEbV1mEVEAcRV1awvb++kEHWZj5EA xVKoGx09/F0rRH1CImmN/GlnJKalgdBXPVROd8V0zGIiYr3xCTaCkoKHxcUPbTKq/QKbTAt0 1aImfbgCjpurKCZRBqhy1uEkd+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SdkDksH4mGL0hAe9KGi8zAlZrgbxJDLxk76DOWhTftzLLhCRCX0joXTjsKmN4ZgC f4uj28wp/mn+Cwyxfa2WOWx5NKmOH5wt8GIMCXkMAaJhjllw7tToV8XL+puiwzvYiUmRoXue iJhy1lE9V46nvXcG3wiRzx2zP42DJr0HPmwU/wuwqqneXJABYBT+ZRj4NQdRXUr2A6ustn7a 5N12WF87JKEBLphk3Glpj1fiAvsnDxjWspkOYVgXAae5AZcqVtoYsW+14QOIscHRj99JssHI BVfYDhDc5tABGnhk3izyxSKITGZAV2Iv7GeDlNhiWt6UkUoJgjpHFog/D2nR87hdsAotd/lq L5259T5cRzp/ktHNRA7dc6MLmK41P2MGbx2RqpUC/a/YE8SjnwQs3Mkf8IDN/DQu1+8HJ1ou WZbG9l
  • Ironport-sdr: AunLTUCF7wooD42Hyc5vxgng4D8++FjVQKvc6nTwP1+ss3TwqLw9kqcoGH+2VAtLcubmh+1onw ypCbI7ixzUhnHIpmh6WzMRAlkkQxwHiwIaAnowTK5MH1eRrkYai+iNFHmXBomOY0/3iptl84t7 43vGc6/p5fsOFat33FFOBJN7Y0sbkZ40oxMz7trzWCLmISLqxN8EAwsA2gqNnAqsPrRRwnRkRz zU6zxN8RrKS+1L1PtA0lyzLOVwbweoEA97jg6vJSHrLXeuRQj5JFFQEAoFIY1LUi3Sz5c/vAJi 2A7aNiK6x1aMFFqYlMOKjSJF
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

Always allow the HPET to be setup, but don't report a frequency back
to the platform time source probe in order to avoid it from being
selected as a valid timer if it's not usable.

Doing the setup even when not intended to be used as a platform timer
is required so that is can be used in legacy replacement mode in order
to assert the IO-APIC is capable of receiving interrupts.

Fixes: c12731493a ('x86/hpet: Use another crystalball to evaluate HPET 
usability')
Reported-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
 xen/arch/x86/time.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index cbadaa036f..a290aba3e8 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -379,6 +379,12 @@ static int64_t __init init_hpet(struct platform_timesource 
*pts)
 {
     uint64_t hpet_rate, start;
     uint32_t count, target;
+    /*
+     * Allow HPET to be setup, but report a frequency of 0 so it's not selected
+     * as a timer source. This is required so it can be used in legacy
+     * replacement mode in check_timer.
+     */
+    bool disable_hpet = false;
 
     if ( hpet_address && strcmp(opt_clocksource, pts->id) &&
          cpuidle_using_deep_cstate() )
@@ -391,7 +397,7 @@ static int64_t __init init_hpet(struct platform_timesource 
*pts)
             case 0x0f1c:
             /* HPET on Cherry Trail platforms will halt in deep C states. */
             case 0x229c:
-                hpet_address = 0;
+                disable_hpet = true;
                 break;
             }
 
@@ -431,14 +437,14 @@ static int64_t __init init_hpet(struct 
platform_timesource *pts)
             else if ( !strcmp(opt_clocksource, pts->id) )
                 printk("HPET use requested via command line, but dysfunctional 
in PC10\n");
             else
-                hpet_address = 0;
+                disable_hpet = true;
         }
 
-        if ( !hpet_address )
+        if ( disable_hpet )
             printk("Disabling HPET for being unreliable\n");
     }
 
-    if ( (hpet_rate = hpet_setup()) == 0 )
+    if ( (hpet_rate = hpet_setup()) == 0 || disable_hpet )
         return 0;
 
     pts->frequency = hpet_rate;
-- 
2.33.0




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.