public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 0/3] KVM: s390: Changes for 6.9
@ 2024-02-26 12:13 Janosch Frank
  2024-02-26 12:13 ` [GIT PULL 1/3] KVM: s390: fix virtual vs physical address confusion Janosch Frank
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Janosch Frank @ 2024-02-26 12:13 UTC (permalink / raw)
  To: pbonzini
  Cc: kvm, frankja, david, borntraeger, cohuck, linux-s390, imbrenda,
	seiden, nsg, farman, agordeev

Paolo,

please pull the 3 fixes that I've held on to as they were very low priority:
- Memop selftest rotate fix
- SCLP event bits over indication fix
- Missing virt_to_phys for the CRYCB fix


Attention:
Three additional patches will go over the main s390 repository since
Heiko made changes to the FPU handling that caused a conflict with KVM
but we didn't want to create a feature branch.

See:
https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/log/?h=for-next

- KVM: s390: fix access register usage in ioctls
- KVM: s390: selftests: memop: add a simple AR test
- KVM: s390: introduce kvm_s390_fpu_(store|load)


Cheers,
Janosch


The following changes since commit 41bccc98fb7931d63d03f326a746ac4d429c1dd3:

  Linux 6.8-rc2 (2024-01-28 17:01:12 -0800)

are available in the Git repository at:

  https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git tags/kvm-s390-next-6.9-1

for you to fetch changes up to 00de073e2420df02ac0f1a19dbfb60ff8eb198be:

  KVM: s390: selftest: memop: Fix undefined behavior (2024-02-23 14:02:27 +0100)

----------------------------------------------------------------
- Memop selftest rotate fix
- SCLP event bits over indication fix
- Missing virt_to_phys for the CRYCB fix
----------------------------------------------------------------
Alexander Gordeev (1):
      KVM: s390: fix virtual vs physical address confusion

Eric Farman (1):
      KVM: s390: only deliver the set service event bits

Nina Schoetterl-Glausch (1):
      KVM: s390: selftest: memop: Fix undefined behavior

 arch/s390/kvm/interrupt.c                 | 4 ++--
 arch/s390/kvm/kvm-s390.c                  | 2 +-
 tools/testing/selftests/kvm/s390x/memop.c | 2 ++
 3 files changed, 5 insertions(+), 3 deletions(-)





-- 
2.43.2


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

* [GIT PULL 1/3] KVM: s390: fix virtual vs physical address confusion
  2024-02-26 12:13 [GIT PULL 0/3] KVM: s390: Changes for 6.9 Janosch Frank
@ 2024-02-26 12:13 ` Janosch Frank
  2024-02-26 12:13 ` [GIT PULL 2/3] KVM: s390: only deliver the set service event bits Janosch Frank
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Janosch Frank @ 2024-02-26 12:13 UTC (permalink / raw)
  To: pbonzini
  Cc: kvm, frankja, david, borntraeger, cohuck, linux-s390, imbrenda,
	seiden, nsg, farman, agordeev

From: Alexander Gordeev <agordeev@linux.ibm.com>

Fix virtual vs physical address confusion. This does not fix a bug
since virtual and physical address spaces are currently the same.

Suggested-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Acked-by: Anthony Krowiak <akrowiak@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ea63ac769889..6635a7acef34 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -3153,7 +3153,7 @@ static int kvm_s390_apxa_installed(void)
  */
 static void kvm_s390_set_crycb_format(struct kvm *kvm)
 {
-	kvm->arch.crypto.crycbd = (__u32)(unsigned long) kvm->arch.crypto.crycb;
+	kvm->arch.crypto.crycbd = virt_to_phys(kvm->arch.crypto.crycb);
 
 	/* Clear the CRYCB format bits - i.e., set format 0 by default */
 	kvm->arch.crypto.crycbd &= ~(CRYCB_FORMAT_MASK);
-- 
2.43.2


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

* [GIT PULL 2/3] KVM: s390: only deliver the set service event bits
  2024-02-26 12:13 [GIT PULL 0/3] KVM: s390: Changes for 6.9 Janosch Frank
  2024-02-26 12:13 ` [GIT PULL 1/3] KVM: s390: fix virtual vs physical address confusion Janosch Frank
@ 2024-02-26 12:13 ` Janosch Frank
  2024-02-26 12:13 ` [GIT PULL 3/3] KVM: s390: selftest: memop: Fix undefined behavior Janosch Frank
  2024-03-15 10:28 ` [GIT PULL 0/3] KVM: s390: Changes for 6.9 Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Janosch Frank @ 2024-02-26 12:13 UTC (permalink / raw)
  To: pbonzini
  Cc: kvm, frankja, david, borntraeger, cohuck, linux-s390, imbrenda,
	seiden, nsg, farman, agordeev

From: Eric Farman <farman@linux.ibm.com>

The SCLP driver code masks off the last two bits of the parameter [1]
to determine if a read is required, but doesn't care about the
contents of those bits. Meanwhile, the KVM code that delivers
event interrupts masks off those two bits but sends both to the
guest, even if only one was specified by userspace [2].

This works for the driver code, but it means any nuances of those
bits gets lost. Use the event pending mask as an actual mask, and
only send the bit(s) that were specified in the pending interrupt.

[1] Linux: sclp_interrupt_handler() (drivers/s390/char/sclp.c:658)
[2] QEMU: service_interrupt() (hw/s390x/sclp.c:360..363)

Fixes: 0890ddea1a90 ("KVM: s390: protvirt: Add SCLP interrupt handling")
Signed-off-by: Eric Farman <farman@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20240205214300.1018522-1-farman@linux.ibm.com
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20240205214300.1018522-1-farman@linux.ibm.com>
---
 arch/s390/kvm/interrupt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kvm/interrupt.c b/arch/s390/kvm/interrupt.c
index fc4007cc067a..20e080e9150b 100644
--- a/arch/s390/kvm/interrupt.c
+++ b/arch/s390/kvm/interrupt.c
@@ -1031,7 +1031,7 @@ static int __must_check __deliver_service_ev(struct kvm_vcpu *vcpu)
 		return 0;
 	}
 	ext = fi->srv_signal;
-	/* only clear the event bit */
+	/* only clear the event bits */
 	fi->srv_signal.ext_params &= ~SCCB_EVENT_PENDING;
 	clear_bit(IRQ_PEND_EXT_SERVICE_EV, &fi->pending_irqs);
 	spin_unlock(&fi->lock);
@@ -1041,7 +1041,7 @@ static int __must_check __deliver_service_ev(struct kvm_vcpu *vcpu)
 	trace_kvm_s390_deliver_interrupt(vcpu->vcpu_id, KVM_S390_INT_SERVICE,
 					 ext.ext_params, 0);
 
-	return write_sclp(vcpu, SCCB_EVENT_PENDING);
+	return write_sclp(vcpu, ext.ext_params & SCCB_EVENT_PENDING);
 }
 
 static int __must_check __deliver_pfault_done(struct kvm_vcpu *vcpu)
-- 
2.43.2


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

* [GIT PULL 3/3] KVM: s390: selftest: memop: Fix undefined behavior
  2024-02-26 12:13 [GIT PULL 0/3] KVM: s390: Changes for 6.9 Janosch Frank
  2024-02-26 12:13 ` [GIT PULL 1/3] KVM: s390: fix virtual vs physical address confusion Janosch Frank
  2024-02-26 12:13 ` [GIT PULL 2/3] KVM: s390: only deliver the set service event bits Janosch Frank
@ 2024-02-26 12:13 ` Janosch Frank
  2024-03-15 10:28 ` [GIT PULL 0/3] KVM: s390: Changes for 6.9 Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Janosch Frank @ 2024-02-26 12:13 UTC (permalink / raw)
  To: pbonzini
  Cc: kvm, frankja, david, borntraeger, cohuck, linux-s390, imbrenda,
	seiden, nsg, farman, agordeev

From: Nina Schoetterl-Glausch <nsg@linux.ibm.com>

If an integer's type has x bits, shifting the integer left by x or more
is undefined behavior.
This can happen in the rotate function when attempting to do a rotation
of the whole value by 0.

Fixes: 0dd714bfd200 ("KVM: s390: selftest: memop: Add cmpxchg tests")
Signed-off-by: Nina Schoetterl-Glausch <nsg@linux.ibm.com>
Link: https://lore.kernel.org/r/20240111094805.363047-1-nsg@linux.ibm.com
Acked-by: Janosch Frank <frankja@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
Message-Id: <20240111094805.363047-1-nsg@linux.ibm.com>
---
 tools/testing/selftests/kvm/s390x/memop.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/kvm/s390x/memop.c b/tools/testing/selftests/kvm/s390x/memop.c
index bb3ca9a5d731..4ec8d0181e8d 100644
--- a/tools/testing/selftests/kvm/s390x/memop.c
+++ b/tools/testing/selftests/kvm/s390x/memop.c
@@ -489,6 +489,8 @@ static __uint128_t rotate(int size, __uint128_t val, int amount)
 
 	amount = (amount + bits) % bits;
 	val = cut_to_size(size, val);
+	if (!amount)
+		return val;
 	return (val << (bits - amount)) | (val >> amount);
 }
 
-- 
2.43.2


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

* Re: [GIT PULL 0/3] KVM: s390: Changes for 6.9
  2024-02-26 12:13 [GIT PULL 0/3] KVM: s390: Changes for 6.9 Janosch Frank
                   ` (2 preceding siblings ...)
  2024-02-26 12:13 ` [GIT PULL 3/3] KVM: s390: selftest: memop: Fix undefined behavior Janosch Frank
@ 2024-03-15 10:28 ` Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2024-03-15 10:28 UTC (permalink / raw)
  To: Janosch Frank
  Cc: kvm, david, borntraeger, cohuck, linux-s390, imbrenda, seiden,
	nsg, farman, agordeev

On Mon, Feb 26, 2024 at 1:24 PM Janosch Frank <frankja@linux.ibm.com> wrote:
>
> Paolo,
>
> please pull the 3 fixes that I've held on to as they were very low priority:
> - Memop selftest rotate fix
> - SCLP event bits over indication fix
> - Missing virt_to_phys for the CRYCB fix
>
>
> Attention:
> Three additional patches will go over the main s390 repository since
> Heiko made changes to the FPU handling that caused a conflict with KVM
> but we didn't want to create a feature branch.

Pulled, thanks.

Paolo

> See:
> https://git.kernel.org/pub/scm/linux/kernel/git/s390/linux.git/log/?h=for-next
>
> - KVM: s390: fix access register usage in ioctls
> - KVM: s390: selftests: memop: add a simple AR test
> - KVM: s390: introduce kvm_s390_fpu_(store|load)
>
>
> Cheers,
> Janosch
>
>
> The following changes since commit 41bccc98fb7931d63d03f326a746ac4d429c1dd3:
>
>   Linux 6.8-rc2 (2024-01-28 17:01:12 -0800)
>
> are available in the Git repository at:
>
>   https://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git tags/kvm-s390-next-6.9-1
>
> for you to fetch changes up to 00de073e2420df02ac0f1a19dbfb60ff8eb198be:
>
>   KVM: s390: selftest: memop: Fix undefined behavior (2024-02-23 14:02:27 +0100)
>
> ----------------------------------------------------------------
> - Memop selftest rotate fix
> - SCLP event bits over indication fix
> - Missing virt_to_phys for the CRYCB fix
> ----------------------------------------------------------------
> Alexander Gordeev (1):
>       KVM: s390: fix virtual vs physical address confusion
>
> Eric Farman (1):
>       KVM: s390: only deliver the set service event bits
>
> Nina Schoetterl-Glausch (1):
>       KVM: s390: selftest: memop: Fix undefined behavior
>
>  arch/s390/kvm/interrupt.c                 | 4 ++--
>  arch/s390/kvm/kvm-s390.c                  | 2 +-
>  tools/testing/selftests/kvm/s390x/memop.c | 2 ++
>  3 files changed, 5 insertions(+), 3 deletions(-)
>
>
>
>
>
> --
> 2.43.2
>


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

end of thread, other threads:[~2024-03-15 10:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-26 12:13 [GIT PULL 0/3] KVM: s390: Changes for 6.9 Janosch Frank
2024-02-26 12:13 ` [GIT PULL 1/3] KVM: s390: fix virtual vs physical address confusion Janosch Frank
2024-02-26 12:13 ` [GIT PULL 2/3] KVM: s390: only deliver the set service event bits Janosch Frank
2024-02-26 12:13 ` [GIT PULL 3/3] KVM: s390: selftest: memop: Fix undefined behavior Janosch Frank
2024-03-15 10:28 ` [GIT PULL 0/3] KVM: s390: Changes for 6.9 Paolo Bonzini

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