[RFC,v1,18/21] irqchip/irq-riscv-aplic-msi: Add ACPI support
Commit Message
Search and configure the MSI domain for the APLIC
on ACPI based systems.
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
---
drivers/irqchip/irq-riscv-aplic-msi.c | 14 +++++++++++++-
1 file changed, 13 insertions(+), 1 deletion(-)
@@ -16,6 +16,7 @@
#include <linux/platform_device.h>
#include <linux/printk.h>
#include <linux/smp.h>
+#include <asm/acpi.h>
#include "irq-riscv-aplic-main.h"
@@ -178,6 +179,8 @@ static void aplic_msi_write_msg(struct msi_desc *desc, struct msi_msg *msg)
int aplic_msi_setup(struct device *dev, void __iomem *regs)
{
const struct imsic_global_config *imsic_global;
+ struct irq_domain *msi_domain = NULL;
+ struct fwnode_handle *msi_fwnode;
struct irq_domain *irqdomain;
struct aplic_priv *priv;
struct aplic_msicfg *mc;
@@ -261,8 +264,17 @@ int aplic_msi_setup(struct device *dev, void __iomem *regs)
* IMSIC and the IMSIC MSI domains are created later through
* the platform driver probing so we set it explicitly here.
*/
- if (is_of_node(dev->fwnode))
+ if (is_of_node(dev->fwnode)) {
of_msi_configure(dev, to_of_node(dev->fwnode));
+ } else {
+ msi_fwnode = acpi_riscv_get_msi_fwnode(dev);
+ if (msi_fwnode)
+ msi_domain = irq_find_matching_fwnode(msi_fwnode,
+ DOMAIN_BUS_PLATFORM_MSI);
+
+ if (msi_domain)
+ dev_set_msi_domain(dev, msi_domain);
+ }
}
/* Create irq domain instance for the APLIC MSI-mode */