Skip to contentSkip to conversation

sparc64: sparse irq

PATCH Superseded Bob Picco 2 participants 2 messages Sep 16, 2014 SPARC + UltraSPARC (sparc/sparc64)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore

Bob Picco

author
#0 lore raw

PATCH v2 1/1 sparc64: sparse irq

From: bob picco <[email protected]>

This patch attempts to do a few things. The highlights are: 1) provides the option to enable SPARSE_IRQ, 2) allocates ivector_table at boot time and
3) default to cookie only VIRQ mechanism for supported firmware. The first firmware with cookie only support for me appears on T5. You can optionally force the HV firmware to not cookie only mode which is the sysino support.

The sysino is a deprecated HV mechanism according to the most recent SPARC Virtual Machine Specification. HV_GRP_INTR is what controls the cookie/sysino firmware versioning. The history appears to be something like this:
major version 2 was dropped.
major version 3 is where a cookie only VIRQ
is possible. Using version 3 means ivector_table isn't required.

A new boot option is provided should cookie only HV support have issues. hvirq - this is the version for HV_GRP_INTR. This is related to HV API versioning. The code attempts major=3 first by default. The option can be used to override this default.

I've tested with SPARSE_IRQ on T5-8, M7-4 and T4-X and Ultra 45. I've also tested Ultra45 (Jalap?no) with !SPARSE_IRQ.

---
V2: default to SPARSE_IRQ.
numa_node_id() used as argument to __irq_alloc_descs(). timer_irq_action is reason for IRQ 0 being special. NR_IRQS to 2048.

 arch/sparc/Kconfig              |    1 +
 arch/sparc/include/asm/irq_64.h |   16 +-
 arch/sparc/kernel/irq_64.c      |  523 +++++++++++++++++++++++++++++++++------
 3 files changed, 458 insertions(+), 82 deletions(-)
arch/sparc/Kconfig +1 -0
index a537816..96ac69c 100644
@@ -67,6 +67,7 @@ config SPARC64
 	select HAVE_SYSCALL_TRACEPOINTS
 	select HAVE_CONTEXT_TRACKING
 	select HAVE_DEBUG_KMEMLEAK
+	select SPARSE_IRQ
 	select RTC_DRV_CMOS
 	select RTC_DRV_BQ4802
 	select RTC_DRV_SUN4V
arch/sparc/include/asm/irq_64.h +12 -4
index 91d2193..34e4905 100644
@@ -37,7 +37,11 @@
  *
  * ino_bucket->irq allocation is made during {sun4v_,}build_irq().
  */
-#define NR_IRQS    255
+#ifdef CONFIG_SPARSE_IRQ
+#define NR_IRQS		(2048)
+#else
+#define NR_IRQS		(255)
+#endif /* CONFIG_SPARSE_IRQ */
 
 void irq_install_pre_handler(int irq,
 			     void (*func)(unsigned int, void *, void *),
@@ -57,11 +61,15 @@ unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p,
 			     unsigned long iclr_base);
 void sun4u_destroy_msi(unsigned int irq);
 
-unsigned char irq_alloc(unsigned int dev_handle,
-			unsigned int dev_ino);
+#ifdef CONFIG_SPARSE_IRQ
+unsigned int irq_alloc(unsigned int dev_handle, unsigned int dev_ino);
+void irq_free(unsigned int irq);
+#else /* CONFIG_SPARSE_IRQ */
+unsigned char irq_alloc(unsigned int dev_handle, unsigned int dev_ino);
 #ifdef CONFIG_PCI_MSI
 void irq_free(unsigned int irq);
-#endif
+#endif /* CONFIG_PCI_MSI */
+#endif /* CONFIG_SPARSE_IRQ */
 
 void __init init_IRQ(void);
 void fixup_irqs(void);
arch/sparc/kernel/irq_64.c +444 -78

673 lines not on this page · raw message

Signature · 1 line
1.7.1
maintainer
#1 lore raw

From: Bob Picco <[email protected]>
Date: Tue, 16 Sep 2014 09:25:26 -0400

Quoted 1 line

1) provides the option to enable SPARSE_IRQ

You're converting sparc64 completely over to SPARSE_IRQ unconditionally, so this wording doesn't make any sense. Please adjust the rest of the commit message as needed.

arch/sparc/include/asm/irq_64.h line 44

Quoted 6 lines
arch/sparc/include/asm/irq_64.h +5 -1
-#define NR_IRQS    255
+#ifdef CONFIG_SPARSE_IRQ
+#define NR_IRQS		(2048)
+#else
+#define NR_IRQS		(255)
+#endif /* CONFIG_SPARSE_IRQ */

And thus SPARSE_IRQ checks no longer make any sense in sparc64 specific files such as irq_64.h here.

arch/sparc/include/asm/irq_64.h unsigned int sun4u_build_msi(u32 portid, unsigned int *irq_p, · line 66

Quoted 3 lines
arch/sparc/include/asm/irq_64.h +3 -0
+#ifdef CONFIG_SPARSE_IRQ
+unsigned int irq_alloc(unsigned int dev_handle, unsigned int dev_ino);
+void irq_free(unsigned int irq);

Likewise throughout the rest of your patch.

You're really close, please fix this up and resubmit. :-)