Linux s390 Architecture development
 help / color / mirror / Atom feed
* [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu
@ 2026-12-02 14:20 Steffen Eiden
  2026-12-02 14:28 ` sashiko-bot
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Steffen Eiden @ 2026-12-02 14:20 UTC (permalink / raw)
  To: Andreas Grapentin, Marc Zyngier, Christian Borntraeger,
	Janosch Frank, Claudio Imbrenda, David Hildenbrand,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Sven Schnelle
  Cc: kvm, linux-s390, Steffen Eiden, Dan Carpenter

This fix is a port from Dan's fix to KVM/arm64. See Link.

When a vcpu exits to userspace for an MMIO access, the next KVM_RUN
completes it.  So for a read, the next run increments the PC counter
and copies data from userspace to the destination vcpu register.

A reset should cancel the MMIO read/write access.  Otherwise the next
run will copy memory from userspace to the vcpu and increment the PC
which skips the first instruction.

Clear vcpu->mmio_needed in kvm_reset_vcpu()

Fixes: 0630ce34a00d ("KVM: s390: arm64: Implement vCPU IOCTLs")
Reported-by: Dan Carpenter <dan@pereq.eu>
Link: https://lore.kernel.org/all/20261130-double_exception_v3-v3-2-864856664b26@pereq.eu
Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
---
@Dan: I copied the commit message word by word and the fix on our side
is very similar to the one on KVM/arm64. I hope this is OK for you.

	Steffen
---
 arch/s390/kvm/arm64/reset.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/s390/kvm/arm64/reset.c b/arch/s390/kvm/arm64/reset.c
index e4cdce1dbf9d..45785da3396a 100644
--- a/arch/s390/kvm/arm64/reset.c
+++ b/arch/s390/kvm/arm64/reset.c
@@ -59,6 +59,8 @@ void kvm_reset_vcpu(struct kvm_vcpu *vcpu)
 	if (current->thread.kfpu_flags)
 		load_vx_regs(vcpu->arch.ctxt.vregs);
 
+	vcpu->mmio_needed = false;
+
 	if (loaded)
 		vcpu_load(vcpu);
 




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

* Re: [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu
  2026-12-02 14:20 [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu Steffen Eiden
@ 2026-12-02 14:28 ` sashiko-bot
  2026-12-02 14:31 ` Dan Carpenter
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: sashiko-bot @ 2026-12-02 14:28 UTC (permalink / raw)
  To: Steffen Eiden
  Cc: linux-s390, Heiko Carstens, Vasily Gorbik, Alexander Gordeev,
	Christian Borntraeger

> This fix is a port from Dan's fix to KVM/arm64. See Link.
> 
> When a vcpu exits to userspace for an MMIO access, the next KVM_RUN
> completes it.  So for a read, the next run increments the PC counter
> and copies data from userspace to the destination vcpu register.
> 
> A reset should cancel the MMIO read/write access.  Otherwise the next
> run will copy memory from userspace to the vcpu and increment the PC
> which skips the first instruction.
> 
> Clear vcpu->mmio_needed in kvm_reset_vcpu()
> 
> Fixes: 0630ce34a00d ("KVM: s390: arm64: Implement vCPU IOCTLs")
> Reported-by: Dan Carpenter <dan@pereq.eu>
> Link: https://lore.kernel.org/all/20261130-double_exception_v3-v3-2-864856664b26@pereq.eu
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>

Sashiko has reviewed this patch and found no issues.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202-reset-v1-1-7a0cd3726655@linux.ibm.com?part=1

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

* Re: [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu
  2026-12-02 14:20 [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu Steffen Eiden
  2026-12-02 14:28 ` sashiko-bot
@ 2026-12-02 14:31 ` Dan Carpenter
  2026-12-02 14:52 ` Andreas Grapentin
  2026-12-02 15:04 ` Christian Borntraeger
  3 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2026-12-02 14:31 UTC (permalink / raw)
  To: Steffen Eiden
  Cc: Andreas Grapentin, Marc Zyngier, Christian Borntraeger,
	Janosch Frank, Claudio Imbrenda, David Hildenbrand,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Sven Schnelle,
	kvm, linux-s390

On Wed, Dec 02, 2026 at 03:20:02PM +0100, Steffen Eiden wrote:
> This fix is a port from Dan's fix to KVM/arm64. See Link.
> 
> When a vcpu exits to userspace for an MMIO access, the next KVM_RUN
> completes it.  So for a read, the next run increments the PC counter
> and copies data from userspace to the destination vcpu register.
> 
> A reset should cancel the MMIO read/write access.  Otherwise the next
> run will copy memory from userspace to the vcpu and increment the PC
> which skips the first instruction.
> 
> Clear vcpu->mmio_needed in kvm_reset_vcpu()
> 
> Fixes: 0630ce34a00d ("KVM: s390: arm64: Implement vCPU IOCTLs")
> Reported-by: Dan Carpenter <dan@pereq.eu>
> Link: https://lore.kernel.org/all/20261130-double_exception_v3-v3-2-864856664b26@pereq.eu
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
> ---
> @Dan: I copied the commit message word by word and the fix on our side
> is very similar to the one on KVM/arm64. I hope this is OK for you.
> 

Always happy to get a Reported-by tag.  :)

regards,
dan carpenter


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

* Re: [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu
  2026-12-02 14:20 [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu Steffen Eiden
  2026-12-02 14:28 ` sashiko-bot
  2026-12-02 14:31 ` Dan Carpenter
@ 2026-12-02 14:52 ` Andreas Grapentin
  2026-12-02 15:04 ` Christian Borntraeger
  3 siblings, 0 replies; 5+ messages in thread
From: Andreas Grapentin @ 2026-12-02 14:52 UTC (permalink / raw)
  To: Steffen Eiden
  Cc: Marc Zyngier, Christian Borntraeger, Janosch Frank,
	Claudio Imbrenda, David Hildenbrand, Heiko Carstens,
	Vasily Gorbik, Alexander Gordeev, Sven Schnelle, kvm, linux-s390,
	Dan Carpenter

On Dec 02 26, Steffen Eiden wrote:
> This fix is a port from Dan's fix to KVM/arm64. See Link.
> 
> When a vcpu exits to userspace for an MMIO access, the next KVM_RUN
> completes it.  So for a read, the next run increments the PC counter
> and copies data from userspace to the destination vcpu register.
> 
> A reset should cancel the MMIO read/write access.  Otherwise the next
> run will copy memory from userspace to the vcpu and increment the PC
> which skips the first instruction.
> 
> Clear vcpu->mmio_needed in kvm_reset_vcpu()
> 
> Fixes: 0630ce34a00d ("KVM: s390: arm64: Implement vCPU IOCTLs")
> Reported-by: Dan Carpenter <dan@pereq.eu>
> Link: https://lore.kernel.org/all/20261130-double_exception_v3-v3-2-864856664b26@pereq.eu
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
> ---
> @Dan: I copied the commit message word by word and the fix on our side
> is very similar to the one on KVM/arm64. I hope this is OK for you.
> 
> 	Steffen
> ---
>  arch/s390/kvm/arm64/reset.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/s390/kvm/arm64/reset.c b/arch/s390/kvm/arm64/reset.c
> index e4cdce1dbf9d..45785da3396a 100644
> --- a/arch/s390/kvm/arm64/reset.c
> +++ b/arch/s390/kvm/arm64/reset.c
> @@ -59,6 +59,8 @@ void kvm_reset_vcpu(struct kvm_vcpu *vcpu)
>  	if (current->thread.kfpu_flags)
>  		load_vx_regs(vcpu->arch.ctxt.vregs);
>  
> +	vcpu->mmio_needed = false;
> +
>  	if (loaded)
>  		vcpu_load(vcpu);
>  
> 
> 
> 

Reviewed-by: Andreas Grapentin <gra@linux.ibm.com>

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

* Re: [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu
  2026-12-02 14:20 [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu Steffen Eiden
                   ` (2 preceding siblings ...)
  2026-12-02 14:52 ` Andreas Grapentin
@ 2026-12-02 15:04 ` Christian Borntraeger
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Borntraeger @ 2026-12-02 15:04 UTC (permalink / raw)
  To: Steffen Eiden, Andreas Grapentin, Marc Zyngier, Janosch Frank,
	Claudio Imbrenda, David Hildenbrand, Heiko Carstens,
	Vasily Gorbik, Alexander Gordeev, Sven Schnelle
  Cc: kvm, linux-s390, Dan Carpenter

Am 02.12.26 um 15:20 schrieb Steffen Eiden:
> This fix is a port from Dan's fix to KVM/arm64. See Link.
> 
> When a vcpu exits to userspace for an MMIO access, the next KVM_RUN
> completes it.  So for a read, the next run increments the PC counter
> and copies data from userspace to the destination vcpu register.
> 
> A reset should cancel the MMIO read/write access.  Otherwise the next
> run will copy memory from userspace to the vcpu and increment the PC
> which skips the first instruction.
> 
> Clear vcpu->mmio_needed in kvm_reset_vcpu()
> 
> Fixes: 0630ce34a00d ("KVM: s390: arm64: Implement vCPU IOCTLs")
> Reported-by: Dan Carpenter <dan@pereq.eu>
> Link: https://lore.kernel.org/all/20261130-double_exception_v3-v3-2-864856664b26@pereq.eu
> Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>

Thanks applied.


> ---
> @Dan: I copied the commit message word by word and the fix on our side
> is very similar to the one on KVM/arm64. I hope this is OK for you.
> 
> 	Steffen
> ---
>   arch/s390/kvm/arm64/reset.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/arch/s390/kvm/arm64/reset.c b/arch/s390/kvm/arm64/reset.c
> index e4cdce1dbf9d..45785da3396a 100644
> --- a/arch/s390/kvm/arm64/reset.c
> +++ b/arch/s390/kvm/arm64/reset.c
> @@ -59,6 +59,8 @@ void kvm_reset_vcpu(struct kvm_vcpu *vcpu)
>   	if (current->thread.kfpu_flags)
>   		load_vx_regs(vcpu->arch.ctxt.vregs);
>   
> +	vcpu->mmio_needed = false;
> +
>   	if (loaded)
>   		vcpu_load(vcpu);
>   


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

end of thread, other threads:[~2026-12-02 15:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02 14:20 [PATCH] KVM: s390: arm64: Drop an incomplete MMIO access when resetting a vcpu Steffen Eiden
2026-12-02 14:28 ` sashiko-bot
2026-12-02 14:31 ` Dan Carpenter
2026-12-02 14:52 ` Andreas Grapentin
2026-12-02 15:04 ` Christian Borntraeger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox