mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-07 10:24:01 -04:00
KVM: s390: selftest: memop: Pass mop_desc via pointer
The struct is quite large, so this seems nicer. Signed-off-by: Janis Schoetterl-Glausch <scgl@linux.ibm.com> Reviewed-by: Thomas Huth <thuth@redhat.com> Reviewed-by: Janosch 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: Janosch Frank <frankja@linux.ibm.com>
This commit is contained in:
committed by
Janosch Frank
parent
d7b9dc1403
commit
7d42b38de9
@@ -48,53 +48,53 @@ struct mop_desc {
|
||||
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 = {
|
||||
.gaddr = (uintptr_t)desc.gaddr,
|
||||
.size = desc.size,
|
||||
.buf = ((uintptr_t)desc.buf),
|
||||
.gaddr = (uintptr_t)desc->gaddr,
|
||||
.size = desc->size,
|
||||
.buf = ((uintptr_t)desc->buf),
|
||||
.reserved = "ignored_ignored_ignored_ignored"
|
||||
};
|
||||
|
||||
switch (desc.target) {
|
||||
switch (desc->target) {
|
||||
case LOGICAL:
|
||||
if (desc.mode == READ)
|
||||
if (desc->mode == READ)
|
||||
ksmo.op = KVM_S390_MEMOP_LOGICAL_READ;
|
||||
if (desc.mode == WRITE)
|
||||
if (desc->mode == WRITE)
|
||||
ksmo.op = KVM_S390_MEMOP_LOGICAL_WRITE;
|
||||
break;
|
||||
case SIDA:
|
||||
if (desc.mode == READ)
|
||||
if (desc->mode == READ)
|
||||
ksmo.op = KVM_S390_MEMOP_SIDA_READ;
|
||||
if (desc.mode == WRITE)
|
||||
if (desc->mode == WRITE)
|
||||
ksmo.op = KVM_S390_MEMOP_SIDA_WRITE;
|
||||
break;
|
||||
case ABSOLUTE:
|
||||
if (desc.mode == READ)
|
||||
if (desc->mode == READ)
|
||||
ksmo.op = KVM_S390_MEMOP_ABSOLUTE_READ;
|
||||
if (desc.mode == WRITE)
|
||||
if (desc->mode == WRITE)
|
||||
ksmo.op = KVM_S390_MEMOP_ABSOLUTE_WRITE;
|
||||
break;
|
||||
case INVALID:
|
||||
ksmo.op = -1;
|
||||
}
|
||||
if (desc.f_check)
|
||||
if (desc->f_check)
|
||||
ksmo.flags |= KVM_S390_MEMOP_F_CHECK_ONLY;
|
||||
if (desc.f_inject)
|
||||
if (desc->f_inject)
|
||||
ksmo.flags |= KVM_S390_MEMOP_F_INJECT_EXCEPTION;
|
||||
if (desc._set_flags)
|
||||
ksmo.flags = desc.set_flags;
|
||||
if (desc.f_key) {
|
||||
if (desc->_set_flags)
|
||||
ksmo.flags = desc->set_flags;
|
||||
if (desc->f_key) {
|
||||
ksmo.flags |= KVM_S390_MEMOP_F_SKEY_PROTECTION;
|
||||
ksmo.key = desc.key;
|
||||
ksmo.key = desc->key;
|
||||
}
|
||||
if (desc._ar)
|
||||
ksmo.ar = desc.ar;
|
||||
if (desc->_ar)
|
||||
ksmo.ar = desc->ar;
|
||||
else
|
||||
ksmo.ar = 0;
|
||||
if (desc._sida_offset)
|
||||
ksmo.sida_offset = desc.sida_offset;
|
||||
if (desc->_sida_offset)
|
||||
ksmo.sida_offset = desc->sida_offset;
|
||||
|
||||
return ksmo;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ static int err_memop_ioctl(struct test_info info, struct kvm_s390_mem_op *ksmo)
|
||||
else \
|
||||
__desc.gaddr = __desc.gaddr_v; \
|
||||
} \
|
||||
__ksmo = ksmo_from_desc(__desc); \
|
||||
__ksmo = ksmo_from_desc(&__desc); \
|
||||
print_memop(__info.vcpu, &__ksmo); \
|
||||
err##memop_ioctl(__info, &__ksmo); \
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user