linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: Correctly populate FAR_EL2 on nested SEA injection
@ 2025-08-13 16:37 Marc Zyngier
  2025-08-15 11:25 ` Ben Horgan
  2025-08-15 18:52 ` Oliver Upton
  0 siblings, 2 replies; 3+ messages in thread
From: Marc Zyngier @ 2025-08-13 16:37 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel, kvm
  Cc: Joey Gouly, Suzuki K Poulose, Oliver Upton, Zenghui Yu

vcoy_write_sys_reg()'s signature is not totally obvious, and it
is rather easy to write something that looks correct, except that...
Oh wait...

Swap addr and FAR_EL2 to restore some sanity in the nested SEA
department.

Fixes: 9aba641b9ec2a ("KVM: arm64: nv: Respect exception routing rules for SEAs")
Signed-off-by: Marc Zyngier <maz@kernel.org>
---
 arch/arm64/kvm/emulate-nested.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
index 90cb4b7ae0ff7..af69c897c2c3a 100644
--- a/arch/arm64/kvm/emulate-nested.c
+++ b/arch/arm64/kvm/emulate-nested.c
@@ -2833,7 +2833,7 @@ int kvm_inject_nested_sea(struct kvm_vcpu *vcpu, bool iabt, u64 addr)
 			     iabt ? ESR_ELx_EC_IABT_LOW : ESR_ELx_EC_DABT_LOW);
 	esr |= ESR_ELx_FSC_EXTABT | ESR_ELx_IL;
 
-	vcpu_write_sys_reg(vcpu, FAR_EL2, addr);
+	vcpu_write_sys_reg(vcpu, addr, FAR_EL2);
 
 	if (__vcpu_sys_reg(vcpu, SCTLR2_EL2) & SCTLR2_EL1_EASE)
 		return kvm_inject_nested(vcpu, esr, except_type_serror);
-- 
2.39.2



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: arm64: Correctly populate FAR_EL2 on nested SEA injection
  2025-08-13 16:37 [PATCH] KVM: arm64: Correctly populate FAR_EL2 on nested SEA injection Marc Zyngier
@ 2025-08-15 11:25 ` Ben Horgan
  2025-08-15 18:52 ` Oliver Upton
  1 sibling, 0 replies; 3+ messages in thread
From: Ben Horgan @ 2025-08-15 11:25 UTC (permalink / raw)
  To: Marc Zyngier, kvmarm, linux-arm-kernel, kvm
  Cc: Joey Gouly, Suzuki K Poulose, Oliver Upton, Zenghui Yu

Hi Marc,

This patch looks good to me. Just a typo in the commit message.

On 8/13/25 17:37, Marc Zyngier wrote:
> vcoy_write_sys_reg()'s signature is not totally obvious, and it
typo: s/vcoy/vcpu/
> is rather easy to write something that looks correct, except that...
> Oh wait...
> 
> Swap addr and FAR_EL2 to restore some sanity in the nested SEA
> department.
> 
> Fixes: 9aba641b9ec2a ("KVM: arm64: nv: Respect exception routing rules for SEAs")
> Signed-off-by: Marc Zyngier <maz@kernel.org>
> ---
>   arch/arm64/kvm/emulate-nested.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c
> index 90cb4b7ae0ff7..af69c897c2c3a 100644
> --- a/arch/arm64/kvm/emulate-nested.c
> +++ b/arch/arm64/kvm/emulate-nested.c
> @@ -2833,7 +2833,7 @@ int kvm_inject_nested_sea(struct kvm_vcpu *vcpu, bool iabt, u64 addr)
>   			     iabt ? ESR_ELx_EC_IABT_LOW : ESR_ELx_EC_DABT_LOW);
>   	esr |= ESR_ELx_FSC_EXTABT | ESR_ELx_IL;
>   
> -	vcpu_write_sys_reg(vcpu, FAR_EL2, addr);
> +	vcpu_write_sys_reg(vcpu, addr, FAR_EL2);
>   
>   	if (__vcpu_sys_reg(vcpu, SCTLR2_EL2) & SCTLR2_EL1_EASE)
>   		return kvm_inject_nested(vcpu, esr, except_type_serror);

Thanks,

Ben



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: arm64: Correctly populate FAR_EL2 on nested SEA injection
  2025-08-13 16:37 [PATCH] KVM: arm64: Correctly populate FAR_EL2 on nested SEA injection Marc Zyngier
  2025-08-15 11:25 ` Ben Horgan
@ 2025-08-15 18:52 ` Oliver Upton
  1 sibling, 0 replies; 3+ messages in thread
From: Oliver Upton @ 2025-08-15 18:52 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel, kvm, Marc Zyngier
  Cc: Oliver Upton, Joey Gouly, Suzuki K Poulose, Zenghui Yu

On Wed, 13 Aug 2025 17:37:47 +0100, Marc Zyngier wrote:
> vcoy_write_sys_reg()'s signature is not totally obvious, and it
> is rather easy to write something that looks correct, except that...
> Oh wait...
> 
> Swap addr and FAR_EL2 to restore some sanity in the nested SEA
> department.
> 
> [...]

Sorry I didn't pick this up immediately, had to find my brown bag...

With the typo addressed: applied to fixes, thanks!

[1/1] KVM: arm64: Correctly populate FAR_EL2 on nested SEA injection
      https://git.kernel.org/kvmarm/kvmarm/c/d19c541d269e

--
Best,
Oliver


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-08-15 20:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-13 16:37 [PATCH] KVM: arm64: Correctly populate FAR_EL2 on nested SEA injection Marc Zyngier
2025-08-15 11:25 ` Ben Horgan
2025-08-15 18:52 ` Oliver Upton

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).