Files
kata-containers/src/runtime/virtcontainers/hypervisor_s390x_test.go
Jakob Naucke c0c05c73e1 virtcontainers: Add support for Secure Execution
Secure Execution is a confidential computing technology on s390x (IBM Z
& LinuxONE). Enable the correspondent virtualization technology in QEMU
(where it is referred to as "Protected Virtualization").

- Introduce enableProtection and appendProtectionDevice functions for
  QEMU s390x.
- Introduce CheckCmdline to check for "prot_virt=1" being present on the
  kernel command line.
- Introduce CPUFacilities and avilableGuestProtection for hypervisor
  s390x to check for CPU support.

Fixes: #1771

Signed-off-by: Jakob Naucke <jakob.naucke@ibm.com>
2021-06-07 10:50:33 +02:00

26 lines
514 B
Go

// Copyright (c) IBM Corp. 2021
//
// SPDX-License-Identifier: Apache-2.0
//
package virtcontainers
import (
"math"
"testing"
"github.com/stretchr/testify/assert"
)
func TestCPUFacilities(t *testing.T) {
assert := assert.New(t)
facilities, err := CPUFacilities(procCPUInfo)
assert.NoError(err)
// z/Architecture facility should always be active (introduced in 2000)
assert.Equal(facilities[1], true)
// facility bits should not be as high as MaxInt
assert.Equal(facilities[math.MaxInt64], false)
}