kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14
@ 2021-06-25 11:24 Christian Borntraeger
  2021-06-25 11:24 ` [GIT PULL 1/3] KVM: s390: get rid of register asm usage Christian Borntraeger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Christian Borntraeger @ 2021-06-25 11:24 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: KVM, Janosch Frank, Claudio Imbrenda, David Hildenbrand,
	Cornelia Huck, linux-s390, Christian Borntraeger, Heiko Carstens,
	Vasily Gorbik

Paolo,

only a small amount of patches for 5.14 for KVM on s390.

The following changes since commit 6efb943b8616ec53a5e444193dccf1af9ad627b5:

  Linux 5.13-rc1 (2021-05-09 14:17:44 -0700)

are available in the Git repository at:

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

for you to fetch changes up to 1f703d2cf20464338c3d5279dddfb65ac79b8782:

  KVM: s390: allow facility 192 (vector-packed-decimal-enhancement facility 2) (2021-06-23 09:35:20 +0200)

----------------------------------------------------------------
KVM: s390: Features for 5.14

- new HW facilities for guests
- make inline assembly more robust with KASAN and co

----------------------------------------------------------------
Christian Borntraeger (2):
      KVM: s390: gen_facilities: allow facilities 165, 193, 194 and 196
      KVM: s390: allow facility 192 (vector-packed-decimal-enhancement facility 2)

Heiko Carstens (1):
      KVM: s390: get rid of register asm usage

 arch/s390/kvm/kvm-s390.c         | 22 +++++++++++++---------
 arch/s390/tools/gen_facilities.c |  4 ++++
 2 files changed, 17 insertions(+), 9 deletions(-)

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

* [GIT PULL 1/3] KVM: s390: get rid of register asm usage
  2021-06-25 11:24 [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14 Christian Borntraeger
@ 2021-06-25 11:24 ` Christian Borntraeger
  2021-06-25 11:24 ` [GIT PULL 2/3] KVM: s390: gen_facilities: allow facilities 165, 193, 194 and 196 Christian Borntraeger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Borntraeger @ 2021-06-25 11:24 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: KVM, Janosch Frank, Claudio Imbrenda, David Hildenbrand,
	Cornelia Huck, linux-s390, Christian Borntraeger, Heiko Carstens,
	Vasily Gorbik, Thomas Huth

From: Heiko Carstens <hca@linux.ibm.com>

Using register asm statements has been proven to be very error prone,
especially when using code instrumentation where gcc may add function
calls, which clobbers register contents in an unexpected way.

Therefore get rid of register asm statements in kvm code, even though
there is currently nothing wrong with them. This way we know for sure
that this bug class won't be introduced here.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Link: https://lore.kernel.org/r/20210621140356.1210771-1-hca@linux.ibm.com
[borntraeger@de.ibm.com: checkpatch strict fix]
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 1296fc10f80c..876fc1f7282a 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -329,31 +329,31 @@ static void allow_cpu_feat(unsigned long nr)
 
 static inline int plo_test_bit(unsigned char nr)
 {
-	register unsigned long r0 asm("0") = (unsigned long) nr | 0x100;
+	unsigned long function = (unsigned long)nr | 0x100;
 	int cc;
 
 	asm volatile(
+		"	lgr	0,%[function]\n"
 		/* Parameter registers are ignored for "test bit" */
 		"	plo	0,0,0,0(0)\n"
 		"	ipm	%0\n"
 		"	srl	%0,28\n"
 		: "=d" (cc)
-		: "d" (r0)
-		: "cc");
+		: [function] "d" (function)
+		: "cc", "0");
 	return cc == 0;
 }
 
 static __always_inline void __insn32_query(unsigned int opcode, u8 *query)
 {
-	register unsigned long r0 asm("0") = 0;	/* query function */
-	register unsigned long r1 asm("1") = (unsigned long) query;
-
 	asm volatile(
-		/* Parameter regs are ignored */
+		"	lghi	0,0\n"
+		"	lgr	1,%[query]\n"
+		/* Parameter registers are ignored */
 		"	.insn	rrf,%[opc] << 16,2,4,6,0\n"
 		:
-		: "d" (r0), "a" (r1), [opc] "i" (opcode)
-		: "cc", "memory");
+		: [query] "d" ((unsigned long)query), [opc] "i" (opcode)
+		: "cc", "memory", "0", "1");
 }
 
 #define INSN_SORTL 0xb938
-- 
2.31.1


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

* [GIT PULL 2/3] KVM: s390: gen_facilities: allow facilities 165, 193, 194 and 196
  2021-06-25 11:24 [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14 Christian Borntraeger
  2021-06-25 11:24 ` [GIT PULL 1/3] KVM: s390: get rid of register asm usage Christian Borntraeger
@ 2021-06-25 11:24 ` Christian Borntraeger
  2021-06-25 11:24 ` [GIT PULL 3/3] KVM: s390: allow facility 192 (vector-packed-decimal-enhancement facility 2) Christian Borntraeger
  2021-06-25 12:02 ` [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14 Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Borntraeger @ 2021-06-25 11:24 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: KVM, Janosch Frank, Claudio Imbrenda, David Hildenbrand,
	Cornelia Huck, linux-s390, Christian Borntraeger, Heiko Carstens,
	Vasily Gorbik

This enables the NNPA, BEAR enhancement,reset DAT protection and
processor activity counter facilities via the cpu model.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/tools/gen_facilities.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c
index 61ce5b59b828..606324e56e4e 100644
--- a/arch/s390/tools/gen_facilities.c
+++ b/arch/s390/tools/gen_facilities.c
@@ -115,6 +115,10 @@ static struct facility_def facility_defs[] = {
 			12, /* AP Query Configuration Information */
 			15, /* AP Facilities Test */
 			156, /* etoken facility */
+			165, /* nnpa facility */
+			193, /* bear enhancement facility */
+			194, /* rdp enhancement facility */
+			196, /* processor activity instrumentation facility */
 			-1  /* END */
 		}
 	},
-- 
2.31.1


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

* [GIT PULL 3/3] KVM: s390: allow facility 192 (vector-packed-decimal-enhancement facility 2)
  2021-06-25 11:24 [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14 Christian Borntraeger
  2021-06-25 11:24 ` [GIT PULL 1/3] KVM: s390: get rid of register asm usage Christian Borntraeger
  2021-06-25 11:24 ` [GIT PULL 2/3] KVM: s390: gen_facilities: allow facilities 165, 193, 194 and 196 Christian Borntraeger
@ 2021-06-25 11:24 ` Christian Borntraeger
  2021-06-25 12:02 ` [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14 Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Christian Borntraeger @ 2021-06-25 11:24 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: KVM, Janosch Frank, Claudio Imbrenda, David Hildenbrand,
	Cornelia Huck, linux-s390, Christian Borntraeger, Heiko Carstens,
	Vasily Gorbik

pass through newer vector instructions if vector support is enabled.

Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Reviewed-by: Janosch Frank <frankja@linux.ibm.com>
Acked-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 876fc1f7282a..f72f361d39dd 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -713,6 +713,10 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, struct kvm_enable_cap *cap)
 				set_kvm_facility(kvm->arch.model.fac_mask, 152);
 				set_kvm_facility(kvm->arch.model.fac_list, 152);
 			}
+			if (test_facility(192)) {
+				set_kvm_facility(kvm->arch.model.fac_mask, 192);
+				set_kvm_facility(kvm->arch.model.fac_list, 192);
+			}
 			r = 0;
 		} else
 			r = -EINVAL;
-- 
2.31.1


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

* Re: [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14
  2021-06-25 11:24 [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14 Christian Borntraeger
                   ` (2 preceding siblings ...)
  2021-06-25 11:24 ` [GIT PULL 3/3] KVM: s390: allow facility 192 (vector-packed-decimal-enhancement facility 2) Christian Borntraeger
@ 2021-06-25 12:02 ` Paolo Bonzini
  3 siblings, 0 replies; 5+ messages in thread
From: Paolo Bonzini @ 2021-06-25 12:02 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: KVM, Janosch Frank, Claudio Imbrenda, David Hildenbrand,
	Cornelia Huck, linux-s390, Heiko Carstens, Vasily Gorbik

On 25/06/21 13:24, Christian Borntraeger wrote:
> Paolo,
> 
> only a small amount of patches for 5.14 for KVM on s390.
> 
> The following changes since commit 6efb943b8616ec53a5e444193dccf1af9ad627b5:
> 
>    Linux 5.13-rc1 (2021-05-09 14:17:44 -0700)
> 
> are available in the Git repository at:
> 
>    git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-next-5.14-1
> 
> for you to fetch changes up to 1f703d2cf20464338c3d5279dddfb65ac79b8782:
> 
>    KVM: s390: allow facility 192 (vector-packed-decimal-enhancement facility 2) (2021-06-23 09:35:20 +0200)
> 
> ----------------------------------------------------------------
> KVM: s390: Features for 5.14
> 
> - new HW facilities for guests
> - make inline assembly more robust with KASAN and co
> 
> ----------------------------------------------------------------
> Christian Borntraeger (2):
>        KVM: s390: gen_facilities: allow facilities 165, 193, 194 and 196
>        KVM: s390: allow facility 192 (vector-packed-decimal-enhancement facility 2)
> 
> Heiko Carstens (1):
>        KVM: s390: get rid of register asm usage
> 
>   arch/s390/kvm/kvm-s390.c         | 22 +++++++++++++---------
>   arch/s390/tools/gen_facilities.c |  4 ++++
>   2 files changed, 17 insertions(+), 9 deletions(-)
> 

Thanks!  I've already prepared my first pull request for 5.14, but I'll 
merge this soon into kvm.git.

Paolo


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

end of thread, other threads:[~2021-06-25 12:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-25 11:24 [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14 Christian Borntraeger
2021-06-25 11:24 ` [GIT PULL 1/3] KVM: s390: get rid of register asm usage Christian Borntraeger
2021-06-25 11:24 ` [GIT PULL 2/3] KVM: s390: gen_facilities: allow facilities 165, 193, 194 and 196 Christian Borntraeger
2021-06-25 11:24 ` [GIT PULL 3/3] KVM: s390: allow facility 192 (vector-packed-decimal-enhancement facility 2) Christian Borntraeger
2021-06-25 12:02 ` [GIT PULL 0/3] KVM: s390: Features and Cleanups for 5.14 Paolo Bonzini

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