diag.c (f4b96f5e4ff8d86699c851c10245e102809b0331) diag.c (85dfe87e24326c472454cc92313ba8c3b4efe53b)
1/*
2 * handling diagnose instructions
3 *
4 * Copyright IBM Corp. 2008, 2011
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 105 unchanged lines hidden (view full) ---

114 (vcpu->run->s.regs.gprs[1] != KVM_S390_VIRTIO_CCW_NOTIFY))
115 return -EOPNOTSUPP;
116
117 idx = srcu_read_lock(&vcpu->kvm->srcu);
118 /*
119 * The layout is as follows:
120 * - gpr 2 contains the subchannel id (passed as addr)
121 * - gpr 3 contains the virtqueue index (passed as datamatch)
1/*
2 * handling diagnose instructions
3 *
4 * Copyright IBM Corp. 2008, 2011
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License (version 2 only)
8 * as published by the Free Software Foundation.

--- 105 unchanged lines hidden (view full) ---

114 (vcpu->run->s.regs.gprs[1] != KVM_S390_VIRTIO_CCW_NOTIFY))
115 return -EOPNOTSUPP;
116
117 idx = srcu_read_lock(&vcpu->kvm->srcu);
118 /*
119 * The layout is as follows:
120 * - gpr 2 contains the subchannel id (passed as addr)
121 * - gpr 3 contains the virtqueue index (passed as datamatch)
122 * - gpr 4 contains the index on the bus (optionally)
122 */
123 */
123 ret = kvm_io_bus_write(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS,
124 vcpu->run->s.regs.gprs[2],
125 8, &vcpu->run->s.regs.gprs[3]);
124 ret = kvm_io_bus_write_cookie(vcpu->kvm, KVM_VIRTIO_CCW_NOTIFY_BUS,
125 vcpu->run->s.regs.gprs[2],
126 8, &vcpu->run->s.regs.gprs[3],
127 vcpu->run->s.regs.gprs[4]);
126 srcu_read_unlock(&vcpu->kvm->srcu, idx);
128 srcu_read_unlock(&vcpu->kvm->srcu, idx);
127 /* kvm_io_bus_write returns -EOPNOTSUPP if it found no match. */
129
130 /*
131 * Return cookie in gpr 2, but don't overwrite the register if the
132 * diagnose will be handled by userspace.
133 */
134 if (ret != -EOPNOTSUPP)
135 vcpu->run->s.regs.gprs[2] = ret;
136 /* kvm_io_bus_write_cookie returns -EOPNOTSUPP if it found no match. */
128 return ret < 0 ? ret : 0;
129}
130
131int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
132{
133 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16;
134
135 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)

--- 18 unchanged lines hidden ---
137 return ret < 0 ? ret : 0;
138}
139
140int kvm_s390_handle_diag(struct kvm_vcpu *vcpu)
141{
142 int code = (vcpu->arch.sie_block->ipb & 0xfff0000) >> 16;
143
144 if (vcpu->arch.sie_block->gpsw.mask & PSW_MASK_PSTATE)

--- 18 unchanged lines hidden ---