From nobody Sat Dec 21 14:01:43 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) client-ip=78.46.105.101; envelope-from=seabios-bounces@seabios.org; helo=coreboot.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of seabios.org designates 78.46.105.101 as permitted sender) smtp.mailfrom=seabios-bounces@seabios.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from coreboot.org (coreboot.org [78.46.105.101]) by mx.zohomail.com with SMTPS id 1719219700720893.3956443811735; Mon, 24 Jun 2024 02:01:40 -0700 (PDT) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTPA id 6A0CDEC7A3; Mon, 24 Jun 2024 09:01:35 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by coreboot.org (Postfix) with ESMTP id 5F9F4EC6F9 for ; Mon, 24 Jun 2024 09:01:19 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-664-5AZ3C4D5NhSxh7gQrAEFrQ-1; Mon, 24 Jun 2024 05:01:13 -0400 Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 4BDE3195608C; Mon, 24 Jun 2024 09:01:12 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 799D81955D83; Mon, 24 Jun 2024 09:01:11 +0000 (UTC) Received: from authenticated-user (PRIMARY_HOSTNAME [PUBLIC_IP]) id 5383C1801099; Mon, 24 Jun 2024 11:01:09 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1719219678; 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: content-transfer-encoding:content-transfer-encoding; bh=w9YLr7ZHEVwF+ujYN/4PFbP8Jnlngs4HyXY6yceNvZg=; b=czcUOJV7BeTQrIOEo2Nvpdep5pT/nm4vFgUZskLpFKygF8uObcjA6VrM8bNYKvsynjJ8UX kVWoix7HKHIGkhsELmZygKOOHJvLcSXZ8zIBJeZ5NHby10PXIoESWNi3ttmocqgLA+PSJ+ AJz9xovt8ZdSkrml3qMWP0RscAVU6pY= X-MC-Unique: 5AZ3C4D5NhSxh7gQrAEFrQ-1 From: Gerd Hoffmann To: seabios@seabios.org Date: Mon, 24 Jun 2024 11:01:09 +0200 Message-ID: <20240624090109.18119-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.12 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Message-ID-Hash: 7KDK2TYKSQI677Z7VRIXTPTLMKW6WNZZ X-Message-ID-Hash: 7KDK2TYKSQI677Z7VRIXTPTLMKW6WNZZ X-MailFrom: kraxel@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-seabios.seabios.org-0; header-match-seabios.seabios.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: john.levon@nutanix.com, Gerd Hoffmann X-Mailman-Version: 3.3.6b1 Precedence: list Subject: [SeaBIOS] [PATCH] limit address space used for pci devices, part two List-Id: SeaBIOS mailing list Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable Authentication-Results: coreboot.org; auth=pass smtp.auth=mailman@coreboot.org smtp.mailfrom=seabios-bounces@seabios.org X-Spamd-Bar: / X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1719219702658100001 Content-Type: text/plain; charset="utf-8"; x-default="true" This patch changes the logic added by commit a6ed6b701f0a ("limit address space used for pci devices.") a bit. Further testing showed that the limit of 46 phys-bits applies to x86_64 kernels only, for i386 kernels the limit is 44. So change the limit from 46 to 44 for better compatibility with i386 guests. Also add one more condition to refine the configuration heuristic: Apply the limit only in case the guest has less than 1 TB of memory installed, so huge guests run without address space limits. Signed-off-by: Gerd Hoffmann Reviewed-by: Igor Mammedov Reviewed-by: John Levon Reviewed-by: Kevin O'Connor --- src/fw/pciinit.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/fw/pciinit.c b/src/fw/pciinit.c index bb44dc296047..b3e359d7fe62 100644 --- a/src/fw/pciinit.c +++ b/src/fw/pciinit.c @@ -1189,11 +1189,16 @@ pci_setup(void) =20 if (CPUPhysBits) { pci_mem64_top =3D 1LL << CPUPhysBits; - if (CPUPhysBits > 46) { - // Old linux kernels have trouble dealing with more than 46 - // phys-bits, so avoid that for now. Seems to be a bug in the - // virtio-pci driver. Reported: centos-7, ubuntu-18.04 - pci_mem64_top =3D 1LL << 46; + if (CPUPhysBits > 44) { + // Old linux kernels have trouble dealing with more than 44 (i= 386 + // kernels) or 46 (x86_64 kernels) phys-bits. Seems to be a bu= g in + // the virtio-pci driver. + // Reported: centos-7, ubuntu-18.04 + // Limit the used address space to mitigate the bug, except we= are + // running in a huge guest with more than 1TB of memory instal= led. + if (RamSizeOver4G < (1LL << 40)) { + pci_mem64_top =3D 1LL << 44; + } } } =20 --=20 2.45.2 _______________________________________________ SeaBIOS mailing list -- seabios@seabios.org To unsubscribe send an email to seabios-leave@seabios.org