diff --git a/Makefile b/Makefile index a27ec3127c..1fc6155a93 100644 --- a/Makefile +++ b/Makefile @@ -61,6 +61,12 @@ ifeq (,$(installing)) EXTRA_DEPS = clean endif +ifeq (uncompressed,$(KERNELTYPE)) + KERNEL_NAME = vmlinux.container +else + KERNEL_NAME = vmlinuz.container +endif + LIBEXECDIR := $(PREFIX)/libexec SHAREDIR := $(PREFIX)/share DEFAULTSDIR := $(SHAREDIR)/defaults @@ -77,7 +83,7 @@ PKGLIBDIR := $(LOCALSTATEDIR)/lib/$(PROJECT_DIR) PKGRUNDIR := $(LOCALSTATEDIR)/run/$(PROJECT_DIR) PKGLIBEXECDIR := $(LIBEXECDIR)/$(PROJECT_DIR) -KERNELPATH := $(PKGDATADIR)/vmlinuz.container +KERNELPATH := $(PKGDATADIR)/$(KERNEL_NAME) INITRDPATH := $(PKGDATADIR)/$(INITRDNAME) IMAGEPATH := $(PKGDATADIR)/$(IMAGENAME) FIRMWAREPATH := @@ -150,6 +156,7 @@ USER_VARS += INITRDNAME USER_VARS += INITRDPATH USER_VARS += MACHINETYPE USER_VARS += KERNELPATH +USER_VARS += KERNELTYPE USER_VARS += FIRMWAREPATH USER_VARS += MACHINEACCELERATORS USER_VARS += KERNELPARAMS diff --git a/arch/ppc64le-options.mk b/arch/ppc64le-options.mk new file mode 100644 index 0000000000..a309ca51db --- /dev/null +++ b/arch/ppc64le-options.mk @@ -0,0 +1,12 @@ +# Copyright (c) 2018 IBM +# +# SPDX-License-Identifier: Apache-2.0 +# + +# Power ppc64le settings + +MACHINETYPE := pseries +KERNELPARAMS := +MACHINEACCELERATORS := +KERNELTYPE := uncompressed #This architecture must use an uncompressed kernel. +QEMUCMD := qemu-system-ppc64le diff --git a/cli/kata-check_ppc64le.go b/cli/kata-check_ppc64le.go new file mode 100644 index 0000000000..ce27777438 --- /dev/null +++ b/cli/kata-check_ppc64le.go @@ -0,0 +1,65 @@ +// Copyright (c) 2018 IBM +// +// SPDX-License-Identifier: Apache-2.0 +// + +package main + +import ( + "fmt" + "github.com/sirupsen/logrus" +) + +// archRequiredCPUFlags maps a CPU flag value to search for and a +// human-readable description of that value. +var archRequiredCPUFlags = map[string]string{} + +// 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{} + +// 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_hv": { + desc: "Kernel-based Virtual Machine hardware virtualization", + }, +} + +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 { + _, err := getCPUInfo(details.cpuInfoFile) + if err != nil { + return err + } + + count, err := checkKernelModules(details.requiredKernelModules, archKernelParamHandler) + if err != nil { + return err + } + + if count == 0 { + return nil + } + + return fmt.Errorf("ERROR: %s", failMessage) +} + +// 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 archKernelParamHandler(onVMM bool, fields logrus.Fields, msg string) bool { + return genericArchKernelParamHandler(onVMM, fields, msg) +} diff --git a/cli/kata-env.go b/cli/kata-env.go index 52bbfacb59..d0daf3490f 100644 --- a/cli/kata-env.go +++ b/cli/kata-env.go @@ -15,6 +15,7 @@ import ( "github.com/kata-containers/runtime/virtcontainers/pkg/oci" specs "github.com/opencontainers/runtime-spec/specs-go" "github.com/urfave/cli" + runtim "runtime" ) // Semantic version for the output of the command. @@ -173,6 +174,9 @@ func getHostInfo() (HostInfo, error) { } hostVMContainerCapable := true + if runtim.GOARCH == "ppc64le" { + hostVMContainerCapable = false + } details := vmContainerCapableDetails{ cpuInfoFile: procCPUInfo,