mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-26 08:25:01 +07:00
9e2c986cb4
We've unfortunately started seeing a situation where percpu interrupts are partitioned in the system: one arbitrary set of CPUs has an interrupt connected to a type of device, while another disjoint set of CPUs has the same interrupt connected to another type of device. This makes it impossible to have a device driver requesting this interrupt using the current percpu-interrupt abstraction, as the same interrupt number is now potentially claimed by at least two drivers, and we forbid interrupt sharing on per-cpu interrupt. A solution to this is to turn things upside down. Let's assume that our system describes all the possible partitions for a given interrupt, and give each of them a unique identifier. It is then possible to create a namespace where the affinity identifier itself is a form of interrupt number. At this point, it becomes easy to implement a set of partitions as a cascaded irqchip, each affinity identifier being the HW irq. This allows us to keep a number of nice properties: - Each partition results in a separate percpu-interrupt (with a restrictied affinity), which keeps drivers happy. - Because the underlying interrupt is still per-cpu, the overhead of the indirection can be kept pretty minimal. - The core code can ignore most of that crap. For that purpose, we implement a small library that deals with some of the boilerplate code, relying on platform-specific drivers to provide a description of the affinity sets and a set of callbacks. Signed-off-by: Marc Zyngier <marc.zyngier@arm.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: devicetree@vger.kernel.org Cc: Jason Cooper <jason@lakedaemon.net> Cc: Will Deacon <will.deacon@arm.com> Cc: Rob Herring <robh+dt@kernel.org> Link: http://lkml.kernel.org/r/1460365075-7316-4-git-send-email-marc.zyngier@arm.com Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
60 lines
1.7 KiB
C
60 lines
1.7 KiB
C
/*
|
|
* Copyright (C) 2016 ARM Limited, All Rights Reserved.
|
|
* Author: Marc Zyngier <marc.zyngier@arm.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include <linux/fwnode.h>
|
|
#include <linux/cpumask.h>
|
|
#include <linux/irqdomain.h>
|
|
|
|
struct partition_affinity {
|
|
cpumask_t mask;
|
|
void *partition_id;
|
|
};
|
|
|
|
struct partition_desc;
|
|
|
|
#ifdef CONFIG_PARTITION_PERCPU
|
|
int partition_translate_id(struct partition_desc *desc, void *partition_id);
|
|
struct partition_desc *partition_create_desc(struct fwnode_handle *fwnode,
|
|
struct partition_affinity *parts,
|
|
int nr_parts,
|
|
int chained_irq,
|
|
const struct irq_domain_ops *ops);
|
|
struct irq_domain *partition_get_domain(struct partition_desc *dsc);
|
|
#else
|
|
static inline int partition_translate_id(struct partition_desc *desc,
|
|
void *partition_id)
|
|
{
|
|
return -EINVAL;
|
|
}
|
|
|
|
static inline
|
|
struct partition_desc *partition_create_desc(struct fwnode_handle *fwnode,
|
|
struct partition_affinity *parts,
|
|
int nr_parts,
|
|
int chained_irq,
|
|
const struct irq_domain_ops *ops)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
static inline
|
|
struct irq_domain *partition_get_domain(struct partition_desc *dsc)
|
|
{
|
|
return NULL;
|
|
}
|
|
#endif
|