diff options
author | Jason J. Herne <jjherne@linux.vnet.ibm.com> | 2017-02-24 10:01:30 -0500 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2017-08-28 10:25:13 -0400 |
commit | b697e435aeee99b7f5b2d8f8dbb51f791be99b16 (patch) | |
tree | f9747db8443e983238de4cc8892bb21472ddf200 | |
parent | ccc59f47b6f9770ef768ada0ac5993de5f608d11 (diff) |
KVM: s390: Support Configuration z/Architecture Mode
kvm has always supported the concept of starting in z/Arch mode so let's
reflect the feature bit to the guest.
Also, we change sigp set architecture to reject any request to change
architecture modes.
Signed-off-by: Jason J. Herne <jjherne@linux.vnet.ibm.com>
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
-rw-r--r-- | arch/s390/kvm/sigp.c | 36 | ||||
-rw-r--r-- | arch/s390/tools/gen_facilities.c | 1 |
2 files changed, 18 insertions, 19 deletions
diff --git a/arch/s390/kvm/sigp.c b/arch/s390/kvm/sigp.c index 1a252f537081..9d592ef4104b 100644 --- a/arch/s390/kvm/sigp.c +++ b/arch/s390/kvm/sigp.c | |||
@@ -155,29 +155,26 @@ static int __sigp_stop_and_store_status(struct kvm_vcpu *vcpu, | |||
155 | return rc; | 155 | return rc; |
156 | } | 156 | } |
157 | 157 | ||
158 | static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter) | 158 | static int __sigp_set_arch(struct kvm_vcpu *vcpu, u32 parameter, |
159 | u64 *status_reg) | ||
159 | { | 160 | { |
160 | int rc; | ||
161 | unsigned int i; | 161 | unsigned int i; |
162 | struct kvm_vcpu *v; | 162 | struct kvm_vcpu *v; |
163 | bool all_stopped = true; | ||
163 | 164 | ||
164 | switch (parameter & 0xff) { | 165 | kvm_for_each_vcpu(i, v, vcpu->kvm) { |
165 | case 0: | 166 | if (v == vcpu) |
166 | rc = SIGP_CC_NOT_OPERATIONAL; | 167 | continue; |
167 | break; | 168 | if (!is_vcpu_stopped(v)) |
168 | case 1: | 169 | all_stopped = false; |
169 | case 2: | ||
170 | kvm_for_each_vcpu(i, v, vcpu->kvm) { | ||
171 | v->arch.pfault_token = KVM_S390_PFAULT_TOKEN_INVALID; | ||
172 | kvm_clear_async_pf_completion_queue(v); | ||
173 | } | ||
174 | |||
175 | rc = SIGP_CC_ORDER_CODE_ACCEPTED; | ||
176 | break; | ||
177 | default: | ||
178 | rc = -EOPNOTSUPP; | ||
179 | } | 170 | } |
180 | return rc; | 171 | |
172 | *status_reg &= 0xffffffff00000000UL; | ||
173 | |||
174 | /* Reject set arch order, with czam we're always in z/Arch mode. */ | ||
175 | *status_reg |= (all_stopped ? SIGP_STATUS_INVALID_PARAMETER : | ||
176 | SIGP_STATUS_INCORRECT_STATE); | ||
177 | return SIGP_CC_STATUS_STORED; | ||
181 | } | 178 | } |
182 | 179 | ||
183 | static int __sigp_set_prefix(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu, | 180 | static int __sigp_set_prefix(struct kvm_vcpu *vcpu, struct kvm_vcpu *dst_vcpu, |
@@ -446,7 +443,8 @@ int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu) | |||
446 | switch (order_code) { | 443 | switch (order_code) { |
447 | case SIGP_SET_ARCHITECTURE: | 444 | case SIGP_SET_ARCHITECTURE: |
448 | vcpu->stat.instruction_sigp_arch++; | 445 | vcpu->stat.instruction_sigp_arch++; |
449 | rc = __sigp_set_arch(vcpu, parameter); | 446 | rc = __sigp_set_arch(vcpu, parameter, |
447 | &vcpu->run->s.regs.gprs[r1]); | ||
450 | break; | 448 | break; |
451 | default: | 449 | default: |
452 | rc = handle_sigp_dst(vcpu, order_code, cpu_addr, | 450 | rc = handle_sigp_dst(vcpu, order_code, cpu_addr, |
diff --git a/arch/s390/tools/gen_facilities.c b/arch/s390/tools/gen_facilities.c index 025ea20fc4b4..181db5b8f8b3 100644 --- a/arch/s390/tools/gen_facilities.c +++ b/arch/s390/tools/gen_facilities.c | |||
@@ -80,6 +80,7 @@ static struct facility_def facility_defs[] = { | |||
80 | 78, /* enhanced-DAT 2 */ | 80 | 78, /* enhanced-DAT 2 */ |
81 | 130, /* instruction-execution-protection */ | 81 | 130, /* instruction-execution-protection */ |
82 | 131, /* enhanced-SOP 2 and side-effect */ | 82 | 131, /* enhanced-SOP 2 and side-effect */ |
83 | 138, /* configuration z/architecture mode (czam) */ | ||
83 | 146, /* msa extension 8 */ | 84 | 146, /* msa extension 8 */ |
84 | -1 /* END */ | 85 | -1 /* END */ |
85 | } | 86 | } |