[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210407105833.mrs5yk4prkopqp6p@kamzik.brq.redhat.com>
Date: Wed, 7 Apr 2021 12:58:33 +0200
From: Andrew Jones <drjones@...hat.com>
To: Auger Eric <eric.auger@...hat.com>
Cc: eric.auger.pro@...il.com, linux-kernel@...r.kernel.org,
kvm@...r.kernel.org, kvmarm@...ts.cs.columbia.edu, maz@...nel.org,
alexandru.elisei@....com, james.morse@....com,
suzuki.poulose@....com, shuah@...nel.org, pbonzini@...hat.com
Subject: Re: [PATCH v6 9/9] KVM: selftests: aarch64/vgic-v3 init sequence
tests
On Wed, Apr 07, 2021 at 12:14:29PM +0200, Auger Eric wrote:
> >> +int _kvm_create_device(struct kvm_vm *vm, uint64_t type, bool test)
> >> +{
> >> + struct kvm_create_device create_dev;
> >> + int ret;
> >> +
> >> + create_dev.type = type;
> >> + create_dev.fd = -1;
> >> + create_dev.flags = test ? KVM_CREATE_DEVICE_TEST : 0;
> >> + ret = ioctl(vm_get_fd(vm), KVM_CREATE_DEVICE, &create_dev);
> >> + if (ret == -1)
> >> + return -errno;
> >> + return test ? 0 : create_dev.fd;
> >
> > Something like this belongs in the non underscore prefixed wrappers.
> I need at least to return the create_dev.fd or do you want me to add an
> extra int *fd parameter?
> What about:
>
> if (ret < 0)
> return ret;
> return test ? 0 : create_dev.fd;
Maybe the underscore version of kvm_create_device isn't necessary. If
the non-underscore version isn't flexible enough, then just use the
ioctl directly from the test code with its own struct kvm_create_device
Being able to call ioctls directly from test code is what vm_get_fd()
is for, otherwise you could just use vm->fd.
Thanks,
drew
Powered by blists - more mailing lists