qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH V2] arm/kvm: add support for MTE


From: Ganapatrao Kulkarni
Subject: Re: [PATCH V2] arm/kvm: add support for MTE
Date: Thu, 19 Sep 2024 21:26:14 +0530
User-agent: Mozilla Thunderbird



On 19-09-2024 08:35 pm, Cornelia Huck wrote:
On Thu, Sep 19 2024, Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com> 
wrote:

I have modified as below diff to keep TCG if loop as it is and adding if
for KVM case to clear/mask the MTE bits if MTE in KVM mode is not
enabled by user command(if no mte=on).

Is below diff makes sense?

diff --git a/target/arm/cpu.c b/target/arm/cpu.c
index a59417aac8..523996576d 100644
--- a/target/arm/cpu.c
+++ b/target/arm/cpu.c
@@ -2390,15 +2390,20 @@ static void arm_cpu_realizefn(DeviceState *dev,
Error **errp)

   #ifndef CONFIG_USER_ONLY
           /*
-         * If we do not have tag-memory provided by the TCG
-         * nor MTE at KVM enabled, reduce MTE support to
-         * instructions enabled at EL0.
+         * If we do not have tag-memory provided by the TCG,
+         * reduce MTE support to instructions enabled at EL0.
            * This matches Cortex-A710 BROADCASTMTE input being LOW.
            */
-        if (cpu->tag_memory == NULL && !cpu->kvm_mte) {
+        if (tcg_enabled() && cpu->tag_memory == NULL) {
               cpu->isar.id_aa64pfr1 =
                   FIELD_DP64(cpu->isar.id_aa64pfr1, ID_AA64PFR1, MTE, 1);
           }
+
+        /* Disable MTE, if it is not enabled by the user for KVM mode.
+         */
+        if (kvm_enabled() && !cpu->kvm_mte) {
+                FIELD_DP64(cpu->isar.id_aa64pfr1, ID_AA64PFR1, MTE, 0);
+        }
   #endif
       }

Wouldn't that be a possibly guest-visible change?


Yes, the MTE bits of id_aa64pfr1 are masked to guest like before.

--
Thanks,
Ganapat/GK



reply via email to

[Prev in Thread] Current Thread [Next in Thread]