[PATCH v2 4/9] powerpc/pseries: Send payload with ibm,send-hvpipe-msg RTAS
Mahesh J Salgaonkar
mahesh at linux.ibm.com
Mon Aug 25 15:58:43 AEST 2025
On 2025-08-12 15:57:08 Tue, Haren Myneni wrote:
> ibm,send-hvpipe-msg RTAS call is used to send data to the source
> (Ex: Hardware Management Console) over the hypervisor pipe. The
> maximum data length of 4048 bytes is supported with this RTAS call
> right now. The user space uses write() to send this payload which
> invokes this RTAS. Then the write returns the buffer length
> (including papr_hvpipe_hdr length) to the user space for success
> or RTAS failure error.
>
> ibm,send-hvpipe-msg call takes source ID as target and the buffer
> in the form of buffer list. The buffer list format consists of
> work area of size 4K to hold buffer list and number of 4K work
> areas depends on buffers is as follows:
>
> Length of Buffer List in bytes
> Address of 4K buffer 1
> Length of 4K buffer 1 used
> ...
> Address of 4K buffer n
> Length of 4K buffer n used
>
> Only one buffer is used right now because of max payload size is
> 4088 bytes. writev() can be used in future when supported more
Do you mean 4048 ?
> than one buffer.
>
> Signed-off-by: Haren Myneni <haren at linux.ibm.com>
> ---
> arch/powerpc/platforms/pseries/papr-hvpipe.c | 120 ++++++++++++++++++-
> arch/powerpc/platforms/pseries/papr-hvpipe.h | 7 ++
> 2 files changed, 126 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/pseries/papr-hvpipe.c b/arch/powerpc/platforms/pseries/papr-hvpipe.c
> index 5768d072859d..c30f4d75e645 100644
> --- a/arch/powerpc/platforms/pseries/papr-hvpipe.c
> +++ b/arch/powerpc/platforms/pseries/papr-hvpipe.c
> @@ -14,6 +14,7 @@
> #include <linux/of.h>
> #include <asm/machdep.h>
> #include <asm/rtas.h>
> +#include <asm/rtas-work-area.h>
> #include <uapi/asm/papr-hvpipe.h>
> #include "pseries.h"
> #include "papr-hvpipe.h"
> @@ -59,6 +60,51 @@ static LIST_HEAD(hvpipe_src_list);
> * return code for failure.
> */
>
> +/*
> + * ibm,send-hvpipe-msg RTAS call
> + * @area: Caller-provided work area buffer to send.
> + * @srcID: Target source for the send pipe message.
> + */
> +static int rtas_ibm_send_hvpipe_msg(struct rtas_work_area *area, u32 srcID)
> +{
> + const s32 token = rtas_function_token(RTAS_FN_IBM_SEND_HVPIPE_MSG);
> + s32 fwrc;
> + int ret;
> +
> + if (token == RTAS_UNKNOWN_SERVICE)
> + return -ENOENT;
> +
> + do {
> + fwrc = rtas_call(token, 2, 1, NULL, srcID,
> + rtas_work_area_phys(area));
> +
> + } while (rtas_busy_delay(fwrc));
> +
> + switch (fwrc) {
> + case RTAS_SUCCESS:
> + ret = 0;
> + break;
> + case RTAS_HARDWARE_ERROR:
> + ret = -EIO;
> + break;
> + case RTAS_INVALID_PARAMETER:
> + ret = -EINVAL;
> + break;
> + case RTAS_HVPIPE_CLOSED:
> + ret = -EACCES;
The status -4 is Pipe connection is closed/unavailabe. Instead of
permission denied does it make sense to return -EPIPE (Broken pipe) ?
> + break;
> + case RTAS_FUNC_NOT_SUPPORTED:
> + ret = -EOPNOTSUPP;
> + break;
> + default:
> + ret = -EIO;
> + pr_err_ratelimited("unexpected ibm,receive-hvpipe-msg status %d\n", fwrc);
> + break;
> + }
> +
> + return ret;
> +}
> +
[...]
Thanks,
-Mahesh.
More information about the Linuxppc-dev
mailing list