hw/arm/virt: fix max-cpus check
PATCH 1/1 hw/arm/virt: fix max-cpus check
mach-virt doesn't yet support hotplug, but command lines specifying -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying bigger-num as something bigger than the machine supports, e.g. > 8 on a gicv2 machine, should fail though. This fix also makes mach- virt's max-cpus check truly consistent with the one in vl.c:main, as the one there was already correctly checking max-cpus instead of smp-cpus.
--- hw/arm/virt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
hw/arm/virt.c +5 -5
@@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine)MemoryRegion *sysmem =get_system_memory ();MemoryRegion *secure_sysmem =NULL ;int gic_version = vms->gic_version; -int n, max_cpus; +int n, virt_max_cpus;MemoryRegion *ram =g_new (MemoryRegion,1 );const char *cpu_model = machine->cpu_model;VirtBoardInfo *vbi;
@@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine)* many redistributors we can fit into the memory map. */ if (gic_version ==3 ) { - max_cpus = vbi->memmap[VIRT_GIC_REDIST ].size /0x20000 ; + virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST ].size /0x20000 ; }else { - max_cpus =GIC_NCPU ; + virt_max_cpus =GIC_NCPU ; } -if (smp_cpus > max_cpus) { +if (max_cpus > virt_max_cpus) {error_report ("Number of SMP CPUs requested (%d) exceeds max CPUs " "supported by machine 'mach-virt' (%d)" , - smp_cpus, max_cpus); + max_cpus, virt_max_cpus);exit (1 ); }
Signature · 1 line
2.4.3
Quoted 31 lines · Andrew Jones
mach-virt doesn't yet support hotplug, but command lines specifying -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying bigger-num as something bigger than the machine supports, e.g. > 8 on a gicv2 machine, should fail though. This fix also makes mach- virt's max-cpus check truly consistent with the one in vl.c:main, as the one there was already correctly checking max-cpus instead of smp-cpus.
Reported-by Shannon Zhao <[email protected]>Signed-off-by Andrew Jones <[email protected]>--- hw/arm/virt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)hw/arm/virt.c +1
-1@@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine)MemoryRegion *sysmem =get_system_memory ();MemoryRegion *secure_sysmem =NULL ;int gic_version = vms->gic_version; -int n, max_cpus; +int n, virt_max_cpus;MemoryRegion *ram =g_new (MemoryRegion,1 );const char *cpu_model = machine->cpu_model;VirtBoardInfo *vbi;@@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine)* many redistributors we can fit into the memory map. */ if (gic_version ==3 ) {
hw/arm/virt.c static void machvirt_init(MachineState *machine) · line 1060
Quoted 10 lines
hw/arm/virt.c +3
-3- max_cpus = vbi->memmap[VIRT_GIC_REDIST ].size /0x20000 ; + virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST ].size /0x20000 ; }else { - max_cpus =GIC_NCPU ; + virt_max_cpus =GIC_NCPU ; } -if (smp_cpus > max_cpus) { +if (max_cpus > virt_max_cpus) { error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "
Does it need to change the SMP? ^~~~
Quoted 5 lines
hw/arm/virt.c +1
-1"supported by machine 'mach-virt' (%d)" , - smp_cpus, max_cpus); + max_cpus, virt_max_cpus);exit (1 ); }
Signature · 1 line
Shannon
Quoted 41 lines · Shannon Zhao
Quoted 38 lines · Andrew Jones
mach-virt doesn't yet support hotplug, but command lines specifying -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying bigger-num as something bigger than the machine supports, e.g. > 8 on a gicv2 machine, should fail though. This fix also makes mach- virt's max-cpus check truly consistent with the one in vl.c:main, as the one there was already correctly checking max-cpus instead of smp-cpus.
Reported-by Shannon Zhao <[email protected]>Signed-off-by Andrew Jones <[email protected]>--- hw/arm/virt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)hw/arm/virt.c +3
-3@@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine)MemoryRegion *sysmem =get_system_memory ();MemoryRegion *secure_sysmem =NULL ;int gic_version = vms->gic_version; -int n, max_cpus; +int n, virt_max_cpus;MemoryRegion *ram =g_new (MemoryRegion,1 );const char *cpu_model = machine->cpu_model;VirtBoardInfo *vbi;@@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine)* many redistributors we can fit into the memory map. */ if (gic_version ==3 ) { - max_cpus = vbi->memmap[VIRT_GIC_REDIST ].size /0x20000 ; + virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST ].size /0x20000 ; }else { - max_cpus =GIC_NCPU ; + virt_max_cpus =GIC_NCPU ; }
Quoted 4 lines
hw/arm/virt.c static void machvirt_init(MachineState *machine) · line 1060
Quoted 3 lines
hw/arm/virt.c +1
-1-if (smp_cpus > max_cpus) { +if (max_cpus > virt_max_cpus) { error_report("Number of SMP CPUs requested (%d) exceeds max CPUs "Does it need to change the SMP? ^~~~
If we consider max_cpus to be [the maximum] "SMP CPUs" after hotplug, then I think it's OK. When I changed smp_cpus to max_cpus in vl.c (c00cd995), either that was my reasoning for leaving it (or it was just overlooked :-), but now that the messages are consistent, I should change them both if that's the consensus.
Thanks,
drew
Quoted 10 lines · 2016年2月3日星期三,Andrew Jones <[email protected]> 写道:
mach-virt doesn't yet support hotplug, but command lines specifying -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying bigger-num as something bigger than the machine supports, e.g. > 8 on a gicv2 machine, should fail though. This fix also makes mach- virt's max-cpus check truly consistent with the one in vl.c:main, as the one there was already correctly checking max-cpus instead of smp-cpus.
Reported-by Shannon Zhao <[email protected] <javascript:;>>Signed-off-by Andrew Jones <[email protected] <javascript:;>>
Quoted 41 lines
--- hw/arm/virt.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)hw/arm/virt.c +5
-6@@ -1013,7 +1013,7 @@ static void machvirt_init(MachineState *machine)MemoryRegion *sysmem =get_system_memory ();MemoryRegion *secure_sysmem =NULL ;int gic_version = vms->gic_version; -int n, max_cpus; +int n, virt_max_cpus;MemoryRegion *ram =g_new (MemoryRegion,1 );const char *cpu_model = machine->cpu_model;VirtBoardInfo *vbi;@@ -1051,15 +1051,15 @@ static void machvirt_init(MachineState *machine)* many redistributors we can fit into the memory map. */ if (gic_version ==3 ) { - max_cpus = vbi->memmap[VIRT_GIC_REDIST ].size /0x20000 ; + virt_max_cpus = vbi->memmap[VIRT_GIC_REDIST ].size /0x20000 ; }else { - max_cpus =GIC_NCPU ; + virt_max_cpus =GIC_NCPU ; } -if (smp_cpus > max_cpus) { +if (max_cpus > virt_max_cpus) {error_report ("Number of SMP CPUs requested (%d) exceeds max CPUs " "supported by machine 'mach-virt' (%d)" , - smp_cpus, max_cpus); + max_cpus, virt_max_cpus);exit (1 ); } --2.4.3
Peter Maydell
AppliedQuoted 12 lines · Shannon Zhao
Quoted 9 lines · 2016年2月3日星期三,Andrew Jones <[email protected]> 写道:
mach-virt doesn't yet support hotplug, but command lines specifying -smp <num>,maxcpus=<bigger-num> don't fail. Of course specifying bigger-num as something bigger than the machine supports, e.g. > 8 on a gicv2 machine, should fail though. This fix also makes mach- virt's max-cpus check truly consistent with the one in vl.c:main, as the one there was already correctly checking max-cpus instead of smp-cpus.
Quoted 5 lines
Quoted 2 lines
Reported-by Shannon Zhao <[email protected]>Signed-off-by Andrew Jones <[email protected]>Reviewed-by Shannon Zhao <[email protected]>Quoted 1 line
Applied to target-arm.next, thanks.
-- PMM