Skip to contentSkip to conversation

irqchip/gic: Remove static irq_chip definition for eoimode1

PATCH In review Jon Hunter 2 participants 4 messages Dec 22, 2015 – Jan 11, 2016

Subsystems (2)
lore
Share & tools
lore

Jon Hunter

author
#0 lore raw

PATCH v2 1/2 irqchip/gic: Remove static irq_chip definition for eoimode1

There are only 3 differences (not including the name) in the definitions of the gic_chip and gic_eoimode1_chip structures. Instead of statically defining the gic_eoimode1_chip structure, remove it and populate the eoimode1 functions dynamically for the appropriate GIC irqchips.

---
 drivers/irqchip/irq-gic.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
drivers/irqchip/irq-gic.c +5 -21
index fcbe0b90870d..94ad60c424a7 100644
@@ -394,23 +394,6 @@ static struct irq_chip gic_chip = {
 				  IRQCHIP_MASK_ON_SUSPEND,
 };
 
-static struct irq_chip gic_eoimode1_chip = {
-	.name			= "GICv2",
-	.irq_mask		= gic_eoimode1_mask_irq,
-	.irq_unmask		= gic_unmask_irq,
-	.irq_eoi		= gic_eoimode1_eoi_irq,
-	.irq_set_type		= gic_set_type,
-#ifdef CONFIG_SMP
-	.irq_set_affinity	= gic_set_affinity,
-#endif
-	.irq_get_irqchip_state	= gic_irq_get_irqchip_state,
-	.irq_set_irqchip_state	= gic_irq_set_irqchip_state,
-	.irq_set_vcpu_affinity	= gic_irq_set_vcpu_affinity,
-	.flags			= IRQCHIP_SET_TYPE_MASKED |
-				  IRQCHIP_SKIP_SET_WAKE |
-				  IRQCHIP_MASK_ON_SUSPEND,
-};
-
 void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)
 {
 	BUG_ON(gic_nr >= CONFIG_ARM_GIC_MAX_NR);
@@ -1030,13 +1013,14 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
 	gic_check_cpu_features();
 
 	gic = &gic_data[gic_nr];
+	gic->chip = gic_chip;
+	gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);
 
 	/* Initialize irq_chip */
 	if (static_key_true(&supports_deactivate) && gic_nr == 0) {
-		gic->chip = gic_eoimode1_chip;
-	} else {
-		gic->chip = gic_chip;
-		gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);
+		gic->chip.irq_mask = gic_eoimode1_mask_irq;
+		gic->chip.irq_eoi = gic_eoimode1_eoi_irq;
+		gic->chip.irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity;
 	}
 
 #ifdef CONFIG_GIC_NON_BANKED
Signature · 1 line
2.1.4
author
#1 lore raw

PATCH v2 2/2 irqchip/gic: Only populate set_affinity for the root controller

Setting the affinity of an IRQ, it only applicable for the root interrupt controller and so only populate this operator for the root controller.

---

V2 changes:
- Fixed compilation error with !SMP

 drivers/irqchip/irq-gic.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
drivers/irqchip/irq-gic.c +11 -7
index 94ad60c424a7..9df912db4105 100644
@@ -384,9 +384,6 @@ static struct irq_chip gic_chip = {
 	.irq_unmask		= gic_unmask_irq,
 	.irq_eoi		= gic_eoi_irq,
 	.irq_set_type		= gic_set_type,
-#ifdef CONFIG_SMP
-	.irq_set_affinity	= gic_set_affinity,
-#endif
 	.irq_get_irqchip_state	= gic_irq_get_irqchip_state,
 	.irq_set_irqchip_state	= gic_irq_set_irqchip_state,
 	.flags			= IRQCHIP_SET_TYPE_MASKED |
@@ -1017,10 +1014,17 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
 	gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);
 
 	/* Initialize irq_chip */
-	if (static_key_true(&supports_deactivate) && gic_nr == 0) {
-		gic->chip.irq_mask = gic_eoimode1_mask_irq;
-		gic->chip.irq_eoi = gic_eoimode1_eoi_irq;
-		gic->chip.irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity;
+	if (gic_nr == 0) {
+#ifdef CONFIG_SMP
+		gic->chip.irq_set_affinity = gic_set_affinity;
+#endif
+
+		if (static_key_true(&supports_deactivate)) {
+			gic->chip.irq_mask = gic_eoimode1_mask_irq;
+			gic->chip.irq_eoi = gic_eoimode1_eoi_irq;
+			gic->chip.irq_set_vcpu_affinity =
+				gic_irq_set_vcpu_affinity;
+		}
 	}
 
 #ifdef CONFIG_GIC_NON_BANKED
Signature · 1 line
2.1.4
author
#2 lore raw
In reply to Jon Hunter

Hi Mark,

Any comment on these patches?

Cheers
Jon

Quoted 58 lines · Jon Hunter

There are only 3 differences (not including the name) in the definitions of the gic_chip and gic_eoimode1_chip structures. Instead of statically defining the gic_eoimode1_chip structure, remove it and populate the eoimode1 functions dynamically for the appropriate GIC irqchips.

---
 drivers/irqchip/irq-gic.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
drivers/irqchip/irq-gic.c +5 -21
index fcbe0b90870d..94ad60c424a7 100644
@@ -394,23 +394,6 @@ static struct irq_chip gic_chip = {
 				  IRQCHIP_MASK_ON_SUSPEND,
 };
 
-static struct irq_chip gic_eoimode1_chip = {
-	.name			= "GICv2",
-	.irq_mask		= gic_eoimode1_mask_irq,
-	.irq_unmask		= gic_unmask_irq,
-	.irq_eoi		= gic_eoimode1_eoi_irq,
-	.irq_set_type		= gic_set_type,
-#ifdef CONFIG_SMP
-	.irq_set_affinity	= gic_set_affinity,
-#endif
-	.irq_get_irqchip_state	= gic_irq_get_irqchip_state,
-	.irq_set_irqchip_state	= gic_irq_set_irqchip_state,
-	.irq_set_vcpu_affinity	= gic_irq_set_vcpu_affinity,
-	.flags			= IRQCHIP_SET_TYPE_MASKED |
-				  IRQCHIP_SKIP_SET_WAKE |
-				  IRQCHIP_MASK_ON_SUSPEND,
-};
-
 void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)
 {
 	BUG_ON(gic_nr >= CONFIG_ARM_GIC_MAX_NR);
@@ -1030,13 +1013,14 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
 	gic_check_cpu_features();
 
 	gic = &gic_data[gic_nr];
+	gic->chip = gic_chip;
+	gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);
 
 	/* Initialize irq_chip */
 	if (static_key_true(&supports_deactivate) && gic_nr == 0) {
-		gic->chip = gic_eoimode1_chip;
-	} else {
-		gic->chip = gic_chip;
-		gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);
+		gic->chip.irq_mask = gic_eoimode1_mask_irq;
+		gic->chip.irq_eoi = gic_eoimode1_eoi_irq;
+		gic->chip.irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity;
 	}
 
 #ifdef CONFIG_GIC_NON_BANKED
#3 lore raw
In reply to Jon Hunter
Quoted 39 lines · Jon Hunter

There are only 3 differences (not including the name) in the definitions of the gic_chip and gic_eoimode1_chip structures. Instead of statically defining the gic_eoimode1_chip structure, remove it and populate the eoimode1 functions dynamically for the appropriate GIC irqchips.

---
 drivers/irqchip/irq-gic.c | 26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)
drivers/irqchip/irq-gic.c +0 -17
index fcbe0b90870d..94ad60c424a7 100644
@@ -394,23 +394,6 @@ static struct irq_chip gic_chip = {
 				  IRQCHIP_MASK_ON_SUSPEND,
 };
 
-static struct irq_chip gic_eoimode1_chip = {
-	.name			= "GICv2",
-	.irq_mask		= gic_eoimode1_mask_irq,
-	.irq_unmask		= gic_unmask_irq,
-	.irq_eoi		= gic_eoimode1_eoi_irq,
-	.irq_set_type		= gic_set_type,
-#ifdef CONFIG_SMP
-	.irq_set_affinity	= gic_set_affinity,
-#endif
-	.irq_get_irqchip_state	= gic_irq_get_irqchip_state,
-	.irq_set_irqchip_state	= gic_irq_set_irqchip_state,
-	.irq_set_vcpu_affinity	= gic_irq_set_vcpu_affinity,
-	.flags			= IRQCHIP_SET_TYPE_MASKED |
-				  IRQCHIP_SKIP_SET_WAKE |
-				  IRQCHIP_MASK_ON_SUSPEND,
-};
-
 void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq)
 {
 	BUG_ON(gic_nr >= CONFIG_ARM_GIC_MAX_NR);

drivers/irqchip/irq-gic.c static void __init __gic_init_bases(unsigned int gic_nr, int irq_start, · line 1017

Quoted 5 lines
drivers/irqchip/irq-gic.c +2 -0
@@ -1030,13 +1013,14 @@ static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,
 	gic_check_cpu_features();
 
 	gic = &gic_data[gic_nr];
+	gic->chip = gic_chip;
+	gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);

I'd really like to keep GICv2 being displayed when the GIC is in EOIMode==1, as it has proved to be a valuable debugging information in the recent past.

Quoted 4 lines
drivers/irqchip/irq-gic.c +0 -1
 	/* Initialize irq_chip */
 	if (static_key_true(&supports_deactivate) && gic_nr == 0) {
-		gic->chip = gic_eoimode1_chip;

drivers/irqchip/irq-gic.c static void __init __gic_init_bases(unsigned int gic_nr, int irq_start,

Quoted 10 lines
drivers/irqchip/irq-gic.c +3 -3
-	} else {
-		gic->chip = gic_chip;
-		gic->chip.name = kasprintf(GFP_KERNEL, "GIC-%d", gic_nr);
+		gic->chip.irq_mask = gic_eoimode1_mask_irq;
+		gic->chip.irq_eoi = gic_eoimode1_eoi_irq;
+		gic->chip.irq_set_vcpu_affinity = gic_irq_set_vcpu_affinity;
 	}
 
 #ifdef CONFIG_GIC_NON_BANKED
 

Other than that, I'm fine with that change (as well as the following one).

Thanks,

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...