Commit 7d42b38d authored by Janis Schoetterl-Glausch's avatar Janis Schoetterl-Glausch Committed by Janosch Frank

KVM: s390: selftest: memop: Pass mop_desc via pointer

The struct is quite large, so this seems nicer.
Signed-off-by: default avatarJanis Schoetterl-Glausch <scgl@linux.ibm.com>
Reviewed-by: default avatarThomas Huth <thuth@redhat.com>
Reviewed-by: default avatarJanosch Frank <frankja@linux.ibm.com>
Link: https://lore.kernel.org/r/20230206164602.138068-2-scgl@linux.ibm.com
Message-Id: <20230206164602.138068-2-scgl@linux.ibm.com>
Signed-off-by: default avatarJanosch Frank <frankja@linux.ibm.com>
parent d7b9dc14
...@@ -48,53 +48,53 @@ struct mop_desc { ...@@ -48,53 +48,53 @@ struct mop_desc {
uint8_t key; uint8_t key;
}; };
static struct kvm_s390_mem_op ksmo_from_desc(struct mop_desc desc) static struct kvm_s390_mem_op ksmo_from_desc(const struct mop_desc *desc)
{ {
struct kvm_s390_mem_op ksmo = { struct kvm_s390_mem_op ksmo = {
.gaddr = (uintptr_t)desc.gaddr, .gaddr = (uintptr_t)desc->gaddr,
.size = desc.size, .size = desc->size,
.buf = ((uintptr_t)desc.buf), .buf = ((uintptr_t)desc->buf),
.reserved = "ignored_ignored_ignored_ignored" .reserved = "ignored_ignored_ignored_ignored"
}; };
switch (desc.target) { switch (desc->target) {
case LOGICAL: case LOGICAL:
if (desc.mode == READ) if (desc->mode == READ)
ksmo.op = KVM_S390_MEMOP_LOGICAL_READ; ksmo.op = KVM_S390_MEMOP_LOGICAL_READ;
if (desc.mode == WRITE) if (desc->mode == WRITE)
ksmo.op = KVM_S390_MEMOP_LOGICAL_WRITE; ksmo.op = KVM_S390_MEMOP_LOGICAL_WRITE;
break; break;
case SIDA: case SIDA:
if (desc.mode == READ) if (desc->mode == READ)
ksmo.op = KVM_S390_MEMOP_SIDA_READ; ksmo.op = KVM_S390_MEMOP_SIDA_READ;
if (desc.mode == WRITE) if (desc->mode == WRITE)
ksmo.op = KVM_S390_MEMOP_SIDA_WRITE; ksmo.op = KVM_S390_MEMOP_SIDA_WRITE;
break; break;
case ABSOLUTE: case ABSOLUTE:
if (desc.mode == READ) if (desc->mode == READ)
ksmo.op = KVM_S390_MEMOP_ABSOLUTE_READ; ksmo.op = KVM_S390_MEMOP_ABSOLUTE_READ;
if (desc.mode == WRITE) if (desc->mode == WRITE)
ksmo.op = KVM_S390_MEMOP_ABSOLUTE_WRITE; ksmo.op = KVM_S390_MEMOP_ABSOLUTE_WRITE;
break; break;
case INVALID: case INVALID:
ksmo.op = -1; ksmo.op = -1;
} }
if (desc.f_check) if (desc->f_check)
ksmo.flags |= KVM_S390_MEMOP_F_CHECK_ONLY; ksmo.flags |= KVM_S390_MEMOP_F_CHECK_ONLY;
if (desc.f_inject) if (desc->f_inject)
ksmo.flags |= KVM_S390_MEMOP_F_INJECT_EXCEPTION; ksmo.flags |= KVM_S390_MEMOP_F_INJECT_EXCEPTION;
if (desc._set_flags) if (desc->_set_flags)
ksmo.flags = desc.set_flags; ksmo.flags = desc->set_flags;
if (desc.f_key) { if (desc->f_key) {
ksmo.flags |= KVM_S390_MEMOP_F_SKEY_PROTECTION; ksmo.flags |= KVM_S390_MEMOP_F_SKEY_PROTECTION;
ksmo.key = desc.key; ksmo.key = desc->key;
} }
if (desc._ar) if (desc->_ar)
ksmo.ar = desc.ar; ksmo.ar = desc->ar;
else else
ksmo.ar = 0; ksmo.ar = 0;
if (desc._sida_offset) if (desc->_sida_offset)
ksmo.sida_offset = desc.sida_offset; ksmo.sida_offset = desc->sida_offset;
return ksmo; return ksmo;
} }
...@@ -183,7 +183,7 @@ static int err_memop_ioctl(struct test_info info, struct kvm_s390_mem_op *ksmo) ...@@ -183,7 +183,7 @@ static int err_memop_ioctl(struct test_info info, struct kvm_s390_mem_op *ksmo)
else \ else \
__desc.gaddr = __desc.gaddr_v; \ __desc.gaddr = __desc.gaddr_v; \
} \ } \
__ksmo = ksmo_from_desc(__desc); \ __ksmo = ksmo_from_desc(&__desc); \
print_memop(__info.vcpu, &__ksmo); \ print_memop(__info.vcpu, &__ksmo); \
err##memop_ioctl(__info, &__ksmo); \ err##memop_ioctl(__info, &__ksmo); \
}) })
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment