linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Haren Myneni <haren@linux.ibm.com>
To: mahesh@linux.ibm.com
Cc: linuxppc-dev@lists.ozlabs.org, maddy@linux.ibm.com,
	mpe@ellerman.id.au, msuchanek@suse.de, tyreld@linux.ibm.com,
	npiggin@gmail.com, bjking1@linux.ibm.com, hbabu@us.ibm.com
Subject: Re: [PATCH v2 4/9] powerpc/pseries: Send payload with ibm,send-hvpipe-msg RTAS
Date: Sun, 24 Aug 2025 23:53:45 -0700	[thread overview]
Message-ID: <da05efd90e7e44c761c09e6d8b0e52af4daa8f1a.camel@linux.ibm.com> (raw)
In-Reply-To: <bzukfcszv6bm6np3vars73x4kjl6zfh6okwmbetmranzaan34o@aufmggdubqz7>

On Mon, 2025-08-25 at 11:28 +0530, Mahesh J Salgaonkar wrote:
> 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 ?
Yes typo error. It should be 4048 bytes as mentioned in the code.

> 
> > than one buffer.
> > 
> > Signed-off-by: Haren Myneni <haren@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) ?

Agree, The user space should close all FDs when sees this error. Will
change it to -EPIPE.

Thanks for your suggestions.

> 
> > +		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.



  reply	other threads:[~2025-08-25  6:54 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-12 22:57 [PATCH v2 0/9] powerpc/pseries: Add hypervisor pipe (HVPIPE) suport Haren Myneni
2025-08-12 22:57 ` [PATCH v2 1/9] powerpc/pseries: Define papr-hvpipe ioctl Haren Myneni
2025-08-12 22:57 ` [PATCH v2 2/9] powerpc/pseries: Define HVPIPE specific macros Haren Myneni
2025-08-12 22:57 ` [PATCH v2 3/9] powerpc/pseries: Add papr-hvpipe char driver for HVPIPE interfaces Haren Myneni
2025-08-27 18:15   ` Mahesh J Salgaonkar
2025-08-27 18:56     ` Haren Myneni
2025-08-12 22:57 ` [PATCH v2 4/9] powerpc/pseries: Send payload with ibm,send-hvpipe-msg RTAS Haren Myneni
2025-08-25  5:58   ` Mahesh J Salgaonkar
2025-08-25  6:53     ` Haren Myneni [this message]
2025-08-25  8:42       ` Mahesh J Salgaonkar
2025-08-12 22:57 ` [PATCH v2 5/9] powerpc/pseries: Receive payload with ibm,receive-hvpipe-msg RTAS Haren Myneni
2025-08-27 18:24   ` Mahesh J Salgaonkar
2025-08-12 22:57 ` [PATCH v2 6/9] powerpc/pseries: Wakeup hvpipe FD when the payload is pending Haren Myneni
2025-08-12 22:57 ` [PATCH v2 7/9] powerpc/pseries: Enable HVPIPE event message interrupt Haren Myneni
2025-08-12 22:57 ` [PATCH v2 8/9] powerpc/pseries: Enable hvpipe with ibm,set-system-parameter RTAS Haren Myneni
2025-08-12 22:57 ` [PATCH v2 9/9] powerpc/pseries: HVPIPE changes to support migration Haren Myneni
2025-08-25  8:40   ` Mahesh J Salgaonkar
2025-08-25  9:31     ` Haren Myneni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=da05efd90e7e44c761c09e6d8b0e52af4daa8f1a.camel@linux.ibm.com \
    --to=haren@linux.ibm.com \
    --cc=bjking1@linux.ibm.com \
    --cc=hbabu@us.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=msuchanek@suse.de \
    --cc=npiggin@gmail.com \
    --cc=tyreld@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).