diff --git a/src/runtime/pkg/govmm/vmm_amd64.go b/src/runtime/pkg/govmm/vmm_amd64.go new file mode 100644 index 0000000000..37c7a7c52f --- /dev/null +++ b/src/runtime/pkg/govmm/vmm_amd64.go @@ -0,0 +1,12 @@ +// +// Copyright (c) 2018 Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 +// + +package govmm + +// MaxVCPUs returns the maximum number of vCPUs supported +func MaxVCPUs() uint32 { + return uint32(240) +} diff --git a/src/runtime/pkg/govmm/vmm_arm64.go b/src/runtime/pkg/govmm/vmm_arm64.go new file mode 100644 index 0000000000..a01cd683f9 --- /dev/null +++ b/src/runtime/pkg/govmm/vmm_arm64.go @@ -0,0 +1,25 @@ +// +// Copyright (c) 2018 Intel Corporation +// +// SPDX-License-Identifier: Apache-2.0 +// + +package govmm + +//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), +} + +var defaultGICVersion = uint32(3) + +// MaxVCPUs returns the maximum number of vCPUs supported +func MaxVCPUs() uint32 { + return gicList[defaultGICVersion] +} diff --git a/src/runtime/pkg/govmm/vmm_ppc64le.go b/src/runtime/pkg/govmm/vmm_ppc64le.go new file mode 100644 index 0000000000..91ef70f867 --- /dev/null +++ b/src/runtime/pkg/govmm/vmm_ppc64le.go @@ -0,0 +1,12 @@ +// +// Copyright (c) 2018 IBM +// +// SPDX-License-Identifier: Apache-2.0 +// + +package qemu + +// MaxVCPUs returns the maximum number of vCPUs supported +func MaxVCPUs() uint32 { + return uint32(128) +} diff --git a/src/runtime/pkg/govmm/vmm_s390x.go b/src/runtime/pkg/govmm/vmm_s390x.go new file mode 100644 index 0000000000..50f1735dc2 --- /dev/null +++ b/src/runtime/pkg/govmm/vmm_s390x.go @@ -0,0 +1,15 @@ +// +// Copyright (c) 2018 IBM +// +// SPDX-License-Identifier: Apache-2.0 +// + +package govmm + +// MaxVCPUs returns the maximum number of vCPUs supported +func MaxVCPUs() uint32 { + // Max number of virtual Cpu defined in qemu. See + // https://github.com/qemu/qemu/blob/80422b00196a7af4c6efb628fae0ad8b644e98af/target/s390x/cpu.h#L55 + // #define S390_MAX_CPUS 248 + return uint32(248) +}