Skip to content

Commit 48f71d5

Browse files
committed
irqchip/gic-v3-its: Provide MSI parent infrastructure
To support per device MSI domains the ITS must provide MSI parent domain functionality. Provide the basic skeleton for this: - msi_parent_ops - child domain init callback - the MSI parent flag set in irqdomain::flags This does not make ITS a functional parent domain as there is no bit set in the bus_select_mask yet, but it provides the base to implement PCI and platform MSI support gradually on top. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Anna-Maria Behnsen <[email protected]> Signed-off-by: Shivamurthy Shastri <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 72e257c commit 48f71d5

File tree

5 files changed

+41
-1
lines changed

5 files changed

+41
-1
lines changed

drivers/irqchip/Kconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ config ARM_GIC_V3
4141
config ARM_GIC_V3_ITS
4242
bool
4343
select GENERIC_MSI_IRQ
44+
select IRQ_MSI_LIB
4445
default ARM_GIC_V3
4546

4647
config ARM_GIC_V3_ITS_PCI

drivers/irqchip/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ obj-$(CONFIG_ARCH_REALVIEW) += irq-gic-realview.o
3232
obj-$(CONFIG_IRQ_MSI_LIB) += irq-msi-lib.o
3333
obj-$(CONFIG_ARM_GIC_V2M) += irq-gic-v2m.o
3434
obj-$(CONFIG_ARM_GIC_V3) += irq-gic-v3.o irq-gic-v3-mbi.o irq-gic-common.o
35-
obj-$(CONFIG_ARM_GIC_V3_ITS) += irq-gic-v3-its.o irq-gic-v3-its-platform-msi.o irq-gic-v4.o
35+
obj-$(CONFIG_ARM_GIC_V3_ITS) += irq-gic-v3-its.o irq-gic-v3-its-platform-msi.o irq-gic-v4.o irq-gic-v3-its-msi-parent.o
3636
obj-$(CONFIG_ARM_GIC_V3_ITS_PCI) += irq-gic-v3-its-pci-msi.o
3737
obj-$(CONFIG_ARM_GIC_V3_ITS_FSL_MC) += irq-gic-v3-its-fsl-mc-msi.o
3838
obj-$(CONFIG_PARTITION_PERCPU) += irq-partition-percpu.o

drivers/irqchip/irq-gic-common.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
#include <linux/of.h>
1010
#include <linux/irqdomain.h>
11+
#include <linux/msi.h>
1112
#include <linux/irqchip/arm-gic-common.h>
1213

1314
struct gic_quirk {
@@ -29,6 +30,8 @@ void gic_enable_quirks(u32 iidr, const struct gic_quirk *quirks,
2930
void gic_enable_of_quirks(const struct device_node *np,
3031
const struct gic_quirk *quirks, void *data);
3132

33+
extern const struct msi_parent_ops gic_v3_its_msi_parent_ops;
34+
3235
#define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING (1 << 0)
3336
#define RDIST_FLAGS_RD_TABLES_PREALLOCATED (1 << 1)
3437
#define RDIST_FLAGS_FORCE_NON_SHAREABLE (1 << 2)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// SPDX-License-Identifier: GPL-2.0-only
2+
// Copyright (C) 2022 Linutronix GmbH
3+
// Copyright (C) 2022 Intel
4+
5+
#include "irq-gic-common.h"
6+
#include "irq-msi-lib.h"
7+
8+
#define ITS_MSI_FLAGS_REQUIRED (MSI_FLAG_USE_DEF_DOM_OPS | \
9+
MSI_FLAG_USE_DEF_CHIP_OPS)
10+
11+
#define ITS_MSI_FLAGS_SUPPORTED (MSI_GENERIC_FLAGS_MASK | \
12+
MSI_FLAG_PCI_MSIX | \
13+
MSI_FLAG_MULTI_PCI_MSI | \
14+
MSI_FLAG_PCI_MSI_MASK_PARENT)
15+
16+
static bool its_init_dev_msi_info(struct device *dev, struct irq_domain *domain,
17+
struct irq_domain *real_parent, struct msi_domain_info *info)
18+
{
19+
if (!msi_lib_init_dev_msi_info(dev, domain, real_parent, info))
20+
return false;
21+
22+
return true;
23+
}
24+
25+
const struct msi_parent_ops gic_v3_its_msi_parent_ops = {
26+
.supported_flags = ITS_MSI_FLAGS_SUPPORTED,
27+
.required_flags = ITS_MSI_FLAGS_REQUIRED,
28+
.bus_select_token = DOMAIN_BUS_NEXUS,
29+
.prefix = "ITS-",
30+
.init_dev_msi_info = its_init_dev_msi_info,
31+
};

drivers/irqchip/irq-gic-v3-its.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include <asm/exception.h>
3939

4040
#include "irq-gic-common.h"
41+
#include "irq-msi-lib.h"
4142

4243
#define ITS_FLAGS_CMDQ_NEEDS_FLUSHING (1ULL << 0)
4344
#define ITS_FLAGS_WORKAROUND_CAVIUM_22375 (1ULL << 1)
@@ -3688,6 +3689,7 @@ static void its_irq_domain_free(struct irq_domain *domain, unsigned int virq,
36883689
}
36893690

36903691
static const struct irq_domain_ops its_domain_ops = {
3692+
.select = msi_lib_irq_domain_select,
36913693
.alloc = its_irq_domain_alloc,
36923694
.free = its_irq_domain_free,
36933695
.activate = its_irq_domain_activate,
@@ -4993,6 +4995,9 @@ static int its_init_domain(struct its_node *its)
49934995

49944996
irq_domain_update_bus_token(inner_domain, DOMAIN_BUS_NEXUS);
49954997

4998+
inner_domain->msi_parent_ops = &gic_v3_its_msi_parent_ops;
4999+
inner_domain->flags |= IRQ_DOMAIN_FLAG_MSI_PARENT;
5000+
49965001
return 0;
49975002
}
49985003

0 commit comments

Comments
 (0)