mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-04 11:06:21 +00:00
Merge pull request #3619 from devimc/2021-02-03/supportQEMUSGX
runtime: support QEMU SGX
This commit is contained in:
commit
046aae7e52
@ -24,6 +24,8 @@ type qemuAmd64 struct {
|
||||
vmFactory bool
|
||||
|
||||
devLoadersCount uint32
|
||||
|
||||
sgxEPCSize int64
|
||||
}
|
||||
|
||||
const (
|
||||
@ -140,6 +142,17 @@ func newQemuArch(config HypervisorConfig) (qemuArch, error) {
|
||||
}
|
||||
}
|
||||
|
||||
if config.SGXEPCSize != 0 {
|
||||
q.sgxEPCSize = config.SGXEPCSize
|
||||
if q.qemuMachine.Options != "" {
|
||||
q.qemuMachine.Options += ","
|
||||
}
|
||||
// qemu sandboxes will only support one EPC per sandbox
|
||||
// this is because there is only one annotation (sgx.intel.com/epc)
|
||||
// to specify the size of the EPC.
|
||||
q.qemuMachine.Options += "sgx-epc.0.memdev=epc0,sgx-epc.0.node=0"
|
||||
}
|
||||
|
||||
q.handleImagePath(config)
|
||||
|
||||
return q, nil
|
||||
@ -233,6 +246,16 @@ func (q *qemuAmd64) enableProtection() error {
|
||||
|
||||
// append protection device
|
||||
func (q *qemuAmd64) appendProtectionDevice(devices []govmmQemu.Device, firmware, firmwareVolume string) ([]govmmQemu.Device, string, error) {
|
||||
if q.sgxEPCSize != 0 {
|
||||
devices = append(devices,
|
||||
govmmQemu.Object{
|
||||
Type: govmmQemu.MemoryBackendEPC,
|
||||
ID: "epc0",
|
||||
Prealloc: true,
|
||||
Size: uint64(q.sgxEPCSize),
|
||||
})
|
||||
}
|
||||
|
||||
switch q.protection {
|
||||
case tdxProtection:
|
||||
id := q.devLoadersCount
|
||||
|
Loading…
Reference in New Issue
Block a user