mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
To: Manivannan Sadhasivam <mani@kernel.org>
Cc: manivannan.sadhasivam@linaro.org, jassisinghbrar@gmail.com,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mailbox: qcom-ipcc: Reset CLEAR_ON_RECV_RD if set from boot firmware
Date: Mon, 27 Jan 2025 12:32:40 +0530	[thread overview]
Message-ID: <Z5cvkKPF+6WXJZtM@hu-mojha-hyd.qualcomm.com> (raw)
In-Reply-To: <20250124075646.oc6ni5gp6c23ozp7@thinkpad>

On Fri, Jan 24, 2025 at 01:26:46PM +0530, Manivannan Sadhasivam wrote:
> On Mon, Dec 30, 2024 at 01:24:25PM +0530, Mukesh Ojha wrote:
> > For some SoCs, boot firmware is using the same IPCC instance used
> > by Linux and it has kept CLEAR_ON_RECV_RD set which basically means
> > interrupt pending registers are cleared when RECV_ID is read and the
> > register automatically updates to the next pending interrupt/client
> > status based on priority.
> > 
> > Clear the CLEAR_ON_RECV_RD if it is set from the boot firmware.
> > 
> 
> Any user visible implications due to this?
>

User visible impact is the case of missing interrupt.

We are accessing IPCC_REG_RECV_ID register both from qcom_ipcc_irq_fn()
and from qcom_ipcc_pm_resume() and for some reason if
qcom_ipcc_pm_resume() run just millisecond before qcom_ipcc_irq_fn after
assertion of interrupt from the remote, qcom_ipcc_pm_resume reads the
IPCC_REG_RECV_ID and clears it and when the same register read from the
qcom_ipcc_irq_fn() it does not see the interrupt.

> > Signed-off-by: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
> > ---
> > Change in v2:
> >  - Corrected email id in the Sob.
> > 
> >  drivers/mailbox/qcom-ipcc.c | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> > 
> > diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
> > index 14c7907c6632..0b17a38ea6bf 100644
> > --- a/drivers/mailbox/qcom-ipcc.c
> > +++ b/drivers/mailbox/qcom-ipcc.c
> > @@ -14,6 +14,7 @@
> >  #include <dt-bindings/mailbox/qcom-ipcc.h>
> >  
> >  /* IPCC Register offsets */
> > +#define IPCC_REG_CONFIG			0x08
> >  #define IPCC_REG_SEND_ID		0x0c
> >  #define IPCC_REG_RECV_ID		0x10
> >  #define IPCC_REG_RECV_SIGNAL_ENABLE	0x14
> > @@ -21,6 +22,7 @@
> >  #define IPCC_REG_RECV_SIGNAL_CLEAR	0x1c
> >  #define IPCC_REG_CLIENT_CLEAR		0x38
> >  
> > +#define IPCC_CLEAR_ON_RECV_RD		BIT(0)
> >  #define IPCC_SIGNAL_ID_MASK		GENMASK(15, 0)
> >  #define IPCC_CLIENT_ID_MASK		GENMASK(31, 16)
> >  
> > @@ -274,6 +276,7 @@ static int qcom_ipcc_pm_resume(struct device *dev)
> >  static int qcom_ipcc_probe(struct platform_device *pdev)
> >  {
> >  	struct qcom_ipcc *ipcc;
> > +	u32 config_value;
> >  	static int id;
> >  	char *name;
> >  	int ret;
> > @@ -288,6 +291,19 @@ static int qcom_ipcc_probe(struct platform_device *pdev)
> >  	if (IS_ERR(ipcc->base))
> >  		return PTR_ERR(ipcc->base);
> >  
> > +	/*
> > +	 * It is possible that boot firmware is using the same IPCC instance
> > +	 * as of the HLOS and it has kept CLEAR_ON_RECV_RD set which basically
> > +	 * means Interrupt pending registers are cleared when RECV_ID is read.
> > +	 * The register automatically updates to the next pending interrupt/client
> > +	 * status based on priority.
> > +	 */
> > +	config_value = readl(ipcc->base + IPCC_REG_CONFIG);
> > +	if (config_value & IPCC_CLEAR_ON_RECV_RD) {
> 
> Can't you just clear this bit always?

We can do, but i wanted to be explicit here that something been done
from bootloader which Linux would need to clear.

I see this patch is merged in mainline.

-Mukesh
> 
> - Mani
> 
> -- 
> மணிவண்ணன் சதாசிவம்

      reply	other threads:[~2025-01-27  7:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-30  7:54 Mukesh Ojha
2025-01-20  6:33 ` Mukesh Ojha
2025-01-24  7:56 ` Manivannan Sadhasivam
2025-01-27  7:02   ` Mukesh Ojha [this message]

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=Z5cvkKPF+6WXJZtM@hu-mojha-hyd.qualcomm.com \
    --to=mukesh.ojha@oss.qualcomm.com \
    --cc=jassisinghbrar@gmail.com \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@linaro.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®