All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot2 for Anup Patel" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Anup Patel <apatel@ventanamicro.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: irq/msi] irqchip/riscv-intc: Add support for RISC-V AIA
Date: Fri, 23 Feb 2024 09:43:52 -0000	[thread overview]
Message-ID: <170868143221.398.5826038525907165938.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20240222094006.1030709-9-apatel@ventanamicro.com>

The following commit has been merged into the irq/msi branch of tip:

Commit-ID:     3c46fc5b5507be1f4aa144a1fbd83b0ccba04cc6
Gitweb:        https://git.kernel.org/tip/3c46fc5b5507be1f4aa144a1fbd83b0ccba04cc6
Author:        Anup Patel <apatel@ventanamicro.com>
AuthorDate:    Thu, 22 Feb 2024 15:09:56 +05:30
Committer:     Thomas Gleixner <tglx@linutronix.de>
CommitterDate: Fri, 23 Feb 2024 10:18:44 +01:00

irqchip/riscv-intc: Add support for RISC-V AIA

The RISC-V advanced interrupt architecture (AIA) extends the per-HART
local interrupts in following ways:
1. Minimum 64 local interrupts for both RV32 and RV64
2. Ability to process multiple pending local interrupts in same
   interrupt handler
3. Priority configuration for each local interrupts
4. Special CSRs to configure/access the per-HART MSI controller

Add support for #1 and #2 described above in the RISC-V intc driver.

Signed-off-by: Anup Patel <apatel@ventanamicro.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Link: https://lore.kernel.org/r/20240222094006.1030709-9-apatel@ventanamicro.com

---
 drivers/irqchip/irq-riscv-intc.c | 32 ++++++++++++++++++++++---------
 1 file changed, 23 insertions(+), 9 deletions(-)

diff --git a/drivers/irqchip/irq-riscv-intc.c b/drivers/irqchip/irq-riscv-intc.c
index 0cd6b48..cccb653 100644
--- a/drivers/irqchip/irq-riscv-intc.c
+++ b/drivers/irqchip/irq-riscv-intc.c
@@ -19,6 +19,8 @@
 #include <linux/smp.h>
 #include <linux/soc/andes/irq.h>
 
+#include <asm/hwcap.h>
+
 static struct irq_domain *intc_domain;
 static unsigned int riscv_intc_nr_irqs __ro_after_init = BITS_PER_LONG;
 static unsigned int riscv_intc_custom_base __ro_after_init = BITS_PER_LONG;
@@ -32,6 +34,14 @@ static asmlinkage void riscv_intc_irq(struct pt_regs *regs)
 		pr_warn_ratelimited("Failed to handle interrupt (cause: %ld)\n", cause);
 }
 
+static asmlinkage void riscv_intc_aia_irq(struct pt_regs *regs)
+{
+	unsigned long topi;
+
+	while ((topi = csr_read(CSR_TOPI)))
+		generic_handle_domain_irq(intc_domain, topi >> TOPI_IID_SHIFT);
+}
+
 /*
  * On RISC-V systems local interrupts are masked or unmasked by writing
  * the SIE (Supervisor Interrupt Enable) CSR.  As CSRs can only be written
@@ -41,12 +51,18 @@ static asmlinkage void riscv_intc_irq(struct pt_regs *regs)
 
 static void riscv_intc_irq_mask(struct irq_data *d)
 {
-	csr_clear(CSR_IE, BIT(d->hwirq));
+	if (IS_ENABLED(CONFIG_32BIT) && d->hwirq >= BITS_PER_LONG)
+		csr_clear(CSR_IEH, BIT(d->hwirq - BITS_PER_LONG));
+	else
+		csr_clear(CSR_IE, BIT(d->hwirq));
 }
 
 static void riscv_intc_irq_unmask(struct irq_data *d)
 {
-	csr_set(CSR_IE, BIT(d->hwirq));
+	if (IS_ENABLED(CONFIG_32BIT) && d->hwirq >= BITS_PER_LONG)
+		csr_set(CSR_IEH, BIT(d->hwirq - BITS_PER_LONG));
+	else
+		csr_set(CSR_IE, BIT(d->hwirq));
 }
 
 static void andes_intc_irq_mask(struct irq_data *d)
@@ -157,8 +173,7 @@ static struct fwnode_handle *riscv_intc_hwnode(void)
 	return intc_domain->fwnode;
 }
 
-static int __init riscv_intc_init_common(struct fwnode_handle *fn,
-					 struct irq_chip *chip)
+static int __init riscv_intc_init_common(struct fwnode_handle *fn, struct irq_chip *chip)
 {
 	int rc;
 
@@ -176,11 +191,10 @@ static int __init riscv_intc_init_common(struct fwnode_handle *fn,
 
 	riscv_set_intc_hwnode_fn(riscv_intc_hwnode);
 
-	pr_info("%d local interrupts mapped\n", riscv_intc_nr_irqs);
-	if (riscv_intc_custom_nr_irqs) {
-		pr_info("%d custom local interrupts mapped\n",
-			riscv_intc_custom_nr_irqs);
-	}
+	pr_info("%d local interrupts mapped\n",
+		riscv_isa_extension_available(NULL, SxAIA) ? 64 : riscv_intc_nr_irqs);
+	if (riscv_intc_custom_nr_irqs)
+		pr_info("%d custom local interrupts mapped\n", riscv_intc_custom_nr_irqs);
 
 	return 0;
 }

  reply	other threads:[~2024-02-23  9:44 UTC|newest]

Thread overview: 117+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-22  9:39 [PATCH v14 00/18] Linux RISC-V AIA Support Anup Patel
2024-02-22  9:39 ` Anup Patel
2024-02-22  9:39 ` Anup Patel
2024-02-22  9:39 ` [PATCH v14 01/18] irqchip/sifive-plic: Convert PLIC driver into a platform driver Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` [tip: irq/msi] " tip-bot2 for Anup Patel
2024-04-03  8:29   ` [PATCH v14 01/18] " Lad, Prabhakar
2024-04-03  8:29     ` Lad, Prabhakar
2024-04-03  8:29     ` Lad, Prabhakar
2024-04-03 14:16     ` Anup Patel
2024-04-03 14:16       ` Anup Patel
2024-04-03 14:16       ` Anup Patel
2024-04-03 15:49       ` Lad, Prabhakar
2024-04-03 15:49         ` Lad, Prabhakar
2024-04-03 15:49         ` Lad, Prabhakar
2024-04-03 16:28         ` Samuel Holland
2024-04-03 16:28           ` Samuel Holland
2024-04-03 16:28           ` Samuel Holland
2024-04-03 18:10           ` Lad, Prabhakar
2024-04-03 18:10             ` Lad, Prabhakar
2024-04-03 18:10             ` Lad, Prabhakar
2024-04-03 16:42         ` Anup Patel
2024-04-03 16:42           ` Anup Patel
2024-04-03 16:42           ` Anup Patel
2024-04-03 17:19         ` Anup Patel
2024-04-03 17:19           ` Anup Patel
2024-04-03 17:19           ` Anup Patel
2024-02-22  9:39 ` [PATCH v14 02/18] irqchip/sifive-plic: Use dev_xyz() in-place of pr_xyz() Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` [tip: irq/msi] " tip-bot2 for Anup Patel
2024-02-22  9:39 ` [PATCH v14 03/18] irqchip/sifive-plic: Use devm_xyz() for managed allocation Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` [tip: irq/msi] " tip-bot2 for Anup Patel
2024-02-22  9:39 ` [PATCH v14 04/18] irqchip/sifive-plic: Use riscv_get_intc_hwnode() to get parent fwnode Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` [tip: irq/msi] " tip-bot2 for Anup Patel
2024-02-22  9:39 ` [PATCH v14 05/18] irqchip/sifive-plic: Cleanup PLIC contexts upon irqdomain creation failure Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` [tip: irq/msi] " tip-bot2 for Anup Patel
2024-02-22  9:39 ` [PATCH v14 06/18] irqchip/sifive-plic: Parse number of irqs and contexts early in plic_probe Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` [tip: irq/msi] irqchip/sifive-plic: Parse number of interrupts and contexts early in plic_probe() tip-bot2 for Anup Patel
2024-02-22  9:39 ` [PATCH v14 07/18] irqchip/sifive-plic: Improve locking safety by using irqsave/irqrestore Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` [tip: irq/msi] " tip-bot2 for Anup Patel
2024-02-22  9:39 ` [PATCH v14 08/18] irqchip/riscv-intc: Add support for RISC-V AIA Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` tip-bot2 for Anup Patel [this message]
2024-02-22  9:39 ` [PATCH v14 09/18] dt-bindings: interrupt-controller: Add RISC-V incoming MSI controller Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39 ` [PATCH v14 10/18] genirq/matrix: Dynamic bitmap allocation Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-23  9:43   ` [tip: irq/msi] " tip-bot2 for Björn Töpel
2024-02-22  9:39 ` [PATCH v14 11/18] irqchip: Add RISC-V incoming MSI controller early driver Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22  9:39   ` Anup Patel
2024-02-22 13:13   ` Björn Töpel
2024-02-22 13:13     ` Björn Töpel
2024-02-22 13:13     ` Björn Töpel
2024-02-22 13:42     ` Anup Patel
2024-02-22 13:42       ` Anup Patel
2024-02-22 13:42       ` Anup Patel
2024-02-22 14:15       ` Björn Töpel
2024-02-22 14:15         ` Björn Töpel
2024-02-22 14:15         ` Björn Töpel
2024-02-23  8:28   ` Thomas Gleixner
2024-02-23  8:28     ` Thomas Gleixner
2024-02-23  8:28     ` Thomas Gleixner
2024-02-23  9:52     ` Anup Patel
2024-02-23  9:52       ` Anup Patel
2024-02-23  9:52       ` Anup Patel
2024-02-22  9:40 ` [PATCH v14 12/18] irqchip/riscv-imsic: Add device MSI domain support for platform devices Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22 13:15   ` Björn Töpel
2024-02-22 13:15     ` Björn Töpel
2024-02-22 13:15     ` Björn Töpel
2024-02-22 13:44     ` Anup Patel
2024-02-22 13:44       ` Anup Patel
2024-02-22 13:44       ` Anup Patel
2024-02-22  9:40 ` [PATCH v14 13/18] irqchip/riscv-imsic: Add device MSI domain support for PCI devices Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22 13:14   ` Björn Töpel
2024-02-22 13:14     ` Björn Töpel
2024-02-22 13:14     ` Björn Töpel
2024-02-22 13:30     ` Anup Patel
2024-02-22 13:30       ` Anup Patel
2024-02-22 13:30       ` Anup Patel
2024-02-22 14:05       ` Björn Töpel
2024-02-22 14:05         ` Björn Töpel
2024-02-22 14:05         ` Björn Töpel
2024-02-22  9:40 ` [PATCH v14 14/18] dt-bindings: interrupt-controller: Add RISC-V advanced PLIC Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40 ` [PATCH v14 15/18] irqchip: Add RISC-V advanced PLIC driver for direct-mode Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40 ` [PATCH v14 16/18] irqchip/riscv-aplic: Add support for MSI-mode Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40 ` [PATCH v14 17/18] RISC-V: Select APLIC and IMSIC drivers Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40 ` [PATCH v14 18/18] MAINTAINERS: Add entry for RISC-V AIA drivers Anup Patel
2024-02-22  9:40   ` Anup Patel
2024-02-22  9:40   ` Anup Patel

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=170868143221.398.5826038525907165938.tip-bot2@tip-bot2 \
    --to=tip-bot2@linutronix.de \
    --cc=apatel@ventanamicro.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=x86@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 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.