From: Oliver Upton <oupton@kernel.org>
To: kvmarm@lists.linux.dev
Cc: Marc Zyngier <maz@kernel.org>, Joey Gouly <joey.gouly@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
Wei-Lin Chang <weilin.chang@arm.com>,
Oliver Upton <oupton@kernel.org>
Subject: [PATCH 3/5] KVM: arm64: nv: Inject SEA TTW when desc update can't write to GPA
Date: Tue, 2 Jun 2026 16:54:48 -0700 [thread overview]
Message-ID: <20260602235450.103057-4-oupton@kernel.org> (raw)
In-Reply-To: <20260602235450.103057-1-oupton@kernel.org>
Similar to the handling of descriptor reads, inject an SEA during TTW
when the descriptor access fails for reasons other than a race, such as
a read-only memslot or a bad HVA.
Fixes: bff8aa213dee ("KVM: arm64: Implement HW access flag management in stage-1 SW PTW")
Fixes: e4c7dfac2f1a ("KVM: arm64: nv: Implement HW access flag management in stage-2 SW PTW")
Signed-off-by: Oliver Upton <oupton@kernel.org>
---
arch/arm64/kvm/at.c | 6 +++++-
arch/arm64/kvm/nested.c | 7 ++++++-
2 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/arch/arm64/kvm/at.c b/arch/arm64/kvm/at.c
index 9f8f0ae8e86e..119a603e636e 100644
--- a/arch/arm64/kvm/at.c
+++ b/arch/arm64/kvm/at.c
@@ -521,8 +521,12 @@ static int walk_s1(struct kvm_vcpu *vcpu, struct s1_walk_info *wi,
}
ret = kvm_swap_s1_desc(vcpu, ipa, desc, new_desc, wi);
- if (ret)
+ if (ret == -EAGAIN)
return ret;
+ if (ret) {
+ fail_s1_walk(wr, ESR_ELx_FSC_SEA_TTW(level), false);
+ return ret;
+ }
desc = new_desc;
}
diff --git a/arch/arm64/kvm/nested.c b/arch/arm64/kvm/nested.c
index d0545144eaac..f8d3f3a72328 100644
--- a/arch/arm64/kvm/nested.c
+++ b/arch/arm64/kvm/nested.c
@@ -352,8 +352,13 @@ static int walk_nested_s2_pgd(struct kvm_vcpu *vcpu, phys_addr_t ipa,
if (new_desc != desc) {
ret = swap_guest_s2_desc(vcpu, paddr, desc, new_desc, wi);
- if (ret)
+ if (ret == -EAGAIN)
return ret;
+ if (ret) {
+ out->esr = ESR_ELx_FSC_SEA_TTW(level);
+ out->desc = desc;
+ return 1;
+ }
desc = new_desc;
}
--
2.47.3
next prev parent reply other threads:[~2026-06-02 23:54 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-02 23:54 [PATCH 0/5] KVM: arm64: nv: MMU fixes for 7.2 Oliver Upton
2026-06-02 23:54 ` [PATCH 1/5] KVM: arm64: Don't leak PFN when kvm_translate_vncr() races MMU notifier Oliver Upton
2026-06-02 23:54 ` [PATCH 2/5] KVM: arm64: nv: Fully update VNCR fixmap state in kvm_translate_vncr() Oliver Upton
2026-06-02 23:54 ` Oliver Upton [this message]
2026-06-02 23:54 ` [PATCH 4/5] KVM: arm64: Restart instruction upon race in __kvm_at_s12() Oliver Upton
2026-06-02 23:54 ` [PATCH 5/5] KVM: arm64: nv: Restart stage-1 walk if stage-2 desc update fails Oliver Upton
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=20260602235450.103057-4-oupton@kernel.org \
--to=oupton@kernel.org \
--cc=joey.gouly@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=weilin.chang@arm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox