From nobody Sun May 5 11:03:15 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=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1616582119; cv=none; d=zohomail.com; s=zohoarc; b=dtlt/oe4kyzaCwil1gBe1UzxkM5Fh73D2NCLJyhoOoIfnIq4Zy/627iyLQF2DYMbgnQp5gX7xH4gFTT7Qy4qFDyLpwPk0TfNGOt0vD65gmG1lbNuT1J/ilX/erP5L6TpM46R0fC/pcITWxeRnmXzuADNdVl7Fc/GvzLIe5YNjuE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1616582119; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=E3sM+MHdMWPuK3E9lJOyRxJeBHE9Ske6vJlUmMvX6Z4=; b=R4dap00Z8v6+zUznhw78cPNs95e6CqETg4rfq/07SeNHgTwrid95H83q9NWFSe7Z4AdDLs90KQW4d0re/JtZqQxAY0yoW1HWoQ6d4c9sarXX+YtjGDy6Qo/IX+Qls/DjMg7S97LEIht4Xp2hj7cLJhaSpEydB3GKQ2EQs+Slo2o= 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=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 16165821191191021.9269969995433; Wed, 24 Mar 2021 03:35:19 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.100901.192510 (Exim 4.92) (envelope-from ) id 1lP0qS-0002I7-C7; Wed, 24 Mar 2021 10:34:36 +0000 Received: by outflank-mailman (output) from mailman id 100901.192510; Wed, 24 Mar 2021 10:34:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lP0qS-0002I0-9B; Wed, 24 Mar 2021 10:34:36 +0000 Received: by outflank-mailman (input) for mailman id 100901; Wed, 24 Mar 2021 10:34:35 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1lP0qR-0002Hv-Az for xen-devel@lists.xenproject.org; Wed, 24 Mar 2021 10:34:35 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id fd221857-e8aa-4367-a4fc-3e6dc49f8f3e; Wed, 24 Mar 2021 10:34:34 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8ACFBAE20; Wed, 24 Mar 2021 10:34:33 +0000 (UTC) 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: fd221857-e8aa-4367-a4fc-3e6dc49f8f3e X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1616582073; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=E3sM+MHdMWPuK3E9lJOyRxJeBHE9Ske6vJlUmMvX6Z4=; b=NDOiO9ZwJRWKTA2v1y9oajxe+KOLRr7QEDLcW3CNShvU53tA67S0Mp+7JiVmd23o3CGROY g+k12hKhmY06AcVdCIjUJsYqQGr2CBYibxh53n2Fek6W4s9NqaVanTBWAzioK9o0yVw6fd p1PcZSmGf7idItawH/oQlIKxM2G4Q/w= To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?UTF-8?Q?Roger_Pau_Monn=c3=a9?= , Ian Jackson From: Jan Beulich Subject: [PATCH][4.15] x86/HPET: don't enable legacy replacement mode unconditionally Message-ID: <8e18a2a5-bc19-615d-0c8c-cea49adcf976@suse.com> Date: Wed, 24 Mar 2021 11:34:32 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Commit e1de4c196a2e ("x86/timer: Fix boot on Intel systems using ITSSPRC static PIT clock gating") was reported to cause boot failures on certain AMD Ryzen systems. Until we can figure out what the actual issue there is, skip this new part of HPET setup by default. Introduce a "hpet" command line option to allow enabling this on hardware where it's really needed for Xen to boot successfully (i.e. where the PIT doesn't drive the timer interrupt). Since it makes little sense to introduce just "hpet=3Dlegacy-replacement", also allow for a boolean argument as well as "broadcast" to replace the separate "hpetbroadcast" option. Signed-off-by: Jan Beulich Reviewed-by: Ian Jackson Reviewed-by: Roger Pau Monn=C3=A9 --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -1274,9 +1274,26 @@ supported. See docs/misc/arm/big.LITTLE. When the hmp-unsafe option is disabled (default), CPUs that are not identical to the boot CPU will be parked and not used by Xen. =20 +### hpet (x86) +> `=3D List of [ | broadcast | legacy-replacement ]` + +> Default : `true`, `no-broadcast`, 'no-legacy-replacement` + +Controls Xen's use of the system's High Precision Event Timer. The boolean +allows to turn off use altogether. + +`broadcast` forces Xen to keep using the broadcast for CPUs in deep C-stat= es +even when an RTC interrupt got enabled. + +`legacy-replacement` is intended to be used on platforms where the timer +interrupt doesn't get raised by the legacy PIT. This then also affects +raising of the RTC interrupt. + ### hpetbroadcast (x86) > `=3D ` =20 +Deprecated alternative of `hpet=3Dbroadcast`. + ### hvm_debug (x86) > `=3D ` =20 --- a/xen/arch/x86/hpet.c +++ b/xen/arch/x86/hpet.c @@ -52,6 +52,8 @@ static unsigned int __read_mostly num_hp DEFINE_PER_CPU(struct hpet_event_channel *, cpu_bc_channel); =20 unsigned long __initdata hpet_address; +static bool __initdata opt_hpet =3D true; +static bool __initdata opt_legacy_replacement; u8 __initdata hpet_blockid; u8 __initdata hpet_flags; =20 @@ -63,6 +65,32 @@ u8 __initdata hpet_flags; static bool __initdata force_hpet_broadcast; boolean_param("hpetbroadcast", force_hpet_broadcast); =20 +static int __init parse_hpet_param(const char *s) +{ + const char *ss; + int val, rc =3D 0; + + do { + ss =3D strchr(s, ','); + if ( !ss ) + ss =3D strchr(s, '\0'); + + if ( (val =3D parse_bool(s, ss)) >=3D 0 ) + opt_hpet =3D val; + else if ( (val =3D parse_boolean("broadcast", s, ss)) >=3D 0 ) + force_hpet_broadcast =3D val; + else if ( (val =3D parse_boolean("legacy-replacement", s, ss)) >= =3D 0 ) + opt_legacy_replacement =3D val; + else + rc =3D -EINVAL; + + s =3D ss + 1; + } while ( *ss ); + + return rc; +} +custom_param("hpet", parse_hpet_param); + /* * Calculate a multiplication factor for scaled math, which is used to con= vert * nanoseconds based values to clock ticks: @@ -761,12 +789,9 @@ u64 __init hpet_setup(void) unsigned int hpet_id, hpet_period, hpet_cfg; unsigned int last, rem; =20 - if ( hpet_rate ) + if ( hpet_rate || !hpet_address || !opt_hpet ) return hpet_rate; =20 - if ( hpet_address =3D=3D 0 ) - return 0; - set_fixmap_nocache(FIX_HPET_BASE, hpet_address); =20 hpet_id =3D hpet_read32(HPET_ID); @@ -803,9 +828,9 @@ u64 __init hpet_setup(void) * IRQ routing is configured. * * Reconfigure the HPET into legacy mode to re-establish the timer - * interrupt. + * interrupt, if available and if so requested. */ - if ( hpet_id & HPET_ID_LEGSUP && + if ( opt_legacy_replacement && (hpet_id & HPET_ID_LEGSUP) && !((hpet_cfg =3D hpet_read32(HPET_CFG)) & HPET_CFG_LEGACY) ) { unsigned int c0_cfg, ticks, count;