al-msi: Rename driver and add support for ACPI
Subsystems (6)
cover al-msi: Rename driver and add support for ACPI
This series includes three major changes:
1. IOMMU DMA mapping MSI message fix.
2. Re-name the AL-MSIx driver to new name convention.
3. Add ACPI support for the driver.
Alpine is the name of the SoC family, while AL stands for Annapurna Labs. Rename to the latter since the driver will appear in other SoC families other than Alpine.
The AL-MSIx controller is not standard, is not included in the UEFI specification, and will not be added. The driver ACPI binding is performed when the following conditions are true:
- OEM ID is AMAZON
- MADT table type is 0x80 (part of the OEM reserved range).
GICv2m driver is called from context of parent interrupt controller, which ensures that the parent interrupt domain exists and holds valid information. As calling AL-MSIx driver from GICv3 driver would not make sense, a new API was added, to get the GSI IRQ domain that was registered by GICv3 driver in the ACPI framework.
Hanna Hawa (7):
irqchip/alpine-msi: Call IOMMU DMA mapping MSI message hook irqchip/alpine-msi: Update driver license to use SPDX irqchip/al-msi: Rename AL-MSIx driver irqchip/al-msi: Update wrong parameter naming ACPI / irq: Add GSI IRQ domain getter function irqchip/al-msi: Refactor in preparation to add ACPI support irqchip/al-msi: Add ACPI support
arch/arm/mach-alpine/Kconfig | 2 +-
arch/arm64/Kconfig.platforms | 2 +-
drivers/acpi/irq.c | 13 +
drivers/irqchip/Kconfig | 2 +-
drivers/irqchip/Makefile | 2 +-
drivers/irqchip/{irq-alpine-msi.c => irq-al-msi.c} | 320 ++++++++++++++-------
include/linux/acpi.h | 1 +
7 files changed, 236 insertions(+), 106 deletions(-)
rename drivers/irqchip/{irq-alpine-msi.c => irq-al-msi.c} (40%)Signature · 1 line
2.7.4
PATCH 1/7 irqchip/alpine-msi: Call IOMMU DMA mapping MSI message hook
Add missing IOMMU DMA mapping MSI message hook in compose_msi_msg() callback for Alpine MSIx driver, to map the MSI physical address to IOMMU IOVA for any device attached to IOMMU DMA ops domains.
--- drivers/irqchip/irq-alpine-msi.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/irqchip/irq-alpine-msi.c +7 -0
@@ -12,6 +12,7 @@#define pr_fmt (fmt) KBUILD_MODNAME ": " fmt +#include <linux/dma-iommu.h> #include <linux/irqchip.h> #include <linux/irqchip/arm-gic.h> #include <linux/msi.h>
@@ -99,6 +100,12 @@ static void alpine_msix_compose_msi_msg(struct irq_data *data, msg->address_hi =upper_32_bits (msg_addr); msg->address_lo =lower_32_bits (msg_addr); msg->data =0 ; + +/* +* Mapping MSI address to IOMMU IOVA, relevant for devices associated +* with IOMMU DMA ops domain. +*/ +iommu_dma_map_msi_msg (data->irq, msg); }static struct msi_domain_info alpine_msix_domain_info = {
Signature · 1 line
2.7.4
PATCH 2/7 irqchip/alpine-msi: Update driver license to use SPDX
In reply to Hanna HawaUpdate driver license to be in-line with Linux conventions.
--- drivers/irqchip/irq-alpine-msi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
drivers/irqchip/irq-alpine-msi.c +1 -4
@@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Annapurna Labs MSIX support services * * Copyright (C) 2016, Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Antoine Tenart <[email protected]> -* -* This file is licensed under the terms of the GNU General Public -* License version 2. This program is licensed "as is" without any -* warranty of any kind, whether express or implied. */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt
Signature · 1 line
2.7.4
Re: [PATCH 2/7] irqchip/alpine-msi: Update driver license to use SPDX
Quoted 13 lines · Hanna Hawa
Update driver license to be in-line with Linux conventions.
Signed-off-by Hanna Hawa <[email protected]>--- drivers/irqchip/irq-alpine-msi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)drivers/irqchip/irq-alpine-msi.c +0
-0
drivers/irqchip/irq-alpine-msi.c line 1
Quoted 1 line
drivers/irqchip/irq-alpine-msi.c +1
-0@@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0
Please fix this as per.
https://lkml.org/lkml/2019/2/13/570
cheers,
Mukesh
Quoted 13 lines
drivers/irqchip/irq-alpine-msi.c +0
-4/* * Annapurna Labs MSIX support services * * Copyright (C) 2016, Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Antoine Tenart <[email protected]> -* -* This file is licensed under the terms of the GNU General Public -* License version 2. This program is licensed "as is" without any -* warranty of any kind, whether express or implied. */ #define pr_fmt (fmt) KBUILD_MODNAME ": " fmt
Re: [PATCH 2/7] irqchip/alpine-msi: Update driver license to use SPDX
Quoted 10 lines · Mukesh Ojha
Quoted 8 lines · Hanna Hawa
Update driver license to be in-line with Linux conventions.
Signed-off-by Hanna Hawa <[email protected]>---
drivers/irqchip/irq-alpine-msi.c| 5 +----1 file changed, 1 insertion(+), 4 deletions(-)
Quoted 11 lines
drivers/irqchip/irq-alpine-msi.c line 1
Quoted 6 lines
drivers/irqchip/irq-alpine-msi.c +1
-0@@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 Please fix this as per.
https://lkml.org/lkml/2019/2/13/570
I'll fix in next patch-set, I'll wait for more inputs on other patches in the series.
Thanks,
Hanna
Quoted 16 lines
cheers,
MukeshQuoted 12 lines
drivers/irqchip/irq-alpine-msi.c +0
-4/* * Annapurna Labs MSIX support services * * Copyright (C) 2016, Amazon.com, Inc. or its affiliates. All Rights Reserved. * * Antoine Tenart <[email protected]> - * - * This file is licensed under the terms of the GNU General Public - * License version 2. This program is licensed "as is" without any - * warranty of any kind, whether express or implied. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Re: [PATCH 2/7] irqchip/alpine-msi: Update driver license to use SPDX
In reply to Mukesh OjhaQuoted 8 lines · Mukesh Ojha
Quoted 7 lines · Hanna Hawa
Update driver license to be in-line with Linux conventions.
Signed-off-by Hanna Hawa <[email protected]>--- drivers/irqchip/irq-alpine-msi.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
Quoted 11 lines
drivers/irqchip/irq-alpine-msi.c line 1
Quoted 7 lines
drivers/irqchip/irq-alpine-msi.c +1
-0@@ -1,13 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0 Please fix this as per.
https://lkml.org/lkml/2019/2/13/570
I find myself struggling to care. And that was even before I spotted:
$ grep -A6 "Style" Documentation/process/license-rules.rst 2. Style:
The SPDX license identifier is added in form of a comment. The comment style depends on the file type::
C source: // SPDX-License-Identifier: <SPDX License Expression>
C header: /* SPDX-License-Identifier: <SPDX License Expression> */
PATCH 3/7 irqchip/al-msi: Rename AL-MSIx driver
In reply to Hanna HawaAlpine is the name of the SoC family, while AL stands for Annapurna Labs. Rename to the latter since the driver will appear in other SoC families other than Alpine.
Add device tree match for "amazon/al-msix".
---
arch/arm/mach-alpine/Kconfig | 2 +-
arch/arm64/Kconfig.platforms | 2 +-
drivers/irqchip/Kconfig | 2 +-
drivers/irqchip/Makefile | 2 +-
drivers/irqchip/{irq-alpine-msi.c => irq-al-msi.c} | 93 +++++++++++-----------
5 files changed, 49 insertions(+), 52 deletions(-)
rename drivers/irqchip/{irq-alpine-msi.c => irq-al-msi.c} (68%)arch/arm/mach-alpine/Kconfig +1 -1
@@ -2,7 +2,7 @@ config ARCH_ALPINE bool "Annapurna Labs Alpine platform" depends on ARCH_MULTI_V7 - select ALPINE_MSI + select AL_MSI select ARM_AMBA select ARM_GIC select GENERIC_IRQ_CHIP
arch/arm64/Kconfig.platforms +1 -1
@@ -18,7 +18,7 @@ config ARCH_SUNXI config ARCH_ALPINE bool "Annapurna Labs Alpine platform" - select ALPINE_MSI if PCI + select AL_MSI if PCI help This enables support for the Annapurna Labs Alpine Soc family.
drivers/irqchip/Kconfig +1 -1
@@ -83,7 +83,7 @@ config ARMADA_370_XP_IRQ select PCI_MSI if PCI select GENERIC_IRQ_EFFECTIVE_AFF_MASK -config ALPINE_MSI +config AL_MSI bool depends on PCI select PCI_MSI
drivers/irqchip/Makefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_IRQCHIP) += irqchip.o -obj-$(CONFIG_ALPINE_MSI) += irq-alpine-msi.o +obj-$(CONFIG_AL_MSI) += irq-al-msi.o obj-$(CONFIG_ATH79) += irq-ath79-cpu.o obj-$(CONFIG_ATH79) += irq-ath79-misc.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o
drivers/irqchip/irq-al-msi.c renamed from drivers/irqchip/irq-alpine-msi.c +45 -48
222 lines not on this page · raw message
Signature · 1 line
2.7.4
Re: [PATCH 3/7] irqchip/al-msi: Rename AL-MSIx driver
Quoted 8 lines · Hanna Hawa
Alpine is the name of the SoC family, while AL stands for Annapurna Labs. Rename to the latter since the driver will appear in other SoC families other than Alpine.
Add device tree match for "amazon/al-msix".
Signed-off-by Hanna Hawa <[email protected]>
Quoted 8 lines
---
arch/arm/mach-alpine/Kconfig | 2 +-
arch/arm64/Kconfig.platforms | 2 +-
drivers/irqchip/Kconfig | 2 +-
drivers/irqchip/Makefile | 2 +-
drivers/irqchip/{irq-alpine-msi.c => irq-al-msi.c} | 93 +++++++++++-----------
5 files changed, 49 insertions(+), 52 deletions(-)
rename drivers/irqchip/{irq-alpine-msi.c => irq-al-msi.c} (68%)Why do we need this churn? It feels absolutely pointless. Adding your new compatibility string is absolutely fine; repainting the whole driver because you've found a "better" name for it isn't.
Thanks,
M.
Signature · 1 line
Jazz is not dead, it just smell funny.
PATCH 4/7 irqchip/al-msi: Update wrong parameter naming
In reply to Hanna HawaUpdate the naming of sgi parameter to be spi, and fix comments.
The message interrupts target the SPIs in the target GIC, and not the SGIs.
No functional change in this patch.
--- drivers/irqchip/irq-al-msi.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/irqchip/irq-al-msi.c +17 -17
@@ -28,8 +28,8 @@struct al_msix_data {spinlock_t msi_map_lock;phys_addr_t addr; -u32 spi_first;/* The SGI number that MSIs start */ -u32 num_spis;/* The number of SGIs for MSIs */ +u32 spi_first;/* The SPI number that MSIs start */ +u32 num_spis;/* The number of SPIs for MSIs */ unsigned long *msi_map; };
@@ -53,7 +53,7 @@ static struct irq_chip al_msix_irq_chip = { .irq_set_affinity = irq_chip_set_affinity_parent, }; -static int al_msix_allocate_sgi (struct al_msix_data *priv,int num_req) +static int al_msix_allocate_spi (struct al_msix_data *priv,int num_req) {int first;
@@ -73,10 +73,10 @@ static int al_msix_allocate_sgi(struct al_msix_data *priv, int num_req)return priv->spi_first + first; } -static void al_msix_free_sgi (struct al_msix_data *priv,unsigned int sgi, +static void al_msix_free_spi (struct al_msix_data *priv,unsigned int spi,int num_req) { -int first = sgi - priv->spi_first; +int first = spi - priv->spi_first;spin_lock (&priv->msi_map_lock);
@@ -119,7 +119,7 @@ static struct irq_chip middle_irq_chip = { };static int al_msix_gic_domain_alloc (struct irq_domain *domain, -unsigned int virq,int sgi) +unsigned int virq,int spi) {struct irq_fwspec fwspec;struct irq_data *d;
@@ -131,7 +131,7 @@ static int al_msix_gic_domain_alloc(struct irq_domain *domain, fwspec.fwnode = domain->parent->fwnode; fwspec.param_count =3 ; fwspec.param[0 ] =0 ; - fwspec.param[1 ] = sgi; + fwspec.param[1 ] = spi; fwspec.param[2 ] =IRQ_TYPE_EDGE_RISING ; ret =irq_domain_alloc_irqs_parent (domain, virq,1 , &fwspec);
@@ -149,27 +149,27 @@ static int al_msix_middle_domain_alloc(struct irq_domain *domain, unsigned int nr_irqs, void *args) { struct al_msix_data *priv = domain->host_data; -int sgi, err, i; +int spi, err, i; - sgi =al_msix_allocate_sgi (priv, nr_irqs); -if (sgi <0 ) -return sgi; + spi =al_msix_allocate_spi (priv, nr_irqs); +if (spi <0 ) +return spi;for (i =0 ; i < nr_irqs; i++) { - err =al_msix_gic_domain_alloc (domain, virq + i, sgi + i); + err =al_msix_gic_domain_alloc (domain, virq + i, spi + i);if (err) - goto err_sgi; + goto err_spi; -irq_domain_set_hwirq_and_chip (domain, virq + i, sgi + i, +irq_domain_set_hwirq_and_chip (domain, virq + i, spi + i, &middle_irq_chip, priv); }return 0 ; -err_sgi: +err_spi:while (--i >=0 )irq_domain_free_irqs_parent (domain, virq, i); -al_msix_free_sgi (priv, sgi, nr_irqs); +al_msix_free_spi (priv, spi, nr_irqs);return err; }
@@ -181,7 +181,7 @@ static void al_msix_middle_domain_free(struct irq_domain *domain,struct al_msix_data *priv =irq_data_get_irq_chip_data (d);irq_domain_free_irqs_parent (domain, virq, nr_irqs); -al_msix_free_sgi (priv, d->hwirq, nr_irqs); +al_msix_free_spi (priv, d->hwirq, nr_irqs); }static const struct irq_domain_ops al_msix_middle_domain_ops = {
Signature · 1 line
2.7.4
Quoted 10 lines · Hanna Hawa
This series includes three major changes:
1. IOMMU DMA mapping MSI message fix.
2. Re-name the AL-MSIx driver to new name convention.
3. Add ACPI support for the driver.Alpine is the name of the SoC family, while AL stands for Annapurna Labs. Rename to the latter since the driver will appear in other SoC families other than Alpine.
Quoted 5 lines
The AL-MSIx controller is not standard, is not included in the UEFI specification, and will not be added. The driver ACPI binding is performed when the following conditions are true:
- OEM ID is AMAZON
- MADT table type is0x80(part of the OEM reserved range).
[+Lorenzo, as the arm64 ACPI maintainer]
So you're happy to explicitly violate the letter of the specification? That's not really going to fly. We've pushed back on such things in the past (MBIGEN, XGene MSI controller), and I don't see any compelling reason to change our tune.
Quoted 5 lines
GICv2m driver is called from context of parent interrupt controller, which ensures that the parent interrupt domain exists and holds valid information. As calling AL-MSIx driver from GICv3 driver would not make sense, a new API was added, to get the GSI IRQ domain that was registered by GICv3 driver in the ACPI framework.
What does this mean? Either your system has a GICv2m or it has a GICv3. Please explain what this is all about.
Thanks,
M.
Signature · 1 line
Jazz is not dead, it just smell funny.