Merge pull request #8693 from BbolroC/ibm-se-config-validation-fix

runtime: Allow no initrd path for IBM Z Secure Execution
This commit is contained in:
Hyounggyu Choi 2024-01-11 09:53:51 +01:00 committed by GitHub
commit f62ec0a7f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -747,6 +747,12 @@ func (conf *HypervisorConfig) ImageOrInitrdAssetPath() (string, types.AssetType,
return initrd, types.InitrdAsset, nil return initrd, types.InitrdAsset, nil
} }
// Even if neither image nor initrd are set, we still need to return
// if we are running a confidential guest on QemuCCWVirtio. (IBM Z Secure Execution)
if conf.ConfidentialGuest && conf.HypervisorMachineType == QemuCCWVirtio {
return "", types.SecureBootAsset, nil
}
return "", types.UnkownAsset, fmt.Errorf("one of image and initrd must be set") return "", types.UnkownAsset, fmt.Errorf("one of image and initrd must be set")
} }

View File

@ -422,9 +422,13 @@ func (q *qemu) buildDevices(ctx context.Context, kernelPath string) ([]govmmQemu
if err != nil { if err != nil {
return nil, nil, nil, err return nil, nil, nil, err
} }
} else { } else if assetType == types.InitrdAsset {
// InitrdAsset, need to set kernel initrd path // InitrdAsset, need to set kernel initrd path
kernel.InitrdPath = assetPath kernel.InitrdPath = assetPath
} else if assetType == types.SecureBootAsset {
// SecureBootAsset, no need to set image or initrd path
q.Logger().Info("For IBM Z Secure Execution, initrd path should not be set")
kernel.InitrdPath = ""
} }
if q.config.IOMMU { if q.config.IOMMU {

View File

@ -28,6 +28,10 @@ const (
// InitrdAsset is an initrd asset. // InitrdAsset is an initrd asset.
InitrdAsset AssetType = "initrd" InitrdAsset AssetType = "initrd"
// SecureBootAsset is a secure boot asset.
// (IBM Z Secure Execution only)
SecureBootAsset AssetType = "secure_boot"
// HypervisorAsset is an hypervisor asset. // HypervisorAsset is an hypervisor asset.
HypervisorAsset AssetType = "hypervisor" HypervisorAsset AssetType = "hypervisor"