[PATCH 4/4] qemu: Generate command line for MTE feature

Michal Privoznik posted 4 patches 1 year, 8 months ago
[PATCH 4/4] qemu: Generate command line for MTE feature
Posted by Michal Privoznik 1 year, 8 months ago
This is pretty trivia, just append "mte=on/off" to -machine
arguments.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_command.c                    | 6 ++++++
 tests/qemuxml2argvdata/aarch64-gic-v3.args | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 2a6d9408f6..9b993c3aad 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -6797,6 +6797,12 @@ qemuAppendDomainFeaturesMachineParam(virBuffer *buf,
         virBufferAsprintf(buf, ",cap-ibs=%s", str);
     }
 
+    if (def->features[VIR_DOMAIN_FEATURE_MTE] != VIR_TRISTATE_SWITCH_ABSENT) {
+        const char *str;
+        str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_MTE]);
+        virBufferAsprintf(buf, ",mte=%s", str);
+    }
+
     return 0;
 }
 
diff --git a/tests/qemuxml2argvdata/aarch64-gic-v3.args b/tests/qemuxml2argvdata/aarch64-gic-v3.args
index 0d7a1c259a..0244951d87 100644
--- a/tests/qemuxml2argvdata/aarch64-gic-v3.args
+++ b/tests/qemuxml2argvdata/aarch64-gic-v3.args
@@ -10,7 +10,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
 -name guest=aarch64test,debug-threads=on \
 -S \
 -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-aarch64test/master-key.aes"}' \
--machine virt,usb=off,gic-version=3,dump-guest-core=off,memory-backend=mach-virt.ram \
+-machine virt,usb=off,gic-version=3,mte=on,dump-guest-core=off,memory-backend=mach-virt.ram \
 -accel kvm \
 -cpu host \
 -m 1024 \
-- 
2.39.3
Re: [PATCH 4/4] qemu: Generate command line for MTE feature
Posted by Martin Kletzander 1 year, 8 months ago
On Tue, May 16, 2023 at 12:54:16PM +0200, Michal Privoznik wrote:
>This is pretty trivia, just append "mte=on/off" to -machine

*trivial

>arguments.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/qemu/qemu_command.c                    | 6 ++++++
> tests/qemuxml2argvdata/aarch64-gic-v3.args | 2 +-
> 2 files changed, 7 insertions(+), 1 deletion(-)
>
>diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
>index 2a6d9408f6..9b993c3aad 100644
>--- a/src/qemu/qemu_command.c
>+++ b/src/qemu/qemu_command.c
>@@ -6797,6 +6797,12 @@ qemuAppendDomainFeaturesMachineParam(virBuffer *buf,
>         virBufferAsprintf(buf, ",cap-ibs=%s", str);
>     }
>
>+    if (def->features[VIR_DOMAIN_FEATURE_MTE] != VIR_TRISTATE_SWITCH_ABSENT) {
>+        const char *str;
>+        str = virTristateSwitchTypeToString(def->features[VIR_DOMAIN_FEATURE_MTE]);
>+        virBufferAsprintf(buf, ",mte=%s", str);
>+    }
>+
>     return 0;
> }
>
>diff --git a/tests/qemuxml2argvdata/aarch64-gic-v3.args b/tests/qemuxml2argvdata/aarch64-gic-v3.args
>index 0d7a1c259a..0244951d87 100644
>--- a/tests/qemuxml2argvdata/aarch64-gic-v3.args
>+++ b/tests/qemuxml2argvdata/aarch64-gic-v3.args
>@@ -10,7 +10,7 @@ XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-aarch64test/.config \
> -name guest=aarch64test,debug-threads=on \
> -S \
> -object '{"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain--1-aarch64test/master-key.aes"}' \
>--machine virt,usb=off,gic-version=3,dump-guest-core=off,memory-backend=mach-virt.ram \
>+-machine virt,usb=off,gic-version=3,mte=on,dump-guest-core=off,memory-backend=mach-virt.ram \
> -accel kvm \
> -cpu host \
> -m 1024 \
>-- 
>2.39.3
>