2024-07-08 17:18:00 +02:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2012-06-13 19:01:28 +02:00
|
|
|
/*
|
|
|
|
* Marvell Armada 370 and Armada XP SoC IRQ handling
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Marvell
|
|
|
|
*
|
|
|
|
* Lior Amsalem <alior@marvell.com>
|
|
|
|
* Gregory CLEMENT <gregory.clement@free-electrons.com>
|
|
|
|
* Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
|
|
|
|
* Ben Dooks <ben.dooks@codethink.co.uk>
|
|
|
|
*/
|
|
|
|
|
2024-07-11 13:57:46 +02:00
|
|
|
#include <linux/bitfield.h>
|
2024-06-21 11:38:31 +02:00
|
|
|
#include <linux/bits.h>
|
2024-07-11 18:09:06 +02:00
|
|
|
#include <linux/err.h>
|
2012-06-13 19:01:28 +02:00
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/init.h>
|
|
|
|
#include <linux/irq.h>
|
|
|
|
#include <linux/interrupt.h>
|
2015-07-07 17:11:46 -04:00
|
|
|
#include <linux/irqchip.h>
|
2014-02-10 17:00:02 -03:00
|
|
|
#include <linux/irqchip/chained_irq.h>
|
2014-04-14 15:54:02 +02:00
|
|
|
#include <linux/cpu.h>
|
2012-06-13 19:01:28 +02:00
|
|
|
#include <linux/io.h>
|
|
|
|
#include <linux/of_address.h>
|
|
|
|
#include <linux/of_irq.h>
|
2013-08-09 22:27:11 +02:00
|
|
|
#include <linux/of_pci.h>
|
2012-06-13 19:01:28 +02:00
|
|
|
#include <linux/irqdomain.h>
|
2013-08-09 22:27:11 +02:00
|
|
|
#include <linux/slab.h>
|
2014-11-21 17:00:00 +01:00
|
|
|
#include <linux/syscore_ops.h>
|
2013-08-09 22:27:11 +02:00
|
|
|
#include <linux/msi.h>
|
2024-06-21 11:38:29 +02:00
|
|
|
#include <linux/types.h>
|
2012-06-13 19:01:28 +02:00
|
|
|
#include <asm/mach/arch.h>
|
|
|
|
#include <asm/exception.h>
|
2012-08-02 11:19:12 +03:00
|
|
|
#include <asm/smp_plat.h>
|
2013-04-09 23:26:15 +02:00
|
|
|
#include <asm/mach/irq.h>
|
|
|
|
|
2017-05-18 10:07:38 +02:00
|
|
|
/*
|
|
|
|
* Overall diagram of the Armada XP interrupt controller:
|
|
|
|
*
|
|
|
|
* To CPU 0 To CPU 1
|
|
|
|
*
|
|
|
|
* /\ /\
|
|
|
|
* || ||
|
|
|
|
* +---------------+ +---------------+
|
|
|
|
* | | | |
|
|
|
|
* | per-CPU | | per-CPU |
|
|
|
|
* | mask/unmask | | mask/unmask |
|
|
|
|
* | CPU0 | | CPU1 |
|
|
|
|
* | | | |
|
|
|
|
* +---------------+ +---------------+
|
|
|
|
* /\ /\
|
|
|
|
* || ||
|
|
|
|
* \\_______________________//
|
|
|
|
* ||
|
|
|
|
* +-------------------+
|
|
|
|
* | |
|
|
|
|
* | Global interrupt |
|
|
|
|
* | mask/unmask |
|
|
|
|
* | |
|
|
|
|
* +-------------------+
|
|
|
|
* /\
|
|
|
|
* ||
|
|
|
|
* interrupt from
|
|
|
|
* device
|
|
|
|
*
|
|
|
|
* The "global interrupt mask/unmask" is modified using the
|
2024-07-08 17:17:57 +02:00
|
|
|
* MPIC_INT_SET_ENABLE and MPIC_INT_CLEAR_ENABLE
|
2024-08-07 18:40:57 +02:00
|
|
|
* registers, which are relative to "mpic->base".
|
2017-05-18 10:07:38 +02:00
|
|
|
*
|
2024-07-08 17:17:57 +02:00
|
|
|
* The "per-CPU mask/unmask" is modified using the MPIC_INT_SET_MASK
|
|
|
|
* and MPIC_INT_CLEAR_MASK registers, which are relative to
|
2024-08-07 18:40:57 +02:00
|
|
|
* "mpic->per_cpu". This base address points to a special address,
|
2024-07-08 17:17:57 +02:00
|
|
|
* which automatically accesses the registers of the current CPU.
|
2017-05-18 10:07:38 +02:00
|
|
|
*
|
|
|
|
* The per-CPU mask/unmask can also be adjusted using the global
|
2024-07-08 17:17:57 +02:00
|
|
|
* per-interrupt MPIC_INT_SOURCE_CTL register, which we use to
|
|
|
|
* configure interrupt affinity.
|
2017-05-18 10:07:38 +02:00
|
|
|
*
|
|
|
|
* Due to this model, all interrupts need to be mask/unmasked at two
|
|
|
|
* different levels: at the global level and at the per-CPU level.
|
|
|
|
*
|
|
|
|
* This driver takes the following approach to deal with this:
|
|
|
|
*
|
|
|
|
* - For global interrupts:
|
|
|
|
*
|
|
|
|
* At ->map() time, a global interrupt is unmasked at the per-CPU
|
|
|
|
* mask/unmask level. It is therefore unmasked at this level for
|
|
|
|
* the current CPU, running the ->map() code. This allows to have
|
|
|
|
* the interrupt unmasked at this level in non-SMP
|
|
|
|
* configurations. In SMP configurations, the ->set_affinity()
|
2024-07-08 17:17:57 +02:00
|
|
|
* callback is called, which using the MPIC_INT_SOURCE_CTL()
|
|
|
|
* readjusts the per-CPU mask/unmask for the interrupt.
|
2017-05-18 10:07:38 +02:00
|
|
|
*
|
|
|
|
* The ->mask() and ->unmask() operations only mask/unmask the
|
|
|
|
* interrupt at the "global" level.
|
|
|
|
*
|
|
|
|
* So, a global interrupt is enabled at the per-CPU level as soon
|
|
|
|
* as it is mapped. At run time, the masking/unmasking takes place
|
|
|
|
* at the global level.
|
|
|
|
*
|
|
|
|
* - For per-CPU interrupts
|
|
|
|
*
|
|
|
|
* At ->map() time, a per-CPU interrupt is unmasked at the global
|
|
|
|
* mask/unmask level.
|
|
|
|
*
|
|
|
|
* The ->mask() and ->unmask() operations mask/unmask the interrupt
|
|
|
|
* at the per-CPU level.
|
|
|
|
*
|
|
|
|
* So, a per-CPU interrupt is enabled at the global level as soon
|
|
|
|
* as it is mapped. At run time, the masking/unmasking takes place
|
|
|
|
* at the per-CPU level.
|
|
|
|
*/
|
2012-06-13 19:01:28 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
/* Registers relative to mpic->base */
|
2024-07-08 17:17:57 +02:00
|
|
|
#define MPIC_INT_CONTROL 0x00
|
2024-07-11 13:57:46 +02:00
|
|
|
#define MPIC_INT_CONTROL_NUMINT_MASK GENMASK(12, 2)
|
2024-07-08 17:17:57 +02:00
|
|
|
#define MPIC_SW_TRIG_INT 0x04
|
|
|
|
#define MPIC_INT_SET_ENABLE 0x30
|
|
|
|
#define MPIC_INT_CLEAR_ENABLE 0x34
|
2024-07-11 18:08:58 +02:00
|
|
|
#define MPIC_INT_SOURCE_CTL(hwirq) (0x100 + (hwirq) * 4)
|
2024-07-08 17:17:57 +02:00
|
|
|
#define MPIC_INT_SOURCE_CPU_MASK GENMASK(3, 0)
|
|
|
|
#define MPIC_INT_IRQ_FIQ_MASK(cpuid) ((BIT(0) | BIT(8)) << (cpuid))
|
2012-06-13 19:01:28 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
/* Registers relative to mpic->per_cpu */
|
2024-07-08 17:17:57 +02:00
|
|
|
#define MPIC_IN_DRBEL_CAUSE 0x08
|
|
|
|
#define MPIC_IN_DRBEL_MASK 0x0c
|
|
|
|
#define MPIC_PPI_CAUSE 0x10
|
|
|
|
#define MPIC_CPU_INTACK 0x44
|
2024-07-11 13:57:46 +02:00
|
|
|
#define MPIC_CPU_INTACK_IID_MASK GENMASK(9, 0)
|
2024-07-08 17:17:57 +02:00
|
|
|
#define MPIC_INT_SET_MASK 0x48
|
|
|
|
#define MPIC_INT_CLEAR_MASK 0x4C
|
|
|
|
#define MPIC_INT_FABRIC_MASK 0x54
|
|
|
|
#define MPIC_INT_CAUSE_PERF(cpu) BIT(cpu)
|
2012-08-02 11:19:12 +03:00
|
|
|
|
2024-08-07 18:41:01 +02:00
|
|
|
#define MPIC_PER_CPU_IRQS_NR 29
|
2012-12-05 21:43:23 +01:00
|
|
|
|
2024-06-21 11:38:31 +02:00
|
|
|
/* IPI and MSI interrupt definitions for IPI platforms */
|
2024-08-07 18:40:53 +02:00
|
|
|
#define IPI_DOORBELL_NR 8
|
2024-07-08 17:17:55 +02:00
|
|
|
#define IPI_DOORBELL_MASK GENMASK(7, 0)
|
2024-07-08 17:17:56 +02:00
|
|
|
#define PCI_MSI_DOORBELL_START 16
|
|
|
|
#define PCI_MSI_DOORBELL_NR 16
|
2024-07-08 17:17:55 +02:00
|
|
|
#define PCI_MSI_DOORBELL_MASK GENMASK(31, 16)
|
2012-08-02 11:19:12 +03:00
|
|
|
|
2024-06-21 11:38:31 +02:00
|
|
|
/* MSI interrupt definitions for non-IPI platforms */
|
|
|
|
#define PCI_MSI_FULL_DOORBELL_START 0
|
|
|
|
#define PCI_MSI_FULL_DOORBELL_NR 32
|
|
|
|
#define PCI_MSI_FULL_DOORBELL_MASK GENMASK(31, 0)
|
|
|
|
#define PCI_MSI_FULL_DOORBELL_SRC0_MASK GENMASK(15, 0)
|
|
|
|
#define PCI_MSI_FULL_DOORBELL_SRC1_MASK GENMASK(31, 16)
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
/**
|
|
|
|
* struct mpic - MPIC private data structure
|
|
|
|
* @base: MPIC registers base address
|
|
|
|
* @per_cpu: per-CPU registers base address
|
|
|
|
* @parent_irq: parent IRQ if MPIC is not top-level interrupt controller
|
|
|
|
* @domain: MPIC main interrupt domain
|
|
|
|
* @ipi_domain: IPI domain
|
|
|
|
* @msi_domain: MSI domain
|
|
|
|
* @msi_inner_domain: MSI inner domain
|
|
|
|
* @msi_used: bitmap of used MSI numbers
|
|
|
|
* @msi_lock: mutex serializing access to @msi_used
|
|
|
|
* @msi_doorbell_addr: physical address of MSI doorbell register
|
2024-08-07 18:40:58 +02:00
|
|
|
* @msi_doorbell_mask: mask of available doorbell bits for MSIs (either PCI_MSI_DOORBELL_MASK or
|
|
|
|
* PCI_MSI_FULL_DOORBELL_MASK)
|
|
|
|
* @msi_doorbell_start: first set bit in @msi_doorbell_mask
|
|
|
|
* @msi_doorbell_size: number of set bits in @msi_doorbell_mask
|
2024-08-07 18:40:57 +02:00
|
|
|
* @doorbell_mask: doorbell mask of MSIs and IPIs, stored on suspend, restored on resume
|
|
|
|
*/
|
|
|
|
struct mpic {
|
|
|
|
void __iomem *base;
|
|
|
|
void __iomem *per_cpu;
|
|
|
|
int parent_irq;
|
|
|
|
struct irq_domain *domain;
|
|
|
|
#ifdef CONFIG_SMP
|
|
|
|
struct irq_domain *ipi_domain;
|
|
|
|
#endif
|
2013-08-09 22:27:11 +02:00
|
|
|
#ifdef CONFIG_PCI_MSI
|
2024-08-07 18:40:57 +02:00
|
|
|
struct irq_domain *msi_domain;
|
|
|
|
struct irq_domain *msi_inner_domain;
|
|
|
|
DECLARE_BITMAP(msi_used, PCI_MSI_FULL_DOORBELL_NR);
|
|
|
|
struct mutex msi_lock;
|
|
|
|
phys_addr_t msi_doorbell_addr;
|
2024-08-07 18:40:58 +02:00
|
|
|
u32 msi_doorbell_mask;
|
|
|
|
unsigned int msi_doorbell_start, msi_doorbell_size;
|
2013-08-09 22:27:11 +02:00
|
|
|
#endif
|
2024-08-07 18:40:57 +02:00
|
|
|
u32 doorbell_mask;
|
|
|
|
};
|
|
|
|
|
2024-08-07 18:41:00 +02:00
|
|
|
static struct mpic *mpic_data __ro_after_init;
|
2012-06-13 19:01:28 +02:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static inline bool mpic_is_ipi_available(struct mpic *mpic)
|
2024-06-21 11:38:29 +02:00
|
|
|
{
|
|
|
|
/*
|
|
|
|
* We distinguish IPI availability in the IC by the IC not having a
|
|
|
|
* parent irq defined. If a parent irq is defined, there is a parent
|
|
|
|
* interrupt controller (e.g. GIC) that takes care of inter-processor
|
|
|
|
* interrupts.
|
|
|
|
*/
|
2024-08-07 18:40:57 +02:00
|
|
|
return mpic->parent_irq <= 0;
|
2024-06-21 11:38:29 +02:00
|
|
|
}
|
|
|
|
|
2024-07-11 18:08:58 +02:00
|
|
|
static inline bool mpic_is_percpu_irq(irq_hw_number_t hwirq)
|
2015-03-03 11:43:15 +01:00
|
|
|
{
|
2024-08-07 18:41:01 +02:00
|
|
|
return hwirq < MPIC_PER_CPU_IRQS_NR;
|
2015-03-03 11:43:15 +01:00
|
|
|
}
|
|
|
|
|
2012-12-05 21:43:23 +01:00
|
|
|
/*
|
|
|
|
* In SMP mode:
|
|
|
|
* For shared global interrupts, mask/unmask global enable bit
|
2013-03-15 23:34:04 +01:00
|
|
|
* For CPU interrupts, mask/unmask the calling CPU's bit
|
2012-12-05 21:43:23 +01:00
|
|
|
*/
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_irq_mask(struct irq_data *d)
|
2012-06-13 19:01:28 +02:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_data_get_irq_chip_data(d);
|
2012-12-05 21:43:23 +01:00
|
|
|
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
if (!mpic_is_percpu_irq(hwirq))
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(hwirq, mpic->base + MPIC_INT_CLEAR_ENABLE);
|
2012-12-05 21:43:23 +01:00
|
|
|
else
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(hwirq, mpic->per_cpu + MPIC_INT_SET_MASK);
|
2012-06-13 19:01:28 +02:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_irq_unmask(struct irq_data *d)
|
2012-06-13 19:01:28 +02:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_data_get_irq_chip_data(d);
|
2012-12-05 21:43:23 +01:00
|
|
|
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
if (!mpic_is_percpu_irq(hwirq))
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(hwirq, mpic->base + MPIC_INT_SET_ENABLE);
|
2012-12-05 21:43:23 +01:00
|
|
|
else
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(hwirq, mpic->per_cpu + MPIC_INT_CLEAR_MASK);
|
2012-06-13 19:01:28 +02:00
|
|
|
}
|
|
|
|
|
2013-08-09 22:27:11 +02:00
|
|
|
#ifdef CONFIG_PCI_MSI
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static struct irq_chip mpic_msi_irq_chip = {
|
2024-07-11 13:57:43 +02:00
|
|
|
.name = "MPIC MSI",
|
|
|
|
.irq_mask = pci_msi_mask_irq,
|
|
|
|
.irq_unmask = pci_msi_unmask_irq,
|
2016-02-10 15:46:57 +01:00
|
|
|
};
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static struct msi_domain_info mpic_msi_domain_info = {
|
2016-02-10 15:47:00 +01:00
|
|
|
.flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS |
|
2017-08-18 14:59:26 +02:00
|
|
|
MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX),
|
2024-07-11 13:57:44 +02:00
|
|
|
.chip = &mpic_msi_irq_chip,
|
2016-02-10 15:46:57 +01:00
|
|
|
};
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-07-11 18:09:00 +02:00
|
|
|
static void mpic_compose_msi_msg(struct irq_data *d, struct msi_msg *msg)
|
2013-08-09 22:27:11 +02:00
|
|
|
{
|
2024-07-11 18:09:00 +02:00
|
|
|
unsigned int cpu = cpumask_first(irq_data_get_effective_affinity_mask(d));
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_data_get_irq_chip_data(d);
|
2022-04-22 04:35:32 +00:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
msg->address_lo = lower_32_bits(mpic->msi_doorbell_addr);
|
|
|
|
msg->address_hi = upper_32_bits(mpic->msi_doorbell_addr);
|
2024-08-07 18:40:58 +02:00
|
|
|
msg->data = BIT(cpu + 8) | (d->hwirq + mpic->msi_doorbell_start);
|
2013-08-09 22:27:11 +02:00
|
|
|
}
|
|
|
|
|
2024-07-11 18:09:00 +02:00
|
|
|
static int mpic_msi_set_affinity(struct irq_data *d, const struct cpumask *mask, bool force)
|
2013-08-09 22:27:11 +02:00
|
|
|
{
|
2022-04-22 04:35:32 +00:00
|
|
|
unsigned int cpu;
|
|
|
|
|
|
|
|
if (!force)
|
|
|
|
cpu = cpumask_any_and(mask, cpu_online_mask);
|
|
|
|
else
|
|
|
|
cpu = cpumask_first(mask);
|
|
|
|
|
|
|
|
if (cpu >= nr_cpu_ids)
|
|
|
|
return -EINVAL;
|
|
|
|
|
2024-07-11 18:09:00 +02:00
|
|
|
irq_data_update_effective_affinity(d, cpumask_of(cpu));
|
2022-04-22 04:35:32 +00:00
|
|
|
|
|
|
|
return IRQ_SET_MASK_OK;
|
2016-02-10 15:46:57 +01:00
|
|
|
}
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static struct irq_chip mpic_msi_bottom_irq_chip = {
|
2016-02-10 15:46:59 +01:00
|
|
|
.name = "MPIC MSI",
|
2024-07-11 13:57:44 +02:00
|
|
|
.irq_compose_msi_msg = mpic_compose_msi_msg,
|
|
|
|
.irq_set_affinity = mpic_msi_set_affinity,
|
2016-02-10 15:46:57 +01:00
|
|
|
};
|
2014-09-07 20:57:54 +02:00
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static int mpic_msi_alloc(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs,
|
|
|
|
void *args)
|
2016-02-10 15:46:57 +01:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = domain->host_data;
|
2024-07-08 17:18:01 +02:00
|
|
|
int hwirq;
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
mutex_lock(&mpic->msi_lock);
|
2024-08-07 18:40:58 +02:00
|
|
|
hwirq = bitmap_find_free_region(mpic->msi_used, mpic->msi_doorbell_size,
|
2021-11-25 14:00:57 +01:00
|
|
|
order_base_2(nr_irqs));
|
2024-08-07 18:40:57 +02:00
|
|
|
mutex_unlock(&mpic->msi_lock);
|
2016-02-10 15:47:00 +01:00
|
|
|
|
2021-11-25 14:00:57 +01:00
|
|
|
if (hwirq < 0)
|
2016-02-10 15:46:57 +01:00
|
|
|
return -ENOSPC;
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-07-11 18:08:59 +02:00
|
|
|
for (unsigned int i = 0; i < nr_irqs; i++) {
|
2016-02-10 15:47:00 +01:00
|
|
|
irq_domain_set_info(domain, virq + i, hwirq + i,
|
2024-07-11 13:57:44 +02:00
|
|
|
&mpic_msi_bottom_irq_chip,
|
2016-02-10 15:47:00 +01:00
|
|
|
domain->host_data, handle_simple_irq,
|
|
|
|
NULL, NULL);
|
|
|
|
}
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2021-11-25 14:00:56 +01:00
|
|
|
return 0;
|
2013-08-09 22:27:11 +02:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_msi_free(struct irq_domain *domain, unsigned int virq, unsigned int nr_irqs)
|
2013-08-09 22:27:11 +02:00
|
|
|
{
|
2016-02-10 15:46:57 +01:00
|
|
|
struct irq_data *d = irq_domain_get_irq_data(domain, virq);
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = domain->host_data;
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
mutex_lock(&mpic->msi_lock);
|
|
|
|
bitmap_release_region(mpic->msi_used, d->hwirq, order_base_2(nr_irqs));
|
|
|
|
mutex_unlock(&mpic->msi_lock);
|
2013-08-09 22:27:11 +02:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static const struct irq_domain_ops mpic_msi_domain_ops = {
|
|
|
|
.alloc = mpic_msi_alloc,
|
|
|
|
.free = mpic_msi_free,
|
2013-08-09 22:27:11 +02:00
|
|
|
};
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_msi_reenable_percpu(struct mpic *mpic)
|
2013-08-09 22:27:11 +02:00
|
|
|
{
|
|
|
|
u32 reg;
|
|
|
|
|
2022-04-22 04:35:32 +00:00
|
|
|
/* Enable MSI doorbell mask and combined cpu local interrupt */
|
2024-08-07 18:40:57 +02:00
|
|
|
reg = readl(mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2024-08-07 18:40:58 +02:00
|
|
|
reg |= mpic->msi_doorbell_mask;
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(reg, mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2024-06-21 11:38:31 +02:00
|
|
|
|
2022-04-22 04:35:32 +00:00
|
|
|
/* Unmask local doorbell interrupt */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(1, mpic->per_cpu + MPIC_INT_CLEAR_MASK);
|
2022-04-22 04:35:32 +00:00
|
|
|
}
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static int __init mpic_msi_init(struct mpic *mpic, struct device_node *node,
|
|
|
|
phys_addr_t main_int_phys_base)
|
2022-04-22 04:35:32 +00:00
|
|
|
{
|
2024-08-07 18:40:57 +02:00
|
|
|
mpic->msi_doorbell_addr = main_int_phys_base + MPIC_SW_TRIG_INT;
|
|
|
|
|
|
|
|
mutex_init(&mpic->msi_lock);
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
if (mpic_is_ipi_available(mpic)) {
|
2024-08-07 18:40:58 +02:00
|
|
|
mpic->msi_doorbell_start = PCI_MSI_DOORBELL_START;
|
|
|
|
mpic->msi_doorbell_size = PCI_MSI_DOORBELL_NR;
|
|
|
|
mpic->msi_doorbell_mask = PCI_MSI_DOORBELL_MASK;
|
|
|
|
} else {
|
|
|
|
mpic->msi_doorbell_start = PCI_MSI_FULL_DOORBELL_START;
|
|
|
|
mpic->msi_doorbell_size = PCI_MSI_FULL_DOORBELL_NR;
|
|
|
|
mpic->msi_doorbell_mask = PCI_MSI_FULL_DOORBELL_MASK;
|
|
|
|
}
|
|
|
|
|
|
|
|
mpic->msi_inner_domain = irq_domain_add_linear(NULL, mpic->msi_doorbell_size,
|
2024-08-07 18:40:59 +02:00
|
|
|
&mpic_msi_domain_ops, mpic);
|
2024-08-07 18:40:57 +02:00
|
|
|
if (!mpic->msi_inner_domain)
|
2013-08-09 22:27:11 +02:00
|
|
|
return -ENOMEM;
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
mpic->msi_domain = pci_msi_create_irq_domain(of_node_to_fwnode(node), &mpic_msi_domain_info,
|
|
|
|
mpic->msi_inner_domain);
|
|
|
|
if (!mpic->msi_domain) {
|
|
|
|
irq_domain_remove(mpic->msi_inner_domain);
|
2013-08-09 22:27:11 +02:00
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
mpic_msi_reenable_percpu(mpic);
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-06-21 11:38:31 +02:00
|
|
|
/* Unmask low 16 MSI irqs on non-IPI platforms */
|
2024-08-07 18:40:59 +02:00
|
|
|
if (!mpic_is_ipi_available(mpic))
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(0, mpic->per_cpu + MPIC_INT_CLEAR_MASK);
|
2024-06-21 11:38:31 +02:00
|
|
|
|
2013-08-09 22:27:11 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#else
|
2024-08-07 18:40:59 +02:00
|
|
|
static __maybe_unused void mpic_msi_reenable_percpu(struct mpic *mpic) {}
|
2022-04-22 04:35:32 +00:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static inline int mpic_msi_init(struct mpic *mpic, struct device_node *node,
|
2024-07-11 13:57:44 +02:00
|
|
|
phys_addr_t main_int_phys_base)
|
2013-08-09 22:27:11 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_perf_init(struct mpic *mpic)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
2024-07-11 18:09:05 +02:00
|
|
|
u32 cpuid;
|
2022-04-25 13:37:05 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This Performance Counter Overflow interrupt is specific for
|
|
|
|
* Armada 370 and XP. It is not available on Armada 375, 38x and 39x.
|
|
|
|
*/
|
|
|
|
if (!of_machine_is_compatible("marvell,armada-370-xp"))
|
|
|
|
return;
|
|
|
|
|
|
|
|
cpuid = cpu_logical_map(smp_processor_id());
|
2020-06-22 21:23:36 +01:00
|
|
|
|
|
|
|
/* Enable Performance Counter Overflow interrupts */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(MPIC_INT_CAUSE_PERF(cpuid), mpic->per_cpu + MPIC_INT_FABRIC_MASK);
|
2020-06-22 21:23:36 +01:00
|
|
|
}
|
|
|
|
|
2012-08-02 11:19:12 +03:00
|
|
|
#ifdef CONFIG_SMP
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_ipi_mask(struct irq_data *d)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_data_get_irq_chip_data(d);
|
2020-06-22 21:23:36 +01:00
|
|
|
u32 reg;
|
2024-07-11 13:57:43 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
reg = readl(mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2020-06-22 21:23:36 +01:00
|
|
|
reg &= ~BIT(d->hwirq);
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(reg, mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2020-06-22 21:23:36 +01:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_ipi_unmask(struct irq_data *d)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_data_get_irq_chip_data(d);
|
2020-06-22 21:23:36 +01:00
|
|
|
u32 reg;
|
2024-07-11 13:57:43 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
reg = readl(mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2020-06-22 21:23:36 +01:00
|
|
|
reg |= BIT(d->hwirq);
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(reg, mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2020-06-22 21:23:36 +01:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_ipi_send_mask(struct irq_data *d, const struct cpumask *mask)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_data_get_irq_chip_data(d);
|
2024-07-08 17:17:58 +02:00
|
|
|
unsigned int cpu;
|
2024-07-11 18:09:05 +02:00
|
|
|
u32 map = 0;
|
2020-06-22 21:23:36 +01:00
|
|
|
|
|
|
|
/* Convert our logical CPU mask into a physical one. */
|
|
|
|
for_each_cpu(cpu, mask)
|
2024-07-08 17:17:55 +02:00
|
|
|
map |= BIT(cpu_logical_map(cpu));
|
2020-06-22 21:23:36 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Ensure that stores to Normal memory are visible to the
|
|
|
|
* other CPUs before issuing the IPI.
|
|
|
|
*/
|
|
|
|
dsb();
|
|
|
|
|
|
|
|
/* submit softirq */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel((map << 8) | d->hwirq, mpic->base + MPIC_SW_TRIG_INT);
|
2020-06-22 21:23:36 +01:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_ipi_ack(struct irq_data *d)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_data_get_irq_chip_data(d);
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(~BIT(d->hwirq), mpic->per_cpu + MPIC_IN_DRBEL_CAUSE);
|
2020-06-22 21:23:36 +01:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static struct irq_chip mpic_ipi_irqchip = {
|
2020-06-22 21:23:36 +01:00
|
|
|
.name = "IPI",
|
2024-07-11 13:57:44 +02:00
|
|
|
.irq_ack = mpic_ipi_ack,
|
|
|
|
.irq_mask = mpic_ipi_mask,
|
|
|
|
.irq_unmask = mpic_ipi_unmask,
|
|
|
|
.ipi_send_mask = mpic_ipi_send_mask,
|
2020-06-22 21:23:36 +01:00
|
|
|
};
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static int mpic_ipi_alloc(struct irq_domain *d, unsigned int virq,
|
|
|
|
unsigned int nr_irqs, void *args)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
2024-07-11 18:08:59 +02:00
|
|
|
for (unsigned int i = 0; i < nr_irqs; i++) {
|
2020-06-22 21:23:36 +01:00
|
|
|
irq_set_percpu_devid(virq + i);
|
2024-07-11 13:57:44 +02:00
|
|
|
irq_domain_set_info(d, virq + i, i, &mpic_ipi_irqchip, d->host_data,
|
2024-07-11 13:57:43 +02:00
|
|
|
handle_percpu_devid_irq, NULL, NULL);
|
2020-06-22 21:23:36 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_ipi_free(struct irq_domain *d, unsigned int virq,
|
|
|
|
unsigned int nr_irqs)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
|
|
|
/* Not freeing IPIs */
|
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static const struct irq_domain_ops mpic_ipi_domain_ops = {
|
|
|
|
.alloc = mpic_ipi_alloc,
|
|
|
|
.free = mpic_ipi_free,
|
2020-06-22 21:23:36 +01:00
|
|
|
};
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_ipi_resume(struct mpic *mpic)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
2024-08-07 18:40:53 +02:00
|
|
|
for (irq_hw_number_t i = 0; i < IPI_DOORBELL_NR; i++) {
|
2024-08-07 18:40:57 +02:00
|
|
|
unsigned int virq = irq_find_mapping(mpic->ipi_domain, i);
|
2024-07-11 13:57:42 +02:00
|
|
|
struct irq_data *d;
|
2020-06-22 21:23:36 +01:00
|
|
|
|
2024-07-11 13:57:42 +02:00
|
|
|
if (!virq || !irq_percpu_is_enabled(virq))
|
2020-06-22 21:23:36 +01:00
|
|
|
continue;
|
2024-07-11 13:57:42 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
d = irq_domain_get_irq_data(mpic->ipi_domain, virq);
|
2024-07-11 13:57:44 +02:00
|
|
|
mpic_ipi_unmask(d);
|
2020-06-22 21:23:36 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static int __init mpic_ipi_init(struct mpic *mpic, struct device_node *node)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
|
|
|
int base_ipi;
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
mpic->ipi_domain = irq_domain_create_linear(of_node_to_fwnode(node), IPI_DOORBELL_NR,
|
2024-08-07 18:40:59 +02:00
|
|
|
&mpic_ipi_domain_ops, mpic);
|
2024-08-07 18:40:57 +02:00
|
|
|
if (WARN_ON(!mpic->ipi_domain))
|
2024-07-11 18:09:07 +02:00
|
|
|
return -ENOMEM;
|
2020-06-22 21:23:36 +01:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
irq_domain_update_bus_token(mpic->ipi_domain, DOMAIN_BUS_IPI);
|
|
|
|
base_ipi = irq_domain_alloc_irqs(mpic->ipi_domain, IPI_DOORBELL_NR, NUMA_NO_NODE, NULL);
|
2020-06-22 21:23:36 +01:00
|
|
|
if (WARN_ON(!base_ipi))
|
2024-07-11 18:09:07 +02:00
|
|
|
return -ENOMEM;
|
|
|
|
|
2024-08-07 18:40:53 +02:00
|
|
|
set_smp_ipi_range(base_ipi, IPI_DOORBELL_NR);
|
2024-07-11 18:09:07 +02:00
|
|
|
|
|
|
|
return 0;
|
2020-06-22 21:23:36 +01:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static int mpic_set_affinity(struct irq_data *d, const struct cpumask *mask_val, bool force)
|
2012-08-02 11:19:12 +03:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_data_get_irq_chip_data(d);
|
2012-12-05 21:43:23 +01:00
|
|
|
irq_hw_number_t hwirq = irqd_to_hwirq(d);
|
2024-07-08 17:17:58 +02:00
|
|
|
unsigned int cpu;
|
2012-12-05 21:43:23 +01:00
|
|
|
|
2014-03-04 20:43:41 +00:00
|
|
|
/* Select a single core from the affinity mask which is online */
|
|
|
|
cpu = cpumask_any_and(mask_val, cpu_online_mask);
|
2012-12-05 21:43:23 +01:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
atomic_io_modify(mpic->base + MPIC_INT_SOURCE_CTL(hwirq),
|
2024-07-08 17:17:57 +02:00
|
|
|
MPIC_INT_SOURCE_CPU_MASK, BIT(cpu_logical_map(cpu)));
|
2012-12-05 21:43:23 +01:00
|
|
|
|
2017-08-18 09:39:19 +01:00
|
|
|
irq_data_update_effective_affinity(d, cpumask_of(cpu));
|
|
|
|
|
2014-10-24 13:59:16 +02:00
|
|
|
return IRQ_SET_MASK_OK;
|
2012-08-02 11:19:12 +03:00
|
|
|
}
|
2012-06-13 19:01:28 +02:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_smp_cpu_init(struct mpic *mpic)
|
2012-08-02 11:19:12 +03:00
|
|
|
{
|
2024-08-07 18:40:57 +02:00
|
|
|
for (irq_hw_number_t i = 0; i < mpic->domain->hwirq_max; i++)
|
|
|
|
writel(i, mpic->per_cpu + MPIC_INT_SET_MASK);
|
2014-05-30 22:18:18 +02:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
if (!mpic_is_ipi_available(mpic))
|
2024-06-21 11:38:30 +02:00
|
|
|
return;
|
|
|
|
|
2020-06-22 21:23:36 +01:00
|
|
|
/* Disable all IPIs */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(0, mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2020-06-22 21:23:36 +01:00
|
|
|
|
2012-08-02 11:19:12 +03:00
|
|
|
/* Clear pending IPIs */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(0, mpic->per_cpu + MPIC_IN_DRBEL_CAUSE);
|
2012-08-02 11:19:12 +03:00
|
|
|
|
|
|
|
/* Unmask IPI interrupt */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(0, mpic->per_cpu + MPIC_INT_CLEAR_MASK);
|
2012-08-02 11:19:12 +03:00
|
|
|
}
|
2014-04-14 15:54:02 +02:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_reenable_percpu(struct mpic *mpic)
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
{
|
|
|
|
/* Re-enable per-CPU interrupts that were enabled before suspend */
|
2024-08-07 18:41:01 +02:00
|
|
|
for (irq_hw_number_t i = 0; i < MPIC_PER_CPU_IRQS_NR; i++) {
|
2024-08-07 18:40:57 +02:00
|
|
|
unsigned int virq = irq_linear_revmap(mpic->domain, i);
|
2024-07-11 18:09:00 +02:00
|
|
|
struct irq_data *d;
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
|
2024-07-11 18:09:01 +02:00
|
|
|
if (!virq || !irq_percpu_is_enabled(virq))
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
continue;
|
|
|
|
|
2024-07-11 18:09:00 +02:00
|
|
|
d = irq_get_irq_data(virq);
|
|
|
|
mpic_irq_unmask(d);
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
}
|
2020-06-22 21:23:36 +01:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
if (mpic_is_ipi_available(mpic))
|
|
|
|
mpic_ipi_resume(mpic);
|
2022-04-22 04:35:32 +00:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
mpic_msi_reenable_percpu(mpic);
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static int mpic_starting_cpu(unsigned int cpu)
|
2014-04-14 15:54:02 +02:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_get_default_host()->host_data;
|
|
|
|
|
|
|
|
mpic_perf_init(mpic);
|
|
|
|
mpic_smp_cpu_init(mpic);
|
|
|
|
mpic_reenable_percpu(mpic);
|
2024-07-11 13:57:43 +02:00
|
|
|
|
2016-07-13 17:16:07 +00:00
|
|
|
return 0;
|
2014-04-14 15:54:02 +02:00
|
|
|
}
|
|
|
|
|
2016-07-13 17:16:07 +00:00
|
|
|
static int mpic_cascaded_starting_cpu(unsigned int cpu)
|
irqchip: armada-370-xp: Fix chained per-cpu interrupts
On the Cortex-A9-based Armada SoCs, the MPIC is not the primary interrupt
controller. Yet, it still has to handle some per-cpu interrupt.
To do so, it is chained with the GIC using a per-cpu interrupt. However, the
current code only call irq_set_chained_handler, which is called and enable that
interrupt only on the boot CPU, which means that the parent per-CPU interrupt
is never unmasked on the secondary CPUs, preventing the per-CPU interrupt to
actually work as expected.
This was not seen until now since the only MPIC PPI users were the Marvell
timers that were not working, but not used either since the system use the ARM
TWD by default, and the ethernet controllers, that are faking there interrupts
as SPI, and don't really expect to have interrupts on the secondary cores
anyway.
Add a CPU notifier that will enable the PPI on the secondary cores when they
are brought up.
Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1425378443-28822-1-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
2015-03-03 11:27:23 +01:00
|
|
|
{
|
2024-08-07 18:41:00 +02:00
|
|
|
struct mpic *mpic = mpic_data;
|
2024-08-07 18:40:59 +02:00
|
|
|
|
|
|
|
mpic_perf_init(mpic);
|
|
|
|
mpic_reenable_percpu(mpic);
|
2024-08-07 18:40:57 +02:00
|
|
|
enable_percpu_irq(mpic->parent_irq, IRQ_TYPE_NONE);
|
2024-07-11 13:57:43 +02:00
|
|
|
|
2016-07-13 17:16:07 +00:00
|
|
|
return 0;
|
irqchip: armada-370-xp: Fix chained per-cpu interrupts
On the Cortex-A9-based Armada SoCs, the MPIC is not the primary interrupt
controller. Yet, it still has to handle some per-cpu interrupt.
To do so, it is chained with the GIC using a per-cpu interrupt. However, the
current code only call irq_set_chained_handler, which is called and enable that
interrupt only on the boot CPU, which means that the parent per-CPU interrupt
is never unmasked on the secondary CPUs, preventing the per-CPU interrupt to
actually work as expected.
This was not seen until now since the only MPIC PPI users were the Marvell
timers that were not working, but not used either since the system use the ARM
TWD by default, and the ethernet controllers, that are faking there interrupts
as SPI, and don't really expect to have interrupts on the secondary cores
anyway.
Add a CPU notifier that will enable the PPI on the secondary cores when they
are brought up.
Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1425378443-28822-1-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
2015-03-03 11:27:23 +01:00
|
|
|
}
|
2020-06-22 21:23:36 +01:00
|
|
|
#else
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_smp_cpu_init(struct mpic *mpic) {}
|
|
|
|
static void mpic_ipi_resume(struct mpic *mpic) {}
|
2020-06-22 21:23:36 +01:00
|
|
|
#endif
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static struct irq_chip mpic_irq_chip = {
|
2020-06-22 21:23:36 +01:00
|
|
|
.name = "MPIC",
|
2024-07-11 13:57:44 +02:00
|
|
|
.irq_mask = mpic_irq_mask,
|
|
|
|
.irq_mask_ack = mpic_irq_mask,
|
|
|
|
.irq_unmask = mpic_irq_unmask,
|
2020-06-22 21:23:36 +01:00
|
|
|
#ifdef CONFIG_SMP
|
2024-07-11 13:57:44 +02:00
|
|
|
.irq_set_affinity = mpic_set_affinity,
|
2016-07-18 18:03:21 +02:00
|
|
|
#endif
|
2020-06-22 21:23:36 +01:00
|
|
|
.flags = IRQCHIP_SKIP_SET_WAKE | IRQCHIP_MASK_ON_SUSPEND,
|
|
|
|
};
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
static int mpic_irq_map(struct irq_domain *domain, unsigned int virq, irq_hw_number_t hwirq)
|
2020-06-22 21:23:36 +01:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = domain->host_data;
|
|
|
|
|
2024-06-21 11:38:28 +02:00
|
|
|
/* IRQs 0 and 1 cannot be mapped, they are handled internally */
|
2024-07-11 18:08:58 +02:00
|
|
|
if (hwirq <= 1)
|
2024-06-21 11:38:28 +02:00
|
|
|
return -EINVAL;
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
irq_set_chip_data(virq, mpic);
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
mpic_irq_mask(irq_get_irq_data(virq));
|
2024-07-11 18:08:58 +02:00
|
|
|
if (!mpic_is_percpu_irq(hwirq))
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(hwirq, mpic->per_cpu + MPIC_INT_CLEAR_MASK);
|
2020-06-22 21:23:36 +01:00
|
|
|
else
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(hwirq, mpic->base + MPIC_INT_SET_ENABLE);
|
2020-06-22 21:23:36 +01:00
|
|
|
irq_set_status_flags(virq, IRQ_LEVEL);
|
|
|
|
|
2024-07-11 18:08:58 +02:00
|
|
|
if (mpic_is_percpu_irq(hwirq)) {
|
2020-06-22 21:23:36 +01:00
|
|
|
irq_set_percpu_devid(virq);
|
2024-07-11 13:57:44 +02:00
|
|
|
irq_set_chip_and_handler(virq, &mpic_irq_chip, handle_percpu_devid_irq);
|
2020-06-22 21:23:36 +01:00
|
|
|
} else {
|
2024-07-11 13:57:44 +02:00
|
|
|
irq_set_chip_and_handler(virq, &mpic_irq_chip, handle_level_irq);
|
2020-06-22 21:23:36 +01:00
|
|
|
irqd_set_single_target(irq_desc_get_irq_data(irq_to_desc(virq)));
|
|
|
|
}
|
|
|
|
irq_set_probe(virq);
|
|
|
|
return 0;
|
|
|
|
}
|
2012-08-02 11:19:12 +03:00
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static const struct irq_domain_ops mpic_irq_ops = {
|
|
|
|
.map = mpic_irq_map,
|
2024-07-11 13:57:43 +02:00
|
|
|
.xlate = irq_domain_xlate_onecell,
|
2012-06-13 19:01:28 +02:00
|
|
|
};
|
|
|
|
|
2014-02-10 17:00:01 -03:00
|
|
|
#ifdef CONFIG_PCI_MSI
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_handle_msi_irq(struct mpic *mpic)
|
2014-02-10 17:00:01 -03:00
|
|
|
{
|
2024-07-11 13:57:47 +02:00
|
|
|
unsigned long cause;
|
|
|
|
unsigned int i;
|
2014-02-10 17:00:01 -03:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
cause = readl_relaxed(mpic->per_cpu + MPIC_IN_DRBEL_CAUSE);
|
2024-08-07 18:40:58 +02:00
|
|
|
cause &= mpic->msi_doorbell_mask;
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(~cause, mpic->per_cpu + MPIC_IN_DRBEL_CAUSE);
|
2014-02-10 17:00:01 -03:00
|
|
|
|
2024-07-11 13:57:47 +02:00
|
|
|
for_each_set_bit(i, &cause, BITS_PER_LONG)
|
2024-08-07 18:40:58 +02:00
|
|
|
generic_handle_domain_irq(mpic->msi_inner_domain, i - mpic->msi_doorbell_start);
|
2014-02-10 17:00:01 -03:00
|
|
|
}
|
|
|
|
#else
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_handle_msi_irq(struct mpic *mpic) {}
|
2014-02-10 17:00:01 -03:00
|
|
|
#endif
|
|
|
|
|
2024-07-11 13:57:48 +02:00
|
|
|
#ifdef CONFIG_SMP
|
2024-08-07 18:40:59 +02:00
|
|
|
static void mpic_handle_ipi_irq(struct mpic *mpic)
|
2024-07-11 13:57:48 +02:00
|
|
|
{
|
|
|
|
unsigned long cause;
|
|
|
|
irq_hw_number_t i;
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
cause = readl_relaxed(mpic->per_cpu + MPIC_IN_DRBEL_CAUSE);
|
2024-07-11 13:57:48 +02:00
|
|
|
cause &= IPI_DOORBELL_MASK;
|
|
|
|
|
2024-08-07 18:40:53 +02:00
|
|
|
for_each_set_bit(i, &cause, IPI_DOORBELL_NR)
|
2024-08-07 18:40:57 +02:00
|
|
|
generic_handle_domain_irq(mpic->ipi_domain, i);
|
2024-07-11 13:57:48 +02:00
|
|
|
}
|
|
|
|
#else
|
2024-08-07 18:40:59 +02:00
|
|
|
static inline void mpic_handle_ipi_irq(struct mpic *mpic) {}
|
2024-07-11 13:57:48 +02:00
|
|
|
#endif
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_handle_cascade_irq(struct irq_desc *desc)
|
2014-02-10 17:00:02 -03:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_desc_get_handler_data(desc);
|
2015-06-04 12:13:20 +08:00
|
|
|
struct irq_chip *chip = irq_desc_get_chip(desc);
|
2024-07-11 18:09:05 +02:00
|
|
|
unsigned long cause;
|
|
|
|
u32 irqsrc, cpuid;
|
2024-07-11 18:08:59 +02:00
|
|
|
irq_hw_number_t i;
|
2014-02-10 17:00:02 -03:00
|
|
|
|
|
|
|
chained_irq_enter(chip, desc);
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
cause = readl_relaxed(mpic->per_cpu + MPIC_PPI_CAUSE);
|
2014-09-25 13:17:19 +02:00
|
|
|
cpuid = cpu_logical_map(smp_processor_id());
|
2014-02-10 17:00:02 -03:00
|
|
|
|
2024-08-07 18:41:02 +02:00
|
|
|
for_each_set_bit(i, &cause, MPIC_PER_CPU_IRQS_NR) {
|
2024-08-07 18:40:57 +02:00
|
|
|
irqsrc = readl_relaxed(mpic->base + MPIC_INT_SOURCE_CTL(i));
|
2014-09-25 13:17:19 +02:00
|
|
|
|
|
|
|
/* Check if the interrupt is not masked on current CPU.
|
|
|
|
* Test IRQ (0-1) and FIQ (8-9) mask bits.
|
|
|
|
*/
|
2024-07-08 17:17:57 +02:00
|
|
|
if (!(irqsrc & MPIC_INT_IRQ_FIQ_MASK(cpuid)))
|
2014-09-25 13:17:19 +02:00
|
|
|
continue;
|
|
|
|
|
2024-07-11 18:08:58 +02:00
|
|
|
if (i == 0 || i == 1) {
|
2024-08-07 18:40:59 +02:00
|
|
|
mpic_handle_msi_irq(mpic);
|
2014-09-25 13:17:19 +02:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
generic_handle_domain_irq(mpic->domain, i);
|
2014-02-10 17:00:02 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
chained_irq_exit(chip, desc);
|
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void __exception_irq_entry mpic_handle_irq(struct pt_regs *regs)
|
2012-06-13 19:01:28 +02:00
|
|
|
{
|
2024-08-07 18:40:59 +02:00
|
|
|
struct mpic *mpic = irq_get_default_host()->host_data;
|
2024-07-11 18:08:59 +02:00
|
|
|
irq_hw_number_t i;
|
|
|
|
u32 irqstat;
|
2012-06-13 19:01:28 +02:00
|
|
|
|
|
|
|
do {
|
2024-08-07 18:40:57 +02:00
|
|
|
irqstat = readl_relaxed(mpic->per_cpu + MPIC_CPU_INTACK);
|
2024-07-11 18:08:58 +02:00
|
|
|
i = FIELD_GET(MPIC_CPU_INTACK_IID_MASK, irqstat);
|
2012-06-13 19:01:28 +02:00
|
|
|
|
2024-07-11 18:08:58 +02:00
|
|
|
if (i > 1022)
|
2012-08-02 11:19:12 +03:00
|
|
|
break;
|
|
|
|
|
2024-07-11 18:09:03 +02:00
|
|
|
if (i > 1)
|
2024-08-07 18:40:57 +02:00
|
|
|
generic_handle_domain_irq(mpic->domain, i);
|
2013-08-09 22:27:11 +02:00
|
|
|
|
|
|
|
/* MSI handling */
|
2024-07-11 18:08:58 +02:00
|
|
|
if (i == 1)
|
2024-08-07 18:40:59 +02:00
|
|
|
mpic_handle_msi_irq(mpic);
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2012-08-02 11:19:12 +03:00
|
|
|
/* IPI Handling */
|
2024-07-11 18:08:58 +02:00
|
|
|
if (i == 0)
|
2024-08-07 18:40:59 +02:00
|
|
|
mpic_handle_ipi_irq(mpic);
|
2012-06-13 19:01:28 +02:00
|
|
|
} while (1);
|
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static int mpic_suspend(void)
|
2014-11-21 17:00:00 +01:00
|
|
|
{
|
2024-08-07 18:41:00 +02:00
|
|
|
struct mpic *mpic = mpic_data;
|
2024-08-07 18:40:59 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
mpic->doorbell_mask = readl(mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2024-07-11 13:57:43 +02:00
|
|
|
|
2014-11-21 17:00:00 +01:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static void mpic_resume(void)
|
2014-11-21 17:00:00 +01:00
|
|
|
{
|
2024-08-07 18:41:00 +02:00
|
|
|
struct mpic *mpic = mpic_data;
|
2024-06-21 11:38:31 +02:00
|
|
|
bool src0, src1;
|
2024-07-11 13:57:45 +02:00
|
|
|
|
2014-11-21 17:00:00 +01:00
|
|
|
/* Re-enable interrupts */
|
2024-08-07 18:40:57 +02:00
|
|
|
for (irq_hw_number_t i = 0; i < mpic->domain->hwirq_max; i++) {
|
|
|
|
unsigned int virq = irq_linear_revmap(mpic->domain, i);
|
2024-07-11 18:09:00 +02:00
|
|
|
struct irq_data *d;
|
2014-11-21 17:00:00 +01:00
|
|
|
|
2024-07-11 13:57:41 +02:00
|
|
|
if (!virq)
|
2014-11-21 17:00:00 +01:00
|
|
|
continue;
|
|
|
|
|
2024-07-11 18:09:00 +02:00
|
|
|
d = irq_get_irq_data(virq);
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
|
2024-07-11 18:08:58 +02:00
|
|
|
if (!mpic_is_percpu_irq(i)) {
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
/* Non per-CPU interrupts */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(i, mpic->per_cpu + MPIC_INT_CLEAR_MASK);
|
2024-07-11 18:09:00 +02:00
|
|
|
if (!irqd_irq_disabled(d))
|
|
|
|
mpic_irq_unmask(d);
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
} else {
|
|
|
|
/* Per-CPU interrupts */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(i, mpic->base + MPIC_INT_SET_ENABLE);
|
2014-11-21 17:00:00 +01:00
|
|
|
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
/*
|
2024-07-11 13:57:44 +02:00
|
|
|
* Re-enable on the current CPU, mpic_reenable_percpu()
|
|
|
|
* will take care of secondary CPUs when they come up.
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
*/
|
|
|
|
if (irq_percpu_is_enabled(virq))
|
2024-07-11 18:09:00 +02:00
|
|
|
mpic_irq_unmask(d);
|
irqchip/armada-370-xp: Re-enable per-CPU interrupts at resume time
Commit d17cab4451df1 ("irqchip: Kill off set_irq_flags usage") changed
the code of armada_370_xp_mpic_irq_map() from using set_irq_flags() to
irq_set_probe().
While the commit log seems to imply that there are no functional
changes, there are indeed functional changes introduced by this commit:
the IRQ_NOAUTOEN flag is no longer cleared. This functional change
caused a regression on Armada XP, which no longer works properly after
suspend/resume because per-CPU interrupts remain disabled. This
regression was temporarly worked around in commit
353d6d6c82e5d ("irqchip/armada-370-xp: Fix regression by clearing
IRQ_NOAUTOEN"), but it is not the most satisfying solution. This commit
implements the solution that was initially discussed with Thomas
Gleixner.
Due to how the hardware registers work, the irq-armada-370-xp cannot
simply save/restore a bunch of registers at suspend/resume to make sure
that the interrupts remain in the same state after resuming. Therefore,
it relies on the kernel to say whether the interrupt is disabled or not,
using the irqd_irq_disabled() function. This was all working fine while
the IRQ_NOAUTOEN flag was cleared.
With the change introduced by Rob Herring in d17cab4451df1, the
IRQ_NOAUTOEN flag is now set for all interrupts. irqd_irq_disabled()
returns false for per-CPU interrupts, and therefore our per-CPU
interrupts are no longer re-enabled after resume.
This commit fixes that by using irqd_irq_disabled() only for global
interrupts, and using the newly introduced irq_percpu_is_enabled() for
per-CPU interrupts.
Also, it fixes a related problems that per-CPU interrupts were only
re-enabled on the boot CPU and not other CPUs. Until now this wasn't a
problem since on this platform, only the local timers are using per-CPU
interrupts and the local timers of secondary CPUs are turned off/on
during CPU hotplug before suspend, after after resume. However, since
Linux 4.4, we are also be using per-CPU interrupts for the network
controller, so we need to properly restore the per-CPU interrupts on
secondary CPUs as well.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
2017-05-18 10:07:39 +02:00
|
|
|
}
|
2014-11-21 17:00:00 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Reconfigure doorbells for IPIs and MSIs */
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(mpic->doorbell_mask, mpic->per_cpu + MPIC_IN_DRBEL_MASK);
|
2024-06-21 11:38:31 +02:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
if (mpic_is_ipi_available(mpic)) {
|
2024-08-07 18:40:57 +02:00
|
|
|
src0 = mpic->doorbell_mask & IPI_DOORBELL_MASK;
|
|
|
|
src1 = mpic->doorbell_mask & PCI_MSI_DOORBELL_MASK;
|
2024-06-21 11:38:31 +02:00
|
|
|
} else {
|
2024-08-07 18:40:57 +02:00
|
|
|
src0 = mpic->doorbell_mask & PCI_MSI_FULL_DOORBELL_SRC0_MASK;
|
|
|
|
src1 = mpic->doorbell_mask & PCI_MSI_FULL_DOORBELL_SRC1_MASK;
|
2024-06-21 11:38:31 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
if (src0)
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(0, mpic->per_cpu + MPIC_INT_CLEAR_MASK);
|
2024-06-21 11:38:31 +02:00
|
|
|
if (src1)
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(1, mpic->per_cpu + MPIC_INT_CLEAR_MASK);
|
2020-06-22 21:23:36 +01:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
if (mpic_is_ipi_available(mpic))
|
|
|
|
mpic_ipi_resume(mpic);
|
2014-11-21 17:00:00 +01:00
|
|
|
}
|
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
static struct syscore_ops mpic_syscore_ops = {
|
|
|
|
.suspend = mpic_suspend,
|
|
|
|
.resume = mpic_resume,
|
2014-11-21 17:00:00 +01:00
|
|
|
};
|
|
|
|
|
2024-07-11 18:09:06 +02:00
|
|
|
static int __init mpic_map_region(struct device_node *np, int index,
|
|
|
|
void __iomem **base, phys_addr_t *phys_base)
|
2012-06-13 19:01:28 +02:00
|
|
|
{
|
2024-07-11 18:09:06 +02:00
|
|
|
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;
|
|
|
|
}
|
2013-04-09 23:26:16 +02:00
|
|
|
|
2024-07-11 18:09:06 +02:00
|
|
|
if (phys_base)
|
|
|
|
*phys_base = res.start;
|
2013-04-09 23:26:16 +02:00
|
|
|
|
2024-07-11 18:09:06 +02:00
|
|
|
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;
|
2024-08-07 18:41:00 +02:00
|
|
|
struct mpic *mpic;
|
2024-07-11 18:09:06 +02:00
|
|
|
int err;
|
2013-08-09 22:27:10 +02:00
|
|
|
|
2024-08-07 18:41:00 +02:00
|
|
|
mpic = kzalloc(sizeof(*mpic), GFP_KERNEL);
|
|
|
|
if (WARN_ON(!mpic))
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
mpic_data = mpic;
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
err = mpic_map_region(node, 0, &mpic->base, &phys_base);
|
2024-07-11 18:09:06 +02:00
|
|
|
if (err)
|
|
|
|
return err;
|
2013-08-09 22:27:10 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
err = mpic_map_region(node, 1, &mpic->per_cpu, NULL);
|
2024-07-11 18:09:06 +02:00
|
|
|
if (err)
|
|
|
|
return err;
|
2013-04-09 23:26:16 +02:00
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
nr_irqs = FIELD_GET(MPIC_INT_CONTROL_NUMINT_MASK, readl(mpic->base + MPIC_INT_CONTROL));
|
2014-05-30 22:18:18 +02:00
|
|
|
|
2024-07-11 18:08:59 +02:00
|
|
|
for (irq_hw_number_t i = 0; i < nr_irqs; i++)
|
2024-08-07 18:40:57 +02:00
|
|
|
writel(i, mpic->base + MPIC_INT_CLEAR_ENABLE);
|
2013-04-09 23:26:16 +02:00
|
|
|
|
2024-08-07 18:41:03 +02:00
|
|
|
/*
|
|
|
|
* Initialize mpic->parent_irq before calling any other functions, since
|
|
|
|
* it is used to distinguish between IPI and non-IPI platforms.
|
|
|
|
*/
|
|
|
|
mpic->parent_irq = irq_of_parse_and_map(node, 0);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* On non-IPI platforms the driver currently supports only the per-CPU
|
|
|
|
* interrupts (the first 29 interrupts). See mpic_handle_cascade_irq().
|
|
|
|
*/
|
|
|
|
if (!mpic_is_ipi_available(mpic))
|
|
|
|
nr_irqs = MPIC_PER_CPU_IRQS_NR;
|
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
mpic->domain = irq_domain_add_linear(node, nr_irqs, &mpic_irq_ops, mpic);
|
2024-08-07 18:40:57 +02:00
|
|
|
if (!mpic->domain) {
|
2024-07-11 18:09:07 +02:00
|
|
|
pr_err("%pOF: Unable to add IRQ domain\n", node);
|
|
|
|
return -ENOMEM;
|
|
|
|
}
|
|
|
|
|
2024-08-07 18:40:57 +02:00
|
|
|
irq_domain_update_bus_token(mpic->domain, DOMAIN_BUS_WIRED);
|
2013-04-09 23:26:16 +02:00
|
|
|
|
2015-03-03 11:43:14 +01:00
|
|
|
/* Setup for the boot CPU */
|
2024-08-07 18:40:59 +02:00
|
|
|
mpic_perf_init(mpic);
|
|
|
|
mpic_smp_cpu_init(mpic);
|
2013-04-09 23:26:16 +02:00
|
|
|
|
2024-08-07 18:40:59 +02:00
|
|
|
err = mpic_msi_init(mpic, node, phys_base);
|
2024-07-11 18:09:07 +02:00
|
|
|
if (err) {
|
|
|
|
pr_err("%pOF: Unable to initialize MSI domain\n", node);
|
|
|
|
return err;
|
|
|
|
}
|
2013-08-09 22:27:11 +02:00
|
|
|
|
2024-08-07 18:41:04 +02:00
|
|
|
if (mpic_is_ipi_available(mpic)) {
|
2024-08-07 18:40:57 +02:00
|
|
|
irq_set_default_host(mpic->domain);
|
2024-07-11 13:57:44 +02:00
|
|
|
set_handle_irq(mpic_handle_irq);
|
2014-04-14 15:54:01 +02:00
|
|
|
#ifdef CONFIG_SMP
|
2024-08-07 18:40:59 +02:00
|
|
|
err = mpic_ipi_init(mpic, node);
|
2024-07-11 18:09:07 +02:00
|
|
|
if (err) {
|
|
|
|
pr_err("%pOF: Unable to initialize IPI domain\n", node);
|
|
|
|
return err;
|
|
|
|
}
|
|
|
|
|
2016-07-13 17:16:07 +00:00
|
|
|
cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_XP_STARTING,
|
2016-12-21 20:19:54 +01:00
|
|
|
"irqchip/armada/ipi:starting",
|
2024-07-11 13:57:44 +02:00
|
|
|
mpic_starting_cpu, NULL);
|
2014-04-14 15:54:01 +02:00
|
|
|
#endif
|
2014-02-10 17:00:02 -03:00
|
|
|
} else {
|
irqchip: armada-370-xp: Fix chained per-cpu interrupts
On the Cortex-A9-based Armada SoCs, the MPIC is not the primary interrupt
controller. Yet, it still has to handle some per-cpu interrupt.
To do so, it is chained with the GIC using a per-cpu interrupt. However, the
current code only call irq_set_chained_handler, which is called and enable that
interrupt only on the boot CPU, which means that the parent per-CPU interrupt
is never unmasked on the secondary CPUs, preventing the per-CPU interrupt to
actually work as expected.
This was not seen until now since the only MPIC PPI users were the Marvell
timers that were not working, but not used either since the system use the ARM
TWD by default, and the ethernet controllers, that are faking there interrupts
as SPI, and don't really expect to have interrupts on the secondary cores
anyway.
Add a CPU notifier that will enable the PPI on the secondary cores when they
are brought up.
Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1425378443-28822-1-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
2015-03-03 11:27:23 +01:00
|
|
|
#ifdef CONFIG_SMP
|
2016-12-21 20:19:57 +01:00
|
|
|
cpuhp_setup_state_nocalls(CPUHP_AP_IRQ_ARMADA_XP_STARTING,
|
2016-12-21 20:19:54 +01:00
|
|
|
"irqchip/armada/cascade:starting",
|
2016-07-13 17:16:07 +00:00
|
|
|
mpic_cascaded_starting_cpu, NULL);
|
irqchip: armada-370-xp: Fix chained per-cpu interrupts
On the Cortex-A9-based Armada SoCs, the MPIC is not the primary interrupt
controller. Yet, it still has to handle some per-cpu interrupt.
To do so, it is chained with the GIC using a per-cpu interrupt. However, the
current code only call irq_set_chained_handler, which is called and enable that
interrupt only on the boot CPU, which means that the parent per-CPU interrupt
is never unmasked on the secondary CPUs, preventing the per-CPU interrupt to
actually work as expected.
This was not seen until now since the only MPIC PPI users were the Marvell
timers that were not working, but not used either since the system use the ARM
TWD by default, and the ethernet controllers, that are faking there interrupts
as SPI, and don't really expect to have interrupts on the secondary cores
anyway.
Add a CPU notifier that will enable the PPI on the secondary cores when they
are brought up.
Cc: <stable@vger.kernel.org> # 3.15+
Signed-off-by: Maxime Ripard <maxime.ripard@free-electrons.com>
Acked-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
Link: https://lkml.kernel.org/r/1425378443-28822-1-git-send-email-maxime.ripard@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
2015-03-03 11:27:23 +01:00
|
|
|
#endif
|
2024-08-07 18:40:59 +02:00
|
|
|
irq_set_chained_handler_and_data(mpic->parent_irq,
|
|
|
|
mpic_handle_cascade_irq, mpic);
|
2014-02-10 17:00:02 -03:00
|
|
|
}
|
2013-04-09 23:26:16 +02:00
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
register_syscore_ops(&mpic_syscore_ops);
|
2014-11-21 17:00:00 +01:00
|
|
|
|
2013-04-09 23:26:16 +02:00
|
|
|
return 0;
|
2012-06-13 19:01:28 +02:00
|
|
|
}
|
2013-04-09 23:26:16 +02:00
|
|
|
|
2024-07-11 13:57:44 +02:00
|
|
|
IRQCHIP_DECLARE(marvell_mpic, "marvell,mpic", mpic_of_init);
|