Re: [PATCH v17 13/35] gunyah: vm_mgr: Add framework for VM Functions

From: Srivatsa Vaddagiri
Date: Wed Mar 13 2024 - 05:21:37 EST


* Elliot Berman <quic_eberman@xxxxxxxxxxx> [2024-02-22 15:16:36]:

> Introduce a framework for Gunyah userspace to install VM functions. VM
> functions are optional interfaces to the virtual machine. vCPUs,
> ioeventfs, and irqfds are examples of such VM functions and are
> implemented in subsequent patches.
>
> A generic framework is implemented instead of individual ioctls to
> create vCPUs, irqfds, etc., in order to simplify the VM manager core
> implementation and allow dynamic loading of VM function modules.
>
> Signed-off-by: Elliot Berman <quic_eberman@xxxxxxxxxxx>

Minor nit below. LGTM otherwise

Reviewed-by: Srivatsa Vaddagiri <quic_svaddagi@xxxxxxxxxxx>

> +static struct gunyah_vm_function *gunyah_vm_get_function(u32 type)
> +{
> + struct gunyah_vm_function *fn;
> +
> + fn = xa_load(&gunyah_vm_functions, type);
> + if (!fn) {
> + request_module("ghfunc:%d", type);

s/%d/%u

> +
> + fn = xa_load(&gunyah_vm_functions, type);
> + }
> +
> + if (!fn || !try_module_get(fn->mod))
> + fn = ERR_PTR(-ENOENT);
> +
> + return fn;
> +}