Re: [PATCH v8 12/28] gunyah: vm_mgr: Introduce basic VM Manager

From: Srivatsa Vaddagiri
Date: Mon Jan 09 2023 - 04:11:26 EST


* Elliot Berman <quic_eberman@xxxxxxxxxxx> [2022-12-19 14:58:33]:

> +config GUNYAH_VM_MANAGER

Any reason why this needs to be a separate config? IOW CONFIG_GUNYAH should
enable VM management functionality also.

> @@ -550,14 +580,29 @@ static int gh_rm_drv_probe(struct platform_device *pdev)
> rsc_mgr->msgq_client.rx_callback = gh_rm_msgq_rx_data;
> rsc_mgr->msgq_client.tx_done = gh_rm_msgq_tx_done;
>
> - return gh_msgq_init(&pdev->dev, &rsc_mgr->msgq, &rsc_mgr->msgq_client,
> + ret = gh_msgq_init(&pdev->dev, &rsc_mgr->msgq, &rsc_mgr->msgq_client,
> &rsc_mgr->tx_ghrsc, &rsc_mgr->rx_ghrsc);

Bail on error here.

[snip]

> +static __must_check struct gunyah_vm *gunyah_vm_alloc(struct gh_rm_rpc *rm)
> +{
> + struct gunyah_vm *ghvm;
> + int vmid;
> +
> + vmid = gh_rm_alloc_vmid(rm, 0);
> + if (vmid < 0)
> + return ERR_PTR(vmid);
> +
> + ghvm = kzalloc(sizeof(*ghvm), GFP_KERNEL);
> + if (!ghvm)

dealloc_vmid here (as well as few other error paths)?

> + return ghvm;
> +
> + get_gh_rm(rm);