mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 02:56:18 +00:00
qemu: refactor maximum vcpus supported in aarch64
on aarch64, we support different gic interrupt controllers. The maximum number of vCPUs depends on the GIC version, or on how many redistributors we can fit into the memory map. Fixes: #584 Signed-off-by: Penny Zheng <penny.zheng@arm.com> Signed-off-by: Wei Chen <Wei.Chen@arm.com>
This commit is contained in:
parent
39ad9702de
commit
c4ded6ee5e
@ -107,8 +107,22 @@ func getGuestGICVersion() (version string) {
|
||||
return "host"
|
||||
}
|
||||
|
||||
//In qemu, maximum number of vCPUs depends on the GIC version, or on how
|
||||
//many redistributors we can fit into the memory map.
|
||||
//related codes are under github.com/qemu/qemu/hw/arm/virt.c(Line 135 and 1306 in stable-2.11)
|
||||
//for now, qemu only supports v2 and v3, we treat v4 as v3 based on
|
||||
//backward compatibility.
|
||||
var gicList = map[uint32]uint32{
|
||||
uint32(2): uint32(8),
|
||||
uint32(3): uint32(123),
|
||||
uint32(4): uint32(123),
|
||||
}
|
||||
|
||||
// MaxQemuVCPUs returns the maximum number of vCPUs supported
|
||||
func MaxQemuVCPUs() uint32 {
|
||||
if hostGICVersion != 0 {
|
||||
return gicList[hostGICVersion]
|
||||
}
|
||||
return uint32(runtime.NumCPU())
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user