mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-15 08:02:31 +00:00
Merge pull request #173 from Jakob-Naucke/sec-exec
qemu: Add support for Secure Execution
This commit is contained in:
commit
6fd848e95e
24
qemu/qemu.go
24
qemu/qemu.go
@ -233,6 +233,9 @@ const (
|
|||||||
|
|
||||||
// SEVGuest represents an SEV guest object
|
// SEVGuest represents an SEV guest object
|
||||||
SEVGuest ObjectType = "sev-guest"
|
SEVGuest ObjectType = "sev-guest"
|
||||||
|
|
||||||
|
// SecExecGuest represents an s390x Secure Execution (Protected Virtualization in QEMU) object
|
||||||
|
SecExecGuest ObjectType = "s390-pv-guest"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Object is a qemu object representation.
|
// Object is a qemu object representation.
|
||||||
@ -275,24 +278,16 @@ type Object struct {
|
|||||||
func (object Object) Valid() bool {
|
func (object Object) Valid() bool {
|
||||||
switch object.Type {
|
switch object.Type {
|
||||||
case MemoryBackendFile:
|
case MemoryBackendFile:
|
||||||
if object.ID == "" || object.MemPath == "" || object.Size == 0 {
|
return object.ID != "" && object.MemPath != "" && object.Size != 0
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
case TDXGuest:
|
case TDXGuest:
|
||||||
if object.ID == "" || object.File == "" || object.DeviceID == "" {
|
return object.ID != "" && object.File != "" && object.DeviceID != ""
|
||||||
return false
|
|
||||||
}
|
|
||||||
case SEVGuest:
|
case SEVGuest:
|
||||||
if object.ID == "" || object.File == "" || object.CBitPos == 0 || object.ReducedPhysBits == 0 {
|
return object.ID != "" && object.File != "" && object.CBitPos != 0 && object.ReducedPhysBits != 0
|
||||||
return false
|
case SecExecGuest:
|
||||||
}
|
return object.ID != ""
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// QemuParams returns the qemu parameters built out of this Object device.
|
// QemuParams returns the qemu parameters built out of this Object device.
|
||||||
@ -329,6 +324,9 @@ func (object Object) QemuParams(config *Config) []string {
|
|||||||
|
|
||||||
driveParams = append(driveParams, "if=pflash,format=raw,readonly=on")
|
driveParams = append(driveParams, "if=pflash,format=raw,readonly=on")
|
||||||
driveParams = append(driveParams, fmt.Sprintf(",file=%s", object.File))
|
driveParams = append(driveParams, fmt.Sprintf(",file=%s", object.File))
|
||||||
|
case SecExecGuest:
|
||||||
|
objectParams = append(objectParams, string(object.Type))
|
||||||
|
objectParams = append(objectParams, fmt.Sprintf(",id=%s", object.ID))
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(deviceParams) > 0 {
|
if len(deviceParams) > 0 {
|
||||||
|
Loading…
Reference in New Issue
Block a user