All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0
@ 2015-03-04 11:41 Christian Borntraeger
  2015-03-04 11:41 ` [GIT PULL 1/5] KVM: s390/cpacf: Enable key wrapping by default Christian Borntraeger
                   ` (6 more replies)
  0 siblings, 7 replies; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-04 11:41 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf,
	Christian Borntraeger

Paolo, Marcelo,

here is a pull request for kvm/master targetting 4.0. It is based on
4.0-rc1 as I want all patches in an upcoming pull request against 
kvm/next as well to avoid nasty merge conflicts with other changes
that we have pending. So my next pull request for kvm/next will
be based on fb5bf93f84c277546473, which is the HEAD of this pull
request.

All patches fix commits that were merged during this merge window.

Please pull.


Christian


The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:

  Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-20150303

for you to fetch changes up to fb5bf93f84c277546473be35543ed7890f6e6742:

  KVM: s390: non-LPAR case obsolete during facilities mask init (2015-03-04 10:33:25 +0100)

----------------------------------------------------------------
KVM: s390: Fixups for changes in merge window for 4.0

Here are some fixups/improvements for

commit 658b6eda204 ("KVM: s390: add cpu model support")
commit 9d8d578605b ("KVM: s390: use facilities and cpu_id per KVM")
commit a374e892c34 ("KVM: s390/cpacf: Enable/disable protected key
functions for kvm guest")
commit 45c9b47c588 ("KVM: s390/CPACF: Choose crypto control block format")

which all have been merged during the merge window for 4.0.

----------------------------------------------------------------
Christian Borntraeger (1):
      KVM: s390/cpacf: Fix kernel bug under z/VM

Michael Mueller (3):
      KVM: s390: fix in memory copy of facility lists
      KVM: s390: include guest facilities in kvm facility test
      KVM: s390: non-LPAR case obsolete during facilities mask init

Tony Krowiak (1):
      KVM: s390/cpacf: Enable key wrapping by default

 arch/s390/include/asm/kvm_host.h | 12 +++----
 arch/s390/kvm/kvm-s390.c         | 68 ++++++++++++++++++----------------------
 arch/s390/kvm/kvm-s390.h         |  3 +-
 arch/s390/kvm/priv.c             |  2 +-
 4 files changed, 40 insertions(+), 45 deletions(-)

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

* [GIT PULL 1/5] KVM: s390/cpacf: Enable key wrapping by default
  2015-03-04 11:41 [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
@ 2015-03-04 11:41 ` Christian Borntraeger
  2015-03-04 11:41 ` [GIT PULL 2/5] KVM: s390/cpacf: Fix kernel bug under z/VM Christian Borntraeger
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-04 11:41 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf,
	Tony Krowiak, Christian Borntraeger

From: Tony Krowiak <akrowiak@linux.vnet.ibm.com>

z/VM and LPAR enable key wrapping by default, lets do the same on KVM.

Signed-off-by: Tony Krowiak <akrowiak@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 0c36239..b4d2030 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -839,9 +839,13 @@ static int kvm_s390_crypto_init(struct kvm *kvm)
 
 	kvm_s390_set_crycb_format(kvm);
 
-	/* Disable AES/DEA protected key functions by default */
-	kvm->arch.crypto.aes_kw = 0;
-	kvm->arch.crypto.dea_kw = 0;
+	/* Enable AES/DEA protected key functions by default */
+	kvm->arch.crypto.aes_kw = 1;
+	kvm->arch.crypto.dea_kw = 1;
+	get_random_bytes(kvm->arch.crypto.crycb->aes_wrapping_key_mask,
+			 sizeof(kvm->arch.crypto.crycb->aes_wrapping_key_mask));
+	get_random_bytes(kvm->arch.crypto.crycb->dea_wrapping_key_mask,
+			 sizeof(kvm->arch.crypto.crycb->dea_wrapping_key_mask));
 
 	return 0;
 }
-- 
2.3.0

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

* [GIT PULL 2/5] KVM: s390/cpacf: Fix kernel bug under z/VM
  2015-03-04 11:41 [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
  2015-03-04 11:41 ` [GIT PULL 1/5] KVM: s390/cpacf: Enable key wrapping by default Christian Borntraeger
@ 2015-03-04 11:41 ` Christian Borntraeger
  2015-03-04 11:41 ` [GIT PULL 3/5] KVM: s390: fix in memory copy of facility lists Christian Borntraeger
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-04 11:41 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf,
	Christian Borntraeger

Under z/VM PQAP might trigger an operation exception if no crypto cards
are defined via APVIRTUAL or APDEDICATED.

[  386.098666] Kernel BUG at 0000000000135c56 [verbose debug info unavailable]
[  386.098693] illegal operation: 0001 ilc:2 [#1] SMP
[...]
[  386.098751] Krnl PSW : 0704c00180000000 0000000000135c56 (kvm_s390_apxa_installed+0x46/0x98)
[...]
[  386.098804]  [<000000000013627c>] kvm_arch_init_vm+0x29c/0x358
[  386.098806]  [<000000000012d008>] kvm_dev_ioctl+0xc0/0x460
[  386.098809]  [<00000000002c639a>] do_vfs_ioctl+0x332/0x508
[  386.098811]  [<00000000002c660e>] SyS_ioctl+0x9e/0xb0
[  386.098814]  [<000000000070476a>] system_call+0xd6/0x258
[  386.098815]  [<000003fffc7400a2>] 0x3fffc7400a2

Lets add an extable entry and provide a zeroed config in that case.

Reported-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Thomas Huth <thuth@linux.vnet.ibm.com>
Tested-by: Stefan Zimmermann <stzi@linux.vnet.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index b4d2030..18965f9 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -778,15 +778,18 @@ long kvm_arch_vm_ioctl(struct file *filp,
 static int kvm_s390_query_ap_config(u8 *config)
 {
 	u32 fcn_code = 0x04000000UL;
-	u32 cc;
+	u32 cc = 0;
 
+	memset(config, 0, 128);
 	asm volatile(
 		"lgr 0,%1\n"
 		"lgr 2,%2\n"
 		".long 0xb2af0000\n"		/* PQAP(QCI) */
-		"ipm %0\n"
+		"0: ipm %0\n"
 		"srl %0,28\n"
-		: "=r" (cc)
+		"1:\n"
+		EX_TABLE(0b, 1b)
+		: "+r" (cc)
 		: "r" (fcn_code), "r" (config)
 		: "cc", "0", "2", "memory"
 	);
-- 
2.3.0

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

* [GIT PULL 3/5] KVM: s390: fix in memory copy of facility lists
  2015-03-04 11:41 [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
  2015-03-04 11:41 ` [GIT PULL 1/5] KVM: s390/cpacf: Enable key wrapping by default Christian Borntraeger
  2015-03-04 11:41 ` [GIT PULL 2/5] KVM: s390/cpacf: Fix kernel bug under z/VM Christian Borntraeger
@ 2015-03-04 11:41 ` Christian Borntraeger
  2015-03-04 11:41 ` [GIT PULL 4/5] KVM: s390: include guest facilities in kvm facility test Christian Borntraeger
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-04 11:41 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf,
	Michael Mueller, Christian Borntraeger

From: Michael Mueller <mimu@linux.vnet.ibm.com>

The facility lists were not fully copied.

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 18965f9..76894c8 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -579,7 +579,7 @@ static int kvm_s390_get_machine(struct kvm *kvm, struct kvm_device_attr *attr)
 	memcpy(&mach->fac_mask, kvm_s390_fac_list_mask,
 	       kvm_s390_fac_list_mask_size() * sizeof(u64));
 	memcpy((unsigned long *)&mach->fac_list, S390_lowcore.stfle_fac_list,
-	       S390_ARCH_FAC_LIST_SIZE_U64);
+	       S390_ARCH_FAC_LIST_SIZE_BYTE);
 	if (copy_to_user((void __user *)attr->addr, mach, sizeof(*mach)))
 		ret = -EFAULT;
 	kfree(mach);
@@ -903,7 +903,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 		goto out_nofac;
 
 	memcpy(kvm->arch.model.fac->kvm, S390_lowcore.stfle_fac_list,
-	       S390_ARCH_FAC_LIST_SIZE_U64);
+	       S390_ARCH_FAC_LIST_SIZE_BYTE);
 
 	/*
 	 * If this KVM host runs *not* in a LPAR, relax the facility bits
-- 
2.3.0

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

* [GIT PULL 4/5] KVM: s390: include guest facilities in kvm facility test
  2015-03-04 11:41 [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
                   ` (2 preceding siblings ...)
  2015-03-04 11:41 ` [GIT PULL 3/5] KVM: s390: fix in memory copy of facility lists Christian Borntraeger
@ 2015-03-04 11:41 ` Christian Borntraeger
  2015-03-04 11:41 ` [GIT PULL 5/5] KVM: s390: non-LPAR case obsolete during facilities mask init Christian Borntraeger
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-04 11:41 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf,
	Michael Mueller, Christian Borntraeger

From: Michael Mueller <mimu@linux.vnet.ibm.com>

Most facility related decisions in KVM have to take into account:

- the facilities offered by the underlying run container (LPAR/VM)
- the facilities supported by the KVM code itself
- the facilities requested by a guest VM

This patch adds the KVM driver requested facilities to the test routine.

It additionally renames struct s390_model_fac to kvm_s390_fac and its field
names to be more meaningful.

The semantics of the facilities stored in the KVM architecture structure
is changed. The address arch.model.fac->list now points to the guest
facility list and arch.model.fac->mask points to the KVM facility mask.

This patch fixes the behaviour of KVM for some facilities for guests
that ignore the guest visible facility bits, e.g. guests could use
transactional memory intructions on hosts supporting them even if the
chosen cpu model would not offer them.

The userspace interface is not affected by this change.

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/include/asm/kvm_host.h | 12 ++++++------
 arch/s390/kvm/kvm-s390.c         | 30 ++++++++++++++++--------------
 arch/s390/kvm/kvm-s390.h         |  3 ++-
 arch/s390/kvm/priv.c             |  2 +-
 4 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index d84559e..f407bbf 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -515,15 +515,15 @@ struct s390_io_adapter {
 #define S390_ARCH_FAC_MASK_SIZE_U64 \
 	(S390_ARCH_FAC_MASK_SIZE_BYTE / sizeof(u64))
 
-struct s390_model_fac {
-	/* facilities used in SIE context */
-	__u64 sie[S390_ARCH_FAC_LIST_SIZE_U64];
-	/* subset enabled by kvm */
-	__u64 kvm[S390_ARCH_FAC_LIST_SIZE_U64];
+struct kvm_s390_fac {
+	/* facility list requested by guest */
+	__u64 list[S390_ARCH_FAC_LIST_SIZE_U64];
+	/* facility mask supported by kvm & hosting machine */
+	__u64 mask[S390_ARCH_FAC_LIST_SIZE_U64];
 };
 
 struct kvm_s390_cpu_model {
-	struct s390_model_fac *fac;
+	struct kvm_s390_fac *fac;
 	struct cpuid cpu_id;
 	unsigned short ibc;
 };
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 76894c8..5a02be4 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -522,7 +522,7 @@ static int kvm_s390_set_processor(struct kvm *kvm, struct kvm_device_attr *attr)
 		memcpy(&kvm->arch.model.cpu_id, &proc->cpuid,
 		       sizeof(struct cpuid));
 		kvm->arch.model.ibc = proc->ibc;
-		memcpy(kvm->arch.model.fac->kvm, proc->fac_list,
+		memcpy(kvm->arch.model.fac->list, proc->fac_list,
 		       S390_ARCH_FAC_LIST_SIZE_BYTE);
 	} else
 		ret = -EFAULT;
@@ -556,7 +556,7 @@ static int kvm_s390_get_processor(struct kvm *kvm, struct kvm_device_attr *attr)
 	}
 	memcpy(&proc->cpuid, &kvm->arch.model.cpu_id, sizeof(struct cpuid));
 	proc->ibc = kvm->arch.model.ibc;
-	memcpy(&proc->fac_list, kvm->arch.model.fac->kvm, S390_ARCH_FAC_LIST_SIZE_BYTE);
+	memcpy(&proc->fac_list, kvm->arch.model.fac->list, S390_ARCH_FAC_LIST_SIZE_BYTE);
 	if (copy_to_user((void __user *)attr->addr, proc, sizeof(*proc)))
 		ret = -EFAULT;
 	kfree(proc);
@@ -576,8 +576,8 @@ static int kvm_s390_get_machine(struct kvm *kvm, struct kvm_device_attr *attr)
 	}
 	get_cpu_id((struct cpuid *) &mach->cpuid);
 	mach->ibc = sclp_get_ibc();
-	memcpy(&mach->fac_mask, kvm_s390_fac_list_mask,
-	       kvm_s390_fac_list_mask_size() * sizeof(u64));
+	memcpy(&mach->fac_mask, kvm->arch.model.fac->mask,
+	       S390_ARCH_FAC_LIST_SIZE_BYTE);
 	memcpy((unsigned long *)&mach->fac_list, S390_lowcore.stfle_fac_list,
 	       S390_ARCH_FAC_LIST_SIZE_BYTE);
 	if (copy_to_user((void __user *)attr->addr, mach, sizeof(*mach)))
@@ -893,16 +893,16 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	/*
 	 * The architectural maximum amount of facilities is 16 kbit. To store
 	 * this amount, 2 kbyte of memory is required. Thus we need a full
-	 * page to hold the active copy (arch.model.fac->sie) and the current
-	 * facilities set (arch.model.fac->kvm). Its address size has to be
+	 * page to hold the guest facility list (arch.model.fac->list) and the
+	 * facility mask (arch.model.fac->mask). Its address size has to be
 	 * 31 bits and word aligned.
 	 */
 	kvm->arch.model.fac =
-		(struct s390_model_fac *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
+		(struct kvm_s390_fac *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
 	if (!kvm->arch.model.fac)
 		goto out_nofac;
 
-	memcpy(kvm->arch.model.fac->kvm, S390_lowcore.stfle_fac_list,
+	memcpy(kvm->arch.model.fac->mask, S390_lowcore.stfle_fac_list,
 	       S390_ARCH_FAC_LIST_SIZE_BYTE);
 
 	/*
@@ -914,7 +914,7 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	 */
 	if (!MACHINE_IS_LPAR)
 		for (i = 0; i < kvm_s390_fac_list_mask_size(); i++)
-			kvm_s390_fac_list_mask[i] &= kvm->arch.model.fac->kvm[i];
+			kvm_s390_fac_list_mask[i] &= kvm->arch.model.fac->mask[i];
 
 	/*
 	 * Apply the kvm facility mask to limit the kvm supported/tolerated
@@ -922,11 +922,15 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	 */
 	for (i = 0; i < S390_ARCH_FAC_LIST_SIZE_U64; i++) {
 		if (i < kvm_s390_fac_list_mask_size())
-			kvm->arch.model.fac->kvm[i] &= kvm_s390_fac_list_mask[i];
+			kvm->arch.model.fac->mask[i] &= kvm_s390_fac_list_mask[i];
 		else
-			kvm->arch.model.fac->kvm[i] = 0UL;
+			kvm->arch.model.fac->mask[i] = 0UL;
 	}
 
+	/* Populate the facility list initially. */
+	memcpy(kvm->arch.model.fac->list, kvm->arch.model.fac->mask,
+	       S390_ARCH_FAC_LIST_SIZE_BYTE);
+
 	kvm_s390_get_cpu_id(&kvm->arch.model.cpu_id);
 	kvm->arch.model.ibc = sclp_get_ibc() & 0x0fff;
 
@@ -1172,8 +1176,6 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
 
 	mutex_lock(&vcpu->kvm->lock);
 	vcpu->arch.cpu_id = vcpu->kvm->arch.model.cpu_id;
-	memcpy(vcpu->kvm->arch.model.fac->sie, vcpu->kvm->arch.model.fac->kvm,
-	       S390_ARCH_FAC_LIST_SIZE_BYTE);
 	vcpu->arch.sie_block->ibc = vcpu->kvm->arch.model.ibc;
 	mutex_unlock(&vcpu->kvm->lock);
 
@@ -1219,7 +1221,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
 		vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca;
 		set_bit(63 - id, (unsigned long *) &kvm->arch.sca->mcn);
 	}
-	vcpu->arch.sie_block->fac = (int) (long) kvm->arch.model.fac->sie;
+	vcpu->arch.sie_block->fac = (int) (long) kvm->arch.model.fac->list;
 
 	spin_lock_init(&vcpu->arch.local_int.lock);
 	vcpu->arch.local_int.float_int = &kvm->arch.float_int;
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index 985c211..c34109a 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -128,7 +128,8 @@ static inline void kvm_s390_set_psw_cc(struct kvm_vcpu *vcpu, unsigned long cc)
 /* test availability of facility in a kvm intance */
 static inline int test_kvm_facility(struct kvm *kvm, unsigned long nr)
 {
-	return __test_facility(nr, kvm->arch.model.fac->kvm);
+	return __test_facility(nr, kvm->arch.model.fac->mask) &&
+		__test_facility(nr, kvm->arch.model.fac->list);
 }
 
 /* are cpu states controlled by user space */
diff --git a/arch/s390/kvm/priv.c b/arch/s390/kvm/priv.c
index bdd9b5b..3511169 100644
--- a/arch/s390/kvm/priv.c
+++ b/arch/s390/kvm/priv.c
@@ -348,7 +348,7 @@ static int handle_stfl(struct kvm_vcpu *vcpu)
 	 * We need to shift the lower 32 facility bits (bit 0-31) from a u64
 	 * into a u32 memory representation. They will remain bits 0-31.
 	 */
-	fac = *vcpu->kvm->arch.model.fac->sie >> 32;
+	fac = *vcpu->kvm->arch.model.fac->list >> 32;
 	rc = write_guest_lc(vcpu, offsetof(struct _lowcore, stfl_fac_list),
 			    &fac, sizeof(fac));
 	if (rc)
-- 
2.3.0

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

* [GIT PULL 5/5] KVM: s390: non-LPAR case obsolete during facilities mask init
  2015-03-04 11:41 [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
                   ` (3 preceding siblings ...)
  2015-03-04 11:41 ` [GIT PULL 4/5] KVM: s390: include guest facilities in kvm facility test Christian Borntraeger
@ 2015-03-04 11:41 ` Christian Borntraeger
  2015-03-04 11:42 ` [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
  2015-03-05  1:07   ` Marcelo Tosatti
  6 siblings, 0 replies; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-04 11:41 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf,
	Michael Mueller, Christian Borntraeger

From: Michael Mueller <mimu@linux.vnet.ibm.com>

With patch "include guest facilities in kvm facility test" it is no
longer necessary to have special handling for the non-LPAR case.

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 arch/s390/kvm/kvm-s390.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 5a02be4..f6579cf 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -902,24 +902,9 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
 	if (!kvm->arch.model.fac)
 		goto out_nofac;
 
+	/* Populate the facility mask initially. */
 	memcpy(kvm->arch.model.fac->mask, S390_lowcore.stfle_fac_list,
 	       S390_ARCH_FAC_LIST_SIZE_BYTE);
-
-	/*
-	 * If this KVM host runs *not* in a LPAR, relax the facility bits
-	 * of the kvm facility mask by all missing facilities. This will allow
-	 * to determine the right CPU model by means of the remaining facilities.
-	 * Live guest migration must prohibit the migration of KVMs running in
-	 * a LPAR to non LPAR hosts.
-	 */
-	if (!MACHINE_IS_LPAR)
-		for (i = 0; i < kvm_s390_fac_list_mask_size(); i++)
-			kvm_s390_fac_list_mask[i] &= kvm->arch.model.fac->mask[i];
-
-	/*
-	 * Apply the kvm facility mask to limit the kvm supported/tolerated
-	 * facility list.
-	 */
 	for (i = 0; i < S390_ARCH_FAC_LIST_SIZE_U64; i++) {
 		if (i < kvm_s390_fac_list_mask_size())
 			kvm->arch.model.fac->mask[i] &= kvm_s390_fac_list_mask[i];
-- 
2.3.0

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

* Re: [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0
  2015-03-04 11:41 [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
                   ` (4 preceding siblings ...)
  2015-03-04 11:41 ` [GIT PULL 5/5] KVM: s390: non-LPAR case obsolete during facilities mask init Christian Borntraeger
@ 2015-03-04 11:42 ` Christian Borntraeger
  2015-03-05  1:07   ` Marcelo Tosatti
  6 siblings, 0 replies; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-04 11:42 UTC (permalink / raw)
  To: Paolo Bonzini, Marcelo Tosatti
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf

Am 04.03.2015 um 12:41 schrieb Christian Borntraeger:
> Paolo, Marcelo,
> 
> here is a pull request for kvm/master targetting 4.0. It is based on
> 4.0-rc1 as I want all patches in an upcoming pull request against 
> kvm/next as well to avoid nasty merge conflicts with other changes
> that we have pending. So my next pull request for kvm/next will
> be based on fb5bf93f84c277546473, which is the HEAD of this pull
> request.

Or just against 4.0-rc1 thus having 5 identical commits.

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

* Re: [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0
  2015-03-04 11:41 [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
@ 2015-03-05  1:07   ` Marcelo Tosatti
  2015-03-04 11:41 ` [GIT PULL 2/5] KVM: s390/cpacf: Fix kernel bug under z/VM Christian Borntraeger
                     ` (5 subsequent siblings)
  6 siblings, 0 replies; 13+ messages in thread
From: Marcelo Tosatti @ 2015-03-05  1:07 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Paolo Bonzini, KVM, linux-s390, Cornelia Huck, Jens Freimann,
	Alexander Graf

On Wed, Mar 04, 2015 at 12:41:49PM +0100, Christian Borntraeger wrote:
> Paolo, Marcelo,
> 
> here is a pull request for kvm/master targetting 4.0. It is based on
> 4.0-rc1 as I want all patches in an upcoming pull request against 
> kvm/next as well to avoid nasty merge conflicts with other changes
> that we have pending. So my next pull request for kvm/next will
> be based on fb5bf93f84c277546473, which is the HEAD of this pull
> request.
> 
> All patches fix commits that were merged during this merge window.
> 
> Please pull.

Can you generate pull against current master?

$ git pull --ff-only git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
tags/kvm-s390-master-20150303   
From git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux
 * tag               kvm-s390-master-20150303 -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.

> Christian
> 
> 
> The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:
> 
>   Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-20150303
> 
> for you to fetch changes up to fb5bf93f84c277546473be35543ed7890f6e6742:
> 
>   KVM: s390: non-LPAR case obsolete during facilities mask init (2015-03-04 10:33:25 +0100)
> 
> ----------------------------------------------------------------
> KVM: s390: Fixups for changes in merge window for 4.0
> 
> Here are some fixups/improvements for
> 
> commit 658b6eda204 ("KVM: s390: add cpu model support")
> commit 9d8d578605b ("KVM: s390: use facilities and cpu_id per KVM")
> commit a374e892c34 ("KVM: s390/cpacf: Enable/disable protected key
> functions for kvm guest")
> commit 45c9b47c588 ("KVM: s390/CPACF: Choose crypto control block format")
> 
> which all have been merged during the merge window for 4.0.
> 
> ----------------------------------------------------------------
> Christian Borntraeger (1):
>       KVM: s390/cpacf: Fix kernel bug under z/VM
> 
> Michael Mueller (3):
>       KVM: s390: fix in memory copy of facility lists
>       KVM: s390: include guest facilities in kvm facility test
>       KVM: s390: non-LPAR case obsolete during facilities mask init
> 
> Tony Krowiak (1):
>       KVM: s390/cpacf: Enable key wrapping by default
> 
>  arch/s390/include/asm/kvm_host.h | 12 +++----
>  arch/s390/kvm/kvm-s390.c         | 68 ++++++++++++++++++----------------------
>  arch/s390/kvm/kvm-s390.h         |  3 +-
>  arch/s390/kvm/priv.c             |  2 +-
>  4 files changed, 40 insertions(+), 45 deletions(-)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0
@ 2015-03-05  1:07   ` Marcelo Tosatti
  0 siblings, 0 replies; 13+ messages in thread
From: Marcelo Tosatti @ 2015-03-05  1:07 UTC (permalink / raw)
  To: Christian Borntraeger
  Cc: Paolo Bonzini, KVM, linux-s390, Cornelia Huck, Jens Freimann,
	Alexander Graf

On Wed, Mar 04, 2015 at 12:41:49PM +0100, Christian Borntraeger wrote:
> Paolo, Marcelo,
> 
> here is a pull request for kvm/master targetting 4.0. It is based on
> 4.0-rc1 as I want all patches in an upcoming pull request against 
> kvm/next as well to avoid nasty merge conflicts with other changes
> that we have pending. So my next pull request for kvm/next will
> be based on fb5bf93f84c277546473, which is the HEAD of this pull
> request.
> 
> All patches fix commits that were merged during this merge window.
> 
> Please pull.

Can you generate pull against current master?

$ git pull --ff-only git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
tags/kvm-s390-master-20150303   
>From git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux
 * tag               kvm-s390-master-20150303 -> FETCH_HEAD
fatal: Not possible to fast-forward, aborting.

> Christian
> 
> 
> The following changes since commit c517d838eb7d07bbe9507871fab3931deccff539:
> 
>   Linux 4.0-rc1 (2015-02-22 18:21:14 -0800)
> 
> are available in the git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-20150303
> 
> for you to fetch changes up to fb5bf93f84c277546473be35543ed7890f6e6742:
> 
>   KVM: s390: non-LPAR case obsolete during facilities mask init (2015-03-04 10:33:25 +0100)
> 
> ----------------------------------------------------------------
> KVM: s390: Fixups for changes in merge window for 4.0
> 
> Here are some fixups/improvements for
> 
> commit 658b6eda204 ("KVM: s390: add cpu model support")
> commit 9d8d578605b ("KVM: s390: use facilities and cpu_id per KVM")
> commit a374e892c34 ("KVM: s390/cpacf: Enable/disable protected key
> functions for kvm guest")
> commit 45c9b47c588 ("KVM: s390/CPACF: Choose crypto control block format")
> 
> which all have been merged during the merge window for 4.0.
> 
> ----------------------------------------------------------------
> Christian Borntraeger (1):
>       KVM: s390/cpacf: Fix kernel bug under z/VM
> 
> Michael Mueller (3):
>       KVM: s390: fix in memory copy of facility lists
>       KVM: s390: include guest facilities in kvm facility test
>       KVM: s390: non-LPAR case obsolete during facilities mask init
> 
> Tony Krowiak (1):
>       KVM: s390/cpacf: Enable key wrapping by default
> 
>  arch/s390/include/asm/kvm_host.h | 12 +++----
>  arch/s390/kvm/kvm-s390.c         | 68 ++++++++++++++++++----------------------
>  arch/s390/kvm/kvm-s390.h         |  3 +-
>  arch/s390/kvm/priv.c             |  2 +-
>  4 files changed, 40 insertions(+), 45 deletions(-)
> 
> --
> To unsubscribe from this list: send the line "unsubscribe kvm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0
  2015-03-05  1:07   ` Marcelo Tosatti
  (?)
@ 2015-03-05  8:41   ` Christian Borntraeger
  2015-03-05  8:47     ` Christian Borntraeger
  -1 siblings, 1 reply; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-05  8:41 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Paolo Bonzini, KVM, linux-s390, Cornelia Huck, Jens Freimann,
	Alexander Graf

Am 05.03.2015 um 02:07 schrieb Marcelo Tosatti:
> On Wed, Mar 04, 2015 at 12:41:49PM +0100, Christian Borntraeger wrote:
>> Paolo, Marcelo,
>>
>> here is a pull request for kvm/master targetting 4.0. It is based on
>> 4.0-rc1 as I want all patches in an upcoming pull request against 
>> kvm/next as well to avoid nasty merge conflicts with other changes
>> that we have pending. So my next pull request for kvm/next will
>> be based on fb5bf93f84c277546473, which is the HEAD of this pull
>> request.
>>
>> All patches fix commits that were merged during this merge window.
>>
>> Please pull.
> 
> Can you generate pull against current master?
> 
> $ git pull --ff-only git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git

Can you use git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-20150303
                                                                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

> tags/kvm-s390-master-20150303   
> From git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux
>  * tag               kvm-s390-master-20150303 -> FETCH_HEAD
> fatal: Not possible to fast-forward, aborting.

I can certainly rebase to master, but this pull request was intentionally a non-ff-only request as it
is based of 4.0-rc1. So your pull is expected to be a merge. (just like
333bce5 Merge tag 'kvm-arm-for-3.19-take2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
8a5de18 Merge tag 'kvm-arm-for-3.18-take-2' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm
e77d99d Merge tag 'kvm-arm-for-3.18' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-next
9542639 Merge tag 'kvm-arm-for-v3.17-rc7-or-final' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into kvm-master
...
)

The result should look somiliar to:

git log --oneline --graph
*   2076a88 Merge tag 'kvm-s390-master-20150303' of git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux into HEAD
|\  
| * fb5bf93 KVM: s390: non-LPAR case obsolete during facilities mask init
| * 981467c KVM: s390: include guest facilities in kvm facility test
| * 94422ee KVM: s390: fix in memory copy of facility lists
| * 86044c8 KVM: s390/cpacf: Fix kernel bug under z/VM
| * ed6f76b KVM: s390/cpacf: Enable key wrapping by default
* | cfec0e7 KVM: MIPS: Enable after disabling interrupt
* | b3cffac KVM: MIPS: Fix trace event to save PC directly
* | f563db4 KVM: SVM: fix interrupt injection (apic->isr_count always 0)
* | 4ff6f8e KVM: emulate: fix CMPXCHG8B on 32-bit hosts
* | 21bc8dc KVM: VMX: fix build without CONFIG_SMP
* | 91314cb arm/arm64: KVM: Add exit reaons to kvm_exit event tracing
* | a050dfb ARM: KVM: Fix size check in __coherent_cache_guest_page
|/  
* c517d83 Linux 4.0-rc1


Let me know if you prefer it --ff-only (which will result in a merge conflict in the next merge window)
or as is.


Christian

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

* Re: [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0
  2015-03-05  8:41   ` Christian Borntraeger
@ 2015-03-05  8:47     ` Christian Borntraeger
  0 siblings, 0 replies; 13+ messages in thread
From: Christian Borntraeger @ 2015-03-05  8:47 UTC (permalink / raw)
  To: Marcelo Tosatti
  Cc: Paolo Bonzini, KVM, linux-s390, Cornelia Huck, Jens Freimann,
	Alexander Graf

Am 05.03.2015 um 09:41 schrieb Christian Borntraeger:

>> Can you generate pull against current master?
>>
>> $ git pull --ff-only git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
> 
> Can you use git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git  tags/kvm-s390-master-20150303
>                                                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
>> tags/kvm-s390-master-20150303   

Oh, it was wrapped. Lets just focus on the 2nd part of my response ;-)

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

* Re: [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0
  2015-03-05  1:07   ` Marcelo Tosatti
  (?)
  (?)
@ 2015-03-05 10:33   ` Paolo Bonzini
  2015-03-05 17:43     ` Marcelo Tosatti
  -1 siblings, 1 reply; 13+ messages in thread
From: Paolo Bonzini @ 2015-03-05 10:33 UTC (permalink / raw)
  To: Marcelo Tosatti, Christian Borntraeger
  Cc: KVM, linux-s390, Cornelia Huck, Jens Freimann, Alexander Graf



On 05/03/2015 02:07, Marcelo Tosatti wrote:
> Can you generate pull against current master?
> 
> $ git pull --ff-only git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
> tags/kvm-s390-master-20150303   

Why insist that the pull request be ff-only?  By using the tag, the
merge commit will include the tag description, so you get more
information by not doing a fast forward.

Paolo

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

* Re: [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0
  2015-03-05 10:33   ` Paolo Bonzini
@ 2015-03-05 17:43     ` Marcelo Tosatti
  0 siblings, 0 replies; 13+ messages in thread
From: Marcelo Tosatti @ 2015-03-05 17:43 UTC (permalink / raw)
  To: Paolo Bonzini
  Cc: Christian Borntraeger, KVM, linux-s390, Cornelia Huck,
	Jens Freimann, Alexander Graf

On Thu, Mar 05, 2015 at 11:33:54AM +0100, Paolo Bonzini wrote:
> 
> 
> On 05/03/2015 02:07, Marcelo Tosatti wrote:
> > Can you generate pull against current master?
> > 
> > $ git pull --ff-only git://git.kernel.org/pub/scm/linux/kernel/git/kvms390/linux.git
> > tags/kvm-s390-master-20150303   
> 
> Why insist that the pull request be ff-only?  By using the tag, the
> merge commit will include the tag description, so you get more
> information by not doing a fast forward.
> 
> Paolo

No reason, in fact. 

Pulled.

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

end of thread, other threads:[~2015-03-05 17:43 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-04 11:41 [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
2015-03-04 11:41 ` [GIT PULL 1/5] KVM: s390/cpacf: Enable key wrapping by default Christian Borntraeger
2015-03-04 11:41 ` [GIT PULL 2/5] KVM: s390/cpacf: Fix kernel bug under z/VM Christian Borntraeger
2015-03-04 11:41 ` [GIT PULL 3/5] KVM: s390: fix in memory copy of facility lists Christian Borntraeger
2015-03-04 11:41 ` [GIT PULL 4/5] KVM: s390: include guest facilities in kvm facility test Christian Borntraeger
2015-03-04 11:41 ` [GIT PULL 5/5] KVM: s390: non-LPAR case obsolete during facilities mask init Christian Borntraeger
2015-03-04 11:42 ` [GIT PULL 0/5] KVM: s390: Fixups for changes in merge window for 4.0 Christian Borntraeger
2015-03-05  1:07 ` Marcelo Tosatti
2015-03-05  1:07   ` Marcelo Tosatti
2015-03-05  8:41   ` Christian Borntraeger
2015-03-05  8:47     ` Christian Borntraeger
2015-03-05 10:33   ` Paolo Bonzini
2015-03-05 17:43     ` Marcelo Tosatti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.