qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Ganapatrao Kulkarni <gankulkarni@os.amperecomputing.com>
To: Cornelia Huck <cohuck@redhat.com>,
	Gustavo Romero <gustavo.romero@linaro.org>,
	qemu-arm@nongnu.org, qemu-devel@nongnu.org
Cc: peter.maydell@linaro.org, richard.henderson@linaro.org,
	alex.bennee@linaro.org, darren@os.amperecomputing.com
Subject: Re: [PATCH V2] arm/kvm: add support for MTE
Date: Thu, 19 Sep 2024 21:26:14 +0530	[thread overview]
Message-ID: <cdbe8ff8-6745-4b3e-9c9e-e557bad1aa21@os.amperecomputing.com> (raw)
In-Reply-To: <8734lvu1ji.fsf@redhat.com>



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	other threads:[~2024-09-19 15:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12  9:16 [PATCH V2] arm/kvm: add support for MTE Ganapatrao Kulkarni
2024-09-17 14:13 ` Cornelia Huck
2024-09-19  3:01   ` Gustavo Romero
2024-09-19 10:11     ` Ganapatrao Kulkarni
2024-09-19  3:22 ` Gustavo Romero
2024-09-19 10:31   ` Ganapatrao Kulkarni
2024-09-19 15:05     ` Cornelia Huck
2024-09-19 15:56       ` Ganapatrao Kulkarni [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cdbe8ff8-6745-4b3e-9c9e-e557bad1aa21@os.amperecomputing.com \
    --to=gankulkarni@os.amperecomputing.com \
    --cc=alex.bennee@linaro.org \
    --cc=cohuck@redhat.com \
    --cc=darren@os.amperecomputing.com \
    --cc=gustavo.romero@linaro.org \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-arm@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).