[RFC PATCH 42/45] KVM: arm64: pkvm: Support SCMI power domain

Mostafa Saleh smostafa at google.com
Tue Feb 7 05:27:17 PST 2023


Hi Jean,

> +bool kvm_host_scmi_handler(struct kvm_cpu_context *host_ctxt)
> +{
> +	DECLARE_REG(u64, func_id, host_ctxt, 0);
> +
> +	if (!scmi_channel.shmem || func_id != scmi_channel.smc_id)
> +		return false; /* Unhandled */
> +
> +	/*
> +	 * Prevent the host from modifying the request while it is in flight.
> +	 * One page is enough, SCMI messages are smaller than that.
> +	 *
> +	 * FIXME: the host is allowed to poll the shmem while the request is in
> +	 * flight, or read shmem when receiving the SCMI interrupt. Although
> +	 * it's unlikely with the SMC-based transport, this too requires some
> +	 * tightening in the spec.
> +	 */
> +	if (WARN_ON(__pkvm_host_add_remove_page(scmi_channel.shmem_pfn, true)))
> +		return true;
> +
> +	__kvm_host_scmi_handler(host_ctxt);
> +
> +	WARN_ON(__pkvm_host_add_remove_page(scmi_channel.shmem_pfn, false));
> +	return true; /* Handled */
> +}

I am not sure what a typical SCMI channel shmem_size would be.
But would map/unmap be more performant than
memcpy(hyp_local_copy,scmi_channel.pfn,scmi_channel.shmem_size ); ?

Thank,
Mostafa





More information about the linux-arm-kernel mailing list