all lists on lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH qemu-server] fix #3784: Parameter for guest vIOMMU
@ 2022-02-25 12:00 Markus Frank
  2022-03-16 17:03 ` Thomas Lamprecht
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Frank @ 2022-02-25 12:00 UTC (permalink / raw)
  To: pve-devel

added a Parameter for vIOMMU so nobody has to use a github-script
or change the kvm command on every vm boot.
The args parameter doesn't work because the -device parameter(kvm)
with intel-iommu has to be placed before the other arguments.

Signed-off-by: Markus Frank <m.frank@proxmox.com>
---
 PVE/QemuServer.pm | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
index 42f0fbd..a09dd2e 100644
--- a/PVE/QemuServer.pm
+++ b/PVE/QemuServer.pm
@@ -647,6 +647,12 @@ EODESCR
 	    ." remove disk operations.",
 	default => 0,
     },
+    viommu => {
+	optional => 1,
+	type => 'boolean',
+	description => "enable guest vIOMMU",
+	default => 0,
+    },
     bios => {
 	optional => 1,
 	type => 'string',
@@ -3427,6 +3433,9 @@ sub config_to_command {
     my $winversion = windows_version($ostype);
     my $kvm = $conf->{kvm};
     my $nodename = nodename();
+    my $viommu = $conf->{viommu};
+
+    push @$devices, '-device', 'intel-iommu,intremap=on,caching-mode=on' if $viommu;
 
     my $arch = get_vm_arch($conf);
     my $kvm_binary = get_command_for_arch($arch);
@@ -4021,6 +4030,8 @@ sub config_to_command {
     }
     push @$machineFlags, "type=${machine_type_min}";
 
+    push @$machineFlags, 'accel=kvm,kernel-irqchip=split' if $viommu;
+
     push @$cmd, @$devices;
     push @$cmd, '-rtc', join(',', @$rtcFlags) if scalar(@$rtcFlags);
     push @$cmd, '-machine', join(',', @$machineFlags) if scalar(@$machineFlags);
-- 
2.30.2





^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [pve-devel] [PATCH qemu-server] fix #3784: Parameter for guest vIOMMU
  2022-02-25 12:00 [pve-devel] [PATCH qemu-server] fix #3784: Parameter for guest vIOMMU Markus Frank
@ 2022-03-16 17:03 ` Thomas Lamprecht
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Lamprecht @ 2022-03-16 17:03 UTC (permalink / raw)
  To: Proxmox VE development discussion, Markus Frank

On 25.02.22 13:00, Markus Frank wrote:
> added a Parameter for vIOMMU so nobody has to use a github-script
> or change the kvm command on every vm boot.
> The args parameter doesn't work because the -device parameter(kvm)
> with intel-iommu has to be placed before the other arguments.
> 

some short sentence what vIOMMU is used for could be nice to have for
context.

> Signed-off-by: Markus Frank <m.frank@proxmox.com>
> ---
>  PVE/QemuServer.pm | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/PVE/QemuServer.pm b/PVE/QemuServer.pm
> index 42f0fbd..a09dd2e 100644
> --- a/PVE/QemuServer.pm
> +++ b/PVE/QemuServer.pm
> @@ -647,6 +647,12 @@ EODESCR
>  	    ." remove disk operations.",
>  	default => 0,
>      },
> +    viommu => {
> +	optional => 1,
> +	type => 'boolean',
> +	description => "enable guest vIOMMU",
> +	default => 0,
> +    },

I'd like to avoid having too many separate config properties where sensible.
qemu-server obv. failed already a bit with that, but that's now its legacy ^^

Anyhow, do you think it could make sense to either:
* have this a format-string (`property: foo=1,bar=2,baz=42`) added to an existing
  option
* use a more general `machine-flags` that already starts out as format-string so
  that we can reuse this in the future, e.g., for memory encryption (qemu sets that
  also on its machine param) or the like?

>      bios => {
>  	optional => 1,
>  	type => 'string',
> @@ -3427,6 +3433,9 @@ sub config_to_command {
>      my $winversion = windows_version($ostype);
>      my $kvm = $conf->{kvm};
>      my $nodename = nodename();
> +    my $viommu = $conf->{viommu};
> +
> +    push @$devices, '-device', 'intel-iommu,intremap=on,caching-mode=on' if $viommu;
>  
>      my $arch = get_vm_arch($conf);
>      my $kvm_binary = get_command_for_arch($arch);
> @@ -4021,6 +4030,8 @@ sub config_to_command {
>      }
>      push @$machineFlags, "type=${machine_type_min}";
>  
> +    push @$machineFlags, 'accel=kvm,kernel-irqchip=split' if $viommu;

We set accel= already elsewhere, did you check for possible conflicts that we could
catch earlier (e.g., config set) and tell the user?

> +
>      push @$cmd, @$devices;
>      push @$cmd, '-rtc', join(',', @$rtcFlags) if scalar(@$rtcFlags);
>      push @$cmd, '-machine', join(',', @$machineFlags) if scalar(@$machineFlags);





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-03-16 17:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-25 12:00 [pve-devel] [PATCH qemu-server] fix #3784: Parameter for guest vIOMMU Markus Frank
2022-03-16 17:03 ` Thomas Lamprecht

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal