All of lore.kernel.org
 help / color / mirror / Atom feed
From: tip-bot for Marc Zyngier <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: jason@lakedaemon.net, hpa@zytor.com, mingo@kernel.org,
	robh+dt@kernel.org, tglx@linutronix.de, marc.zyngier@arm.com,
	will.deacon@arm.com, linux-kernel@vger.kernel.org,
	mark.rutland@arm.com
Subject: [tip:irq/core] genirq: Allow the affinity of a percpu interrupt to be set/retrieved
Date: Mon, 2 May 2016 05:34:52 -0700	[thread overview]
Message-ID: <tip-222df54fd8b7641dcc81476f157806bb3144ee1d@git.kernel.org> (raw)
In-Reply-To: <1460365075-7316-3-git-send-email-marc.zyngier@arm.com>

Commit-ID:  222df54fd8b7641dcc81476f157806bb3144ee1d
Gitweb:     http://git.kernel.org/tip/222df54fd8b7641dcc81476f157806bb3144ee1d
Author:     Marc Zyngier <marc.zyngier@arm.com>
AuthorDate: Mon, 11 Apr 2016 09:57:52 +0100
Committer:  Thomas Gleixner <tglx@linutronix.de>
CommitDate: Mon, 2 May 2016 13:42:51 +0200

genirq: Allow the affinity of a percpu interrupt to be set/retrieved

In order to prepare the genirq layer for the concept of partitionned
percpu interrupts, let's allow an affinity to be associated with
such an interrupt. We introduce:

- irq_set_percpu_devid_partition: flag an interrupt as a percpu-devid
  interrupt, and associate it with an affinity
- irq_get_percpu_devid_partition: allow the affinity of that interrupt
  to be retrieved.

This will allow a driver to discover which CPUs the per-cpu interrupt
can actually fire on.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: devicetree@vger.kernel.org
Cc: Jason Cooper <jason@lakedaemon.net>
Cc: Will Deacon <will.deacon@arm.com>
Cc: Rob Herring <robh+dt@kernel.org>
Link: http://lkml.kernel.org/r/1460365075-7316-3-git-send-email-marc.zyngier@arm.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>

---
 include/linux/irq.h     |  4 ++++
 include/linux/irqdesc.h |  1 +
 kernel/irq/irqdesc.c    | 26 +++++++++++++++++++++++++-
 3 files changed, 30 insertions(+), 1 deletion(-)

diff --git a/include/linux/irq.h b/include/linux/irq.h
index c4de623..4d758a7 100644
--- a/include/linux/irq.h
+++ b/include/linux/irq.h
@@ -530,6 +530,10 @@ static inline void irq_set_chip_and_handler(unsigned int irq, struct irq_chip *c
 }
 
 extern int irq_set_percpu_devid(unsigned int irq);
+extern int irq_set_percpu_devid_partition(unsigned int irq,
+					  const struct cpumask *affinity);
+extern int irq_get_percpu_devid_partition(unsigned int irq,
+					  struct cpumask *affinity);
 
 extern void
 __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index dcca77c..b51beeb 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -66,6 +66,7 @@ struct irq_desc {
 	int			threads_handled_last;
 	raw_spinlock_t		lock;
 	struct cpumask		*percpu_enabled;
+	const struct cpumask	*percpu_affinity;
 #ifdef CONFIG_SMP
 	const struct cpumask	*affinity_hint;
 	struct irq_affinity_notify *affinity_notify;
diff --git a/kernel/irq/irqdesc.c b/kernel/irq/irqdesc.c
index 0ccd028..8731e1c 100644
--- a/kernel/irq/irqdesc.c
+++ b/kernel/irq/irqdesc.c
@@ -595,7 +595,8 @@ void __irq_put_desc_unlock(struct irq_desc *desc, unsigned long flags, bool bus)
 		chip_bus_sync_unlock(desc);
 }
 
-int irq_set_percpu_devid(unsigned int irq)
+int irq_set_percpu_devid_partition(unsigned int irq,
+				   const struct cpumask *affinity)
 {
 	struct irq_desc *desc = irq_to_desc(irq);
 
@@ -610,10 +611,33 @@ int irq_set_percpu_devid(unsigned int irq)
 	if (!desc->percpu_enabled)
 		return -ENOMEM;
 
+	if (affinity)
+		desc->percpu_affinity = affinity;
+	else
+		desc->percpu_affinity = cpu_possible_mask;
+
 	irq_set_percpu_devid_flags(irq);
 	return 0;
 }
 
+int irq_set_percpu_devid(unsigned int irq)
+{
+	return irq_set_percpu_devid_partition(irq, NULL);
+}
+
+int irq_get_percpu_devid_partition(unsigned int irq, struct cpumask *affinity)
+{
+	struct irq_desc *desc = irq_to_desc(irq);
+
+	if (!desc || !desc->percpu_enabled)
+		return -EINVAL;
+
+	if (affinity)
+		cpumask_copy(affinity, desc->percpu_affinity);
+
+	return 0;
+}
+
 void kstat_incr_irq_this_cpu(unsigned int irq)
 {
 	kstat_incr_irqs_this_cpu(irq_to_desc(irq));

  reply	other threads:[~2016-05-02 12:35 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-04-11  8:57 [PATCH 0/5] Partitioning per-cpu interrupts Marc Zyngier
2016-04-11  8:57 ` Marc Zyngier
2016-04-11  8:57 ` [PATCH 3/5] irqchip: Add per-cpu interrupt partitioning library Marc Zyngier
2016-05-02 12:35   ` [tip:irq/core] " tip-bot for Marc Zyngier
     [not found] ` <1460365075-7316-1-git-send-email-marc.zyngier-5wv7dgnIgG8@public.gmane.org>
2016-04-11  8:57   ` [PATCH 1/5] irqdomain: Allow domain matching on irq_fwspec Marc Zyngier
2016-04-11  8:57     ` Marc Zyngier
2016-05-02 12:34     ` [tip:irq/core] " tip-bot for Marc Zyngier
2016-04-11  8:57   ` [PATCH 2/5] genirq: Allow the affinity of a percpu interrupt to be set/retrieved Marc Zyngier
2016-04-11  8:57     ` Marc Zyngier
2016-05-02 12:34     ` tip-bot for Marc Zyngier [this message]
     [not found]     ` <1460365075-7316-3-git-send-email-marc.zyngier-5wv7dgnIgG8@public.gmane.org>
2016-05-19 11:08       ` Geert Uytterhoeven
2016-05-19 11:08         ` Geert Uytterhoeven
     [not found]         ` <CAMuHMdW_QNM0c+u-pj3w8TOhr4s40B+OwxUAoQwqPxKeRrU4ZQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2016-05-19 13:13           ` Marc Zyngier
2016-05-19 13:13             ` Marc Zyngier
     [not found]             ` <573DBBFA.8020903-5wv7dgnIgG8@public.gmane.org>
2016-05-19 13:25               ` Geert Uytterhoeven
2016-05-19 13:25                 ` Geert Uytterhoeven
2016-04-11  8:57   ` [PATCH 4/5] irqchip/gic-v3: Add support for partitioned PPIs Marc Zyngier
2016-04-11  8:57     ` Marc Zyngier
2016-05-02 12:35     ` [tip:irq/core] " tip-bot for Marc Zyngier
2016-04-11  8:57   ` [PATCH 5/5] DT: arm,gic-v3: Documment PPI partition support Marc Zyngier
2016-04-11  8:57     ` Marc Zyngier
     [not found]     ` <1460365075-7316-6-git-send-email-marc.zyngier-5wv7dgnIgG8@public.gmane.org>
2016-04-12 16:29       ` Rob Herring
2016-04-12 16:29         ` Rob Herring
2016-04-12 16:42         ` Marc Zyngier
2016-04-12 16:42           ` Marc Zyngier
     [not found]           ` <570D2585.5070801-5wv7dgnIgG8@public.gmane.org>
2016-04-12 18:31             ` Rob Herring
2016-04-12 18:31               ` Rob Herring
2016-05-02 12:36     ` [tip:irq/core] DT/arm,gic-v3: " tip-bot for Marc Zyngier
2016-04-28 14:48   ` [PATCH 0/5] Partitioning per-cpu interrupts Marc Zyngier
2016-04-28 14:48     ` Marc Zyngier
     [not found]     ` <572222B0.8010608-5wv7dgnIgG8@public.gmane.org>
2016-04-28 17:22       ` Thomas Gleixner
2016-04-28 17:22         ` Thomas Gleixner

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=tip-222df54fd8b7641dcc81476f157806bb3144ee1d@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=hpa@zytor.com \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=mark.rutland@arm.com \
    --cc=mingo@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=will.deacon@arm.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.