mirror of
https://github.com/aljazceru/kata-containers.git
synced 2025-12-17 06:14:26 +01:00
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>
26 lines
514 B
Go
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)
|
|
}
|