From: Oliver Upton <oliver.upton@linux.dev>
To: Zhou Wang <wangzhou1@hisilicon.com>
Cc: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org,
joey.gouly@arm.com, suzuki.poulose@arm.com, yuzenghui@huawei.com,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
yangyccccc@gmail.com, prime.zeng@hisilicon.com,
xuwei5@huawei.com
Subject: Re: [PATCH v6 3/7] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory
Date: Fri, 24 Oct 2025 12:54:01 -0700 [thread overview]
Message-ID: <aPvZWY57ppqqWm50@linux.dev> (raw)
In-Reply-To: <20251024090819.4097819-4-wangzhou1@hisilicon.com>
Hi Zhou,
On Fri, Oct 24, 2025 at 05:08:15PM +0800, Zhou Wang wrote:
> +/**
> + * kvm_inject_dabt_excl_atomic - inject a data abort for unsupported exclusive
> + * or atomic access
> + * @vcpu: The VCPU to receive the data abort
> + * @addr: The address to report in the DFAR
> + *
> + * It is assumed that this code is called from the VCPU thread and that the
> + * VCPU therefore is not currently executing guest code.
> + */
> +void kvm_inject_dabt_excl_atomic(struct kvm_vcpu *vcpu, u64 addr)
> +{
> + u64 esr;
> +
> + /* Reuse the general DABT injection routine and modify the DFSC */
> + kvm_inject_sea(vcpu, false, addr);
This potentially injects a nested SEA which I'm not sure you want. There
still is an interaction with nested, from DDI0487L.a B2.2.6:
For the EL1&0 translation regime, if the atomic instruction is not
supported because of the memory type that is defined in the first
stage of translation, or the second stage of translation is not
enabled, then this exception is a first stage abort and is taken to
EL1. Otherwise, the exception is a second stage abort and is taken to EL2.
We don't need to worry about the S1 memory type since hardware will
handle that for us. But we do need to consider whether the guest
hypervisor enabled stage-2 translation or not and route accordingly.
int kvm_inject_nested_excl_atomic(struct kvm_vcpu *vcpu, u64 addr)
{
u64 esr = FIELD_PREP(ESR_ELx_EC_MASK, ESR_ELx_EC_DABT_LOW) |
FIELD_PREP(ESR_ELx_FSC, ESR_ELx_FSC_EXCL_ATOMIC) |
ESR_ELx_IL;
vcpu_write_sys_reg(vcpu, addr, FAR_EL2);
return kvm_inject_nested_sync(vcpu, esr);
}
int kvm_inject_excl_atomic(struct kvm_vcpu *vcpu, u64 addr)
{
if (is_nested_ctxt(vcpu) && (vcpu_read_sys_reg(vcpu, HCR_EL2) & HCR_VM))
return kvm_inject_nested_excl_atomic(vcpu, addr);
__kvm_inject_sea(vcpu, false, addr);
esr = vcpu_read_sys_reg(vcpu, exception_esr_elx(vcpu));
esr &= ~ESR_ELx_FSC;
esr |= ESR_ELx_FSC_EXCL_ATOMIC;
vcpu_write_sys_reg(vcpu, esr, exception_esr_elx(vcpu));
return 1;
}
Thanks,
Oliver
next prev parent reply other threads:[~2025-10-24 19:54 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-24 9:08 [PATCH v6 0/7] Add support for FEAT_{LS64, LS64_V} and related tests Zhou Wang
2025-10-24 9:08 ` [PATCH v6 1/7] KVM: arm64: Add exit to userspace on {LD,ST}64B* outside of memslots Zhou Wang
2025-10-24 9:08 ` [PATCH v6 2/7] KVM: arm64: Add documentation for KVM_EXIT_ARM_LDST64B Zhou Wang
2025-10-24 9:08 ` [PATCH v6 3/7] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory Zhou Wang
2025-10-24 19:54 ` Oliver Upton [this message]
2025-10-25 10:11 ` Zhou Wang
2025-10-24 9:08 ` [PATCH v6 4/7] arm64: Provide basic EL2 setup for FEAT_{LS64, LS64_V} usage at EL0/1 Zhou Wang
2025-10-24 9:08 ` [PATCH v6 5/7] arm64: Add support for FEAT_{LS64, LS64_V} Zhou Wang
2025-10-24 9:08 ` [PATCH v6 6/7] KVM: arm64: Enable FEAT_{LS64, LS64_V} in the supported guest Zhou Wang
2025-10-24 9:08 ` [PATCH v6 7/7] kselftest/arm64: Add HWCAP test for FEAT_{LS64, LS64_V} Zhou Wang
2025-10-24 16:18 ` Arnd Bergmann
2025-10-25 10:06 ` Zhou Wang
2025-10-26 21:56 ` Arnd Bergmann
2025-10-27 2:50 ` Zhou Wang
2025-10-27 6:57 ` Arnd Bergmann
2025-10-24 16:22 ` [PATCH v6 0/7] Add support for FEAT_{LS64, LS64_V} and related tests Arnd Bergmann
2025-10-25 8:42 ` Zhou Wang
2025-10-26 21:59 ` Arnd Bergmann
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=aPvZWY57ppqqWm50@linux.dev \
--to=oliver.upton@linux.dev \
--cc=catalin.marinas@arm.com \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=prime.zeng@hisilicon.com \
--cc=suzuki.poulose@arm.com \
--cc=wangzhou1@hisilicon.com \
--cc=will@kernel.org \
--cc=xuwei5@huawei.com \
--cc=yangyccccc@gmail.com \
--cc=yuzenghui@huawei.com \
/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 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.