armada-370-xp irqchip updates round 4
Subsystems (2)
cover armada-370-xp irqchip updates round 4
Hi Thomas, Andrew, Ilpo et al.,
since round 3 was reviewed so quickly, here comes round 4, which should be similarly easy to review.
This series can be applied on tip/irq/core, but only after round 2 and round 3 series are applied:
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=869325
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=870469
Marek
Marek Behún (10):
irqchip/armada-370-xp: Use consistent variable names for hwirqs irqchip/armada-370-xp: Use consistent types when iterating interrupts irqchip/armada-370-xp: Use consistent name for struct irq_data
variables
irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and
mpic_resume()
irqchip/armada-370-xp: Drop unneeded curly brackets irqchip/armada-370-xp: Drop redundant continue irqchip/armada-370-xp: Rename variable for consistency irqchip/armada-370-xp: Use u32 type instead of unsigned long where
possieble
irqchip/armada-370-xp: Refactor initial memory regions mapping irqchip/armada-370-xp: Print error and return error code on
initialization failure
drivers/irqchip/irq-armada-370-xp.c | 201 ++++++++++++++++------------ 1 file changed, 118 insertions(+), 83 deletions(-)
Signature · 1 line
2.44.2
PATCH 1/10 irqchip/armada-370-xp: Use consistent variable names for hwirqs
Use consistent variable names for hwirqs: when iterating, use "i", otherwise use "hwirq".
--- drivers/irqchip/irq-armada-370-xp.c | 56 ++++++++++++++--------------- 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +28 -28
@@ -117,7 +117,7 @@#define MPIC_SW_TRIG_INT 0x04#define MPIC_INT_SET_ENABLE 0x30#define MPIC_INT_CLEAR_ENABLE 0x34 -#define MPIC_INT_SOURCE_CTL (irq) (0x100 + (irq) * 4) +#define MPIC_INT_SOURCE_CTL (hwirq) (0x100 + (hwirq) * 4)#define MPIC_INT_SOURCE_CPU_MASK GENMASK(3, 0)#define MPIC_INT_IRQ_FIQ_MASK (cpuid) ((BIT(0) | BIT(8)) << (cpuid))
@@ -199,9 +199,9 @@ static inline unsigned int msi_doorbell_end(void)PCI_MSI_FULL_DOORBELL_END ; } -static inline bool mpic_is_percpu_irq (irq_hw_number_t irq) +static inline bool mpic_is_percpu_irq (irq_hw_number_t hwirq) { -return irq <=MPIC_MAX_PER_CPU_IRQS ; +return hwirq <=MPIC_MAX_PER_CPU_IRQS ; }/*
@@ -530,11 +530,11 @@ static void mpic_smp_cpu_init(void)static void mpic_reenable_percpu (void ) {/* Re-enable per-CPU interrupts that were enabled before suspend */ -for (unsigned int irq =0 ; irq <MPIC_MAX_PER_CPU_IRQS ; irq++) { +for (unsigned int i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) {struct irq_data *data;unsigned int virq; - virq =irq_linear_revmap (mpic_domain, irq); + virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ;
@@ -586,20 +586,20 @@ static struct irq_chip mpic_irq_chip = { };static int mpic_irq_map (struct irq_domain *h,unsigned int virq, -irq_hw_number_t hw) +irq_hw_number_t hwirq) {/* IRQs 0 and 1 cannot be mapped, they are handled internally */ -if (hw <=1 ) +if (hwirq <=1 )return -EINVAL ;mpic_irq_mask (irq_get_irq_data (virq)); -if (!mpic_is_percpu_irq (hw)) -writel (hw, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); +if (!mpic_is_percpu_irq (hwirq)) +writel (hwirq, per_cpu_int_base +MPIC_INT_CLEAR_MASK );else -writel (hw, main_int_base +MPIC_INT_SET_ENABLE ); +writel (hwirq, main_int_base +MPIC_INT_SET_ENABLE );irq_set_status_flags (virq,IRQ_LEVEL ); -if (mpic_is_percpu_irq (hw)) { +if (mpic_is_percpu_irq (hwirq)) {irq_set_percpu_devid (virq);irq_set_chip_and_handler (virq, &mpic_irq_chip, handle_percpu_devid_irq);
@@ -654,15 +654,15 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, irqn, irqsrc, cpuid; +unsigned long irqmap, i, irqsrc, cpuid;chained_irq_enter (chip, desc); irqmap =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); cpuid =cpu_logical_map (smp_processor_id ()); -for_each_set_bit (irqn, &irqmap,BITS_PER_LONG ) { - irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (irqn)); +for_each_set_bit (i, &irqmap,BITS_PER_LONG ) { + irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (i));/* Check if the interrupt is not masked on current CPU. * Test IRQ (0-1) and FIQ (8-9) mask bits.
@@ -670,12 +670,12 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)if (!(irqsrc &MPIC_INT_IRQ_FIQ_MASK (cpuid)))continue ; -if (irqn ==0 || irqn ==1 ) { +if (i ==0 || i ==1 ) {mpic_handle_msi_irq ();continue ; } -generic_handle_domain_irq (mpic_domain, irqn); +generic_handle_domain_irq (mpic_domain, i); }chained_irq_exit (chip, desc);
@@ -683,26 +683,26 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc) static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs) { -u32 irqstat, irqnr; +u32 irqstat, i;do { irqstat =readl_relaxed (per_cpu_int_base +MPIC_CPU_INTACK ); - irqnr =FIELD_GET (MPIC_CPU_INTACK_IID_MASK , irqstat); + i =FIELD_GET (MPIC_CPU_INTACK_IID_MASK , irqstat); -if (irqnr >1022 ) +if (i >1022 )break ; -if (irqnr >1 ) { -generic_handle_domain_irq (mpic_domain, irqnr); +if (i >1 ) { +generic_handle_domain_irq (mpic_domain, i);continue ; }/* MSI handling */ -if (irqnr ==1 ) +if (i ==1 )mpic_handle_msi_irq ();/* IPI Handling */ -if (irqnr ==0 ) +if (i ==0 )mpic_handle_ipi_irq (); }while (1 ); }
@@ -719,24 +719,24 @@ static void mpic_resume(void)bool src0, src1;/* Re-enable interrupts */ -for (irq_hw_number_t irq =0 ; irq < mpic_domain->hwirq_max; irq++) { +for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) {struct irq_data *data;unsigned int virq; - virq =irq_linear_revmap (mpic_domain, irq); + virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; data =irq_get_irq_data (virq); -if (!mpic_is_percpu_irq (irq)) { +if (!mpic_is_percpu_irq (i)) {/* Non per-CPU interrupts */ -writel (irq, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); +writel (i, per_cpu_int_base +MPIC_INT_CLEAR_MASK );if (!irqd_irq_disabled (data))mpic_irq_unmask (data); }else {/* Per-CPU interrupts */ -writel (irq, main_int_base +MPIC_INT_SET_ENABLE ); +writel (i, main_int_base +MPIC_INT_SET_ENABLE );/* * Re-enable on the current CPU, mpic_reenable_percpu()
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Use consistent variable names for hwirqs
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: da3b3ce541259951ff4e087c20ff991f9056fa64 Gitweb: https://git.kernel.org/tip/da3b3ce541259951ff4e087c20ff991f9056fa64 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:08:58 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Use consistent variable names for hwirqs
Use consistent variable names for hwirqs: when iterating, use "i", otherwise use "hwirq".
--- drivers/irqchip/irq-armada-370-xp.c | 56 ++++++++++++++-------------- 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +28 -28
@@ -117,7 +117,7 @@#define MPIC_SW_TRIG_INT 0x04#define MPIC_INT_SET_ENABLE 0x30#define MPIC_INT_CLEAR_ENABLE 0x34 -#define MPIC_INT_SOURCE_CTL (irq) (0x100 + (irq) * 4) +#define MPIC_INT_SOURCE_CTL (hwirq) (0x100 + (hwirq) * 4)#define MPIC_INT_SOURCE_CPU_MASK GENMASK(3, 0)#define MPIC_INT_IRQ_FIQ_MASK (cpuid) ((BIT(0) | BIT(8)) << (cpuid))
@@ -195,9 +195,9 @@ static inline unsigned int msi_doorbell_end(void)return mpic_is_ipi_available () ?PCI_MSI_DOORBELL_END :PCI_MSI_FULL_DOORBELL_END ; } -static inline bool mpic_is_percpu_irq (irq_hw_number_t irq) +static inline bool mpic_is_percpu_irq (irq_hw_number_t hwirq) { -return irq <=MPIC_MAX_PER_CPU_IRQS ; +return hwirq <=MPIC_MAX_PER_CPU_IRQS ; }/*
@@ -516,11 +516,11 @@ static void mpic_smp_cpu_init(void)static void mpic_reenable_percpu (void ) {/* Re-enable per-CPU interrupts that were enabled before suspend */ -for (unsigned int irq =0 ; irq <MPIC_MAX_PER_CPU_IRQS ; irq++) { +for (unsigned int i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) {struct irq_data *data;unsigned int virq; - virq =irq_linear_revmap (mpic_domain, irq); + virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ;
@@ -572,20 +572,20 @@ static struct irq_chip mpic_irq_chip = { };static int mpic_irq_map (struct irq_domain *h,unsigned int virq, -irq_hw_number_t hw) +irq_hw_number_t hwirq) {/* IRQs 0 and 1 cannot be mapped, they are handled internally */ -if (hw <=1 ) +if (hwirq <=1 )return -EINVAL ;mpic_irq_mask (irq_get_irq_data (virq)); -if (!mpic_is_percpu_irq (hw)) -writel (hw, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); +if (!mpic_is_percpu_irq (hwirq)) +writel (hwirq, per_cpu_int_base +MPIC_INT_CLEAR_MASK );else -writel (hw, main_int_base +MPIC_INT_SET_ENABLE ); +writel (hwirq, main_int_base +MPIC_INT_SET_ENABLE );irq_set_status_flags (virq,IRQ_LEVEL ); -if (mpic_is_percpu_irq (hw)) { +if (mpic_is_percpu_irq (hwirq)) {irq_set_percpu_devid (virq);irq_set_chip_and_handler (virq, &mpic_irq_chip, handle_percpu_devid_irq); }else {
@@ -638,15 +638,15 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, irqn, irqsrc, cpuid; +unsigned long irqmap, i, irqsrc, cpuid;chained_irq_enter (chip, desc); irqmap =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); cpuid =cpu_logical_map (smp_processor_id ()); -for_each_set_bit (irqn, &irqmap,BITS_PER_LONG ) { - irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (irqn)); +for_each_set_bit (i, &irqmap,BITS_PER_LONG ) { + irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (i));/* Check if the interrupt is not masked on current CPU. * Test IRQ (0-1) and FIQ (8-9) mask bits.
@@ -654,12 +654,12 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)if (!(irqsrc &MPIC_INT_IRQ_FIQ_MASK (cpuid)))continue ; -if (irqn ==0 || irqn ==1 ) { +if (i ==0 || i ==1 ) {mpic_handle_msi_irq ();continue ; } -generic_handle_domain_irq (mpic_domain, irqn); +generic_handle_domain_irq (mpic_domain, i); }chained_irq_exit (chip, desc);
@@ -667,26 +667,26 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc) static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs) { -u32 irqstat, irqnr; +u32 irqstat, i;do { irqstat =readl_relaxed (per_cpu_int_base +MPIC_CPU_INTACK ); - irqnr =FIELD_GET (MPIC_CPU_INTACK_IID_MASK , irqstat); + i =FIELD_GET (MPIC_CPU_INTACK_IID_MASK , irqstat); -if (irqnr >1022 ) +if (i >1022 )break ; -if (irqnr >1 ) { -generic_handle_domain_irq (mpic_domain, irqnr); +if (i >1 ) { +generic_handle_domain_irq (mpic_domain, i);continue ; }/* MSI handling */ -if (irqnr ==1 ) +if (i ==1 )mpic_handle_msi_irq ();/* IPI Handling */ -if (irqnr ==0 ) +if (i ==0 )mpic_handle_ipi_irq (); }while (1 ); }
@@ -703,24 +703,24 @@ static void mpic_resume(void)bool src0, src1;/* Re-enable interrupts */ -for (irq_hw_number_t irq =0 ; irq < mpic_domain->hwirq_max; irq++) { +for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) {struct irq_data *data;unsigned int virq; - virq =irq_linear_revmap (mpic_domain, irq); + virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; data =irq_get_irq_data (virq); -if (!mpic_is_percpu_irq (irq)) { +if (!mpic_is_percpu_irq (i)) {/* Non per-CPU interrupts */ -writel (irq, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); +writel (i, per_cpu_int_base +MPIC_INT_CLEAR_MASK );if (!irqd_irq_disabled (data))mpic_irq_unmask (data); }else {/* Per-CPU interrupts */ -writel (irq, main_int_base +MPIC_INT_SET_ENABLE ); +writel (i, main_int_base +MPIC_INT_SET_ENABLE );/* * Re-enable on the current CPU, mpic_reenable_percpu()
[tip: irq/core] irqchip/armada-370-xp: Use consistent variable names for hwirqs
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 66fc31034f96cbdef7687b1c55d600367e70287e Gitweb: https://git.kernel.org/tip/66fc31034f96cbdef7687b1c55d600367e70287e Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:08:58 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Use consistent variable names for hwirqs
Use consistent variable names for hwirqs: when iterating, use "i", otherwise use "hwirq".
--- drivers/irqchip/irq-armada-370-xp.c | 56 ++++++++++++++-------------- 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +28 -28
@@ -117,7 +117,7 @@#define MPIC_SW_TRIG_INT 0x04#define MPIC_INT_SET_ENABLE 0x30#define MPIC_INT_CLEAR_ENABLE 0x34 -#define MPIC_INT_SOURCE_CTL (irq) (0x100 + (irq) * 4) +#define MPIC_INT_SOURCE_CTL (hwirq) (0x100 + (hwirq) * 4)#define MPIC_INT_SOURCE_CPU_MASK GENMASK(3, 0)#define MPIC_INT_IRQ_FIQ_MASK (cpuid) ((BIT(0) | BIT(8)) << (cpuid))
@@ -195,9 +195,9 @@ static inline unsigned int msi_doorbell_end(void)return mpic_is_ipi_available () ?PCI_MSI_DOORBELL_END :PCI_MSI_FULL_DOORBELL_END ; } -static inline bool mpic_is_percpu_irq (irq_hw_number_t irq) +static inline bool mpic_is_percpu_irq (irq_hw_number_t hwirq) { -return irq <=MPIC_MAX_PER_CPU_IRQS ; +return hwirq <=MPIC_MAX_PER_CPU_IRQS ; }/*
@@ -516,11 +516,11 @@ static void mpic_smp_cpu_init(void)static void mpic_reenable_percpu (void ) {/* Re-enable per-CPU interrupts that were enabled before suspend */ -for (unsigned int irq =0 ; irq <MPIC_MAX_PER_CPU_IRQS ; irq++) { +for (unsigned int i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) {struct irq_data *data;unsigned int virq; - virq =irq_linear_revmap (mpic_domain, irq); + virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ;
@@ -572,20 +572,20 @@ static struct irq_chip mpic_irq_chip = { };static int mpic_irq_map (struct irq_domain *h,unsigned int virq, -irq_hw_number_t hw) +irq_hw_number_t hwirq) {/* IRQs 0 and 1 cannot be mapped, they are handled internally */ -if (hw <=1 ) +if (hwirq <=1 )return -EINVAL ;mpic_irq_mask (irq_get_irq_data (virq)); -if (!mpic_is_percpu_irq (hw)) -writel (hw, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); +if (!mpic_is_percpu_irq (hwirq)) +writel (hwirq, per_cpu_int_base +MPIC_INT_CLEAR_MASK );else -writel (hw, main_int_base +MPIC_INT_SET_ENABLE ); +writel (hwirq, main_int_base +MPIC_INT_SET_ENABLE );irq_set_status_flags (virq,IRQ_LEVEL ); -if (mpic_is_percpu_irq (hw)) { +if (mpic_is_percpu_irq (hwirq)) {irq_set_percpu_devid (virq);irq_set_chip_and_handler (virq, &mpic_irq_chip, handle_percpu_devid_irq); }else {
@@ -638,15 +638,15 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, irqn, irqsrc, cpuid; +unsigned long irqmap, i, irqsrc, cpuid;chained_irq_enter (chip, desc); irqmap =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); cpuid =cpu_logical_map (smp_processor_id ()); -for_each_set_bit (irqn, &irqmap,BITS_PER_LONG ) { - irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (irqn)); +for_each_set_bit (i, &irqmap,BITS_PER_LONG ) { + irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (i));/* Check if the interrupt is not masked on current CPU. * Test IRQ (0-1) and FIQ (8-9) mask bits.
@@ -654,12 +654,12 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc)if (!(irqsrc &MPIC_INT_IRQ_FIQ_MASK (cpuid)))continue ; -if (irqn ==0 || irqn ==1 ) { +if (i ==0 || i ==1 ) {mpic_handle_msi_irq ();continue ; } -generic_handle_domain_irq (mpic_domain, irqn); +generic_handle_domain_irq (mpic_domain, i); }chained_irq_exit (chip, desc);
@@ -667,26 +667,26 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc) static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs) { -u32 irqstat, irqnr; +u32 irqstat, i;do { irqstat =readl_relaxed (per_cpu_int_base +MPIC_CPU_INTACK ); - irqnr =FIELD_GET (MPIC_CPU_INTACK_IID_MASK , irqstat); + i =FIELD_GET (MPIC_CPU_INTACK_IID_MASK , irqstat); -if (irqnr >1022 ) +if (i >1022 )break ; -if (irqnr >1 ) { -generic_handle_domain_irq (mpic_domain, irqnr); +if (i >1 ) { +generic_handle_domain_irq (mpic_domain, i);continue ; }/* MSI handling */ -if (irqnr ==1 ) +if (i ==1 )mpic_handle_msi_irq ();/* IPI Handling */ -if (irqnr ==0 ) +if (i ==0 )mpic_handle_ipi_irq (); }while (1 ); }
@@ -703,24 +703,24 @@ static void mpic_resume(void)bool src0, src1;/* Re-enable interrupts */ -for (irq_hw_number_t irq =0 ; irq < mpic_domain->hwirq_max; irq++) { +for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) {struct irq_data *data;unsigned int virq; - virq =irq_linear_revmap (mpic_domain, irq); + virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; data =irq_get_irq_data (virq); -if (!mpic_is_percpu_irq (irq)) { +if (!mpic_is_percpu_irq (i)) {/* Non per-CPU interrupts */ -writel (irq, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); +writel (i, per_cpu_int_base +MPIC_INT_CLEAR_MASK );if (!irqd_irq_disabled (data))mpic_irq_unmask (data); }else {/* Per-CPU interrupts */ -writel (irq, main_int_base +MPIC_INT_SET_ENABLE ); +writel (i, main_int_base +MPIC_INT_SET_ENABLE );/* * Re-enable on the current CPU, mpic_reenable_percpu()
PATCH 2/10 irqchip/armada-370-xp: Use consistent types when iterating interrupts
In reply to Marek BehúnWhen iterating, use either the irq_hw_number_t type or the unsigned int type for the iterator variable, depending on whether the variable represents HW IRQ number or whether it is added to a IRQ number.
--- drivers/irqchip/irq-armada-370-xp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +10 -8
@@ -289,7 +289,7 @@ static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq,if (hwirq <0 )return -ENOSPC ; -for (int i =0 ; i < nr_irqs; i++) { +for (unsigned int i =0 ; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &mpic_msi_bottom_irq_chip, domain->host_data, handle_simple_irq,
@@ -438,7 +438,7 @@ static struct irq_chip mpic_ipi_irqchip = {static int mpic_ipi_alloc (struct irq_domain *d,unsigned int virq,unsigned int nr_irqs,void *args) { -for (int i =0 ; i < nr_irqs; i++) { +for (unsigned int i =0 ; i < nr_irqs; i++) {irq_set_percpu_devid (virq + i); irq_domain_set_info(d, virq + i, i, &mpic_ipi_irqchip, d->host_data, handle_percpu_devid_irq,
@@ -461,7 +461,7 @@ static const struct irq_domain_ops mpic_ipi_domain_ops = {static void mpic_ipi_resume (void ) { -for (int i =0 ; i <IPI_DOORBELL_END ; i++) { +for (irq_hw_number_t i =0 ; i <IPI_DOORBELL_END ; i++) {unsigned int virq =irq_find_mapping (mpic_ipi_domain, i);struct irq_data *d;
@@ -511,7 +511,7 @@ static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,static void mpic_smp_cpu_init (void ) { -for (int i =0 ; i < mpic_domain->hwirq_max; i++) +for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++)writel (i, per_cpu_int_base +MPIC_INT_SET_MASK );if (!mpic_is_ipi_available ())
@@ -530,7 +530,7 @@ static void mpic_smp_cpu_init(void)static void mpic_reenable_percpu (void ) {/* Re-enable per-CPU interrupts that were enabled before suspend */ -for (unsigned int i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { +for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) {struct irq_data *data;unsigned int virq;
@@ -654,7 +654,8 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, i, irqsrc, cpuid; +unsigned long irqmap, irqsrc, cpuid; +irq_hw_number_t i;chained_irq_enter (chip, desc);
@@ -683,7 +684,8 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc) static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs) { -u32 irqstat, i; +irq_hw_number_t i; +u32 irqstat; do { irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
@@ -799,7 +801,7 @@ static int __init mpic_of_init(struct device_node *node, nr_irqs =FIELD_GET (MPIC_INT_CONTROL_NUMINT_MASK ,readl (main_int_base +MPIC_INT_CONTROL )); -for (int i =0 ; i < nr_irqs; i++) +for (irq_hw_number_t i =0 ; i < nr_irqs; i++)writel (i, main_int_base +MPIC_INT_CLEAR_ENABLE ); mpic_domain =irq_domain_add_linear (node, nr_irqs, &mpic_irq_ops,NULL );
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Use consistent types when iterating interrupts
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: bb6d30540c5f6c2035c07c885f4117b33d4e549a Gitweb: https://git.kernel.org/tip/bb6d30540c5f6c2035c07c885f4117b33d4e549a Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:08:59 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Use consistent types when iterating interrupts
When iterating, use either the irq_hw_number_t type or the unsigned int type for the iterator variable, depending on whether the variable represents HW IRQ number or whether it is added to a IRQ number.
--- drivers/irqchip/irq-armada-370-xp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +10 -8
@@ -284,7 +284,7 @@ static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq, unsignedif (hwirq <0 )return -ENOSPC ; -for (int i =0 ; i < nr_irqs; i++) { +for (unsigned int i =0 ; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &mpic_msi_bottom_irq_chip, domain->host_data, handle_simple_irq,
@@ -429,7 +429,7 @@ static struct irq_chip mpic_ipi_irqchip = {static int mpic_ipi_alloc (struct irq_domain *d,unsigned int virq,unsigned int nr_irqs,void *args) { -for (int i =0 ; i < nr_irqs; i++) { +for (unsigned int i =0 ; i < nr_irqs; i++) {irq_set_percpu_devid (virq + i);irq_domain_set_info (d, virq + i, i, &mpic_ipi_irqchip, d->host_data, handle_percpu_devid_irq,NULL ,NULL );
@@ -451,7 +451,7 @@ static const struct irq_domain_ops mpic_ipi_domain_ops = {static void mpic_ipi_resume (void ) { -for (int i =0 ; i <IPI_DOORBELL_END ; i++) { +for (irq_hw_number_t i =0 ; i <IPI_DOORBELL_END ; i++) {unsigned int virq =irq_find_mapping (mpic_ipi_domain, i);struct irq_data *d;
@@ -497,7 +497,7 @@ static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,static void mpic_smp_cpu_init (void ) { -for (int i =0 ; i < mpic_domain->hwirq_max; i++) +for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++)writel (i, per_cpu_int_base +MPIC_INT_SET_MASK );if (!mpic_is_ipi_available ())
@@ -516,7 +516,7 @@ static void mpic_smp_cpu_init(void)static void mpic_reenable_percpu (void ) {/* Re-enable per-CPU interrupts that were enabled before suspend */ -for (unsigned int i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { +for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) {struct irq_data *data;unsigned int virq;
@@ -638,7 +638,8 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, i, irqsrc, cpuid; +unsigned long irqmap, irqsrc, cpuid; +irq_hw_number_t i;chained_irq_enter (chip, desc);
@@ -667,7 +668,8 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc) static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs) { -u32 irqstat, i; +irq_hw_number_t i; +u32 irqstat; do { irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
@@ -782,7 +784,7 @@ static int __init mpic_of_init(struct device_node *node, nr_irqs =FIELD_GET (MPIC_INT_CONTROL_NUMINT_MASK ,readl (main_int_base +MPIC_INT_CONTROL )); -for (int i =0 ; i < nr_irqs; i++) +for (irq_hw_number_t i =0 ; i < nr_irqs; i++)writel (i, main_int_base +MPIC_INT_CLEAR_ENABLE ); mpic_domain =irq_domain_add_linear (node, nr_irqs, &mpic_irq_ops,NULL );
[tip: irq/core] irqchip/armada-370-xp: Use consistent types when iterating interrupts
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: a5d32b7475fffe2506fa374b1d6b4a74fa13020c Gitweb: https://git.kernel.org/tip/a5d32b7475fffe2506fa374b1d6b4a74fa13020c Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:08:59 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Use consistent types when iterating interrupts
When iterating, use either the irq_hw_number_t type or the unsigned int type for the iterator variable, depending on whether the variable represents HW IRQ number or whether it is added to a IRQ number.
--- drivers/irqchip/irq-armada-370-xp.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +10 -8
@@ -284,7 +284,7 @@ static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq, unsignedif (hwirq <0 )return -ENOSPC ; -for (int i =0 ; i < nr_irqs; i++) { +for (unsigned int i =0 ; i < nr_irqs; i++) { irq_domain_set_info(domain, virq + i, hwirq + i, &mpic_msi_bottom_irq_chip, domain->host_data, handle_simple_irq,
@@ -429,7 +429,7 @@ static struct irq_chip mpic_ipi_irqchip = {static int mpic_ipi_alloc (struct irq_domain *d,unsigned int virq,unsigned int nr_irqs,void *args) { -for (int i =0 ; i < nr_irqs; i++) { +for (unsigned int i =0 ; i < nr_irqs; i++) {irq_set_percpu_devid (virq + i);irq_domain_set_info (d, virq + i, i, &mpic_ipi_irqchip, d->host_data, handle_percpu_devid_irq,NULL ,NULL );
@@ -451,7 +451,7 @@ static const struct irq_domain_ops mpic_ipi_domain_ops = {static void mpic_ipi_resume (void ) { -for (int i =0 ; i <IPI_DOORBELL_END ; i++) { +for (irq_hw_number_t i =0 ; i <IPI_DOORBELL_END ; i++) {unsigned int virq =irq_find_mapping (mpic_ipi_domain, i);struct irq_data *d;
@@ -497,7 +497,7 @@ static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,static void mpic_smp_cpu_init (void ) { -for (int i =0 ; i < mpic_domain->hwirq_max; i++) +for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++)writel (i, per_cpu_int_base +MPIC_INT_SET_MASK );if (!mpic_is_ipi_available ())
@@ -516,7 +516,7 @@ static void mpic_smp_cpu_init(void)static void mpic_reenable_percpu (void ) {/* Re-enable per-CPU interrupts that were enabled before suspend */ -for (unsigned int i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { +for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) {struct irq_data *data;unsigned int virq;
@@ -638,7 +638,8 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, i, irqsrc, cpuid; +unsigned long irqmap, irqsrc, cpuid; +irq_hw_number_t i;chained_irq_enter (chip, desc);
@@ -667,7 +668,8 @@ static void mpic_handle_cascade_irq(struct irq_desc *desc) static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs) { -u32 irqstat, i; +irq_hw_number_t i; +u32 irqstat; do { irqstat = readl_relaxed(per_cpu_int_base + MPIC_CPU_INTACK);
@@ -782,7 +784,7 @@ static int __init mpic_of_init(struct device_node *node, nr_irqs =FIELD_GET (MPIC_INT_CONTROL_NUMINT_MASK ,readl (main_int_base +MPIC_INT_CONTROL )); -for (int i =0 ; i < nr_irqs; i++) +for (irq_hw_number_t i =0 ; i < nr_irqs; i++)writel (i, main_int_base +MPIC_INT_CLEAR_ENABLE ); mpic_domain =irq_domain_add_linear (node, nr_irqs, &mpic_irq_ops,NULL );
PATCH 3/10 irqchip/armada-370-xp: Use consistent name for struct irq_data variables
In reply to Marek BehúnAlways use variable name "d" for struct irq_data *, for consistency.
--- drivers/irqchip/irq-armada-370-xp.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +14 -14
@@ -243,17 +243,17 @@ static struct msi_domain_info mpic_msi_domain_info = { .chip = &mpic_msi_irq_chip, }; -static void mpic_compose_msi_msg (struct irq_data *data,struct msi_msg *msg) +static void mpic_compose_msi_msg (struct irq_data *d,struct msi_msg *msg) { -unsigned int cpu =cpumask_first (irq_data_get_effective_affinity_mask (data)); +unsigned int cpu =cpumask_first (irq_data_get_effective_affinity_mask (d)); msg->address_lo =lower_32_bits (msi_doorbell_addr); msg->address_hi =upper_32_bits (msi_doorbell_addr); - msg->data =BIT (cpu +8 ) | (data->hwirq +msi_doorbell_start ()); + msg->data =BIT (cpu +8 ) | (d->hwirq +msi_doorbell_start ()); } -static int mpic_msi_set_affinity (struct irq_data *irq_data, -const struct cpumask *mask,bool force) +static int mpic_msi_set_affinity (struct irq_data *d,const struct cpumask *mask, +bool force) {unsigned int cpu;
@@ -265,7 +265,7 @@ static int mpic_msi_set_affinity(struct irq_data *irq_data,if (cpu >= nr_cpu_ids)return -EINVAL ; -irq_data_update_effective_affinity (irq_data,cpumask_of (cpu)); +irq_data_update_effective_affinity (d,cpumask_of (cpu));return IRQ_SET_MASK_OK ; }
@@ -531,19 +531,19 @@ static void mpic_reenable_percpu(void) {/* Re-enable per-CPU interrupts that were enabled before suspend */ for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { -struct irq_data *data; +struct irq_data *d;unsigned int virq; virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; - data =irq_get_irq_data (virq); + d =irq_get_irq_data (virq);if (!irq_percpu_is_enabled (virq))continue ; -mpic_irq_unmask (data); +mpic_irq_unmask (d); }if (mpic_is_ipi_available ())
@@ -722,20 +722,20 @@ static void mpic_resume(void)/* Re-enable interrupts */ for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) { -struct irq_data *data; +struct irq_data *d;unsigned int virq; virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; - data =irq_get_irq_data (virq); + d =irq_get_irq_data (virq);if (!mpic_is_percpu_irq (i)) {/* Non per-CPU interrupts */ writel (i, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); -if (!irqd_irq_disabled (data)) -mpic_irq_unmask (data); +if (!irqd_irq_disabled (d)) +mpic_irq_unmask (d); }else {/* Per-CPU interrupts */ writel (i, main_int_base +MPIC_INT_SET_ENABLE );
@@ -745,7 +745,7 @@ static void mpic_resume(void)* will take care of secondary CPUs when they come up. */ if (irq_percpu_is_enabled (virq)) -mpic_irq_unmask (data); +mpic_irq_unmask (d); } }
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Use consistent name for struct irq_data variables
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: f72976cd7f0e16639f29398d5fe5ab1b03789b42 Gitweb: https://git.kernel.org/tip/f72976cd7f0e16639f29398d5fe5ab1b03789b42 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:00 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Use consistent name for struct irq_data variables
Always use variable name "d" for struct irq_data *, for consistency.
--- drivers/irqchip/irq-armada-370-xp.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +12 -12
@@ -239,13 +239,13 @@ static struct msi_domain_info mpic_msi_domain_info = { .chip = &mpic_msi_irq_chip, }; -static void mpic_compose_msi_msg (struct irq_data *data,struct msi_msg *msg) +static void mpic_compose_msi_msg (struct irq_data *d,struct msi_msg *msg) { -unsigned int cpu =cpumask_first (irq_data_get_effective_affinity_mask (data)); +unsigned int cpu =cpumask_first (irq_data_get_effective_affinity_mask (d)); msg->address_lo =lower_32_bits (msi_doorbell_addr); msg->address_hi =upper_32_bits (msi_doorbell_addr); - msg->data =BIT (cpu +8 ) | (data->hwirq +msi_doorbell_start ()); + msg->data =BIT (cpu +8 ) | (d->hwirq +msi_doorbell_start ()); }static int mpic_msi_set_affinity (struct irq_data *irq_data,const struct cpumask *mask,bool force)
@@ -260,7 +260,7 @@ static int mpic_msi_set_affinity(struct irq_data *irq_data, const struct cpumaskif (cpu >= nr_cpu_ids)return -EINVAL ; -irq_data_update_effective_affinity (irq_data,cpumask_of (cpu)); +irq_data_update_effective_affinity (d,cpumask_of (cpu));return IRQ_SET_MASK_OK ; }
@@ -517,19 +517,19 @@ static void mpic_reenable_percpu(void) {/* Re-enable per-CPU interrupts that were enabled before suspend */ for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { -struct irq_data *data; +struct irq_data *d;unsigned int virq; virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; - data =irq_get_irq_data (virq); + d =irq_get_irq_data (virq);if (!irq_percpu_is_enabled (virq))continue ; -mpic_irq_unmask (data); +mpic_irq_unmask (d); }if (mpic_is_ipi_available ())
@@ -706,20 +706,20 @@ static void mpic_resume(void)/* Re-enable interrupts */ for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) { -struct irq_data *data; +struct irq_data *d;unsigned int virq; virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; - data =irq_get_irq_data (virq); + d =irq_get_irq_data (virq);if (!mpic_is_percpu_irq (i)) {/* Non per-CPU interrupts */ writel (i, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); -if (!irqd_irq_disabled (data)) -mpic_irq_unmask (data); +if (!irqd_irq_disabled (d)) +mpic_irq_unmask (d); }else {/* Per-CPU interrupts */ writel (i, main_int_base +MPIC_INT_SET_ENABLE );
@@ -729,7 +729,7 @@ static void mpic_resume(void)* will take care of secondary CPUs when they come up. */ if (irq_percpu_is_enabled (virq)) -mpic_irq_unmask (data); +mpic_irq_unmask (d); } }
[tip: irq/core] irqchip/armada-370-xp: Use consistent name for struct irq_data variables
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 0d4b1fcd378ea61ff76bedf0d484eac69c028c57 Gitweb: https://git.kernel.org/tip/0d4b1fcd378ea61ff76bedf0d484eac69c028c57 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:00 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Use consistent name for struct irq_data variables
Always use variable name "d" for struct irq_data *, for consistency.
--- drivers/irqchip/irq-armada-370-xp.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +13 -13
@@ -239,16 +239,16 @@ static struct msi_domain_info mpic_msi_domain_info = { .chip = &mpic_msi_irq_chip, }; -static void mpic_compose_msi_msg (struct irq_data *data,struct msi_msg *msg) +static void mpic_compose_msi_msg (struct irq_data *d,struct msi_msg *msg) { -unsigned int cpu =cpumask_first (irq_data_get_effective_affinity_mask (data)); +unsigned int cpu =cpumask_first (irq_data_get_effective_affinity_mask (d)); msg->address_lo =lower_32_bits (msi_doorbell_addr); msg->address_hi =upper_32_bits (msi_doorbell_addr); - msg->data =BIT (cpu +8 ) | (data->hwirq +msi_doorbell_start ()); + msg->data =BIT (cpu +8 ) | (d->hwirq +msi_doorbell_start ()); } -static int mpic_msi_set_affinity (struct irq_data *irq_data,const struct cpumask *mask,bool force) +static int mpic_msi_set_affinity (struct irq_data *d,const struct cpumask *mask,bool force) {unsigned int cpu;
@@ -260,7 +260,7 @@ static int mpic_msi_set_affinity(struct irq_data *irq_data, const struct cpumaskif (cpu >= nr_cpu_ids)return -EINVAL ; -irq_data_update_effective_affinity (irq_data,cpumask_of (cpu)); +irq_data_update_effective_affinity (d,cpumask_of (cpu));return IRQ_SET_MASK_OK ; }
@@ -517,19 +517,19 @@ static void mpic_reenable_percpu(void) {/* Re-enable per-CPU interrupts that were enabled before suspend */ for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { -struct irq_data *data; +struct irq_data *d;unsigned int virq; virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; - data =irq_get_irq_data (virq); + d =irq_get_irq_data (virq);if (!irq_percpu_is_enabled (virq))continue ; -mpic_irq_unmask (data); +mpic_irq_unmask (d); }if (mpic_is_ipi_available ())
@@ -706,20 +706,20 @@ static void mpic_resume(void)/* Re-enable interrupts */ for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) { -struct irq_data *data; +struct irq_data *d;unsigned int virq; virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ; - data =irq_get_irq_data (virq); + d =irq_get_irq_data (virq);if (!mpic_is_percpu_irq (i)) {/* Non per-CPU interrupts */ writel (i, per_cpu_int_base +MPIC_INT_CLEAR_MASK ); -if (!irqd_irq_disabled (data)) -mpic_irq_unmask (data); +if (!irqd_irq_disabled (d)) +mpic_irq_unmask (d); }else {/* Per-CPU interrupts */ writel (i, main_int_base +MPIC_INT_SET_ENABLE );
@@ -729,7 +729,7 @@ static void mpic_resume(void)* will take care of secondary CPUs when they come up. */ if (irq_percpu_is_enabled (virq)) -mpic_irq_unmask (data); +mpic_irq_unmask (d); } }
PATCH 4/10 irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
In reply to Marek BehúnRefactor the mpic_reenable_percpu() and mpic_resume() functions to make them a little bit simpler.
--- drivers/irqchip/irq-armada-370-xp.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +3 -9
@@ -531,18 +531,13 @@ static void mpic_reenable_percpu(void) {/* Re-enable per-CPU interrupts that were enabled before suspend */ for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { +unsigned int virq =irq_linear_revmap (mpic_domain, i);struct irq_data *d; -unsigned int virq; - virq =irq_linear_revmap (mpic_domain, i); -if (!virq) +if (!virq || !irq_percpu_is_enabled (virq))continue ; d =irq_get_irq_data (virq); - -if (!irq_percpu_is_enabled (virq)) -continue ; -mpic_irq_unmask (d); }
@@ -722,10 +717,9 @@ static void mpic_resume(void)/* Re-enable interrupts */ for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) { +unsigned int virq =irq_linear_revmap (mpic_domain, i);struct irq_data *d; -unsigned int virq; - virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ;
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: e1ed69fb599823fb04372b2a02bc3cbf7deb23c3 Gitweb: https://git.kernel.org/tip/e1ed69fb599823fb04372b2a02bc3cbf7deb23c3 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:01 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
Refactor the mpic_reenable_percpu() and mpic_resume() functions to make them a little bit simpler.
--- drivers/irqchip/irq-armada-370-xp.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +3 -9
@@ -517,18 +517,13 @@ static void mpic_reenable_percpu(void) {/* Re-enable per-CPU interrupts that were enabled before suspend */ for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { +unsigned int virq =irq_linear_revmap (mpic_domain, i);struct irq_data *d; -unsigned int virq; - virq =irq_linear_revmap (mpic_domain, i); -if (!virq) +if (!virq || !irq_percpu_is_enabled (virq))continue ; d =irq_get_irq_data (virq); - -if (!irq_percpu_is_enabled (virq)) -continue ; -mpic_irq_unmask (d); }
@@ -706,10 +701,9 @@ static void mpic_resume(void)/* Re-enable interrupts */ for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) { +unsigned int virq =irq_linear_revmap (mpic_domain, i);struct irq_data *d; -unsigned int virq; - virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ;
[tip: irq/core] irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 15a50eeaadc169243b00ec90087f689a8a28848e Gitweb: https://git.kernel.org/tip/15a50eeaadc169243b00ec90087f689a8a28848e Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:01 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()
Refactor the mpic_reenable_percpu() and mpic_resume() functions to make them a little bit simpler.
--- drivers/irqchip/irq-armada-370-xp.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +3 -9
@@ -517,18 +517,13 @@ static void mpic_reenable_percpu(void) {/* Re-enable per-CPU interrupts that were enabled before suspend */ for (irq_hw_number_t i =0 ; i <MPIC_MAX_PER_CPU_IRQS ; i++) { +unsigned int virq =irq_linear_revmap (mpic_domain, i);struct irq_data *d; -unsigned int virq; - virq =irq_linear_revmap (mpic_domain, i); -if (!virq) +if (!virq || !irq_percpu_is_enabled (virq))continue ; d =irq_get_irq_data (virq); - -if (!irq_percpu_is_enabled (virq)) -continue ; -mpic_irq_unmask (d); }
@@ -706,10 +701,9 @@ static void mpic_resume(void)/* Re-enable interrupts */ for (irq_hw_number_t i =0 ; i < mpic_domain->hwirq_max; i++) { +unsigned int virq =irq_linear_revmap (mpic_domain, i);struct irq_data *d; -unsigned int virq; - virq =irq_linear_revmap (mpic_domain, i);if (!virq)continue ;
PATCH 5/10 irqchip/armada-370-xp: Drop unneeded curly brackets
In reply to Marek BehúnDrop unneeded curly brackets in mpic_msi_alloc().
--- drivers/irqchip/irq-armada-370-xp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +1 -2
@@ -289,12 +289,11 @@ static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq,if (hwirq <0 )return -ENOSPC ; -for (unsigned int i =0 ; i < nr_irqs; i++) { +for (unsigned int i =0 ; i < nr_irqs; i++)irq_domain_set_info (domain, virq + i, hwirq + i, &mpic_msi_bottom_irq_chip, domain->host_data, handle_simple_irq,NULL ,NULL ); - }return 0 ; }
Signature · 1 line
2.44.2
Re: [PATCH 05/10] irqchip/armada-370-xp: Drop unneeded curly brackets
Quoted 1 line · Marek Behún
Drop unneeded curly brackets in
mpic_msi_alloc().
No.
https://www.kernel.org/doc/html/latest/process/maintainer-tip.html#bracket-rules
PATCH 6/10 irqchip/armada-370-xp: Drop redundant continue
In reply to Marek BehúnDrop redundant continue from mpic_handle_irq().
--- drivers/irqchip/irq-armada-370-xp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +1 -3
@@ -688,10 +688,8 @@ static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)if (i >1022 )break ; -if (i >1 ) { +if (i >1 )generic_handle_domain_irq (mpic_domain, i); -continue ; - }/* MSI handling */ if (i ==1 )
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Drop redundant continue
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 9424aba41d43204236fe0d1af322c021d14b9f8a Gitweb: https://git.kernel.org/tip/9424aba41d43204236fe0d1af322c021d14b9f8a Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:03 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Drop redundant continue
Drop redundant continue from mpic_handle_irq().
--- drivers/irqchip/irq-armada-370-xp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +1 -3
@@ -673,10 +673,8 @@ static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)if (i >1022 )break ; -if (i >1 ) { +if (i >1 )generic_handle_domain_irq (mpic_domain, i); -continue ; - }/* MSI handling */ if (i ==1 )
[tip: irq/core] irqchip/armada-370-xp: Drop redundant continue
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 081b64cc872707f80a23e41f0ab12852716551b2 Gitweb: https://git.kernel.org/tip/081b64cc872707f80a23e41f0ab12852716551b2 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:03 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Drop redundant continue
Drop redundant continue from mpic_handle_irq().
--- drivers/irqchip/irq-armada-370-xp.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +1 -3
@@ -673,10 +673,8 @@ static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)if (i >1022 )break ; -if (i >1 ) { +if (i >1 )generic_handle_domain_irq (mpic_domain, i); -continue ; - }/* MSI handling */ if (i ==1 )
PATCH 7/10 irqchip/armada-370-xp: Rename variable for consistency
In reply to Marek BehúnRename the variable holding the cause register to "cause" in mpic_handle_cascade_irq().
--- drivers/irqchip/irq-armada-370-xp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +3 -3
@@ -648,15 +648,15 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, irqsrc, cpuid; +unsigned long cause, irqsrc, cpuid;irq_hw_number_t i;chained_irq_enter (chip, desc); - irqmap =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); + cause =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); cpuid =cpu_logical_map (smp_processor_id ()); -for_each_set_bit (i, &irqmap,BITS_PER_LONG ) { +for_each_set_bit (i, &cause,BITS_PER_LONG ) { irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (i));/* Check if the interrupt is not masked on current CPU.
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Rename variable for consistency
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: e827b6cb64b412a6b52e5fc0f453013ac98032f6 Gitweb: https://git.kernel.org/tip/e827b6cb64b412a6b52e5fc0f453013ac98032f6 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:04 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Rename variable for consistency
Rename the variable holding the cause register to "cause" in mpic_handle_cascade_irq().
--- drivers/irqchip/irq-armada-370-xp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +3 -3
@@ -633,15 +633,15 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, irqsrc, cpuid; +unsigned long cause, irqsrc, cpuid;irq_hw_number_t i;chained_irq_enter (chip, desc); - irqmap =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); + cause =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); cpuid =cpu_logical_map (smp_processor_id ()); -for_each_set_bit (i, &irqmap,BITS_PER_LONG ) { +for_each_set_bit (i, &cause,BITS_PER_LONG ) { irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (i));/* Check if the interrupt is not masked on current CPU.
[tip: irq/core] irqchip/armada-370-xp: Rename variable for consistency
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: ac0ae59db6f521223b477677d2ff51e26815b114 Gitweb: https://git.kernel.org/tip/ac0ae59db6f521223b477677d2ff51e26815b114 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:04 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Rename variable for consistency
Rename the variable holding the cause register to "cause" in mpic_handle_cascade_irq().
--- drivers/irqchip/irq-armada-370-xp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +3 -3
@@ -633,15 +633,15 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long irqmap, irqsrc, cpuid; +unsigned long cause, irqsrc, cpuid;irq_hw_number_t i;chained_irq_enter (chip, desc); - irqmap =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); + cause =readl_relaxed (per_cpu_int_base +MPIC_PPI_CAUSE ); cpuid =cpu_logical_map (smp_processor_id ()); -for_each_set_bit (i, &irqmap,BITS_PER_LONG ) { +for_each_set_bit (i, &cause,BITS_PER_LONG ) { irqsrc =readl_relaxed (main_int_base +MPIC_INT_SOURCE_CTL (i));/* Check if the interrupt is not masked on current CPU.
PATCH 8/10 irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
In reply to Marek BehúnFor consistency across the driver, use the u32 type instead of unsigned long for holding register values and return value of cpu_logical_map().
One exception is when the variable is referenced for passing into for_each_set_bit(), in which case it has to be unsigned long.
--- drivers/irqchip/irq-armada-370-xp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +4 -3
@@ -365,7 +365,7 @@ static inline int mpic_msi_init(struct device_node *node,static void mpic_perf_init (void ) { -unsigned long cpuid; +u32 cpuid;/* * This Performance Counter Overflow interrupt is specific for
@@ -404,8 +404,8 @@ static void mpic_ipi_unmask(struct irq_data *d)static void mpic_ipi_send_mask (struct irq_data *d,const struct cpumask *mask) { -unsigned long map =0 ;unsigned int cpu; +u32 map =0 ;/* Convert our logical CPU mask into a physical one. */ for_each_cpu (cpu, mask)
@@ -648,7 +648,8 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long cause, irqsrc, cpuid; +unsigned long cause; +u32 irqsrc, cpuid;irq_hw_number_t i;chained_irq_enter (chip, desc);
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 33950cdeab2ebc7644db556a0c3f486ca0296027 Gitweb: https://git.kernel.org/tip/33950cdeab2ebc7644db556a0c3f486ca0296027 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:05 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
For consistency across the driver, use the u32 type instead of unsigned long for holding register values and return value of cpu_logical_map().
One exception is when the variable is referenced for passing into for_each_set_bit(), in which case it has to be unsigned long.
--- drivers/irqchip/irq-armada-370-xp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +4 -3
@@ -357,7 +357,7 @@ static inline int mpic_msi_init(struct device_node *node,static void mpic_perf_init (void ) { -unsigned long cpuid; +u32 cpuid;/* * This Performance Counter Overflow interrupt is specific for
@@ -396,8 +396,8 @@ static void mpic_ipi_unmask(struct irq_data *d)static void mpic_ipi_send_mask (struct irq_data *d,const struct cpumask *mask) { -unsigned long map =0 ;unsigned int cpu; +u32 map =0 ;/* Convert our logical CPU mask into a physical one. */ for_each_cpu (cpu, mask)
@@ -633,7 +633,8 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long cause, irqsrc, cpuid; +unsigned long cause; +u32 irqsrc, cpuid;irq_hw_number_t i;chained_irq_enter (chip, desc);
[tip: irq/core] irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 625f0582f05d1f496ecd598323df1c8bfcdcbd6f Gitweb: https://git.kernel.org/tip/625f0582f05d1f496ecd598323df1c8bfcdcbd6f Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:05 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:48 +02:00
irqchip/armada-370-xp: Use u32 type instead of unsigned long where possieble
For consistency across the driver, use the u32 type instead of unsigned long for holding register values and return value of cpu_logical_map().
One exception is when the variable is referenced for passing into for_each_set_bit(), in which case it has to be unsigned long.
--- drivers/irqchip/irq-armada-370-xp.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +4 -3
@@ -357,7 +357,7 @@ static inline int mpic_msi_init(struct device_node *node,static void mpic_perf_init (void ) { -unsigned long cpuid; +u32 cpuid;/* * This Performance Counter Overflow interrupt is specific for
@@ -396,8 +396,8 @@ static void mpic_ipi_unmask(struct irq_data *d)static void mpic_ipi_send_mask (struct irq_data *d,const struct cpumask *mask) { -unsigned long map =0 ;unsigned int cpu; +u32 map =0 ;/* Convert our logical CPU mask into a physical one. */ for_each_cpu (cpu, mask)
@@ -633,7 +633,8 @@ static inline void mpic_handle_ipi_irq(void) {}static void mpic_handle_cascade_irq (struct irq_desc *desc) {struct irq_chip *chip =irq_desc_get_chip (desc); -unsigned long cause, irqsrc, cpuid; +unsigned long cause; +u32 irqsrc, cpuid;irq_hw_number_t i;chained_irq_enter (chip, desc);
PATCH 9/10 irqchip/armada-370-xp: Refactor initial memory regions mapping
In reply to Marek BehúnRefactor the initial memory regions mapping:
- put into its own function
- return error numbers on failure
- use WARN_ON() instead of BUG_ON()
--- drivers/irqchip/irq-armada-370-xp.c | 62 ++++++++++++++++++++--------- 1 file changed, 44 insertions(+), 18 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +44 -18
@@ -12,6 +12,7 @@#include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/err.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h>
@@ -766,29 +767,54 @@ static struct syscore_ops mpic_syscore_ops = { .resume = mpic_resume, }; +static int __init mpic_map_region (struct device_node *np,int index, +void __iomem **base,phys_addr_t *phys_base) +{ +struct resource res; +int err; + + err =of_address_to_resource (np, index, &res); +if (WARN_ON (err)) + goto fail; + +if (WARN_ON (!request_mem_region (res.start,resource_size (&res), + np->full_name))) { + err = -EBUSY ; + goto fail; + } + + *base =ioremap (res.start,resource_size (&res)); +if (WARN_ON (!*base)) { + err = -ENOMEM ; + goto fail; + } + +if (phys_base) + *phys_base = res.start; + +return 0 ; + +fail: +pr_err ("%pOF: Unable to map resource %d: %pE\n" , np, index, +ERR_PTR (err)); + +return err; +} +static int __init mpic_of_init (struct device_node *node,struct device_node *parent) { -struct resource main_int_res, per_cpu_int_res; +phys_addr_t phys_base;unsigned int nr_irqs; +int err; -BUG_ON (of_address_to_resource (node,0 , &main_int_res)); -BUG_ON (of_address_to_resource (node,1 , &per_cpu_int_res)); - -BUG_ON (!request_mem_region (main_int_res.start, -resource_size (&main_int_res), - node->full_name)); -BUG_ON (!request_mem_region (per_cpu_int_res.start, -resource_size (&per_cpu_int_res), - node->full_name)); - - main_int_base =ioremap (main_int_res.start, -resource_size (&main_int_res)); -BUG_ON (!main_int_base); + err =mpic_map_region (node,0 , &main_int_base, &phys_base); +if (err) +return err; - per_cpu_int_base =ioremap (per_cpu_int_res.start, -resource_size (&per_cpu_int_res)); -BUG_ON (!per_cpu_int_base); + err =mpic_map_region (node,1 , &per_cpu_int_base,NULL ); +if (err) +return err; nr_irqs =FIELD_GET (MPIC_INT_CONTROL_NUMINT_MASK ,readl (main_int_base +MPIC_INT_CONTROL ));
@@ -810,7 +836,7 @@ static int __init mpic_of_init(struct device_node *node,mpic_perf_init ();mpic_smp_cpu_init (); -mpic_msi_init (node, main_int_res.start); +mpic_msi_init (node, phys_base);if (parent_irq <=0 ) {irq_set_default_host (mpic_domain);
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Refactor initial memory regions mapping
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 732639e1d5f0f4b5135833de63ad4e4b79cbfd78 Gitweb: https://git.kernel.org/tip/732639e1d5f0f4b5135833de63ad4e4b79cbfd78 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:06 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:24 +02:00
irqchip/armada-370-xp: Refactor initial memory regions mapping
Refactor the initial memory regions mapping:
- put into its own function
- return error numbers on failure
- use WARN_ON() instead of BUG_ON()
--- drivers/irqchip/irq-armada-370-xp.c | 60 +++++++++++++++++++--------- 1 file changed, 41 insertions(+), 19 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +41 -19
@@ -12,6 +12,7 @@#include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/err.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h>
@@ -751,29 +752,50 @@ static struct syscore_ops mpic_syscore_ops = { .resume = mpic_resume, }; -static int __init mpic_of_init (struct device_node *node, -struct device_node *parent) +static int __init mpic_map_region (struct device_node *np,int index, +void __iomem **base,phys_addr_t *phys_base) { -struct resource main_int_res, per_cpu_int_res; -unsigned int nr_irqs; +struct resource res; +int err; + + err =of_address_to_resource (np, index, &res); +if (WARN_ON (err)) + goto fail; + +if (WARN_ON (!request_mem_region (res.start,resource_size (&res), np->full_name))) { + err = -EBUSY ; + goto fail; + } + + *base =ioremap (res.start,resource_size (&res)); +if (WARN_ON (!*base)) { + err = -ENOMEM ; + goto fail; + } -BUG_ON (of_address_to_resource (node,0 , &main_int_res)); -BUG_ON (of_address_to_resource (node,1 , &per_cpu_int_res)); +if (phys_base) + *phys_base = res.start; -BUG_ON (!request_mem_region (main_int_res.start, -resource_size (&main_int_res), - node->full_name)); -BUG_ON (!request_mem_region (per_cpu_int_res.start, -resource_size (&per_cpu_int_res), - node->full_name)); +return 0 ; + +fail: +pr_err ("%pOF: Unable to map resource %d: %pE\n" , np, index,ERR_PTR (err)); +return err; +} + +static int __init mpic_of_init (struct device_node *node,struct device_node *parent) +{ +phys_addr_t phys_base; +unsigned int nr_irqs; +int err; - main_int_base =ioremap (main_int_res.start, -resource_size (&main_int_res)); -BUG_ON (!main_int_base); + err =mpic_map_region (node,0 , &main_int_base, &phys_base); +if (err) +return err; - per_cpu_int_base =ioremap (per_cpu_int_res.start, -resource_size (&per_cpu_int_res)); -BUG_ON (!per_cpu_int_base); + err =mpic_map_region (node,1 , &per_cpu_int_base,NULL ); +if (err) +return err; nr_irqs =FIELD_GET (MPIC_INT_CONTROL_NUMINT_MASK ,readl (main_int_base +MPIC_INT_CONTROL ));
@@ -794,7 +816,7 @@ static int __init mpic_of_init(struct device_node *node,mpic_perf_init ();mpic_smp_cpu_init (); -mpic_msi_init (node, main_int_res.start); +mpic_msi_init (node, phys_base);if (parent_irq <=0 ) {irq_set_default_host (mpic_domain);
[tip: irq/core] irqchip/armada-370-xp: Refactor initial memory regions mapping
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 654caa9db6649dbecdfa55ea29c9cbf4603fb402 Gitweb: https://git.kernel.org/tip/654caa9db6649dbecdfa55ea29c9cbf4603fb402 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:06 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:49 +02:00
irqchip/armada-370-xp: Refactor initial memory regions mapping
Refactor the initial memory regions mapping:
- put into its own function
- return error numbers on failure
- use WARN_ON() instead of BUG_ON()
--- drivers/irqchip/irq-armada-370-xp.c | 60 +++++++++++++++++++--------- 1 file changed, 41 insertions(+), 19 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +41 -19
@@ -12,6 +12,7 @@#include <linux/bitfield.h> #include <linux/bits.h> +#include <linux/err.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/init.h>
@@ -751,29 +752,50 @@ static struct syscore_ops mpic_syscore_ops = { .resume = mpic_resume, }; -static int __init mpic_of_init (struct device_node *node, -struct device_node *parent) +static int __init mpic_map_region (struct device_node *np,int index, +void __iomem **base,phys_addr_t *phys_base) { -struct resource main_int_res, per_cpu_int_res; -unsigned int nr_irqs; +struct resource res; +int err; + + err =of_address_to_resource (np, index, &res); +if (WARN_ON (err)) + goto fail; + +if (WARN_ON (!request_mem_region (res.start,resource_size (&res), np->full_name))) { + err = -EBUSY ; + goto fail; + } + + *base =ioremap (res.start,resource_size (&res)); +if (WARN_ON (!*base)) { + err = -ENOMEM ; + goto fail; + } -BUG_ON (of_address_to_resource (node,0 , &main_int_res)); -BUG_ON (of_address_to_resource (node,1 , &per_cpu_int_res)); +if (phys_base) + *phys_base = res.start; -BUG_ON (!request_mem_region (main_int_res.start, -resource_size (&main_int_res), - node->full_name)); -BUG_ON (!request_mem_region (per_cpu_int_res.start, -resource_size (&per_cpu_int_res), - node->full_name)); +return 0 ; + +fail: +pr_err ("%pOF: Unable to map resource %d: %pE\n" , np, index,ERR_PTR (err)); +return err; +} + +static int __init mpic_of_init (struct device_node *node,struct device_node *parent) +{ +phys_addr_t phys_base; +unsigned int nr_irqs; +int err; - main_int_base =ioremap (main_int_res.start, -resource_size (&main_int_res)); -BUG_ON (!main_int_base); + err =mpic_map_region (node,0 , &main_int_base, &phys_base); +if (err) +return err; - per_cpu_int_base =ioremap (per_cpu_int_res.start, -resource_size (&per_cpu_int_res)); -BUG_ON (!per_cpu_int_base); + err =mpic_map_region (node,1 , &per_cpu_int_base,NULL ); +if (err) +return err; nr_irqs =FIELD_GET (MPIC_INT_CONTROL_NUMINT_MASK ,readl (main_int_base +MPIC_INT_CONTROL ));
@@ -794,7 +816,7 @@ static int __init mpic_of_init(struct device_node *node,mpic_perf_init ();mpic_smp_cpu_init (); -mpic_msi_init (node, main_int_res.start); +mpic_msi_init (node, phys_base);if (parent_irq <=0 ) {irq_set_default_host (mpic_domain);
PATCH 10/10 irqchip/armada-370-xp: Print error and return error code on initialization failure
In reply to Marek BehúnPrint error and return error code on main / IPI / MSI domain initialization failure. Use WARN_ON() instead of BUG_ON().
--- drivers/irqchip/irq-armada-370-xp.c | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +21 -6
@@ -473,7 +473,7 @@ static void mpic_ipi_resume(void) } } -static __init void mpic_ipi_init (struct device_node *node) +static __init int mpic_ipi_init (struct device_node *node) {int base_ipi;
@@ -481,15 +481,17 @@ static __init void mpic_ipi_init(struct device_node *node)IPI_DOORBELL_END , &mpic_ipi_domain_ops, NULL);if (WARN_ON (!mpic_ipi_domain)) -return ; +return -ENOMEM ;irq_domain_update_bus_token (mpic_ipi_domain,DOMAIN_BUS_IPI ); base_ipi =irq_domain_alloc_irqs (mpic_ipi_domain,IPI_DOORBELL_END ,NUMA_NO_NODE ,NULL );if (WARN_ON (!base_ipi)) -return ; +return -ENOMEM ;set_smp_ipi_range (base_ipi,IPI_DOORBELL_END ); + +return 0 ; } static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
@@ -823,7 +825,11 @@ static int __init mpic_of_init(struct device_node *node,writel (i, main_int_base +MPIC_INT_CLEAR_ENABLE ); mpic_domain =irq_domain_add_linear (node, nr_irqs, &mpic_irq_ops,NULL ); -BUG_ON (!mpic_domain); +if (!mpic_domain) { +pr_err ("%pOF: Unable to add IRQ domain\n" , node); +return -ENOMEM ; + } +irq_domain_update_bus_token (mpic_domain,DOMAIN_BUS_WIRED );/*
@@ -836,13 +842,22 @@ static int __init mpic_of_init(struct device_node *node,mpic_perf_init ();mpic_smp_cpu_init (); -mpic_msi_init (node, phys_base); + err =mpic_msi_init (node, phys_base); +if (err) { +pr_err ("%pOF: Unable to initialize MSI domain\n" , node); +return err; + }if (parent_irq <=0 ) {irq_set_default_host (mpic_domain);set_handle_irq (mpic_handle_irq);#ifdef CONFIG_SMP -mpic_ipi_init (node); + err =mpic_ipi_init (node); +if (err) { +pr_err ("%pOF: Unable to initialize IPI domain\n" , node); +return err; + } +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING ,"irqchip/armada/ipi:starting" , mpic_starting_cpu,NULL );
Signature · 1 line
2.44.2
[tip: irq/core] irqchip/armada-370-xp: Print error and return error code on initialization failure
The following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: b50a11ce64e7c2de0b1a5ba50bba38cccc770125 Gitweb: https://git.kernel.org/tip/b50a11ce64e7c2de0b1a5ba50bba38cccc770125 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:07 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Mon, 29 Jul 2024 10:57:25 +02:00
irqchip/armada-370-xp: Print error and return error code on initialization failure
Print error and return error code on main / IPI / MSI domain initialization failure. Use WARN_ON() instead of BUG_ON().
--- drivers/irqchip/irq-armada-370-xp.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +22 -6
@@ -464,20 +464,23 @@ static void mpic_ipi_resume(void) } } -static __init void mpic_ipi_init (struct device_node *node) +static __init int mpic_ipi_init (struct device_node *node) {int base_ipi; mpic_ipi_domain =irq_domain_create_linear (of_node_to_fwnode (node),IPI_DOORBELL_END , &mpic_ipi_domain_ops,NULL );if (WARN_ON (!mpic_ipi_domain)) -return ; +return -ENOMEM ;irq_domain_update_bus_token (mpic_ipi_domain,DOMAIN_BUS_IPI ); base_ipi =irq_domain_alloc_irqs (mpic_ipi_domain,IPI_DOORBELL_END ,NUMA_NO_NODE ,NULL );if (WARN_ON (!base_ipi)) -return ; +return -ENOMEM ; +set_smp_ipi_range (base_ipi,IPI_DOORBELL_END ); + +return 0 ; }static int mpic_set_affinity (struct irq_data *d,const struct cpumask *mask_val,bool force)
@@ -803,7 +806,11 @@ static int __init mpic_of_init(struct device_node *node, struct device_node *parwritel (i, main_int_base +MPIC_INT_CLEAR_ENABLE ); mpic_domain =irq_domain_add_linear (node, nr_irqs, &mpic_irq_ops,NULL ); -BUG_ON (!mpic_domain); +if (!mpic_domain) { +pr_err ("%pOF: Unable to add IRQ domain\n" , node); +return -ENOMEM ; + } +irq_domain_update_bus_token (mpic_domain,DOMAIN_BUS_WIRED );/*
@@ -816,13 +823,22 @@ static int __init mpic_of_init(struct device_node *node, struct device_node *parmpic_perf_init ();mpic_smp_cpu_init (); -mpic_msi_init (node, phys_base); + err =mpic_msi_init (node, phys_base); +if (err) { +pr_err ("%pOF: Unable to initialize MSI domain\n" , node); +return err; + }if (parent_irq <=0 ) {irq_set_default_host (mpic_domain);set_handle_irq (mpic_handle_irq);#ifdef CONFIG_SMP -mpic_ipi_init (node); + err =mpic_ipi_init (node); +if (err) { +pr_err ("%pOF: Unable to initialize IPI domain\n" , node); +return err; + } +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING ,"irqchip/armada/ipi:starting" , mpic_starting_cpu,NULL );
[tip: irq/core] irqchip/armada-370-xp: Print error and return error code on initialization failure
In reply to Marek BehúnThe following commit has been merged into the irq/core branch of tip:
The following commit has been merged into the irq/core branch of tip:
Commit-ID: 1d07c9a3e71c97ee1bbc1f119e104bf3746c51f7 Gitweb: https://git.kernel.org/tip/1d07c9a3e71c97ee1bbc1f119e104bf3746c51f7 Author: Marek Behún <[email protected]> AuthorDate: Thu, 11 Jul 2024 18:09:07 +02:00 Committer: Thomas Gleixner <[email protected]> CommitterDate: Tue, 30 Jul 2024 13:35:49 +02:00
irqchip/armada-370-xp: Print error and return error code on initialization failure
Print error and return error code on main / IPI / MSI domain initialization failure. Use WARN_ON() instead of BUG_ON().
--- drivers/irqchip/irq-armada-370-xp.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/irqchip/irq-armada-370-xp.c +22 -6
@@ -464,20 +464,23 @@ static void mpic_ipi_resume(void) } } -static __init void mpic_ipi_init (struct device_node *node) +static __init int mpic_ipi_init (struct device_node *node) {int base_ipi; mpic_ipi_domain =irq_domain_create_linear (of_node_to_fwnode (node),IPI_DOORBELL_END , &mpic_ipi_domain_ops,NULL );if (WARN_ON (!mpic_ipi_domain)) -return ; +return -ENOMEM ;irq_domain_update_bus_token (mpic_ipi_domain,DOMAIN_BUS_IPI ); base_ipi =irq_domain_alloc_irqs (mpic_ipi_domain,IPI_DOORBELL_END ,NUMA_NO_NODE ,NULL );if (WARN_ON (!base_ipi)) -return ; +return -ENOMEM ; +set_smp_ipi_range (base_ipi,IPI_DOORBELL_END ); + +return 0 ; }static int mpic_set_affinity (struct irq_data *d,const struct cpumask *mask_val,bool force)
@@ -803,7 +806,11 @@ static int __init mpic_of_init(struct device_node *node, struct device_node *parwritel (i, main_int_base +MPIC_INT_CLEAR_ENABLE ); mpic_domain =irq_domain_add_linear (node, nr_irqs, &mpic_irq_ops,NULL ); -BUG_ON (!mpic_domain); +if (!mpic_domain) { +pr_err ("%pOF: Unable to add IRQ domain\n" , node); +return -ENOMEM ; + } +irq_domain_update_bus_token (mpic_domain,DOMAIN_BUS_WIRED );/*
@@ -816,13 +823,22 @@ static int __init mpic_of_init(struct device_node *node, struct device_node *parmpic_perf_init ();mpic_smp_cpu_init (); -mpic_msi_init (node, phys_base); + err =mpic_msi_init (node, phys_base); +if (err) { +pr_err ("%pOF: Unable to initialize MSI domain\n" , node); +return err; + }if (parent_irq <=0 ) {irq_set_default_host (mpic_domain);set_handle_irq (mpic_handle_irq);#ifdef CONFIG_SMP -mpic_ipi_init (node); + err =mpic_ipi_init (node); +if (err) { +pr_err ("%pOF: Unable to initialize IPI domain\n" , node); +return err; + } +cpuhp_setup_state_nocalls (CPUHP_AP_IRQ_ARMADA_XP_STARTING ,"irqchip/armada/ipi:starting" , mpic_starting_cpu,NULL );
Marek!
Quoted 9 lines · Marek Behún
Hi Thomas, Andrew, Ilpo et al.,
since round 3 was reviewed so quickly, here comes round 4, which should be similarly easy to review.
This series can be applied on tip/irq/core, but only after round 2 and round 3 series are applied:
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=869325
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=870469
I marked all of this as material to merge right after 6.11-rc1.
Thanks,
tglx
Hello Thomas,
Quoted 9 lines · Thomas Gleixner
Marek!
Quoted 5 lines · Marek Behún
Hi Thomas, Andrew, Ilpo et al.,
since round 3 was reviewed so quickly, here comes round 4, which should be similarly easy to review.
Quoted 6 lines
Quoted 4 lines
This series can be applied on tip/irq/core, but only after round 2 and round 3 series are applied:
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=869325
https://patchwork.kernel.org/project/linux-arm-kernel/list/?series=870469I marked all of this as material to merge right after 6.11-rc1.
I have another 10 refactoring/cleanup patches prepared, bringing this driver to modern style, I will be sending that as round 5.
And finally after that I have the patch adding support for SoC Error interrupts, which is why I have been doing all this.
Hopefully this SoC Error interrupt support will get merger for 6.12.
Marek
Marek!
Quoted 10 lines · Marek Behún
Quoted 1 line · Thomas Gleixner
I marked all of this as material to merge right after 6.11-rc1.
I have another 10 refactoring/cleanup patches prepared, bringing this driver to modern style, I will be sending that as round 5.
And finally after that I have the patch adding support for SoC Error interrupts, which is why I have been doing all this.
Hopefully this SoC Error interrupt support will get merger for 6.12.
I don't see a problem with that if the quality stays at that level. Nice work!
Thanks,
tglx
Marek!
Quoted 7 lines · Thomas Gleixner
Quoted 6 lines · Marek Behún
Quoted 1 line · Thomas Gleixner
I marked all of this as material to merge right after 6.11-rc1.
I have another 10 refactoring/cleanup patches prepared, bringing this driver to modern style, I will be sending that as round 5.
Quoted 7 lines
Quoted 4 lines
And finally after that I have the patch adding support for SoC Error interrupts, which is why I have been doing all this.
Hopefully this SoC Error interrupt support will get merger for 6.12.
I don't see a problem with that if the quality stays at that level. Nice work!
I've applied the lot (except the brackets one) to tip irq/core and fixed up a bunch of line breaks while going through it. The 80 character limit was lifted quite some time ago and extended to 100.
Please double check that everything is correct.
Btw, please Cc: LKML on your next series as that's the official mailing list for irqchip work.
Thanks,
tglx