Skip to content

Commit b697e43

Browse files
Jason J. Herneborntraeger
authored andcommitted
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 <[email protected]> Reviewed-by: Christian Borntraeger <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Signed-off-by: Christian Borntraeger <[email protected]>
1 parent ccc59f4 commit b697e43

File tree

2 files changed

+18
-19
lines changed

2 files changed

+18
-19
lines changed

arch/s390/kvm/sigp.c

Lines changed: 17 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -155,29 +155,26 @@ static int __sigp_stop_and_store_status(struct kvm_vcpu *vcpu,
155155
return rc;
156156
}
157157

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)
159160
{
160-
int rc;
161161
unsigned int i;
162162
struct kvm_vcpu *v;
163+
bool all_stopped = true;
163164

164-
switch (parameter & 0xff) {
165-
case 0:
166-
rc = SIGP_CC_NOT_OPERATIONAL;
167-
break;
168-
case 1:
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;
165+
kvm_for_each_vcpu(i, v, vcpu->kvm) {
166+
if (v == vcpu)
167+
continue;
168+
if (!is_vcpu_stopped(v))
169+
all_stopped = false;
179170
}
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;
181178
}
182179

183180
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)
446443
switch (order_code) {
447444
case SIGP_SET_ARCHITECTURE:
448445
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]);
450448
break;
451449
default:
452450
rc = handle_sigp_dst(vcpu, order_code, cpu_addr,

arch/s390/tools/gen_facilities.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ static struct facility_def facility_defs[] = {
8080
78, /* enhanced-DAT 2 */
8181
130, /* instruction-execution-protection */
8282
131, /* enhanced-SOP 2 and side-effect */
83+
138, /* configuration z/architecture mode (czam) */
8384
146, /* msa extension 8 */
8485
-1 /* END */
8586
}

0 commit comments

Comments
 (0)