mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-10-21 20:08:54 +00:00
The CPUinfo need to be refined in Arm architecture, because the vendor and model of CPU may refer to different meaning in Arm architecture. Besides, relevant contents extracted from /proc/cpuinfo may need to be normalized for human-readability. Fixes: #368 Signed-off-by: Penny Zheng <penny.zheng@arm.com> Signed-off-by: Wei Chen <wei.chen@arm.com>
81 lines
2.2 KiB
Go
81 lines
2.2 KiB
Go
// Copyright (c) 2018 Intel Corporation
|
|
//
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
//
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
const (
|
|
cpuFlagsTag = genericCPUFlagsTag
|
|
archCPUVendorField = genericCPUVendorField
|
|
archCPUModelField = genericCPUModelField
|
|
)
|
|
|
|
// archRequiredCPUFlags maps a CPU flag value to search for and a
|
|
// human-readable description of that value.
|
|
var archRequiredCPUFlags = map[string]string{
|
|
"vmx": "Virtualization support",
|
|
"lm": "64Bit CPU",
|
|
"sse4_1": "SSE4.1",
|
|
}
|
|
|
|
// archRequiredCPUAttribs maps a CPU (non-CPU flag) attribute value to search for
|
|
// and a human-readable description of that value.
|
|
var archRequiredCPUAttribs = map[string]string{
|
|
"GenuineIntel": "Intel Architecture CPU",
|
|
}
|
|
|
|
// archRequiredKernelModules maps a required module name to a human-readable
|
|
// description of the modules functionality and an optional list of
|
|
// required module parameters.
|
|
var archRequiredKernelModules = map[string]kernelModule{
|
|
"kvm": {
|
|
desc: "Kernel-based Virtual Machine",
|
|
},
|
|
"kvm_intel": {
|
|
desc: "Intel KVM",
|
|
parameters: map[string]string{
|
|
"nested": "Y",
|
|
// "VMX Unrestricted mode support". This is used
|
|
// as a heuristic to determine if the system is
|
|
// "new enough" to run a Kata Container
|
|
// (atleast a Westmere).
|
|
"unrestricted_guest": "Y",
|
|
},
|
|
},
|
|
"vhost": {
|
|
desc: "Host kernel accelerator for virtio",
|
|
},
|
|
"vhost_net": {
|
|
desc: "Host kernel accelerator for virtio network",
|
|
},
|
|
}
|
|
|
|
// kvmIsUsable determines if it will be possible to create a full virtual machine
|
|
// by creating a minimal VM and then deleting it.
|
|
func kvmIsUsable() error {
|
|
return genericKvmIsUsable()
|
|
}
|
|
|
|
func archHostCanCreateVMContainer() error {
|
|
return kvmIsUsable()
|
|
}
|
|
|
|
// hostIsVMContainerCapable checks to see if the host is theoretically capable
|
|
// of creating a VM container.
|
|
func hostIsVMContainerCapable(details vmContainerCapableDetails) error {
|
|
return genericHostIsVMContainerCapable(details)
|
|
}
|
|
|
|
func archKernelParamHandler(onVMM bool, fields logrus.Fields, msg string) bool {
|
|
return genericArchKernelParamHandler(onVMM, fields, msg)
|
|
}
|
|
|
|
func getCPUDetails() (vendor, model string, err error) {
|
|
return genericGetCPUDetails()
|
|
}
|