mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-08-15 06:34:03 +00:00
gpu: Cold Plug VFIO toml setting
Added the cold_plug_vfio setting to the qemu-toml.in with some epxlanation Signed-off-by: Zvonko Kaiser <zkaiser@nvidia.com>
This commit is contained in:
parent
f7ad75cb12
commit
138ada049c
@ -352,6 +352,11 @@ pflashes = []
|
|||||||
# Default false
|
# Default false
|
||||||
#hotplug_vfio_on_root_bus = true
|
#hotplug_vfio_on_root_bus = true
|
||||||
|
|
||||||
|
# In a confidential compute environment hot-plugging can compromise
|
||||||
|
# security. Enable cold-plugging of VFIO devices to a root-port.
|
||||||
|
# The default setting is "no-port", which means disabled.
|
||||||
|
#cold_plug_vfio = "root-port"
|
||||||
|
|
||||||
# Before hot plugging a PCIe device, you need to add a pcie_root_port device.
|
# Before hot plugging a PCIe device, you need to add a pcie_root_port device.
|
||||||
# Use this parameter when using some large PCI bar devices, such as Nvidia GPU
|
# Use this parameter when using some large PCI bar devices, such as Nvidia GPU
|
||||||
# The value means the number of pcie_root_port
|
# The value means the number of pcie_root_port
|
||||||
|
@ -19,6 +19,7 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/govmm"
|
"github.com/kata-containers/kata-containers/src/runtime/pkg/govmm"
|
||||||
|
hv "github.com/kata-containers/kata-containers/src/runtime/pkg/hypervisors"
|
||||||
ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
|
ktu "github.com/kata-containers/kata-containers/src/runtime/pkg/katatestutils"
|
||||||
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
"github.com/kata-containers/kata-containers/src/runtime/pkg/oci"
|
||||||
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
vc "github.com/kata-containers/kata-containers/src/runtime/virtcontainers"
|
||||||
@ -70,7 +71,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
if hypervisor == "" {
|
if hypervisor == "" {
|
||||||
return config, fmt.Errorf("BUG: need hypervisor")
|
return config, fmt.Errorf("BUG: need hypervisor")
|
||||||
}
|
}
|
||||||
|
var coldPlugVFIO hv.PCIePort
|
||||||
hypervisorPath := path.Join(dir, "hypervisor")
|
hypervisorPath := path.Join(dir, "hypervisor")
|
||||||
kernelPath := path.Join(dir, "kernel")
|
kernelPath := path.Join(dir, "kernel")
|
||||||
kernelParams := "foo=bar xyz"
|
kernelParams := "foo=bar xyz"
|
||||||
@ -85,6 +86,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
enableIOThreads := true
|
enableIOThreads := true
|
||||||
hotplugVFIOOnRootBus := true
|
hotplugVFIOOnRootBus := true
|
||||||
pcieRootPort := uint32(2)
|
pcieRootPort := uint32(2)
|
||||||
|
coldPlugVFIO = hv.RootPort
|
||||||
disableNewNetNs := false
|
disableNewNetNs := false
|
||||||
sharedFS := "virtio-9p"
|
sharedFS := "virtio-9p"
|
||||||
virtioFSdaemon := path.Join(dir, "virtiofsd")
|
virtioFSdaemon := path.Join(dir, "virtiofsd")
|
||||||
@ -107,6 +109,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
EnableIOThreads: enableIOThreads,
|
EnableIOThreads: enableIOThreads,
|
||||||
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
||||||
PCIeRootPort: pcieRootPort,
|
PCIeRootPort: pcieRootPort,
|
||||||
|
ColdPlugVFIO: coldPlugVFIO,
|
||||||
DisableNewNetNs: disableNewNetNs,
|
DisableNewNetNs: disableNewNetNs,
|
||||||
DefaultVCPUCount: defaultVCPUCount,
|
DefaultVCPUCount: defaultVCPUCount,
|
||||||
DefaultMaxVCPUCount: defaultMaxVCPUCount,
|
DefaultMaxVCPUCount: defaultMaxVCPUCount,
|
||||||
@ -170,6 +173,7 @@ func createAllRuntimeConfigFiles(dir, hypervisor string) (config testRuntimeConf
|
|||||||
EnableIOThreads: enableIOThreads,
|
EnableIOThreads: enableIOThreads,
|
||||||
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
||||||
PCIeRootPort: pcieRootPort,
|
PCIeRootPort: pcieRootPort,
|
||||||
|
ColdPlugVFIO: coldPlugVFIO,
|
||||||
Msize9p: defaultMsize9p,
|
Msize9p: defaultMsize9p,
|
||||||
MemSlots: defaultMemSlots,
|
MemSlots: defaultMemSlots,
|
||||||
EntropySource: defaultEntropySource,
|
EntropySource: defaultEntropySource,
|
||||||
@ -564,6 +568,7 @@ func TestMinimalRuntimeConfig(t *testing.T) {
|
|||||||
VirtioFSCache: defaultVirtioFSCacheMode,
|
VirtioFSCache: defaultVirtioFSCacheMode,
|
||||||
BlockDeviceAIO: defaultBlockDeviceAIO,
|
BlockDeviceAIO: defaultBlockDeviceAIO,
|
||||||
DisableGuestSeLinux: defaultDisableGuestSeLinux,
|
DisableGuestSeLinux: defaultDisableGuestSeLinux,
|
||||||
|
ColdPlugVFIO: defaultColdPlugVFIO,
|
||||||
}
|
}
|
||||||
|
|
||||||
expectedAgentConfig := vc.KataAgentConfig{
|
expectedAgentConfig := vc.KataAgentConfig{
|
||||||
@ -597,7 +602,7 @@ func TestMinimalRuntimeConfig(t *testing.T) {
|
|||||||
|
|
||||||
func TestNewQemuHypervisorConfig(t *testing.T) {
|
func TestNewQemuHypervisorConfig(t *testing.T) {
|
||||||
dir := t.TempDir()
|
dir := t.TempDir()
|
||||||
|
var coldPlugVFIO hv.PCIePort
|
||||||
hypervisorPath := path.Join(dir, "hypervisor")
|
hypervisorPath := path.Join(dir, "hypervisor")
|
||||||
kernelPath := path.Join(dir, "kernel")
|
kernelPath := path.Join(dir, "kernel")
|
||||||
imagePath := path.Join(dir, "image")
|
imagePath := path.Join(dir, "image")
|
||||||
@ -606,6 +611,7 @@ func TestNewQemuHypervisorConfig(t *testing.T) {
|
|||||||
enableIOThreads := true
|
enableIOThreads := true
|
||||||
hotplugVFIOOnRootBus := true
|
hotplugVFIOOnRootBus := true
|
||||||
pcieRootPort := uint32(2)
|
pcieRootPort := uint32(2)
|
||||||
|
coldPlugVFIO = hv.RootPort
|
||||||
orgVHostVSockDevicePath := utils.VHostVSockDevicePath
|
orgVHostVSockDevicePath := utils.VHostVSockDevicePath
|
||||||
blockDeviceAIO := "io_uring"
|
blockDeviceAIO := "io_uring"
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -625,6 +631,7 @@ func TestNewQemuHypervisorConfig(t *testing.T) {
|
|||||||
EnableIOThreads: enableIOThreads,
|
EnableIOThreads: enableIOThreads,
|
||||||
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
HotplugVFIOOnRootBus: hotplugVFIOOnRootBus,
|
||||||
PCIeRootPort: pcieRootPort,
|
PCIeRootPort: pcieRootPort,
|
||||||
|
ColdPlugVFIO: coldPlugVFIO,
|
||||||
RxRateLimiterMaxRate: rxRateLimiterMaxRate,
|
RxRateLimiterMaxRate: rxRateLimiterMaxRate,
|
||||||
TxRateLimiterMaxRate: txRateLimiterMaxRate,
|
TxRateLimiterMaxRate: txRateLimiterMaxRate,
|
||||||
SharedFS: "virtio-fs",
|
SharedFS: "virtio-fs",
|
||||||
|
Loading…
Reference in New Issue
Block a user