Re: [RFC PATCH v4 03/11] coco: guest: arm64: Add Realm Host Interface and guest DA helper

Kameron Carr <[email protected]>
Newsgroups dev.linux.lists.linux-coco,dev.linux.lists.kvmarm,org.infradead.lists.linux-arm-kernel,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On 4/27/2026 1:27 AM, Aneesh Kumar K.V (Arm) wrote:
> - Add  guest-side rhi-da helper that drives the vdev TDI state machine
>   via RHI host calls and translates the firmware status codes

...

> +
> +bool rhi_has_da_support(void)
> +{
> +	int ret;
> +
> +	struct rsi_host_call *rhi_call __free(kfree) =
> +		kmalloc(sizeof(*rhi_call), GFP_KERNEL);

Same comment as before that kzalloc is best practice for struct
rsi_host_call.

> +	if (!rhi_call)
> +		return -ENOMEM;

Returning an error value in a bool function will evaluate to true. This is
probably not your intended behavior.

Regards,
Kameron

> +
> +	rhi_call->imm = 0;
> +	rhi_call->gprs[0] = RHI_DA_FEATURES;
> +
> +	ret = rsi_host_call(rhi_call);
> +	if (ret != RSI_SUCCESS || rhi_call->gprs[0] == SMCCC_RET_NOT_SUPPORTED)
> +		return false;
> +
> +	/* For base DA to work we need these to be supported */
> +	if ((rhi_call->gprs[0] & RHI_DA_BASE_FEATURE) == RHI_DA_BASE_FEATURE)
> +		return true;
> +
> +	return false;
> +}...
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.