From nobody Sat Nov 23 10:48:32 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=pass; 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; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725893740; cv=none; d=zohomail.com; s=zohoarc; b=IMvDEcpEWg86V6TutY0JroZ82Q7f5jJBJOSS9pW7x2/39+MLBNy+S3iOLPlmAHLqFIXoJ1HozaZ2lNUYE5pDecvTeFuRP5/Snlt2liWJaGe4seAl3/c0GdxnN11+jd0kXYEaVABcHuGUV8lykypmxOPCO6I64ge0xpKJosedb+0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725893740; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=SzgDXYtJg5j6LBhNtCvSNUlOqDJy96VnpmbQz4pdFjA=; b=jFWwtGCAWhSiAP+YT68DQboSIXY0dQfFPYoYdcaj49MAQlVkzlSeMyafRJUR/+6LusMpsgsVrqeqI4swpZriw6rO04wlJz5IWWZx0tJTyVj8LQ4+90oa/dAILx7+UR7GKRNonFyQhZmru62JnCKx96p4HoTHGhUuGhUW7Xkwsho= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725893740896330.0140304786099; Mon, 9 Sep 2024 07:55:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.794627.1203641 (Exim 4.92) (envelope-from ) id 1snfnS-0003mn-82; Mon, 09 Sep 2024 14:55:18 +0000 Received: by outflank-mailman (output) from mailman id 794627.1203641; Mon, 09 Sep 2024 14:55:18 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1snfnS-0003mg-5J; Mon, 09 Sep 2024 14:55:18 +0000 Received: by outflank-mailman (input) for mailman id 794627; Mon, 09 Sep 2024 14:55:17 +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 1snfnR-0003YR-83 for xen-devel@lists.xenproject.org; Mon, 09 Sep 2024 14:55:17 +0000 Received: from mail-lj1-x22a.google.com (mail-lj1-x22a.google.com [2a00:1450:4864:20::22a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 85e2f69b-6ebb-11ef-99a1-01e77a169b0f; Mon, 09 Sep 2024 16:55:15 +0200 (CEST) Received: by mail-lj1-x22a.google.com with SMTP id 38308e7fff4ca-2f75428b9f8so30678911fa.3 for ; Mon, 09 Sep 2024 07:55:15 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25ceaf4fsm351514766b.152.2024.09.09.07.55.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 07:55:12 -0700 (PDT) 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: 85e2f69b-6ebb-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725893715; x=1726498515; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SzgDXYtJg5j6LBhNtCvSNUlOqDJy96VnpmbQz4pdFjA=; b=shuZlL53/LsEZNxvdhEBsqLke6gV7/CymcoObyHOFwBWfE2x2P7iRn8pW5HBge8bpb 0hj2Q26r4sR2C22obBNLAH/3qikD007QyyrO0oqJzDmWLj+cEsua78Yc8gRFBUxxaKaS 8oVC1rgYD0QewUXWaRZ5GMYh2RGuQ8HWx8TaA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725893715; x=1726498515; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=SzgDXYtJg5j6LBhNtCvSNUlOqDJy96VnpmbQz4pdFjA=; b=ZwBQtgy3dRdBE4Vj1LVvx+dnjC6uJ/G7wUeTS12qxar0hNVb3HtbAPVKayoAQrOsCq 4VboIK2vJTDtm5JOkRTOcUn1F9iC7sBPAd2NpAIFdsTVynAcAidjxePTzq0dUrlN8h8/ UA1cBlMhIxN8WdLSD/231GZfeKyUt0rXyPTLzSfCWJM3jfxBxtf8hHzbZKplnFQbHzX8 gq9aX+EQ13Up1q33xhbu1Hfn+rBiPnAIE47j5YFQfTkBjd9DFuCvjdtN2YhktQ2jbKXs 3f/ml5Jq5VIhW/krozQTtfE8yXHNwH11ftgFLFRRUp3C5B+YWMETTXUvthUVQkKPmxs/ sn+w== X-Gm-Message-State: AOJu0Yzd+wjZ5ef4m2pvqn2aIWqLhetZBj7gC+zQjo9XxmKDilqe3FDN mjIkN6kqFN1e9Z2i7FFoJXFpuNa42wx6ERov62IZdSAN5MZzGtqSRUaVfXQGqGanqQCQZvytp8+ K X-Google-Smtp-Source: AGHT+IF3ZkUNy/jr3w/Wt6ZHMU/LIrZM1q0T3siIkFtydQHSCn7lR5EsReWAiwYgwUCtWItn+G5l8Q== X-Received: by 2002:a2e:741:0:b0:2f6:4d1b:d9d6 with SMTP id 38308e7fff4ca-2f75a99e85dmr57388001fa.25.1725893714054; Mon, 09 Sep 2024 07:55:14 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH v5 1/4] x86/time: pull cmos_rtc_probe outside of function and rename Date: Mon, 9 Sep 2024 16:54:52 +0200 Message-ID: <20240909145455.7517-2-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909145455.7517-1-roger.pau@citrix.com> References: <20240909145455.7517-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725893742857116600 Rename cmos_rtc_probe to opt_cmos_rtc_probe in order to better describe it being a command line option, and rename cmos_probe() function to cmos_rtc_probe(). Also move opt_cmos_rtc_probe to being a static global variable in preparati= on for further changes that will require the variable being global to the file. No functional change intended. Signed-off-by: Roger Pau Monn=C3=A9 Acked-by: Jan Beulich --- Changes since v4: - New in this version. --- xen/arch/x86/time.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index f37300946e4e..ec48805a2239 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1291,7 +1291,10 @@ static bool __get_cmos_time(struct rtc_time *rtc) return t1 <=3D SECONDS(1) && t2 < MILLISECS(3); } =20 -static bool cmos_probe(struct rtc_time *rtc_p, bool cmos_rtc_probe) +static bool __read_mostly opt_cmos_rtc_probe; +boolean_param("cmos-rtc-probe", opt_cmos_rtc_probe); + +static bool cmos_rtc_probe(struct rtc_time *rtc_p) { unsigned int seconds =3D 60; =20 @@ -1300,7 +1303,7 @@ static bool cmos_probe(struct rtc_time *rtc_p, bool c= mos_rtc_probe) bool success =3D __get_cmos_time(rtc_p); struct rtc_time rtc =3D *rtc_p; =20 - if ( likely(!cmos_rtc_probe) ) + if ( likely(!opt_cmos_rtc_probe) ) return true; =20 if ( !success || @@ -1332,8 +1335,6 @@ static unsigned long get_cmos_time(void) { unsigned long res; struct rtc_time rtc; - static bool __read_mostly cmos_rtc_probe; - boolean_param("cmos-rtc-probe", cmos_rtc_probe); =20 if ( efi_enabled(EFI_RS) ) { @@ -1343,12 +1344,12 @@ static unsigned long get_cmos_time(void) } =20 if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) ) - cmos_rtc_probe =3D false; - else if ( system_state < SYS_STATE_smp_boot && !cmos_rtc_probe ) + opt_cmos_rtc_probe =3D false; + else if ( system_state < SYS_STATE_smp_boot && !opt_cmos_rtc_probe ) panic("System with no CMOS RTC advertised must be booted from EFI" " (or with command line option \"cmos-rtc-probe\")\n"); =20 - if ( !cmos_probe(&rtc, cmos_rtc_probe) ) + if ( !cmos_rtc_probe(&rtc) ) panic("No CMOS RTC found - system must be booted from EFI\n"); =20 return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec); --=20 2.46.0 From nobody Sat Nov 23 10:48:32 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=pass; 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; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725893736; cv=none; d=zohomail.com; s=zohoarc; b=XsQzBQU6/4dET8BP1Dej9V0TUk6VRM5s7LhS5ornwdX38xeIEqaseyoGr5GhqPbkLI79bBX4Ww2JoAEfiUb/8gEbVWGmDdb8/2WrMxYLg1UG/1lkPgLXi8OMWniWWIy7ANS378DKBkfamCfGcRDKMKle9kBnBReNKHD0bLNgUug= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725893736; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=Xfpm3WHLIJFmf39gbtVp4szeZd8QNXu+ehi7rpOFEyM=; b=Pe2UZP/NSfmE7O8py5ugEPDLvQuQNTrR75MV078RzD+XPUDoQVDxHf9UplotFFNBJzbfdYB7r0e6q+nwdajGWO2kUHnKuTNIKy7x/1feXlmBXTXRRf+yI3JtY8OYcDdJ8tEaz8TrLqhISIuHZuTL209Qh1w29EWNKIWEHitqgEM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725893735991260.86189732837465; Mon, 9 Sep 2024 07:55:35 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.794628.1203652 (Exim 4.92) (envelope-from ) id 1snfnT-00041E-H9; Mon, 09 Sep 2024 14:55:19 +0000 Received: by outflank-mailman (output) from mailman id 794628.1203652; Mon, 09 Sep 2024 14:55:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1snfnT-000415-C4; Mon, 09 Sep 2024 14:55:19 +0000 Received: by outflank-mailman (input) for mailman id 794628; Mon, 09 Sep 2024 14:55:18 +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 1snfnS-0003YR-En for xen-devel@lists.xenproject.org; Mon, 09 Sep 2024 14:55:18 +0000 Received: from mail-ej1-x62d.google.com (mail-ej1-x62d.google.com [2a00:1450:4864:20::62d]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 8683bcce-6ebb-11ef-99a1-01e77a169b0f; Mon, 09 Sep 2024 16:55:16 +0200 (CEST) Received: by mail-ej1-x62d.google.com with SMTP id a640c23a62f3a-a8d60e23b33so118987766b.0 for ; Mon, 09 Sep 2024 07:55:16 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25a43370sm352479166b.96.2024.09.09.07.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 07:55:14 -0700 (PDT) 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: 8683bcce-6ebb-11ef-99a1-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725893716; x=1726498516; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Xfpm3WHLIJFmf39gbtVp4szeZd8QNXu+ehi7rpOFEyM=; b=tEj449eb6olpMGnYEq5kxk3UEQY5/lRW1oh/3b2cKZs8BxBWcfR/9W2nwo6RZTgsBq GE7psQnQtPSnNMMWHkrswLOwwwx407LBejzg+9NEvTrqrfpZz0qy0hg4QrhkReKOBome bfXZ8ZZLhtg2oe6nkX3gPkuLvyQsfKRdWITU4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725893716; x=1726498516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Xfpm3WHLIJFmf39gbtVp4szeZd8QNXu+ehi7rpOFEyM=; b=m29vx92MehmoZkKpdU5qurdLT6b/9KYAyv0u87voxzB7oC/x9wzdPURgjbJYQhFHJA 4eMeLn9HaXsg3CTRHcOFG8veq2WhQpRwSTd7JLiLPxDyxkYHRAQSivdPF29lG8TquOvH Dol0ZspTpEx7rnQmpEwRgzmcDHa03rcvEOa5MwhcQ2rmC2rLEEz5UpirzveC5iesa0WB UshT7G8G/WzKBpOjMxZGBu4c/bpUP8b98Y47muipevWLCSWdue95wLM1sqrOfEJE6NyL Efk/7S0JZehYylvCQnz64KyrQpFcwnR8LfB5yAE9WfgI5CjeYCCCwIZNOuzpUW7Hfq9f 00Ug== X-Gm-Message-State: AOJu0YxbmFx2s24ZJ1gwqKTszLrb/gEKaR7ZrVy74EPMp7805cIXlQC1 iRWhQe/mRu0iRqqCyo7gaEuiMvA05mijRCLWqj7R2l0L0L8YXzz8FzQDwcae0aBK3qsZhmDwU7q S X-Google-Smtp-Source: AGHT+IGI89/WnGR2jms/WaYozqbIjByY6fMxe8cuiwWRtN9ti1u0miKWi7/EySN9f0CfVngBcTToyA== X-Received: by 2002:a17:907:94d5:b0:a8d:5e1a:8d80 with SMTP id a640c23a62f3a-a8d5e1a8f3fmr276508466b.40.1725893715237; Mon, 09 Sep 2024 07:55:15 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH v5 2/4] x86/time: introduce probing logic for the wallclock Date: Mon, 9 Sep 2024 16:54:53 +0200 Message-ID: <20240909145455.7517-3-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909145455.7517-1-roger.pau@citrix.com> References: <20240909145455.7517-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725893737415116600 Adding such probing allows to clearly separate init vs runtime code, and to place the probing logic into the init section for the CMOS case. Note both the Xen shared_info page wallclock, and the EFI wallclock don't really have= any probing-specific logic. The shared_info wallclock will always be there if booted as a Xen guest, while the EFI_GET_TIME method probing relies on chec= king if it returns a value different than 0. The panic message printed when Xen is unable to find a viable wallclock sou= rce has been adjusted slightly, I believe the printed guidance still provides t= he same amount of information to the user. Signed-off-by: Roger Pau Monn=C3=A9 Reviewed-by: Jan Beulich --- Changes since v3: - Remove ASSERT from cmos_read(). - Change indentation of panic message arguments in probe_wallclock(). - Add __init attribute. Changes since v2: - New in this version. --- xen/arch/x86/time.c | 118 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 92 insertions(+), 26 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index ec48805a2239..1dcbd9f520f5 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1291,20 +1291,23 @@ static bool __get_cmos_time(struct rtc_time *rtc) return t1 <=3D SECONDS(1) && t2 < MILLISECS(3); } =20 -static bool __read_mostly opt_cmos_rtc_probe; +static bool __initdata opt_cmos_rtc_probe; boolean_param("cmos-rtc-probe", opt_cmos_rtc_probe); =20 -static bool cmos_rtc_probe(struct rtc_time *rtc_p) +static bool __init cmos_rtc_probe(void) { unsigned int seconds =3D 60; =20 + if ( !(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) ) + return true; + + if ( !opt_cmos_rtc_probe ) + return false; + for ( ; ; ) { - bool success =3D __get_cmos_time(rtc_p); - struct rtc_time rtc =3D *rtc_p; - - if ( likely(!opt_cmos_rtc_probe) ) - return true; + struct rtc_time rtc; + bool success =3D __get_cmos_time(&rtc); =20 if ( !success || rtc.sec >=3D 60 || rtc.min >=3D 60 || rtc.hour >=3D 24 || @@ -1331,26 +1334,12 @@ static bool cmos_rtc_probe(struct rtc_time *rtc_p) return false; } =20 -static unsigned long get_cmos_time(void) + +static unsigned long cmos_rtc_read(void) { - unsigned long res; struct rtc_time rtc; =20 - if ( efi_enabled(EFI_RS) ) - { - res =3D efi_get_time(); - if ( res ) - return res; - } - - if ( likely(!(acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC)) ) - opt_cmos_rtc_probe =3D false; - else if ( system_state < SYS_STATE_smp_boot && !opt_cmos_rtc_probe ) - panic("System with no CMOS RTC advertised must be booted from EFI" - " (or with command line option \"cmos-rtc-probe\")\n"); - - if ( !cmos_rtc_probe(&rtc) ) - panic("No CMOS RTC found - system must be booted from EFI\n"); + __get_cmos_time(&rtc); =20 return mktime(rtc.year, rtc.mon, rtc.day, rtc.hour, rtc.min, rtc.sec); } @@ -1533,12 +1522,85 @@ void rtc_guest_write(unsigned int port, unsigned in= t data) } } =20 -static unsigned long get_wallclock_time(void) +static enum { + WALLCLOCK_UNSET, + WALLCLOCK_XEN, + WALLCLOCK_CMOS, + WALLCLOCK_EFI, +} wallclock_source __ro_after_init; + +static const char *__init wallclock_type_to_string(void) +{ + switch ( wallclock_source ) + { + case WALLCLOCK_XEN: + return "XEN"; + + case WALLCLOCK_CMOS: + return "CMOS RTC"; + + case WALLCLOCK_EFI: + return "EFI"; + + case WALLCLOCK_UNSET: + return "UNSET"; + } + + ASSERT_UNREACHABLE(); + return ""; +} + +static void __init probe_wallclock(void) { + ASSERT(wallclock_source =3D=3D WALLCLOCK_UNSET); + if ( xen_guest ) + { + wallclock_source =3D WALLCLOCK_XEN; + return; + } + if ( efi_enabled(EFI_RS) && efi_get_time() ) + { + wallclock_source =3D WALLCLOCK_EFI; + return; + } + if ( cmos_rtc_probe() ) + { + wallclock_source =3D WALLCLOCK_CMOS; + return; + } + + panic("No usable wallclock found, probed:%s%s%s\n%s", + !opt_cmos_rtc_probe && !efi_enabled(EFI_RS) ? " None" : "", + opt_cmos_rtc_probe ? " CMOS" : "", + efi_enabled(EFI_RS) ? " EFI" : "", + !opt_cmos_rtc_probe + ? "Try with command line option \"cmos-rtc-probe\"\n" + : !efi_enabled(EFI_RS) + ? "System must be booted from EFI\n" + : ""); +} + +static unsigned long get_wallclock_time(void) +{ + switch ( wallclock_source ) + { + case WALLCLOCK_XEN: return read_xen_wallclock(); =20 - return get_cmos_time(); + case WALLCLOCK_CMOS: + return cmos_rtc_read(); + + case WALLCLOCK_EFI: + return efi_get_time(); + + case WALLCLOCK_UNSET: + /* Unexpected state - handled by the ASSERT_UNREACHABLE() below. */ + break; + } + + ASSERT_UNREACHABLE(); + return 0; } =20 /*************************************************************************= ** @@ -2463,6 +2525,10 @@ int __init init_xen_time(void) =20 open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration); =20 + probe_wallclock(); + + printk(XENLOG_INFO "Wallclock source: %s\n", wallclock_type_to_string(= )); + /* NB. get_wallclock_time() can take over one second to execute. */ do_settime(get_wallclock_time(), 0, NOW()); =20 --=20 2.46.0 From nobody Sat Nov 23 10:48:32 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=pass; 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; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725893744; cv=none; d=zohomail.com; s=zohoarc; b=KgAoOV1mU81xsbOl4TwWPEJBtoLcUBCu842xmsdH6uiomGw+l1X1puWmbn+mnkQPYA2TEFmTJTEj/H9wIaAszRDgEzX+l3c06U/VVAhIe0oaM7miu04o993Y/kbYoxgSfXSja61WEONsBIdnT0lXAzwxGjFyLYNAEOoO/RGu8XA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725893744; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=wTxNeOtTpgpkcU1eMs+pBEYVIkJMsd43OtRijP17qwg=; b=d+IS5nH71fn3MfcvUIlgFdS3kTE/iT2qHkC9X/A53mhpaOEiLRIx/QVDWXVLTG7tRBbXD4w/47o2bamBnFDjBG3qIxIwvlKTbuSd0dj23HQUQ847dc4zL2+HoL9bRiRAFexzsBw9a6HJoRuD2OyKVOL5oCK6eeihmbY6EmTH9Ls= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725893744143745.4650228579691; Mon, 9 Sep 2024 07:55:44 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.794629.1203656 (Exim 4.92) (envelope-from ) id 1snfnT-00043g-P0; Mon, 09 Sep 2024 14:55:19 +0000 Received: by outflank-mailman (output) from mailman id 794629.1203656; Mon, 09 Sep 2024 14:55:19 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1snfnT-00042I-J8; Mon, 09 Sep 2024 14:55:19 +0000 Received: by outflank-mailman (input) for mailman id 794629; Mon, 09 Sep 2024 14:55:18 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1snfnS-0003mf-FN for xen-devel@lists.xenproject.org; Mon, 09 Sep 2024 14:55:18 +0000 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [2a00:1450:4864:20::636]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 86cede3d-6ebb-11ef-a0b5-8be0dac302b0; Mon, 09 Sep 2024 16:55:17 +0200 (CEST) Received: by mail-ej1-x636.google.com with SMTP id a640c23a62f3a-a8d3cde1103so275465266b.2 for ; Mon, 09 Sep 2024 07:55:17 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d258317d6sm350985666b.29.2024.09.09.07.55.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 07:55:16 -0700 (PDT) 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: 86cede3d-6ebb-11ef-a0b5-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725893716; x=1726498516; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wTxNeOtTpgpkcU1eMs+pBEYVIkJMsd43OtRijP17qwg=; b=dSYvkJm6zRMjNqJgwB6JGv57pxeKHRQtKoBIE+19EbggmSh9axcJwval6X0w9cEp+l WDO5j5GvYY4Tch9To2iOUtgYXstI++pC2NmN7XabWpo/qKuvKZFwoner55e1otvokVD0 Ag6m6e2k0Twb6R1s6hEKy6zoDbTu0wnLO5DAE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725893716; x=1726498516; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wTxNeOtTpgpkcU1eMs+pBEYVIkJMsd43OtRijP17qwg=; b=msAntqXYZTKkusmDBDbrve84nMY2vS0pUZ6QuqeR6aaBNwy2OcqZgNknY+xbj+gSnZ 1LpxfbLICiy+S62hCTVki/MrKAmnItI7p5//rjD5vh40IEuksOcR66T2aryN4IH7tZUi oSamH2ehlgbPHbwJR+Z8TmUOt/Rp9A8cpvh8hpXmrgrqEsEcS6lHvT+6GoeLUEQQ9Ngc ztK+uvRO3RnOgcrsiNjHFLty6OkrIYIesCqkf1H8hn6I80pCkNOusgtnhZZ3I0PM70A8 MByVlNjJrNEKjXmFyZp12IB99B+XPqvglpV+UrrPSr3xWrjR8ZfkYndC/nhBBtr249tW pXbg== X-Gm-Message-State: AOJu0YwC7HbTcBpY8Jl7ZNqX7GcB1j67qietgThWt8HOpzNPDjaDD3my naUmE8N+UbECONWi28/CQm6pJaH/2Gq9vtXHjX2pxMIL/t/sszoc12GqljY6MhvLG0FmhsiuHpC k X-Google-Smtp-Source: AGHT+IH6ud8BIVnvDcDx9sWO4zrhdmH/lNaVH8QzbGkj1oQf/a1nXTSSso+xFdynUxxPOtcQNvvZqA== X-Received: by 2002:a17:907:9627:b0:a77:cf9d:f495 with SMTP id a640c23a62f3a-a8d1c4d78f0mr792458466b.40.1725893716375; Mon, 09 Sep 2024 07:55:16 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Roger Pau Monne , Andrew Cooper , Jan Beulich , Julien Grall , Stefano Stabellini Subject: [PATCH v5 3/4] x86/time: introduce command line option to select wallclock Date: Mon, 9 Sep 2024 16:54:54 +0200 Message-ID: <20240909145455.7517-4-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909145455.7517-1-roger.pau@citrix.com> References: <20240909145455.7517-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725893744903116600 Allow setting the used wallclock from the command line. When the option is= set to a value different than `auto` the probing is bypassed and the selected implementation is used (as long as it's available). The `xen` and `efi` options require being booted as a Xen guest (with Xen g= uest supported built-in) or from UEFI firmware. Signed-off-by: Roger Pau Monn=C3=A9 --- Changes since v3: - Note xen option is only available if Xen guest support it built. - Fix typo. --- docs/misc/xen-command-line.pandoc | 19 ++++++++++++++++++ xen/arch/x86/time.c | 33 ++++++++++++++++++++++++++++++- 2 files changed, 51 insertions(+), 1 deletion(-) diff --git a/docs/misc/xen-command-line.pandoc b/docs/misc/xen-command-line= .pandoc index 0a66e1ee2d7e..1944b9d8eb9d 100644 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -2821,6 +2821,25 @@ vwfi to `native` reduces irq latency significantly. = It can also lead to suboptimal scheduling decisions, but only when the system is oversubscribed (i.e., in total there are more vCPUs than pCPUs). =20 +### wallclock (x86) +> `=3D auto |=C2=A0xen | cmos | efi` + +> Default: `auto` + +Allow forcing the usage of a specific wallclock source. + + * `auto` let the hypervisor select the clocksource based on internal + heuristics. + + * `xen` force usage of the Xen shared_info wallclock when booted as a Xen + guest. This option is only available if the hypervisor was compiled wi= th + `CONFIG_XEN_GUEST` enabled. + + * `cmos` force usage of the CMOS RTC wallclock. + + * `efi` force usage of the EFI_GET_TIME run-time method when booted from = EFI + firmware. + ### watchdog (x86) > `=3D force | ` =20 diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index 1dcbd9f520f5..c6d3f19a56d1 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1550,6 +1550,36 @@ static const char *__init wallclock_type_to_string(v= oid) return ""; } =20 +static int __init cf_check parse_wallclock(const char *arg) +{ + if ( !arg ) + return -EINVAL; + + if ( !strcmp("auto", arg) ) + wallclock_source =3D WALLCLOCK_UNSET; + else if ( !strcmp("xen", arg) ) + { + if ( !xen_guest ) + return -EINVAL; + + wallclock_source =3D WALLCLOCK_XEN; + } + else if ( !strcmp("cmos", arg) ) + wallclock_source =3D WALLCLOCK_CMOS; + else if ( !strcmp("efi", arg) ) + { + if ( !efi_enabled(EFI_RS) ) + return -EINVAL; + + wallclock_source =3D WALLCLOCK_EFI; + } + else + return -EINVAL; + + return 0; +} +custom_param("wallclock", parse_wallclock); + static void __init probe_wallclock(void) { ASSERT(wallclock_source =3D=3D WALLCLOCK_UNSET); @@ -2525,7 +2555,8 @@ int __init init_xen_time(void) =20 open_softirq(TIME_CALIBRATE_SOFTIRQ, local_time_calibration); =20 - probe_wallclock(); + if ( wallclock_source =3D=3D WALLCLOCK_UNSET ) + probe_wallclock(); =20 printk(XENLOG_INFO "Wallclock source: %s\n", wallclock_type_to_string(= )); =20 --=20 2.46.0 From nobody Sat Nov 23 10:48:32 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=pass; 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; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1725893739; cv=none; d=zohomail.com; s=zohoarc; b=h1MQ9ZhqQMV7LNJMMDx569nNp0/1Xo0+of47jRkj08kaBxUTu8II54rh6YXXLqC/R8Ut7+RrrFUFF7bcC7UVoKTGLHkGUIRirWMNPDkoToV908MRvq9zjyeJ/DhZaJ8/gCWLm9g11Jkf24hsdKzZfK3GctTOzp9rXG6sMwj+DAA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1725893739; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=2Y9YIa+flEwcm1mi9TBLTtzT97ruhPHJAxbMZ4R863o=; b=cBhn6OSpEPfAzDRbu70XuNHg71W+lejryjZGUWn/4dvLJ6tySAzGmrb26zDXo1U4RH94bsL4UR27SXAeqojn+w+nNlGsmTrRAv7xGCqFt2OrXep79Cjej/erc62zbDBYKFQds4cXsRJqgTeXWGT+azECVZw+tr7y6NrGLuLQAGQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; 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; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1725893739828103.40154154461243; Mon, 9 Sep 2024 07:55:39 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.794630.1203671 (Exim 4.92) (envelope-from ) id 1snfnV-0004VZ-0j; Mon, 09 Sep 2024 14:55:21 +0000 Received: by outflank-mailman (output) from mailman id 794630.1203671; Mon, 09 Sep 2024 14:55:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1snfnU-0004Uq-Sy; Mon, 09 Sep 2024 14:55:20 +0000 Received: by outflank-mailman (input) for mailman id 794630; Mon, 09 Sep 2024 14:55:19 +0000 Received: from se1-gles-sth1-in.inumbo.com ([159.253.27.254] helo=se1-gles-sth1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1snfnT-0003mf-EI for xen-devel@lists.xenproject.org; Mon, 09 Sep 2024 14:55:19 +0000 Received: from mail-ed1-x530.google.com (mail-ed1-x530.google.com [2a00:1450:4864:20::530]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 87c94fc8-6ebb-11ef-a0b5-8be0dac302b0; Mon, 09 Sep 2024 16:55:18 +0200 (CEST) Received: by mail-ed1-x530.google.com with SMTP id 4fb4d7f45d1cf-5c241feb80dso10566690a12.0 for ; Mon, 09 Sep 2024 07:55:19 -0700 (PDT) Received: from localhost ([213.195.124.163]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a8d25cfb3acsm352836566b.184.2024.09.09.07.55.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 07:55:17 -0700 (PDT) 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: 87c94fc8-6ebb-11ef-a0b5-8be0dac302b0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1725893718; x=1726498518; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=2Y9YIa+flEwcm1mi9TBLTtzT97ruhPHJAxbMZ4R863o=; b=CVVDTCmja/TjfIIrDbgmHuIjjdmIxOBGGcRiVrC8g8xsI9bBN/xs2ZklsM4CroyJtD WxxCv/JvUJlHMRGVbOf55wQBgvTB2u16GtMWKq4ScSUgwpgL1o+cjop1dGbn/Fa+3fU8 AtrP7LElIpQxa1l0q+zFLR3nhyRQsGD4KRmJM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725893718; x=1726498518; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2Y9YIa+flEwcm1mi9TBLTtzT97ruhPHJAxbMZ4R863o=; b=fxoAvKp43sipWBBo6gbva9w3cf2gFdg1N28oJuXAHi5bDlMyc9ZkzDT0/DEzWfUL3A xBAaycUNxI3UXuhbc1XMrrq4Im/saMG+nyZLsN70l/dJmaulWVEJvwnxdwTTFxaiDhhC P7GfXREIbzrUI5D8pCqHd6EX/ApUGL73VmShlGDTmt+9RQhGExr7g/lUXjwROc0LiuO9 UbqKP9Moxll285fPl9zIdPTICpLOjSEMbYYxhsxWmYa94tdmba3RHtHEYT494iIMicno 0XcoHFb+zVi9PHIIbUJOWM6lgg6HZLXtdz9sdbqIcvtpGrcX3j9nRqv46SrtVn2iEQ8E Nx+w== X-Gm-Message-State: AOJu0YzZ2LYb30D5qaZAm63bIozvpV6MLqK+sRuzrkUQucueOWIzQlPW EAYj44kWiFCq5WyTNXgXBXR36MUWsggHFh/iFJWdRB1mHvMUsvSZwoEgfags68i8EH1mk0K+4uL Y X-Google-Smtp-Source: AGHT+IEFfPivq+9DlNjPZuNfM5ZQFbHwbcKqJNNhCe2IEG0+dvd4j+uQqjyPwl/N4zeeqIbkwgW/4g== X-Received: by 2002:a17:906:f584:b0:a8d:29b7:ece3 with SMTP id a640c23a62f3a-a8d29b7ef61mr730308466b.33.1725893717514; Mon, 09 Sep 2024 07:55:17 -0700 (PDT) From: Roger Pau Monne To: xen-devel@lists.xenproject.org Cc: "Daniel P. Smith" , =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= , Roger Pau Monne , Jan Beulich , Andrew Cooper Subject: [PATCH v5 4/4] x86/time: prefer CMOS over EFI_GET_TIME Date: Mon, 9 Sep 2024 16:54:55 +0200 Message-ID: <20240909145455.7517-5-roger.pau@citrix.com> X-Mailer: git-send-email 2.46.0 In-Reply-To: <20240909145455.7517-1-roger.pau@citrix.com> References: <20240909145455.7517-1-roger.pau@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1725893740846116600 The EFI_GET_TIME implementation is well known to be broken for many firmware implementations, for Xen the result on such implementations are: ----[ Xen-4.19-unstable x86_64 debug=3Dy Tainted: C ]---- CPU: 0 RIP: e008:[<0000000062ccfa70>] 0000000062ccfa70 [...] Xen call trace: [<0000000062ccfa70>] R 0000000062ccfa70 [<00000000732e9a3f>] S 00000000732e9a3f [] F arch/x86/time.c#get_cmos_time+0x1b3/0x26e [] F init_xen_time+0x28/0xa4 [] F __start_xen+0x1ee7/0x2578 [] F __high_start+0x94/0xa0 Pagetable walk from 0000000062ccfa70: L4[0x000] =3D 000000207ef1c063 ffffffffffffffff L3[0x001] =3D 000000005d6c0063 ffffffffffffffff L2[0x116] =3D 8000000062c001e3 ffffffffffffffff (PSE) **************************************** Panic on CPU 0: FATAL PAGE FAULT [error_code=3D0011] Faulting linear address: 0000000062ccfa70 **************************************** Swap the preference to default to CMOS first, and EFI later, in an attempt = to use EFI_GET_TIME as a last resort option only. Note that Linux for example doesn't allow calling the get_time method, and instead provides a dummy han= dler that unconditionally returns EFI_UNSUPPORTED on x86-64. Such change in the preferences requires some re-arranging of the function logic, so that panic messages with workaround suggestions are suitably prin= ted. Signed-off-by: Roger Pau Monn=C3=A9 --- Changes since v2: - Updated to match previous changes. --- xen/arch/x86/time.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c index c6d3f19a56d1..8567eb2a98e3 100644 --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1589,14 +1589,14 @@ static void __init probe_wallclock(void) wallclock_source =3D WALLCLOCK_XEN; return; } - if ( efi_enabled(EFI_RS) && efi_get_time() ) + if ( cmos_rtc_probe() ) { - wallclock_source =3D WALLCLOCK_EFI; + wallclock_source =3D WALLCLOCK_CMOS; return; } - if ( cmos_rtc_probe() ) + if ( efi_enabled(EFI_RS) && efi_get_time() ) { - wallclock_source =3D WALLCLOCK_CMOS; + wallclock_source =3D WALLCLOCK_EFI; return; } =20 --=20 2.46.0