Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,32 @@
$id: http://devicetree.org/schemas/interrupt-controller/thead,c900-aclint-sswi.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: T-HEAD C900 ACLINT Supervisor-level Software Interrupt Device
title: ACLINT Supervisor-level Software Interrupt Device

maintainers:
- Inochi Amaoto <inochiama@outlook.com>

description:
The SSWI device is a part of the THEAD ACLINT device. It provides
supervisor-level IPI functionality for a set of HARTs on a THEAD
platform. It provides a register to set an IPI (SETSSIP) for each
HART connected to the SSWI device.
The SSWI device is a part of the ACLINT device. It provides
supervisor-level IPI functionality for a set of HARTs on a supported
platforms. It provides a register to set an IPI (SETSSIP) for each
HART connected to the SSWI device. See draft specification
https://github.com/riscvarchive/riscv-aclint

Following variants of the SSWI ACLINT supported, using dedicated
compatible string
- THEAD C900
- MIPS P8700

properties:
compatible:
items:
- enum:
- sophgo,sg2044-aclint-sswi
- const: thead,c900-aclint-sswi
oneOf:
- items:
- enum:
- sophgo,sg2044-aclint-sswi
- const: thead,c900-aclint-sswi
- items:
- const: mips,p8700-aclint-sswi

reg:
maxItems: 1
Expand All @@ -34,6 +43,14 @@ properties:
minItems: 1
maxItems: 4095

riscv,hart-indexes:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 4095
description:
A list of hart indexes that APLIC should use to address each hart
that is mentioned in the "interrupts-extended"

additionalProperties: false

required:
Expand All @@ -43,8 +60,22 @@ required:
- interrupt-controller
- interrupts-extended

allOf:
- if:
properties:
compatible:
contains:
const: mips,p8700-aclint-sswi
then:
required:
- riscv,hart-indexes
else:
properties:
riscv,hart-indexes: false

examples:
- |
//Example 1
interrupt-controller@94000000 {
compatible = "sophgo,sg2044-aclint-sswi", "thead,c900-aclint-sswi";
reg = <0x94000000 0x00004000>;
Expand All @@ -55,4 +86,19 @@ examples:
<&cpu3intc 1>,
<&cpu4intc 1>;
};

- |
//Example 2
interrupt-controller@94000000 {
compatible = "mips,p8700-aclint-sswi";
reg = <0x94000000 0x00004000>;
#interrupt-cells = <0>;
interrupt-controller;
interrupts-extended = <&cpu1intc 1>,
<&cpu2intc 1>,
<&cpu3intc 1>,
<&cpu4intc 1>;
riscv,hart-indexes = <0x0 0x1 0x10 0x11>;
};

...
2 changes: 2 additions & 0 deletions arch/riscv/include/asm/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ void arch_trigger_cpumask_backtrace(const cpumask_t *mask, int exclude_cpu);
void riscv_set_intc_hwnode_fn(struct fwnode_handle *(*fn)(void));

struct fwnode_handle *riscv_get_intc_hwnode(void);
int riscv_get_hart_index(struct fwnode_handle *fwnode, u32 logical_index,
u32 *hart_index);

#ifdef CONFIG_ACPI

Expand Down
34 changes: 34 additions & 0 deletions arch/riscv/kernel/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,40 @@ struct fwnode_handle *riscv_get_intc_hwnode(void)
}
EXPORT_SYMBOL_GPL(riscv_get_intc_hwnode);

/**
* riscv_get_hart_index() - get hart index for interrupt delivery
* @fwnode: interrupt controller node
* @logical_index: index within the "interrupts-extended" property
* @hart_index: filled with the hart index to use
*
* RISC-V uses term "hart index" for its interrupt controllers, for the
* purpose of the interrupt routing to destination harts.
* It may be arbitrary numbers assigned to each destination hart in context
* of the particular interrupt domain.
*
* These numbers encoded in the optional property "riscv,hart-indexes"
* that should contain hart index for each interrupt destination in the same
* order as in the "interrupts-extended" property. If this property
* not exist, it assumed equal to the logical index, i.e. index within the
* "interrupts-extended" property.
*
* Return: error code
*/
int riscv_get_hart_index(struct fwnode_handle *fwnode, u32 logical_index,
u32 *hart_index)
{
static const char *prop_hart_index = "riscv,hart-indexes";
struct device_node *np = to_of_node(fwnode);

if (!np || !of_property_present(np, prop_hart_index)) {
*hart_index = logical_index;
return 0;
}

return of_property_read_u32_index(np, prop_hart_index,
logical_index, hart_index);
}

#ifdef CONFIG_IRQ_STACKS
#include <asm/irq_stack.h>

Expand Down
15 changes: 11 additions & 4 deletions drivers/irqchip/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -634,18 +634,25 @@ config STARFIVE_JH8100_INTC

If you don't know what to do here, say Y.

config THEAD_C900_ACLINT_SSWI
bool "THEAD C9XX ACLINT S-mode IPI Interrupt Controller"
config ACLINT_SSWI
bool "RISC-V ACLINT S-mode IPI Interrupt Controller"
depends on RISCV
depends on SMP
select IRQ_DOMAIN_HIERARCHY
select GENERIC_IRQ_IPI_MUX
help
This enables support for T-HEAD specific ACLINT SSWI device
support.
This enables support for variants of the RISC-V ACLINT-SSWI device.
Supported variants are:
- T-HEAD, with compatible "thead,c900-aclint-sswi"
- MIPS P8700, with compatible "mips,p8700-aclint-sswi"

If you don't know what to do here, say Y.

# Backwards compatibility so oldconfig does not drop it.
config THEAD_C900_ACLINT_SSWI
bool
select ACLINT_SSWI

config EXYNOS_IRQ_COMBINER
bool "Samsung Exynos IRQ combiner support" if COMPILE_TEST
depends on (ARCH_EXYNOS && ARM) || COMPILE_TEST
Expand Down
2 changes: 1 addition & 1 deletion drivers/irqchip/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ obj-$(CONFIG_RISCV_APLIC_MSI) += irq-riscv-aplic-msi.o
obj-$(CONFIG_RISCV_IMSIC) += irq-riscv-imsic-state.o irq-riscv-imsic-early.o irq-riscv-imsic-platform.o
obj-$(CONFIG_SIFIVE_PLIC) += irq-sifive-plic.o
obj-$(CONFIG_STARFIVE_JH8100_INTC) += irq-starfive-jh8100-intc.o
obj-$(CONFIG_THEAD_C900_ACLINT_SSWI) += irq-thead-c900-aclint-sswi.o
obj-$(CONFIG_ACLINT_SSWI) += irq-aclint-sswi.o
obj-$(CONFIG_IMX_IRQSTEER) += irq-imx-irqsteer.o
obj-$(CONFIG_IMX_INTMUX) += irq-imx-intmux.o
obj-$(CONFIG_IMX_MU_MSI) += irq-imx-mu-msi.o
Expand Down
Loading
Loading