summaryrefslogtreecommitdiffstats
path: root/drivers/irqchip/irq-armada-370-xp.c
Commit message (Collapse)AuthorAgeFilesLines
* irqchip/armada-370-xp: Use mpic_is_ipi_available() in mpic_of_init()Marek Behún2024-08-081-1/+1
| | | | | | | | | mpic_of_init() contains the last case where the open coded IPI support condition needs to be replaced with mpic_is_ipi_available() to keep the code consistent. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Allow mapping only per-CPU interruptsMarek Behún2024-08-081-6/+13
| | | | | | | | | | | | | | | | | On platforms where MPIC is not the top-level interrupt controller the driver currently only supports handling of the per-CPU interrupts (the first 29 interrupts). This is obvious from the code of mpic_handle_cascade_irq(), which reads only one cause register. Bound the number of available interrupts in the interrupt domain to 29 for these platforms. The corresponding device-trees refer only to per-CPU interrupts via MPIC, the other interrupts are referred to via GIC. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Iterate only valid bits of the per-CPU interrupt ↵Marek Behún2024-08-081-1/+1
| | | | | | | | | | | | cause register Use MPIC_PER_CPU_IRQS_NR (29) bound instead of BITS_PER_LONG (32) when iterating the bits of the per-CPU interrupt cause register, since there are only 29 per-CPU interrupts. The top 3 bits are always zero anyway. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Fix reenabling last per-CPU interruptMarek Behún2024-08-081-3/+3
| | | | | | | | | | | | | | | | | | | | | The number of per-CPU interrupts is 29 (0 to 28). This is described by the constant MPIC_MAX_PER_CPU_IRQS, set to 28 (the maximum per-CPU interrupt). Commit 0fa4ce746d1d ("irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time") used the constant incorrectly in the for-loop, it used the operator < instead of <=, causing it to iterate only the first 28 interrupts (0 to 27), ignoring the last, 28th, per-CPU interrupt. To avoid this kind of confusions, fix this issue by renaming the constant to MPIC_PER_CPU_IRQS_NR and set it to 29, the number of per-CPU IRQs. Update its use in mpic_is_percpu_irq() accordingly. Fixes: 0fa4ce746d1d ("irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time") Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: <stable+noautosel@kernel.org> # The 29th interrupt is not used in any device-tree
* irqchip/armada-370-xp: Dynamically allocate the driver private structureMarek Behún2024-08-081-5/+11
| | | | | | | | | Dynamically allocate the driver private structure. This concludes the conversion of this driver to modern style. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Pass around the driver private structureMarek Behún2024-08-081-45/+70
| | | | | | | | | | | | In continuation of converting the driver to modern style, drop the global pointer to the driver private structure and instead pass it around the functions and callbacks, wherever possible. (There are 3 cases where it is not possible: mpic_cascaded_starting_cpu() and the syscore operations mpic_suspend() and mpic_resume()). Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Put MSI doorbell limits into the mpic structureMarek Behún2024-08-081-22/+22
| | | | | | | | | | Put the MSI doorbell limits msi_doorbell_start, msi_doorbell_size and msi_doorbell_mask into the driver private structure and get rid of the corresponding functions. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Put static variables into driver private structureMarek Behún2024-08-081-101/+122
| | | | | | | | | | | | | | | | | In preparation for converting the driver to modern style put all the interrupt controller private static variables into driver private structure. Access to these variables changes as: main_int_base mpic->base per_cpu_int_base mpic->per_cpu mpic_domain mpic->domain parent_irq mpic->parent_irq ... Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Put __init attribute after return type in mpic_ipi_init()Marek Behún2024-08-081-1/+1
| | | | | | | | | For consistency with the rest of the driver, put the __init attribute after the return type of the mpic_ipi_init() function. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Add the __init attribute to mpic_msi_init()Marek Behún2024-08-081-1/+1
| | | | | | | | | | Add the __init attribute to the mpic_msi_init() function. It is only called from the device initializer, and so can be dropped after boot is complete. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Drop msi_doorbell_end()Marek Behún2024-08-081-7/+0
| | | | | | | | | Drop the msi_doorbell_end() function and related constants, it is not used anymore. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Drop IPI_DOORBELL_START and rename IPI_DOORBELL_ENDMarek Behún2024-08-081-7/+6
| | | | | | | | | Drop IPI_DOORBELL_START since it is not used and rename IPI_DOORBELL_END to IPI_DOORBELL_NR. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
* irqchip/armada-370-xp: Print error and return error code on initialization ↵Marek Behún2024-07-301-6/+22
| | | | | | | | | | | | | failure Print error and return error code on main / IPI / MSI domain initialization failure. Use WARN_ON() instead of BUG_ON(). Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-11-kabel@kernel.org
* irqchip/armada-370-xp: Refactor initial memory regions mappingMarek Behún2024-07-301-19/+41
| | | | | | | | | | | | | Refactor the initial memory regions mapping: - put into its own function - return error numbers on failure - use WARN_ON() instead of BUG_ON() Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-10-kabel@kernel.org
* irqchip/armada-370-xp: Use u32 type instead of unsigned long where possiebleMarek Behún2024-07-301-3/+4
| | | | | | | | | | | | | | 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. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-9-kabel@kernel.org
* irqchip/armada-370-xp: Rename variable for consistencyMarek Behún2024-07-301-3/+3
| | | | | | | | | | | Rename the variable holding the cause register to "cause" in mpic_handle_cascade_irq(). Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-8-kabel@kernel.org
* irqchip/armada-370-xp: Drop redundant continueMarek Behún2024-07-301-3/+1
| | | | | | | | | | Drop redundant continue from mpic_handle_irq(). Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-7-kabel@kernel.org
* irqchip/armada-370-xp: Simplify mpic_reenable_percpu() and mpic_resume()Marek Behún2024-07-301-9/+3
| | | | | | | | | | | Refactor the mpic_reenable_percpu() and mpic_resume() functions to make them a little bit simpler. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-5-kabel@kernel.org
* irqchip/armada-370-xp: Use consistent name for struct irq_data variablesMarek Behún2024-07-301-13/+13
| | | | | | | | | | Always use variable name "d" for struct irq_data *, for consistency. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-4-kabel@kernel.org
* irqchip/armada-370-xp: Use consistent types when iterating interruptsMarek Behún2024-07-301-8/+10
| | | | | | | | | | | | 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. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-3-kabel@kernel.org
* irqchip/armada-370-xp: Use consistent variable names for hwirqsMarek Behún2024-07-301-28/+28
| | | | | | | | | | | Use consistent variable names for hwirqs: when iterating, use "i", otherwise use "hwirq". Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/20240711160907.31012-2-kabel@kernel.org
* irqchip/armada-370-xp: Refactor handling IPI interruptsMarek Behún2024-07-301-12/+18
| | | | | | | | | | | | | | | | | Refactor the handling of IPI interrupts - put into own function mpic_handle_ipi_irq(), similar to mpic_handle_msi_irq() - rename the variable holding the doorbell cause register to "cause" - retype and rename the variable holding the IPI HW IRQ number to "irq_hw_number_t i" Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-11-kabel@kernel.org
* irqchip/armada-370-xp: Refactor mpic_handle_msi_irq() codeMarek Behún2024-07-301-20/+12
| | | | | | | | | | | | | | | | Refactor the mpic_handle_msi_irq() function to make it simpler: - drop the function arguments, they are not needed - rename the variable holding the doorbell cause register to "cause" - rename the iterating variable to "i" - use for_each_set_bit() (requires retyping "cause" to unsigned long) Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-10-kabel@kernel.org
* irqchip/armada-370-xp: Use FIELD_GET() and named register constantMarek Behún2024-07-301-5/+6
| | | | | | | | | | | | | Use FIELD_GET() and named register mask constant when reading the number of supported interrupts / current interrupt. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-9-kabel@kernel.org
* irqchip/armada-370-xp: Don't read number of supported interrupts multiple timesMarek Behún2024-07-301-10/+3
| | | | | | | | | | | | | Use mpic_domain::hwirq_max at runtime instead of reading the same value over and over from the MPIC_INT_CONTROL register. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-8-kabel@kernel.org
* irqchip/armada-370-xp: Change symbol prefixes to mpicMarek Behún2024-07-301-163/+142
| | | | | | | | | | | | | | | Change symbol prefixes from armada_370_xp_ or others to mpic_. The rationale is that it is shorter and more generic (this controller is called MPIC and is also used on Armada 38x and 39x). Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-7-kabel@kernel.org
* irqchip/armada-370-xp: Improve indentationMarek Behún2024-07-301-30/+26
| | | | | | | | | | | | | | Add some blank lines and other indentation improvements. Checkpatch now stops complaining. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-6-kabel@kernel.org
* irqchip/armada-370-xp: Simplify ipi_resume() codeMarek Behún2024-07-301-8/+6
| | | | | | | | | | | | Refactor the ipi_resume() function to drop one indentation level. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-5-kabel@kernel.org
* irqchip/armada-370-xp: Use !virq instead of virq == 0 in conditionMarek Behún2024-07-301-2/+2
| | | | | | | | | | | | | Use !virq instead of virq == 0 when checking for availability of the virq. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-4-kabel@kernel.org
* irqchip/armada-370-xp: Use unsigned int type for virqsMarek Behún2024-07-301-4/+4
| | | | | | | | | | | | | | The return type of irq_find_mapping() and irq_linear_revmap() is unsigned int. Use the unsigned int type for the variables storing the return value. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-3-kabel@kernel.org
* irqchip/armada-370-xp: Rename variable for consistencyMarek Behún2024-07-301-5/+5
| | | | | | | | | | | | | Rename the irq variable to virq in the ipi_resume() function for consistency with the rest of the code. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240711115748.30268-2-kabel@kernel.org
* irqchip/armada-370-xp: Declare iterators in for loopMarek Behún2024-07-301-17/+10
| | | | | | | | | | | | Where possible, declare iterators in for cycle. This is possible since kernel uses -std=gnu11. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/all/20240708151801.11592-11-kabel@kernel.org
* irqchip/armada-370-xp: Change to SPDX license identifierMarek Behún2024-07-301-4/+1
| | | | | | | | | | | Change the license identifier to SPDX style. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/all/20240708151801.11592-10-kabel@kernel.org
* irqchip/armada-370-xp: Simplify is_percpu_irq() codeMarek Behún2024-07-301-4/+1
| | | | | | | | | | | | | | | | Simplify the code in the is_percpu_irq() function. Instead of if (condition) return true; return false; simply return condition. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240708151801.11592-9-kabel@kernel.org
* irqchip/armada-370-xp: Use correct type for cpu variableMarek Behún2024-07-301-2/+2
| | | | | | | | | | | Use unsigned int instead of int for variable storing the cpu number. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/all/20240708151801.11592-8-kabel@kernel.org
* irqchip/armada-370-xp: Change register constants prefix to MPIC_Marek Behún2024-07-301-79/+69
| | | | | | | | | | | | | | Change the long ARMADA_370_XP_ prefix in register constants (ARMADA_375_ in one case) to MPIC_. The rationale is that it is shorter and more generic (this controller is called MPIC and is also used on Armada 38x and 39x). Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/all/20240708151801.11592-7-kabel@kernel.org
* irqchip/armada-370-xp: Cosmetic fix parentheses in register constant definitionsMarek Behún2024-07-301-19/+19
| | | | | | | | | | | | | Drop parentheses where not needed and add them where it makes sense in register constant definitions. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240708151801.11592-6-kabel@kernel.org
* irqchip/armada-370-xp: Use BIT() and GENMASK() macrosMarek Behún2024-07-301-5/+5
| | | | | | | | | | | Use the BIT() and GENMASK() macros where appropriate. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/all/20240708151801.11592-5-kabel@kernel.org
* irqchip/armada-370-xp: Change spaces to tabsMarek Behún2024-07-301-7/+7
| | | | | | | | | | | | Change spaces to tabs in register constants definitions. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240708151801.11592-4-kabel@kernel.org
* irqchip/armada-370-xp: Change register constant suffix from _MSK to _MASKMarek Behún2024-07-301-10/+10
| | | | | | | | | | | | | There is one occurrence of suffix _MSK in register constants, others have _MASK instead. Change the one to _MASK for consistency. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240708151801.11592-3-kabel@kernel.org
* irqchip/armada-370-xp: Drop _OFFS suffix from some register constantsMarek Behún2024-07-301-57/+48
| | | | | | | | | | | | Some register constants have the _OFFS suffix and some do not. Drop it to be more consistent. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Link: https://lore.kernel.org/all/20240708151801.11592-2-kabel@kernel.org
* irqchip/armada-370-xp: Add support for 32 MSI interrupts on non-IPI platformsPali Rohár2024-06-231-14/+63
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The doorbell interrupts have the following layout on IPI vs no-IPI platforms: | 0...7 | 8...15 | 16...31 | ------------------+---------+----------+---------------------+ IPI platform | IPI | n/a | MSI | ------------------+---------+----------+---------------------+ non-IPI platform | MSI | ------------------+------------------------------------------+ Currently the driver only allows for the upper 16...31 interrupts for MSI domain (i.e. the MSI domain has only 16 interrupts). On platforms where IPI is not available, we can use whole 32 MSI interrupts. Implement support also for the lower 16 MSI interrupts on non-IPI platforms. [ Marek: refactored, changed commit message ] Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
* irqchip/armada-370-xp: Do not touch IPI registers on platforms without IPIPali Rohár2024-06-231-2/+10
| | | | | | | | | | | | | | | | | On platforms where IPI is not available in the MPIC, the IPI registers instead represent an additional set of MSI interrupt registers (currently unused by the driver). Do not touch these registers on platforms where IPI is not available in the MPIC. [ Marek: refactored, changed commit message ] Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
* irqchip/armada-370-xp: Only call ipi_resume() if IPI is availablePali Rohár2024-06-231-2/+16
| | | | | | | | | | | | | | | | | IPI is available only on systems where the mpic controller does not have a parent interrupt defined (e.g. on Armada XP). If a parent interrupt is defined, inter-processor interrupts are handled by an interrupt controller higher in the hierarchy (most probably a parent GIC). Only call ipi_resume() on systems where IPI is available in the mpic controller. Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> [ refactored a little and changed commit message ]
* irqchip/armada-370-xp: Do not allow mapping IRQ 0 and 1Pali Rohár2024-06-231-0/+4
| | | | | | | | | | | | | | IRQs 0 (IPI) and 1 (MSI) are handled internally by this driver, generic_handle_domain_irq() is never called for these IRQs. Disallow mapping these IRQs. [ Marek: changed commit message ] Signed-off-by: Pali Rohár <pali@kernel.org> Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
* irqchip/armada-370-xp: Use atomic_io_modify() instead of another spinlockMarek Behún2024-06-231-9/+3
| | | | | | | | | | | Use the dedicated atomic_io_modify() instead of a open coded spin_lock() + readl() + writel() + spin_unlock() sequence. This allows to drop the irq_controller_lock spinlock from the driver. Signed-off-by: Marek Behún <kabel@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
* irqchip/armada-370-xp: Suppress unused-function warningArnd Bergmann2024-03-261-1/+1
| | | | | | | | | | | | | | | | | | | | | armada_370_xp_msi_reenable_percpu() is only defined when CONFIG_PCI_MSI is enabled, and only called when SMP is enabled. Without CONFIG_SMP, there are no callers, which results in a build time warning instead: drivers/irqchip/irq-armada-370-xp.c:319:13: error: 'armada_370_xp_msi_reenable_percpu' defined but not used [-Werror=unused-function] 319 | static void armada_370_xp_msi_reenable_percpu(void) {} | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Mark the function as __maybe_unused to avoid adding more complexity to the #ifdefs. Fixes: 8ca61cde32c1 ("irqchip/armada-370-xp: Enable MSI affinity configuration") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Link: https://lore.kernel.org/r/20240322125838.901649-1-arnd@kernel.org
* irqchip: Use irq_domain_alloc_irqs()Johan Hovold2023-01-111-2/+1
| | | | | | | | | | | Use the irq_domain_alloc_irqs() wrapper instead of the full __irq_domain_alloc_irqs() interface, which was only intended for some legacy (x86) use cases. Signed-off-by: Johan Hovold <johan+linaro@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/r/20221213140844.15470-2-johan+linaro@kernel.org
* irqchip/armada-370-xp: Do not touch Performance Counter Overflow on A375, ↵Pali Rohár2022-05-061-1/+10
| | | | | | | | | | | | | | | | A38x, A39x Register ARMADA_370_XP_INT_FABRIC_MASK_OFFS is Armada 370 and XP specific and on new Armada platforms it has different meaning. It does not configure Performance Counter Overflow interrupt masking. So do not touch this register on non-A370/XP platforms (A375, A38x and A39x). Signed-off-by: Pali Rohár <pali@kernel.org> Cc: stable@vger.kernel.org Fixes: 28da06dfd9e4 ("irqchip: armada-370-xp: Enable the PMU interrupts") Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220425113706.29310-1-pali@kernel.org
* irqchip/armada-370-xp: Enable MSI affinity configurationNathan Rossi2022-05-041-12/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | With multiple devices attached via PCIe to an Armada 385 it is possible to overwhelm a single CPU with MSI interrupts. Under certain scenarios configuring the interrupts to be handled by more than one CPU would prevent the system from being overwhelmed. However the irqchip-aramada-370-xp driver is configured to only handle MSIs on the boot CPU, and provides no affinity configuration. This change adds support to the armada-370-xp driver to allow for configuring the affinity of specific MSI irqs and to generate the interrupts on secondary CPUs. This is done by enabling the private doorbell for all online CPUs and configures all CPUs to unmask MSI specific private doorbell bits. The CPU affinity selection of the interrupt is handled by the target list of the software triggered interrupt value, which is provided as the MSI message. The message has the associated CPU bit set for the target CPU. For private doorbell interrupts only one bit can be set otherwise all CPUs will receive the interrupt, so the lowest CPU in the affinity mask is used. This means that by default the first CPU will handle all the interrupts as was the case before. Signed-off-by: Nathan Rossi <nathan.rossi@digi.com> Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220422043532.146946-1-nathan@nathanrossi.com