summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java8
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuPciPassthrough.java24
-rw-r--r--core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuGpuPassthroughNvidiaTest.java2
3 files changed, 21 insertions, 13 deletions
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
index f5d4b878..6626f5fc 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/App.java
@@ -179,6 +179,7 @@ public class App
transformationManager.register( new TransformationGenericFileSystemDevices(), true );
// register QEMU specific transformations to finalize configuration template
+ boolean lookingGlass = false;
if ( hypervisor instanceof LibvirtHypervisorQemu ) {
final LibvirtHypervisorQemu hypervisorQemu = LibvirtHypervisorQemu.class.cast( hypervisor );
@@ -187,7 +188,10 @@ public class App
transformationManager.register( new TransformationSpecificQemuGraphics( hypervisorQemu ), true );
transformationManager.register( new TransformationSpecificQemuSerialDevices( hypervisorQemu ), true );
transformationManager.register( new TransformationSpecificQemuMdevPassthroughIntel( hypervisorQemu ), false );
- transformationManager.register( new TransformationSpecificQemuPciPassthrough( hypervisorQemu ), false );
+ String os = config.getLibOsInfoOsId();
+ lookingGlass = cmdLn.isNvidiaGpuPassthroughEnabled()
+ && ( "http://microsoft.com/win/10".equals( os ) || "http://microsoft.com/win/11".equals( os ) );
+ transformationManager.register( new TransformationSpecificQemuPciPassthrough( hypervisorQemu, lookingGlass ), false );
}
// Needs to be last one since TransformationSpecificQemuArchitecture sets this too
@@ -259,7 +263,7 @@ public class App
// create specific viewer to display Libvirt VM
final Viewer vmViewer;
- if ( cmdLn.isNvidiaGpuPassthroughEnabled() && !cmdLn.isDebugDevicePassthroughEnabled() ) {
+ if ( lookingGlass && !cmdLn.isDebugDevicePassthroughEnabled() ) {
// viewer for GPU passthrough (framebuffer access) is required
vmViewer = new ViewerLookingGlassClient( vm, hypervisor, cmdLn.isDebugEnabled() );
} else {
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuPciPassthrough.java b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuPciPassthrough.java
index 798ddfec..3f67bed5 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuPciPassthrough.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/main/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuPciPassthrough.java
@@ -64,6 +64,8 @@ public class TransformationSpecificQemuPciPassthrough
* Reserved memory for framebuffer meta data of the Looking Glass shared memory device in MiB.
*/
private static final long RESERVED_MEMORY_FRAMEBUFFER = 10;
+
+ private final boolean withLookingGlass;
/**
* Creates a new Nvidia GPU passthrough transformation for Libvirt/QEMU virtualization
@@ -71,9 +73,10 @@ public class TransformationSpecificQemuPciPassthrough
*
* @param hypervisor Libvirt/QEMU hypervisor.
*/
- public TransformationSpecificQemuPciPassthrough( LibvirtHypervisorQemu hypervisor )
+ public TransformationSpecificQemuPciPassthrough( LibvirtHypervisorQemu hypervisor, boolean withLookingGlass )
{
super( TransformationSpecificQemuPciPassthrough.NAME, hypervisor );
+ this.withLookingGlass = withLookingGlass;
}
/**
@@ -102,7 +105,7 @@ public class TransformationSpecificQemuPciPassthrough
//
if ( pciIds.size() % 2 != 0 ) {
throw new TransformationException(
- "Arguments of PCI IDs are not follow the pattern for a GPU passthrough!" );
+ "Arguments of PCI IDs do not follow the pattern for a GPU passthrough!" );
}
// parse PCI device description and PCI device address
@@ -235,20 +238,13 @@ public class TransformationSpecificQemuPciPassthrough
}
// check if passthrough of Nvidia GPU takes place
- if ( args.isNvidiaGpuPassthroughEnabled() ) {
+ if ( this.withLookingGlass ) {
// add shared memory device for Looking Glass
final Shmem shmemDevice = config.addShmemDevice();
shmemDevice.setName( "looking-glass" );
shmemDevice.setModel( Shmem.Model.IVSHMEM_PLAIN );
shmemDevice.setSize( TransformationSpecificQemuPciPassthrough.calculateFramebufferSize() );
- // enable hypervisor shadowing to avoid error code 43 of Nvidia drivers in virtual machines
- if ( TransformationSpecificQemuPciPassthrough.NVIDIA_PATCH ) {
- config.setFeatureHypervVendorIdValue( TransformationSpecificQemuPciPassthrough.HYPERV_VENDOR_ID );
- config.setFeatureHypervVendorIdState( true );
- config.setFeatureKvmHiddenState( true );
- }
-
// disable all software video devices if device passthrough debug mode is not enabled
if ( !args.isDebugDevicePassthroughEnabled() ) {
for ( Video videoDevice : config.getVideoDevices() ) {
@@ -264,6 +260,14 @@ public class TransformationSpecificQemuPciPassthrough
graphicsSpiceDevice.setListenPort( GraphicsSpice.DEFAULT_PORT + i );
}
}
+ if ( args.isNvidiaGpuPassthroughEnabled() ) {
+ // enable hypervisor shadowing to avoid error code 43 of Nvidia drivers in virtual machines
+ if ( TransformationSpecificQemuPciPassthrough.NVIDIA_PATCH ) {
+ config.setFeatureHypervVendorIdValue( TransformationSpecificQemuPciPassthrough.HYPERV_VENDOR_ID );
+ config.setFeatureHypervVendorIdState( true );
+ config.setFeatureKvmHiddenState( true );
+ }
+ }
}
private int getFreeAddr( int[] inUse, HostdevPciDeviceAddress pciDeviceAddress )
diff --git a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuGpuPassthroughNvidiaTest.java b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuGpuPassthroughNvidiaTest.java
index ae9f531b..c0d4ff81 100644
--- a/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuGpuPassthroughNvidiaTest.java
+++ b/core/modules/qemu/runvirt-plugin-qemu/src/test/java/org/openslx/runvirt/plugin/qemu/configuration/TransformationSpecificQemuGpuPassthroughNvidiaTest.java
@@ -35,7 +35,7 @@ class TransformationSpecificQemuGpuPassthroughNvidiaStub extends TransformationS
public TransformationSpecificQemuGpuPassthroughNvidiaStub( String capabilityFileName )
{
- super( null );
+ super( null, true );
this.capabilityFileName = capabilityFileName;
}