From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web11.25916.1685606259601596499 for ; Thu, 01 Jun 2023 00:57:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GFU6WwxS; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1685606258; 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=r3JqYTEYri9ppAp9tUeeBm8zUMu7Ki2rIe9O+sxLc7A=; b=GFU6WwxS8z/O8vJVmmvdZda4huDzsWWbaKKZ/GWlo3v4onw6RWiagQqZRanYcFpu7hq60G q+3g2Ifgm2XGGkqzi/9pwn7ErwFFLy/hWLlkRZxZv5aDakr9bOZHy9obUEPwPmGQNfsssN UL+CcifH6I9wXRf8ea6roygcPPkaxqo= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-222-5tj3UilkM2-Fkxyzd7LDmg-1; Thu, 01 Jun 2023 03:57:33 -0400 X-MC-Unique: 5tj3UilkM2-Fkxyzd7LDmg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7DD57858F19; Thu, 1 Jun 2023 07:57:33 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.155]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DD7F5421C5; Thu, 1 Jun 2023 07:57:32 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 6CE1D1800626; Thu, 1 Jun 2023 09:57:31 +0200 (CEST) From: "Gerd Hoffmann" To: devel@edk2.groups.io Cc: Gerd Hoffmann , Jordan Justen , Oliver Steffen , Pawel Polawski , Ard Biesheuvel , Jiewen Yao , Fiona Ebner Subject: [PATCH 1/1] OvmfPkg/PlatformInitLib: limit phys-bits to 46. Date: Thu, 1 Jun 2023 09:57:31 +0200 Message-Id: <20230601075731.531384-1-kraxel@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true Older linux kernels have problems with phys-bits larger than 46, ubuntu 18.04 (kernel 4.15) has been reported to be affected. Reduce phys-bits limit from 47 to 46. Reported-by: Fiona Ebner Signed-off-by: Gerd Hoffmann --- OvmfPkg/Library/PlatformInitLib/MemDetect.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c b/OvmfPkg/Library/PlatformInitLib/MemDetect.c index 1102b00ecbf0..662e7e85bbc5 100644 --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c @@ -646,16 +646,19 @@ PlatformAddressWidthFromCpuid ( )); if (Valid) { - if (PhysBits > 47) { + if (PhysBits > 46) { /* * Avoid 5-level paging altogether for now, which limits * PhysBits to 48. Also avoid using address bit 48, due to sign * extension we can't identity-map these addresses (and lots of * places in edk2 assume we have everything identity-mapped). * So the actual limit is 47. + * + * Also some older linux kernels apparently have problems handling + * phys-bits > 46 correctly, so use that as limit. */ - DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 47 (avoid 5-level paging)\n", __func__)); - PhysBits = 47; + DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 46 (avoid 5-level paging)\n", __func__)); + PhysBits = 46; } if (!Page1GSupport && (PhysBits > 40)) { -- 2.40.1