diff --git a/Gopkg.lock b/Gopkg.lock index e7ced564c9..ab5a9bf8cf 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -391,11 +391,11 @@ revision = "2f1d1f20f75d5404f53b9edf6b53ed5505508675" [[projects]] - digest = "1:6b643bd5e349019c33430301a3e5c38324c3014c423fe5e7cf857a8dd341efe2" + digest = "1:bba46c73858fda3e8066d66553615bd271f1ee811a0bf19f239ea2fb1e313f22" name = "github.com/intel/govmm" packages = ["qemu"] pruneopts = "NUT" - revision = "52b2309a558fe89b3e81b85440144b535288ce4f" + revision = "e0505242c0670f1a522f5b2d827e4a7e4062a14d" [[projects]] digest = "1:36dfd4701e98a9d8371dd3053e32d4f29e82b07bcc9e655db82138f9273bcb0f" diff --git a/Gopkg.toml b/Gopkg.toml index 11a04621bd..59b09fd61b 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -48,7 +48,7 @@ [[constraint]] name = "github.com/intel/govmm" - revision = "52b2309a558fe89b3e81b85440144b535288ce4f" + revision = "e0505242c0670f1a522f5b2d827e4a7e4062a14d" [[constraint]] name = "github.com/kata-containers/agent" diff --git a/vendor/github.com/intel/govmm/qemu/qmp.go b/vendor/github.com/intel/govmm/qemu/qmp.go index 665f69e9d2..2a645ca24f 100644 --- a/vendor/github.com/intel/govmm/qemu/qmp.go +++ b/vendor/github.com/intel/govmm/qemu/qmp.go @@ -149,6 +149,7 @@ type QMPVersion struct { type CPUProperties struct { Node int `json:"node-id"` Socket int `json:"socket-id"` + Die int `json:"die-id"` Core int `json:"core-id"` Thread int `json:"thread-id"` } @@ -1157,26 +1158,56 @@ func (q *QMP) ExecutePCIVFIOMediatedDeviceAdd(ctx context.Context, devID, sysfsd return q.executeCommand(ctx, "device_add", args, nil) } +// isSocketIDSupported returns if the cpu driver supports the socket id option +func isSocketIDSupported(driver string) bool { + if driver == "host-s390x-cpu" || driver == "host-powerpc64-cpu" { + return false + } + return true +} + +// isThreadIDSupported returns if the cpu driver supports the thread id option +func isThreadIDSupported(driver string) bool { + if driver == "host-s390x-cpu" || driver == "host-powerpc64-cpu" { + return false + } + return true +} + +// isDieIDSupported returns if the cpu driver and the qemu version support the die id option +func (q *QMP) isDieIDSupported(driver string) bool { + if (q.version.Major > 4 || (q.version.Major == 4 && q.version.Minor >= 1)) && driver == "host-x86_64-cpu" { + return true + } + return false +} + // ExecuteCPUDeviceAdd adds a CPU to a QEMU instance using the device_add command. // driver is the CPU model, cpuID must be a unique ID to identify the CPU, socketID is the socket number within // node/board the CPU belongs to, coreID is the core number within socket the CPU belongs to, threadID is the // thread number within core the CPU belongs to. Note that socketID and threadID are not a requirement for // architecures like ppc64le. -func (q *QMP) ExecuteCPUDeviceAdd(ctx context.Context, driver, cpuID, socketID, coreID, threadID, romfile string) error { +func (q *QMP) ExecuteCPUDeviceAdd(ctx context.Context, driver, cpuID, socketID, dieID, coreID, threadID, romfile string) error { args := map[string]interface{}{ "driver": driver, "id": cpuID, "core-id": coreID, } - if socketID != "" { + if socketID != "" && isSocketIDSupported(driver) { args["socket-id"] = socketID } - if threadID != "" { + if threadID != "" && isThreadIDSupported(driver) { args["thread-id"] = threadID } + if q.isDieIDSupported(driver) { + if dieID != "" { + args["die-id"] = dieID + } + } + if isVirtioPCI[DeviceDriver(driver)] { args["romfile"] = romfile }