Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Low] The `guest_fn` parameter restricts the guest entry point type to `void (*)(void)`, deviating from the selftests standard `void *`.
--
--- Patch [4]: [PATCH v2 4/5] KVM: arm64: selftests: Pass guest code to vm_gic_create_with_vcpus() ---
commit 6c09a6b348b8fbe5cd4e0cef1198db5d49812401
Author: Karl Mehltretter <[email protected]>
KVM: arm64: selftests: Pass guest code to vm_gic_create_with_vcpus()
This commit adds a guest entry point parameter to vm_gic_create_with_vcpus()
and updates the existing call sites to pass guest_code. This allows tests
with different guest code to reuse the common VM and VGIC initialization
sequence.
> diff --git a/tools/testing/selftests/kvm/arm64/vgic_init.c b/tools/testing/selftests/kvm/arm64/vgic_init.c
> index 47e34b43afb29..91484fd4f7869 100644
> --- a/tools/testing/selftests/kvm/arm64/vgic_init.c
> +++ b/tools/testing/selftests/kvm/arm64/vgic_init.c
> @@ -73,12 +73,13 @@ static int run_vcpu(struct kvm_vcpu *vcpu)
>
> static struct vm_gic vm_gic_create_with_vcpus(u32 gic_dev_type,
> u32 nr_vcpus,
> + void (*guest_fn)(void),
[Severity: Low]
Does this unnecessarily restrict the guest entry point type?
The underlying kvm selftests API, such as vm_create_with_vcpus(), typically
uses a generic void pointer for the guest code. If a future test tries to
reuse this setup function and pass a parameterized guest code function, the
compiler might emit an incompatible pointer type warning.
Would it be better to change the type of guest_fn to void * to maintain API
consistency with the rest of the selftests framework?
> struct kvm_vcpu *vcpus[])
> {
> struct vm_gic v;
>
> v.gic_dev_type = gic_dev_type;
> - v.vm = vm_create_with_vcpus(nr_vcpus, guest_code, vcpus);
> + v.vm = vm_create_with_vcpus(nr_vcpus, guest_fn, vcpus);
> v.gic_fd = kvm_create_device(v.vm, gic_dev_type);
[ ... ]
--
Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=4
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.