aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Hildenbrand <dahi@linux.vnet.ibm.com>2015-11-24 10:41:33 -0500
committerChristian Borntraeger <borntraeger@de.ibm.com>2016-06-21 03:43:41 -0400
commita1b7b9b286c0157748922526ecb353e550209833 (patch)
tree7e98809dbbada365383b55ace9731145551251e5
parent77d18f6d47fbeaaceb15df9ab928757d5bb96ec6 (diff)
KVM: s390: vsie: support guest-storage-limit-suppression
We can easily forward guest-storage-limit-suppression if available. One thing to care about is keeping the prefix properly mapped when gsls in toggled on/off or the mso changes in between. Therefore we better remap the prefix on any mso changes just like we already do with the prefix. Acked-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r--arch/s390/include/uapi/asm/kvm.h1
-rw-r--r--arch/s390/kvm/kvm-s390.c2
-rw-r--r--arch/s390/kvm/vsie.c7
3 files changed, 8 insertions, 2 deletions
diff --git a/arch/s390/include/uapi/asm/kvm.h b/arch/s390/include/uapi/asm/kvm.h
index 98526ac114bf..9ed07479714f 100644
--- a/arch/s390/include/uapi/asm/kvm.h
+++ b/arch/s390/include/uapi/asm/kvm.h
@@ -102,6 +102,7 @@ struct kvm_s390_vm_cpu_machine {
102#define KVM_S390_VM_CPU_FEAT_64BSCAO 2 102#define KVM_S390_VM_CPU_FEAT_64BSCAO 2
103#define KVM_S390_VM_CPU_FEAT_SIIF 3 103#define KVM_S390_VM_CPU_FEAT_SIIF 3
104#define KVM_S390_VM_CPU_FEAT_GPERE 4 104#define KVM_S390_VM_CPU_FEAT_GPERE 4
105#define KVM_S390_VM_CPU_FEAT_GSLS 5
105struct kvm_s390_vm_cpu_feat { 106struct kvm_s390_vm_cpu_feat {
106 __u64 feat[16]; 107 __u64 feat[16];
107}; 108};
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index 175752877c0d..ce9813afd502 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -271,6 +271,8 @@ static void kvm_s390_cpu_feat_init(void)
271 allow_cpu_feat(KVM_S390_VM_CPU_FEAT_SIIF); 271 allow_cpu_feat(KVM_S390_VM_CPU_FEAT_SIIF);
272 if (sclp.has_gpere) 272 if (sclp.has_gpere)
273 allow_cpu_feat(KVM_S390_VM_CPU_FEAT_GPERE); 273 allow_cpu_feat(KVM_S390_VM_CPU_FEAT_GPERE);
274 if (sclp.has_gsls)
275 allow_cpu_feat(KVM_S390_VM_CPU_FEAT_GSLS);
274} 276}
275 277
276int kvm_arch_init(void *opaque) 278int kvm_arch_init(void *opaque)
diff --git a/arch/s390/kvm/vsie.c b/arch/s390/kvm/vsie.c
index b8792ef01030..ea65bf2f0201 100644
--- a/arch/s390/kvm/vsie.c
+++ b/arch/s390/kvm/vsie.c
@@ -109,6 +109,8 @@ static int prepare_cpuflags(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
109 } 109 }
110 if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_GPERE)) 110 if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_GPERE))
111 newflags |= cpuflags & CPUSTAT_P; 111 newflags |= cpuflags & CPUSTAT_P;
112 if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_GSLS))
113 newflags |= cpuflags & CPUSTAT_SM;
112 114
113 atomic_set(&scb_s->cpuflags, newflags); 115 atomic_set(&scb_s->cpuflags, newflags);
114 return 0; 116 return 0;
@@ -242,7 +244,7 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
242 struct kvm_s390_sie_block *scb_o = vsie_page->scb_o; 244 struct kvm_s390_sie_block *scb_o = vsie_page->scb_o;
243 struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s; 245 struct kvm_s390_sie_block *scb_s = &vsie_page->scb_s;
244 bool had_tx = scb_s->ecb & 0x10U; 246 bool had_tx = scb_s->ecb & 0x10U;
245 unsigned long new_mso; 247 unsigned long new_mso = 0;
246 int rc; 248 int rc;
247 249
248 /* make sure we don't have any leftovers when reusing the scb */ 250 /* make sure we don't have any leftovers when reusing the scb */
@@ -284,7 +286,8 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
284 scb_s->ictl |= ICTL_ISKE | ICTL_SSKE | ICTL_RRBE; 286 scb_s->ictl |= ICTL_ISKE | ICTL_SSKE | ICTL_RRBE;
285 scb_s->icpua = scb_o->icpua; 287 scb_s->icpua = scb_o->icpua;
286 288
287 new_mso = scb_o->mso & 0xfffffffffff00000UL; 289 if (!(atomic_read(&scb_s->cpuflags) & CPUSTAT_SM))
290 new_mso = scb_o->mso & 0xfffffffffff00000UL;
288 /* if the hva of the prefix changes, we have to remap the prefix */ 291 /* if the hva of the prefix changes, we have to remap the prefix */
289 if (scb_s->mso != new_mso || scb_s->prefix != scb_o->prefix) 292 if (scb_s->mso != new_mso || scb_s->prefix != scb_o->prefix)
290 prefix_unmapped(vsie_page); 293 prefix_unmapped(vsie_page);