From patchwork Mon Dec 18 14:47:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jan Beulich X-Patchwork-Id: 13497086 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 4D3AEC35274 for ; Mon, 18 Dec 2023 14:47:42 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.656094.1024064 (Exim 4.92) (envelope-from ) id 1rFEty-0007NK-E9; Mon, 18 Dec 2023 14:47:26 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 656094.1024064; Mon, 18 Dec 2023 14:47:26 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1rFEty-0007ND-B5; Mon, 18 Dec 2023 14:47:26 +0000 Received: by outflank-mailman (input) for mailman id 656094; Mon, 18 Dec 2023 14:47:25 +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 1rFEtx-0007N3-53 for xen-devel@lists.xenproject.org; Mon, 18 Dec 2023 14:47:25 +0000 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [2a00:1450:4864:20::434]) by se1-gles-sth1.inumbo.com (Halon) with ESMTPS id 5af23cc0-9db4-11ee-98eb-6d05b1d4d9a1; Mon, 18 Dec 2023 15:47:24 +0100 (CET) Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-336668a5a8dso1348899f8f.1 for ; Mon, 18 Dec 2023 06:47:24 -0800 (PST) Received: from [10.156.60.236] (ip-037-024-206-209.um08.pools.vodafone-ip.de. [37.24.206.209]) by smtp.gmail.com with ESMTPSA id j29-20020a5d6e5d000000b003364e437577sm10175351wrz.84.2023.12.18.06.47.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 18 Dec 2023 06:47:23 -0800 (PST) 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: 5af23cc0-9db4-11ee-98eb-6d05b1d4d9a1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1702910843; x=1703515643; darn=lists.xenproject.org; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:from:to:cc:subject:date:message-id:reply-to; bh=/fMlAv9ea8KmO95h1rEr/bKlXlzXc/GyAyAyQRSshWQ=; b=K9ndiHpo/nJKD3gSh9ZRw7a4F4sHUiXYc4ZOWIhLtvgJJLdDjgsbWRdE0Zo7ca9o+j xqBEcHHJ+yunc/Jadgf66ppkFQx+PhDwmDGaVkJVVc39YZCGld+HXtxeMXYSovpiBoEz Hv5ApNGpHyjhM+OXQreRbqtThpSk6CRtuqI9HDVqyOQhTZrONLHxFfFiX04TdIiKiNvN hR8kxfxZhZzicHbRIs2Lm0YtfnuJ+F82hI6fCCUIYuezS2xTlyM7OJTc4O6/aeLHZccR bKL7tcJCKn5FZsWxPZjgs6tt5GSoooUgo43bxTox2UYaVDheb5nbze68zXwrg0lhzb3H at4Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702910843; x=1703515643; h=content-transfer-encoding:in-reply-to:autocrypt:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/fMlAv9ea8KmO95h1rEr/bKlXlzXc/GyAyAyQRSshWQ=; b=kNL7tQaauYg6UUgt5m3KveWg9DqUpgdxFCLPI/tom7E/RZMe+R0M/kreJ2nQudJ7EK WsX9SQuI8UkEdESo5aNX3Mq/7Qkoc26MhbzDzla+NaTkTFj+2xGKrf4p5xV6vvSS8Z5X QUH3ECPzPtGZtMIZ77dz+sp2i0UX8HTSMN5LZ0Piwdmw0AIieqnemokb9Yf+98BvoJUE KCrmVwRax5zQJ9/Lcfaq2QuCfO49JGukSxXHvSrrDHn+UO6VH2I5d5hFx3Fn72BW46rY nmtH1044/EA6OsNM9LQuvKm2F14eMjbOgd6y+9JSEn1rObkYRKiSb7SAWWYTfhAFi7QS b6fg== X-Gm-Message-State: AOJu0Yxc7ruYyZdAG/xq9uSSRZhjqCA93yMR2I6STPtpIK8ivoSBk0H7 JQkqXkEYSM0VrDLvPcrjwg2mhlEWfFyarvakhKJm X-Google-Smtp-Source: AGHT+IEEWLq7N/yo94hEvikQL8/wPkeWEXKD8oVGf1W5HpGeD4qe37bbrWxPQNmlpNA+UW9AGlaq0A== X-Received: by 2002:a5d:55c6:0:b0:336:6e7d:3aff with SMTP id i6-20020a5d55c6000000b003366e7d3affmr185148wrw.37.1702910843678; Mon, 18 Dec 2023 06:47:23 -0800 (PST) Message-ID: Date: Mon, 18 Dec 2023 15:47:23 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: [PATCH v2 1/3] x86: allow to suppress port-alias probing Content-Language: en-US From: Jan Beulich To: "xen-devel@lists.xenproject.org" Cc: Andrew Cooper , Wei Liu , =?utf-8?q?Roger_Pau_Monn=C3=A9?= References: <0c45155a-2beb-4e69-bca3-cdf42ba22f2b@suse.com> Autocrypt: addr=jbeulich@suse.com; keydata= xsDiBFk3nEQRBADAEaSw6zC/EJkiwGPXbWtPxl2xCdSoeepS07jW8UgcHNurfHvUzogEq5xk hu507c3BarVjyWCJOylMNR98Yd8VqD9UfmX0Hb8/BrA+Hl6/DB/eqGptrf4BSRw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Wg5V2WZsUMlnDL9 mpwIGFhlbM3gfDMs7MPMu8YQRFVdUvtSpaAs8OFfGQ0ia3LGZcjA6Ik2+xcqscEJzNH+qh8V m5jjp28yZgaqTaRbg3M/+MTbMpicpZuqF4rnB0AQD12/3BNWDR6bmh+EkYSMcEIpQmBM51qM EKYTQGybRCjpnKHGOxG0rfFY1085mBDZCH5Kx0cl0HVJuQKC+dV2ZY5AqjcKwAxpE75MLFkr wkkEGBECAAkFAlk3nEQCGwwACgkQoDSui/t3IH7nnwCfcJWUDUFKdCsBH/E5d+0ZnMQi+G0A nAuWpQkjM1ASeQwSHEeAWPgskBQL In-Reply-To: <0c45155a-2beb-4e69-bca3-cdf42ba22f2b@suse.com> By default there's already no use for this when we run in shim mode. Plus there may also be a need to suppress the probing in case of issues with it. Before introducing further port alias probing, introduce a command line option allowing to bypass it, default it to on when in shim mode, and gate RTC/CMOS port alias probing on it. Requested-by: Roger Pau Monné Signed-off-by: Jan Beulich Reviewed-by: Jason Andryuk --- While "probe-port-aliases" is longish, shorter forms (e.g. "port-probe") partially lose the intended meaning. --- v2: New. --- a/docs/misc/xen-command-line.pandoc +++ b/docs/misc/xen-command-line.pandoc @@ -2000,6 +2000,17 @@ INVPCID is supported and not disabled vi This is a mask of C-states which are to be used preferably. This option is applicable only on hardware were certain C-states are exclusive of one another. +### probe-port-aliases (x86) +> `= ` + +> Default: `true` outside of shim mode, `false` in shim mode + +Certain devices accessible by I/O ports may be accessible also through "alias" +ports (originally a result of incomplete address decoding). When such devices +are solely under Xen's control, Xen disallows even Dom0 access to the "primary" +ports. When alias probing is active and aliases are detected, "alias" ports +would then be treated similar to the "primary" ones. + ### psr (Intel) > `= List of ( cmt: | rmid_max: | cat: | cos_max: | cdp: )` --- a/xen/arch/x86/include/asm/setup.h +++ b/xen/arch/x86/include/asm/setup.h @@ -47,6 +47,7 @@ extern unsigned long highmem_start; #endif extern int8_t opt_smt; +extern int8_t opt_probe_port_aliases; #ifdef CONFIG_SHADOW_PAGING extern bool opt_dom0_shadow; --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -75,6 +75,9 @@ static bool __initdata opt_invpcid = tru boolean_param("invpcid", opt_invpcid); bool __read_mostly use_invpcid; +int8_t __initdata opt_probe_port_aliases = -1; +boolean_param("probe-port-aliases", opt_probe_port_aliases); + /* Only used in asm code and within this source file */ unsigned long asmlinkage __read_mostly cr4_pv32_mask; @@ -1844,6 +1847,9 @@ void asmlinkage __init noreturn __start_ /* Low mappings were only needed for some BIOS table parsing. */ zap_low_mappings(); + if ( opt_probe_port_aliases < 0 ) + opt_probe_port_aliases = !pv_shim; + init_apic_mappings(); normalise_cpu_order(); --- a/xen/arch/x86/time.c +++ b/xen/arch/x86/time.c @@ -1253,7 +1253,8 @@ static int __init cf_check probe_cmos_al { unsigned int offs; - if ( acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC ) + if ( (acpi_gbl_FADT.boot_flags & ACPI_FADT_NO_CMOS_RTC) || + !opt_probe_port_aliases ) return 0; for ( offs = 2; offs < 8; offs <<= 1 )