[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] arm/kvm: add support for MTE
From: |
Ganapatrao Kulkarni |
Subject: |
Re: [PATCH] arm/kvm: add support for MTE |
Date: |
Tue, 10 Sep 2024 17:27:31 +0530 |
User-agent: |
Mozilla Thunderbird |
Hi Peter,
On 16-07-2024 09:15 pm, Peter Maydell wrote:
In target/arm/cpu.c:arm_cpu_realizefn() there is this code:
if (cpu_isar_feature(aa64_mte, cpu)) {
/*
* The architectural range of GM blocksize is 2-6, however qemu
* doesn't support blocksize of 2 (see HELPER(ldgm)).
*/
if (tcg_enabled()) {
assert(cpu->gm_blocksize >= 3 && cpu->gm_blocksize <= 6);
}
#ifndef CONFIG_USER_ONLY
/*
* If we do not have tag-memory provided by the machine,
* reduce MTE support to instructions enabled at EL0.
* This matches Cortex-A710 BROADCASTMTE input being LOW.
*/
if (cpu->tag_memory == NULL) {
cpu->isar.id_aa64pfr1 =
FIELD_DP64(cpu->isar.id_aa64pfr1, ID_AA64PFR1, MTE, 1);
}
#endif
}
With this patch, for KVM we will end up going through the
"squash ID_AA64PFR1_EL1.MTE to 1" codepath, because KVM doesn't
set cpu->tag_memory and this is still using that as its check.
More generally, how does the enabling of the MTE KVM cap
interact with the ID_AA64PFR1_EL1 value that we read from
the host in kvm_arm_get_host_cpu_features() ? We care that we
Linux kernel masks the MTE bits of register id_aa64pfr1 until unless the
MTE is enabled for that VM. I have modified to enable
MTE(KVM_CAP_ARM_MTE) before we read the register id_aa64pfr1 in
kvm_arm_get_host_cpu_features to make sure we get the unmasked/actual
MTE bits. I will post this change in the V2 patchset.
have the right ID register values because we use ID field
checks to determine whether the vcpu has a feature or not,
even in the KVM case.
Since Cornelia first wrote the patch this is based on, we've
landed gdbstub support for MTE (so gdb can find out which
addresses in the memory map have tags and read and write
those tags). So I think the KVM MTE support now also needs to
handle that. (See aarch64_cpu_register_gdb_commands() in
target/arm/gdbstub64.c.)
I looked at this code and it looks like, complete code is under
ifdef CONFIG_USER_ONLY and for kvm(target aarch64-softmmu) this is not
getting enabled. Are you asking to remove these ifdef and make
mte-gdbstub commands available for the KVM mode as well?
--
Thanks,
Ganapat/GK
- Re: [PATCH] arm/kvm: add support for MTE,
Ganapatrao Kulkarni <=