Am 17.03.23 um 15:01 schrieb Gerd Hoffmann:
>   Hi,
> 
>> With edk2-stable202205 or when reverting the commit, my VM boots with
>> only 512 MiB of assigned memory. With the commit, with 512 MiB it cannot
>> even initialize the display, with 750 MiB it runs into a different error
>> during Linux boot, and with 900 MiB it boots fine again.
>>
>> So it seems that having a larger PhysMemAddressWidth requires more
>> memory? Is this expected and does running VMs with this version simply
>> require more memory now? Is there a way to avoid that?
> 
> Might be more memory being needed for page tables.  Making sure gigabyte
> pages are enabled (-cpu $name,pdpe1gb=on), so edk2 can use them for the
> mmio window identity mapping.
> 
> Alternatively try change the cap:
> 
> ------------------------------------------------------------
> diff --git a/OvmfPkg/Library/PlatformInitLib/MemDetect.c 
> b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> index 38cece9173e8..76df6fd020bf 100644
> --- a/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> +++ b/OvmfPkg/Library/PlatformInitLib/MemDetect.c
> @@ -669,9 +669,9 @@ PlatformAddressWidthFromCpuid (
>        PhysBits = 47;
>      }
>  
> -    if (!Page1GSupport && (PhysBits > 40)) {
> -      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 40 (no 1G pages 
> available)\n", __func__));
> -      PhysBits = 40;
> +    if (!Page1GSupport && (PhysBits > 38)) {
> +      DEBUG ((DEBUG_INFO, "%a: limit PhysBits to 38 (no 1G pages 
> available)\n", __func__));
> +      PhysBits = 38;
>      }
>  
>      PlatformInfoHob->PhysMemAddressWidth = PhysBits;
> ------------------------------------------------------------
> 
> HTH,
>   Gerd
> 
> 

It seems that Page1GSupport is already TRUE in my case, so
unfortunately, the suggested changes don't help.

Before commit bbda386d25, PhysMemAddressWidth is 36, after the commit,
it's 47. I tried with hardcoding different values:
45 - My VM boots fine.
46 - I run into a "KVM internal error. Suberror: 1" during Linux boot
(that's also what happens with 47 and 750 MiB of memory).
47 - Hangs right away and display is never initialized.

Is there any interest to use a smaller limit than 47 from upstream's
perspective? Admittedly, it is a rather niche case to use OVMF with so
little memory.

In any case, thank you for taking a look!

Best Regards,
Fiona



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#101449): https://edk2.groups.io/g/devel/message/101449
Mute This Topic: https://groups.io/mt/94113631/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to