From: Mark Rutland <mark.rutland@arm.com>
To: Stafford Horne <shorne@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
Openrisc <openrisc@lists.librecores.org>,
Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
Thomas Gleixner <tglx@linutronix.de>,
Jason Cooper <jason@lakedaemon.net>,
Marc Zyngier <marc.zyngier@arm.com>,
Rob Herring <robh+dt@kernel.org>, Jonas Bonn <jonas@southpole.se>,
devicetree@vger.kernel.org
Subject: Re: [PATCH 05/13] irqchip: add initial support for ompic
Date: Thu, 31 Aug 2017 11:59:40 +0100 [thread overview]
Message-ID: <20170831105940.GE15031@leverpostej> (raw)
In-Reply-To: <538699c64b5601e8800b77da29f7951bf23f57ce.1504129273.git.shorne@gmail.com>
On Thu, Aug 31, 2017 at 06:58:36AM +0900, Stafford Horne wrote:
> From: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
>
> IPI driver for OpenRISC Multicore programmable interrupt controller as
> described in the Multicore support section of the OpenRISC 1.2
> proposed architecture specification:
>
> https://github.com/stffrdhrn/doc/raw/arch-1.2-proposal/openrisc-arch-1.2-rev0.pdf
>
> Each OpenRISC core contains a full interrupt controller which is used in
> the SMP architecture for interrupt balancing. This IPI device is the
> only external device required for enabling SMP on OpenRISC.
I'm a little confused. Is this device the whole "ompic", a sub-device
thereof, or an independent IP block connected to it?
> Pending ops are stored in a memory bit mask which can allow multiple
> pending operations to be set and serviced at a time. This is mostly
> borrowed from the alpha IPI implementation.
>
> Signed-off-by: Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>
> [shorne@gmail.com: converted ops to bitmask, wrote commit message]
> Signed-off-by: Stafford Horne <shorne@gmail.com>
> ---
> .../bindings/interrupt-controller/ompic.txt | 22 ++++
> arch/openrisc/Kconfig | 1 +
> drivers/irqchip/Kconfig | 4 +
> drivers/irqchip/Makefile | 1 +
> drivers/irqchip/irq-ompic.c | 117 +++++++++++++++++++++
> 5 files changed, 145 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/interrupt-controller/ompic.txt
> create mode 100644 drivers/irqchip/irq-ompic.c
>
> diff --git a/Documentation/devicetree/bindings/interrupt-controller/ompic.txt b/Documentation/devicetree/bindings/interrupt-controller/ompic.txt
> new file mode 100644
> index 000000000000..4176ecc3366d
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/interrupt-controller/ompic.txt
> @@ -0,0 +1,22 @@
> +OpenRISC Multicore Programmable Interrupt Controller
> +
> +Required properties:
> +
> +- compatible : This should be "ompic"
This needs a vendor prefix.
Presumably, this should be "opencores,ompic"? (pending whether this is
actually the whole ompic, as above).
> +- reg : Specifies base physical address and size of the register space. The
> + size can be arbitrary based on the number of cores the controller has
> + been configured to handle, typically 8 bytes per core.
How are those regions correlated with CPUs?
e.g. is there a fixed relationship with a physical CPU id, or some
mechanism by which the relationship can be probed dynamically?
> +- interrupt-controller : Identifies the node as an interrupt controller
> +- #interrupt-cells : Specifies the number of cells needed to encode an
> + interrupt source. The value shall be 1.
No flags? Does this not need edge/level configuration or active high/low
configuration?
> +- interrupts : Specifies the interrupt line to which the ompic is wired.
What is this interrupt used for?
Is this some percpu interrupt used to proxy the IPI? It feels very odd
to assume such a thing from the parent irqchip. Surely this is
intimately coupled with that?
> +
> +Example:
> +
> +ompic: ompic {
> + compatible = "ompic";
> + reg = <0x98000000 16>;
> + #interrupt-cells = <1>;
> + interrupt-controller;
> + interrupts = <1>;
> +};
[...]
> +static struct {
> + unsigned long ops;
> +} ipi_data[NR_CPUS];
> +
> +static void __iomem *ompic_base;
Is there guaranteed to only be one of these system-wide?
[...]
> +void ompic_raise_softirq(const struct cpumask *mask, unsigned int irq)
> +{
> + unsigned int dst_cpu;
> + unsigned int src_cpu = smp_processor_id();
> +
> + for_each_cpu(dst_cpu, mask) {
> + set_bit(irq, &ipi_data[dst_cpu].ops);
> +
> + ompic_writereg(ompic_base, OMPIC_IPI_CTRL(src_cpu),
> + OMPIC_IPI_CTRL_IRQ_GEN |
> + OMPIC_IPI_CTRL_DST(dst_cpu) |
> + OMPIC_IPI_DATA(1));
> + }
Here you assume that the mapping is big enough to cover these registers,
but the ompic_of_init() function didn't sanity-check the size, so this
is not guaranteed.
[...]
> +int __init ompic_of_init(struct device_node *node, struct device_node *parent)
> +{
> + int irq;
> +
> + if (WARN_ON(!node))
> + return -ENODEV;
Given this function is only invoked if the kernel found a node with a
matching compatible string, how can this possibly happen?
> + memset(ipi_data, 0, sizeof(ipi_data));
As ipi_data was static, it is already zeroed.
> +
> + ompic_base = of_iomap(node, 0);
What if this failed?
> +
> + irq = irq_of_parse_and_map(node, 0);
What if this is missing?
> + setup_irq(irq, &ompi_ipi_irqaction);
As covered earlier, I;m confused by this. I'd expect that your root
irqchip would handle the IPIs, and hence need to probe nothing from the
DT for those.
Here we're assuming the IRQ is wired up to some per-cpu interrupt that
we can treat as an IPI, and that the parent irqchip handles that
appropriately, which seems very odd.
Thanks,
Mark.
next prev parent reply other threads:[~2017-08-31 11:01 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-30 21:58 [PATCH 00/13] OpenRISC SMP Support Stafford Horne
2017-08-30 21:58 ` [PATCH 01/13] openrisc: use shadow registers to save regs on exception Stafford Horne
2017-09-01 8:02 ` [OpenRISC] " Geert Uytterhoeven
2017-09-01 8:03 ` Geert Uytterhoeven
2017-09-01 8:26 ` Stafford Horne
2017-08-30 21:58 ` [PATCH 02/13] openrisc: define CPU_BIG_ENDIAN as true Stafford Horne
2017-09-01 8:06 ` [OpenRISC] " Geert Uytterhoeven
2017-09-01 8:28 ` Stafford Horne
2017-08-30 21:58 ` [PATCH 03/13] openrisc: add 1 and 2 byte cmpxchg support Stafford Horne
2017-08-31 7:46 ` Peter Zijlstra
2017-08-31 9:01 ` Stafford Horne
2017-08-30 21:58 ` [PATCH 04/13] openrisc: use qspinlocks and qrwlocks Stafford Horne
2017-08-30 21:58 ` [PATCH 05/13] irqchip: add initial support for ompic Stafford Horne
2017-08-31 9:28 ` Marc Zyngier
2017-09-01 1:24 ` Stafford Horne
2017-09-01 17:25 ` Marc Zyngier
2017-09-03 22:12 ` Stafford Horne
2017-09-04 7:35 ` Marc Zyngier
2017-08-31 10:59 ` Mark Rutland [this message]
2017-09-01 13:59 ` Stafford Horne
2017-08-30 21:58 ` [PATCH 06/13] openrisc: initial SMP support Stafford Horne
2017-08-30 22:02 ` [PATCH 07/13] openrisc: fix initial preempt state for secondary cpu tasks Stafford Horne
2017-08-30 22:02 ` [PATCH 08/13] openrisc: sleep instead of spin on secondary wait Stafford Horne
2017-08-30 22:02 ` [PATCH 09/13] openrisc: add cacheflush support to fix icache aliasing Stafford Horne
2017-08-30 22:03 ` [PATCH 10/13] openrisc: add simple_smp dts and defconfig for simulators Stafford Horne
2017-08-31 10:41 ` Mark Rutland
2017-08-31 13:05 ` Stafford Horne
2017-09-11 22:37 ` Pavel Machek
2017-09-11 22:55 ` Stafford Horne
2017-09-12 7:47 ` Pavel Machek
2017-09-12 22:15 ` Stafford Horne
2017-08-30 22:03 ` [PATCH 11/13] openrisc: support framepointers and STACKTRACE_SUPPORT Stafford Horne
2017-08-30 22:03 ` [PATCH 12/13] openrisc: enable LOCKDEP_SUPPORT and irqflags tracing Stafford Horne
2017-08-30 22:03 ` [PATCH 13/13] openrisc: add tick timer multicore sync logic Stafford Horne
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=20170831105940.GE15031@leverpostej \
--to=mark.rutland@arm.com \
--cc=devicetree@vger.kernel.org \
--cc=jason@lakedaemon.net \
--cc=jonas@southpole.se \
--cc=linux-kernel@vger.kernel.org \
--cc=marc.zyngier@arm.com \
--cc=openrisc@lists.librecores.org \
--cc=robh+dt@kernel.org \
--cc=shorne@gmail.com \
--cc=stefan.kristiansson@saunalahti.fi \
--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