From 361bee91f7edf40bccf4d44abb437a2a953f4136 Mon Sep 17 00:00:00 2001 From: Julio Montes Date: Mon, 14 Jun 2021 15:27:03 -0500 Subject: [PATCH] runtime/virtcontrainers: fix alignment structures fix alignment of qemuArchBase and HypervisorConfig structures Signed-off-by: Julio Montes --- src/runtime/virtcontainers/hypervisor.go | 62 ++++++++++---------- src/runtime/virtcontainers/qemu_arch_base.go | 10 ++-- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/src/runtime/virtcontainers/hypervisor.go b/src/runtime/virtcontainers/hypervisor.go index d6bc97c118..53cebe7e35 100644 --- a/src/runtime/virtcontainers/hypervisor.go +++ b/src/runtime/virtcontainers/hypervisor.go @@ -222,6 +222,10 @@ type Param struct { // HypervisorConfig is the hypervisor configuration. type HypervisorConfig struct { + // PCIeRootPort is used to indicate the number of PCIe Root Port devices + // The PCIe Root Port device is used to hot-plug the PCIe device + PCIeRootPort uint32 + // NumVCPUs specifies default number of vCPUs for the VM. NumVCPUs uint32 @@ -241,9 +245,6 @@ type HypervisorConfig struct { // MemSlots specifies default memory slots the VM. MemSlots uint32 - // MemOffset specifies memory space for nvdimm device - MemOffset uint64 - // VirtioFSCacheSize is the DAX cache size in MiB VirtioFSCacheSize uint32 @@ -310,9 +311,6 @@ type HypervisorConfig struct { // entropy (/dev/random, /dev/urandom or real hardware RNG device) EntropySource string - // EntropySourceList is the list of valid entropy sources - EntropySourceList []string - // Shared file system type: // - virtio-9p (default) // - virtio-fs @@ -321,6 +319,12 @@ type HypervisorConfig struct { // VirtioFSDaemon is the virtio-fs vhost-user daemon path VirtioFSDaemon string + // File based memory backend root directory + FileBackedMemRootDir string + + // EntropySourceList is the list of valid entropy sources + EntropySourceList []string + // VirtioFSDaemonList is the list of valid virtiofs names for annotations VirtioFSDaemonList []string @@ -330,8 +334,8 @@ type HypervisorConfig struct { // VirtioFSExtraArgs passes options to virtiofsd daemon VirtioFSExtraArgs []string - // File based memory backend root directory - FileBackedMemRootDir string + // Enable annotations by name + EnableAnnotations []string // FileBackedMemRootList is the list of valid root directories values for annotations FileBackedMemRootList []string @@ -339,6 +343,9 @@ type HypervisorConfig struct { // PFlash image paths PFlash []string + // VhostUserStorePathList is the list of valid values for vhost-user paths + VhostUserStorePathList []string + // customAssets is a map of assets. // Each value in that map takes precedence over the configured assets. // For example, if there is a value for the "kernel" key in this map, @@ -401,9 +408,14 @@ type HypervisorConfig struct { // root bus instead of a bridge. HotplugVFIOOnRootBus bool - // PCIeRootPort is used to indicate the number of PCIe Root Port devices - // The PCIe Root Port device is used to hot-plug the PCIe device - PCIeRootPort uint32 + // GuestMemoryDumpPaging is used to indicate if enable paging + // for QEMU dump-guest-memory command + GuestMemoryDumpPaging bool + + // Enable confidential guest support. + // Enable or disable different hardware features, ranging + // from memory encryption to both memory and CPU-state encryption and integrity. + ConfidentialGuest bool // BootToBeTemplate used to indicate if the VM is created to be a template VM BootToBeTemplate bool @@ -421,8 +433,8 @@ type HypervisorConfig struct { // related folders, sockets and device nodes should be. VhostUserStorePath string - // VhostUserStorePathList is the list of valid values for vhost-user paths - VhostUserStorePathList []string + // GuestCoredumpPath is the path in host for saving guest memory dump + GuestMemoryDumpPath string // GuestHookPath is the path within the VM that will be used for 'drop-in' hooks GuestHookPath string @@ -434,30 +446,18 @@ type HypervisorConfig struct { // SELinux label for the VM SELinuxProcessLabel string + // SGXEPCSize specifies the size in bytes for the EPC Section. + // Enable SGX. Hardware-based isolation and memory encryption. + SGXEPCSize int64 + // RxRateLimiterMaxRate is used to control network I/O inbound bandwidth on VM level. RxRateLimiterMaxRate uint64 // TxRateLimiterMaxRate is used to control network I/O outbound bandwidth on VM level. TxRateLimiterMaxRate uint64 - // SGXEPCSize specifies the size in bytes for the EPC Section. - // Enable SGX. Hardware-based isolation and memory encryption. - SGXEPCSize int64 - - // Enable annotations by name - EnableAnnotations []string - - // GuestCoredumpPath is the path in host for saving guest memory dump - GuestMemoryDumpPath string - - // GuestMemoryDumpPaging is used to indicate if enable paging - // for QEMU dump-guest-memory command - GuestMemoryDumpPaging bool - - // Enable confidential guest support. - // Enable or disable different hardware features, ranging - // from memory encryption to both memory and CPU-state encryption and integrity. - ConfidentialGuest bool + // MemOffset specifies memory space for nvdimm device + MemOffset uint64 } // vcpu mapping from vcpu number to thread number diff --git a/src/runtime/virtcontainers/qemu_arch_base.go b/src/runtime/virtcontainers/qemu_arch_base.go index ebdfc4a3b8..0948401a62 100644 --- a/src/runtime/virtcontainers/qemu_arch_base.go +++ b/src/runtime/virtcontainers/qemu_arch_base.go @@ -175,20 +175,20 @@ const ( ) type qemuArchBase struct { - qemuMachine govmmQemu.Machine - qemuExePath string memoryOffset uint64 + networkIndex int nestedRun bool vhost bool disableNvdimm bool dax bool - networkIndex int + protection guestProtection + qemuMachine govmmQemu.Machine + qemuExePath string + PFlash []string kernelParamsNonDebug []Param kernelParamsDebug []Param kernelParams []Param Bridges []types.Bridge - PFlash []string - protection guestProtection } const (