Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: Chris Lew <quic_clew@quicinc.com>
To: <agross@kernel.org>, <bjorn.andersson@linaro.org>,
	<konrad.dybcio@somainline.org>
Cc: <linux-arm-msm@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<quic_clew@quicinc.com>
Subject: [PATCH 2/4] soc: qcom: smp2p: Add proper retrigger detection
Date: Tue, 5 Jul 2022 23:02:09 -0700	[thread overview]
Message-ID: <1657087331-32455-3-git-send-email-quic_clew@quicinc.com> (raw)
In-Reply-To: <1657087331-32455-1-git-send-email-quic_clew@quicinc.com>

Currently, smp2p relies on the hwirq resend feature to retrigger irqs
that were missed because the irq was disabled at the time of receiving
it. The hwirq resend feature will retrigger the parent smp2p interrupt.
In order to keep track of what children needed to be retriggered, the
pending bitmap was added.

After calling handle_nested_irq, smp2p checks if the interrupt is
enabled and sets the pending bit if the interrupt is not enabled. There
is a small window where a client can enable the interrupt between
calling handle_nested_irq and checking if the interrupt is enabled.
If this happens, the interrupt is never called when the parent smp2p
interrupt is retriggered.

Add the irq_retrigger callback so smp2p can know which child interrupts
need to be retriggered. Set the pending bits accordingly.

Signed-off-by: Chris Lew <quic_clew@quicinc.com>
---
 drivers/soc/qcom/smp2p.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/drivers/soc/qcom/smp2p.c b/drivers/soc/qcom/smp2p.c
index 1c3259fe98be..a94cddcb0298 100644
--- a/drivers/soc/qcom/smp2p.c
+++ b/drivers/soc/qcom/smp2p.c
@@ -260,11 +260,7 @@ static void qcom_smp2p_notify_in(struct qcom_smp2p *smp2p)
 			    (!(val & BIT(i)) && test_bit(i, entry->irq_falling))) {
 				irq_pin = irq_find_mapping(entry->domain, i);
 				handle_nested_irq(irq_pin);
-
-				if (test_bit(i, entry->irq_enabled))
-					clear_bit(i, entry->irq_pending);
-				else
-					set_bit(i, entry->irq_pending);
+				clear_bit(i, entry->irq_pending);
 			}
 		}
 	}
@@ -353,11 +349,22 @@ static int smp2p_set_irq_type(struct irq_data *irqd, unsigned int type)
 	return 0;
 }
 
+static int smp2p_retrigger_irq(struct irq_data *irqd)
+{
+	struct smp2p_entry *entry = irq_data_get_irq_chip_data(irqd);
+	irq_hw_number_t irq = irqd_to_hwirq(irqd);
+
+	set_bit(irq, entry->irq_pending);
+
+	return 0;
+}
+
 static struct irq_chip smp2p_irq_chip = {
 	.name           = "smp2p",
 	.irq_mask       = smp2p_mask_irq,
 	.irq_unmask     = smp2p_unmask_irq,
 	.irq_set_type	= smp2p_set_irq_type,
+	.irq_retrigger	= smp2p_retrigger_irq,
 };
 
 static int smp2p_irq_map(struct irq_domain *d,
-- 
2.7.4


  parent reply	other threads:[~2022-07-06  6:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-06  6:02 [PATCH 0/4] Add smp2p retrigger support Chris Lew
2022-07-06  6:02 ` [PATCH 1/4] soc: qcom: smp2p: Introduce pending state for virtual irq Chris Lew
2022-07-13 15:32   ` Doug Anderson
2022-07-06  6:02 ` Chris Lew [this message]
2022-07-06  6:02 ` [PATCH 3/4] soc: qcom: smp2p: Add memory barrier for irq_pending Chris Lew
2022-07-06 12:52   ` Manivannan Sadhasivam
2022-07-13 15:32   ` Doug Anderson
2022-07-06  6:02 ` [PATCH 4/4] soc: qcom: smp2p: Add remote_id into irq name Chris Lew

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=1657087331-32455-3-git-send-email-quic_clew@quicinc.com \
    --to=quic_clew@quicinc.com \
    --cc=agross@kernel.org \
    --cc=bjorn.andersson@linaro.org \
    --cc=konrad.dybcio@somainline.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.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