linux-csky.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: guoren@kernel.org
To: marc.zyngier@arm.com, mark.rutland@arm.com, tglx@linutronix.de
Cc: linux-kernel@vger.kernel.org, jason@lakedaemon.net,
	guoren@kernel.org, linux-csky@vger.kernel.org,
	Guo Ren <ren_guo@c-sky.com>
Subject: [PATCH V4 3/4] irqchip/irq-csky-mpintc: Support auto irq deliver to all cpus
Date: Tue,  4 Jun 2019 19:05:05 +0800	[thread overview]
Message-ID: <1559646306-18860-4-git-send-email-guoren@kernel.org> (raw)
In-Reply-To: <1559646306-18860-1-git-send-email-guoren@kernel.org>

From: Guo Ren <ren_guo@c-sky.com>

The csky,mpintc could deliver a external irq to one cpu or all cpus, but
it couldn't deliver a external irq to a group of cpus with cpu_mask. So
we only use auto deliver mode when affinity mask_val is equal to
cpu_present_mask.

There is no limitation for only two cpus in SMP system.

Signed-off-by: Guo Ren <ren_guo@c-sky.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
---
 drivers/irqchip/irq-csky-mpintc.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-csky-mpintc.c b/drivers/irqchip/irq-csky-mpintc.c
index a451a07..2740dd5 100644
--- a/drivers/irqchip/irq-csky-mpintc.c
+++ b/drivers/irqchip/irq-csky-mpintc.c
@@ -143,8 +143,19 @@ static int csky_irq_set_affinity(struct irq_data *d,
 	if (cpu >= nr_cpu_ids)
 		return -EINVAL;
 
-	/* Enable interrupt destination */
-	cpu |= BIT(31);
+	/*
+	 * The csky,mpintc could support auto irq deliver, but it only
+	 * could deliver external irq to one cpu or all cpus. So it
+	 * doesn't support deliver external irq to a group of cpus
+	 * with cpu_mask.
+	 * SO we only use auto deliver mode when affinity mask_val is
+	 * equal to cpu_present_mask.
+	 *
+	 */
+	if (cpumask_equal(mask_val, cpu_present_mask))
+		cpu = 0;
+	else
+		cpu |= BIT(31);
 
 	writel_relaxed(cpu, INTCG_base + INTCG_CIDSTR + offset);
 
-- 
2.7.4


  parent reply	other threads:[~2019-06-04 11:06 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-04 11:05 [PATCH V4 0/4] irqchip/irq-csky-mpintc: Update some features guoren
2019-06-04 11:05 ` [PATCH V4 1/4] irqchip/irq-csky-mpintc: Add triger type guoren
2019-06-04 11:05 ` [PATCH V4 2/4] dt-bindings: interrupt-controller: Update csky mpintc guoren
2019-06-04 11:05 ` guoren [this message]
2019-06-04 11:54   ` [PATCH V4 3/4] irqchip/irq-csky-mpintc: Support auto irq deliver to all cpus Marc Zyngier
2019-06-04 12:32     ` Guo Ren
2019-06-04 11:05 ` [PATCH V4 4/4] irqchip/irq-csky-mpintc: Remove unnecessary loop in interrupt handler guoren

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=1559646306-18860-4-git-send-email-guoren@kernel.org \
    --to=guoren@kernel.org \
    --cc=jason@lakedaemon.net \
    --cc=linux-csky@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=ren_guo@c-sky.com \
    --cc=tglx@linutronix.de \
    /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).