On 2024/2/21 上午12:47, Thomas Huth wrote:
> On 20/02/2024 13.41, Bibo Mao wrote:
>> The minium memory size for LoongArch UEFI bios is 256M, also some
>> test cases such as migration and qos uses parameter 256M.
>>
>> Here set minium memory size for Loongarch VirtMachine with 256M,
>> also default memory size is changed with 256M.
>>
>> Signed-off-by: Bibo Mao <maobibo@loongson.cn>
>> ---
>> hw/loongarch/virt.c | 6 +++---
>> 1 file changed, 3 insertions(+), 3 deletions(-)
>>
>> diff --git a/hw/loongarch/virt.c b/hw/loongarch/virt.c
>> index a7d700497d..5bc332f4e3 100644
>> --- a/hw/loongarch/virt.c
>> +++ b/hw/loongarch/virt.c
>> @@ -815,8 +815,8 @@ static void virt_init(MachineState *machine)
>> cpu_model = LOONGARCH_CPU_TYPE_NAME("la464");
>> }
>> - if (ram_size < 1 * GiB) {
>> - error_report("ram_size must be greater than 1G.");
>> + if (ram_size < 256 * MiB) {
>> + error_report("ram_size must be greater than 256M.");
>> exit(1);
>> }
>> create_fdt(vms);
>> @@ -1144,7 +1144,7 @@ static void virt_class_init(ObjectClass *oc,
>> void *data)
>> HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(oc);
>> mc->init = virt_init;
>> - mc->default_ram_size = 1 * GiB;
>> + mc->default_ram_size = 256 * MiB;
>
> While changing the minimum ram_size in the first hunk is certainly a
> good idea, you should maybe consider twice whether you also want to
> change the default_ram_size here. 256 MiB is often not enough to run a
> guest OS like Linux, so for most users it might be more convenient if
> you have a default_ram_size of 1GiB instead. At least that's what I've
> seen on other architectures. YMMV.
Sounds good, I will keep default ram size unchanged, and only change
minimum ram size with 256MiB.
And thanks for your suggestion.
Regards
Bibo Mao
>
> Thomas