diff mbox series

[4/5] hw/loongarch: Set minimium memory size as 256M

Message ID 20240220124126.1164081-5-maobibo@loongson.cn
State New
Headers show
Series Add migration test for loongarch64 | expand

Commit Message

maobibo Feb. 20, 2024, 12:41 p.m. UTC
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(-)

Comments

Thomas Huth Feb. 20, 2024, 4:47 p.m. UTC | #1
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.

  Thomas
maobibo Feb. 21, 2024, 1:52 a.m. UTC | #2
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
diff mbox series

Patch

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;
     mc->default_cpu_type = LOONGARCH_CPU_TYPE_NAME("la464");
     mc->default_ram_id = "loongarch.ram";
     mc->max_cpus = LOONGARCH_MAX_CPUS;