mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Amirreza Zarrabi <amirreza.zarrabi@oss.qualcomm.com>
To: Anup Patel <anup.patel@oss.qualcomm.com>,
	Palmer Dabbelt <palmer@dabbelt.com>,
	Paul Walmsley <pjw@kernel.org>,
	Rahul Pathak <rahul@summations.net>,
	Stephen Boyd <sboyd@kernel.org>,
	Brian Masney <bmasney+clk@redhat.com>,
	Jerome Brunet <jbrunet+clk@baylibre.com>,
	Thomas Gleixner <tglx@kernel.org>, Radu Rendec <radu@rendec.net>,
	Jassi Brar <jassisinghbrar@gmail.com>
Cc: Sunil V L <sunilvl@oss.qualcomm.com>,
	Himanshu Chauhan <himanshu.chauhan@oss.qualcomm.com>,
	Atish Patra <atish.patra@linux.dev>,
	Anup Patel <anup@brainfault.org>,
	linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org,
	linux-clk@vger.kernel.org
Subject: Re: [PATCH v2 1/5] RISC-V: Move common MPXY helper routines to arch/riscv
Date: Mon, 30 Nov 2026 10:47:44 +1100	[thread overview]
Message-ID: <a6ed6fbe-8248-4e91-a321-2ef629aa11db@oss.qualcomm.com> (raw)
In-Reply-To: <20261116040049.1795610-2-anup.patel@oss.qualcomm.com>

Hi Anup,

On 11/16/2026 3:00 PM, Anup Patel wrote:
> +int sbi_mpxy_send_message_with_resp(u32 channel_id, u32 msg_id,
> +				    void *tx, unsigned long tx_len,
> +				    void *rx, unsigned long max_rx_len,
> +				    unsigned long *rx_len)
> +{
> +	struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
> +	unsigned long rx_bytes;
> +	struct sbiret sret;
> +
> +	if (!mpxy->shmem_active)
> +		return -ENODEV;
> +	if (!tx && tx_len)
> +		return -EINVAL;
> +
> +	get_cpu();
> +
> +	/* Message protocols allowed to have no data in messages */
> +	if (tx_len)
> +		memcpy(mpxy->shmem, tx, tx_len);

Before this patch, both send helpers were private to the mailbox driver.
Their caller, mpxy_mbox_send_rpmi_data(), checks request_len against
mchan->max_xfer_len. That limit is the smaller of the MPXY shared-memory
size and the channel's maximum message length.

Now that callers can use these helpers directly, should not both helpers
check tx_len against mpxy_shmem_size before the memcpy()?


Regards,
Amir

> +
> +	sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_SEND_MSG_WITH_RESP,
> +			 channel_id, msg_id, tx_len, 0, 0, 0);
> +	if (rx && !sret.error) {
> +		rx_bytes = sret.value;
> +		if (rx_bytes > max_rx_len) {
> +			put_cpu();
> +			return -ENOSPC;
> +		}
> +
> +		memcpy(rx, mpxy->shmem, rx_bytes);
> +		if (rx_len)
> +			*rx_len = rx_bytes;
> +	}
> +
> +	put_cpu();
> +	return sbi_err_map_linux_errno(sret.error);
> +}
> +EXPORT_SYMBOL_GPL(sbi_mpxy_send_message_with_resp);


  parent reply	other threads:[~2026-11-29 23:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-16  4:00 [PATCH v2 0/5] Parallel message send using SBI MPXY Anup Patel
2026-11-16  4:00 ` [PATCH v2 1/5] RISC-V: Move common MPXY helper routines to arch/riscv Anup Patel
2026-11-29  9:51   ` Rahul Pathak
2026-11-29 23:47   ` Amirreza Zarrabi [this message]
2026-11-16  4:00 ` [PATCH v2 2/5] RISC-V: Use irqsave to prevent interrupt when accessing MPXY shared memory Anup Patel
2026-11-29 10:12   ` Rahul Pathak
2026-11-16  4:00 ` [PATCH v2 3/5] mailbox: add direct synchronous transmit API Anup Patel
2026-11-16  4:00 ` [PATCH v2 4/5] mailbox: document direct synchronous transmit Anup Patel
2026-11-29  3:53   ` Rahul Pathak
2026-11-16  4:00 ` [PATCH v2 5/5] mailbox: convert RISC-V SBI MPXY to direct transmit Anup Patel
2026-11-29  9:59   ` Rahul Pathak

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=a6ed6fbe-8248-4e91-a321-2ef629aa11db@oss.qualcomm.com \
    --to=amirreza.zarrabi@oss.qualcomm.com \
    --cc=anup.patel@oss.qualcomm.com \
    --cc=anup@brainfault.org \
    --cc=atish.patra@linux.dev \
    --cc=bmasney+clk@redhat.com \
    --cc=himanshu.chauhan@oss.qualcomm.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=jbrunet+clk@baylibre.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=pjw@kernel.org \
    --cc=radu@rendec.net \
    --cc=rahul@summations.net \
    --cc=sboyd@kernel.org \
    --cc=sunilvl@oss.qualcomm.com \
    --cc=tglx@kernel.org \
    /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

all inboxes | Powered by JetHome®