[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH v2 1/2] arch/arm: irq: Add platform_get_irq_byname() implementation


  • To: xen-devel@xxxxxxxxxxxxxxxxxxxx
  • From: "Andrei Cherechesu (OSS)" <andrei.cherechesu@xxxxxxxxxxx>
  • Date: Thu, 9 Mar 2023 18:19:32 +0200
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=uQNYeJoSq7Q9ZqnSKcAT7DwtkzmkKIujQqNfvAuqlr0=; b=Dyg7i8umN99wdedUkRE5e3dyD69PlDuMG0Hh67Nm0Moc9UdqrOGPfR85JsZ9p/91aIihgAD8AV7ZUCH7o6gekCJnL60ClzYjqWnYGxIrpix9YPmdRsWfhV4WufYmF3+QQlUGKuIg8oYbjFiqHDLqwe4QE6o71KM+/uXqNTGmVIaL7jpL6EGl9KEJFR4jH4UmyOtytwuGJ+h7KyKJ3jqb5UGEjF2oTj8MV58ZOlAdgGZRbZrHoZl15NDQ5Ji5MzQOD2h3VP2jrzMCjP3kmZTquyPZzaYiNmEVif4cSeeZgOjcrdITgmTqe/DFvHPa6saxhj6onyV9L8mXOKgbw3O0XA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NSgY9SjtE7MbRUG3P7gNlSXUK7GQ7nLtc/EZ8VSdH1w5Q5t7ysJTakLWjYxzTS5+gvIMpCogd9l3UWaJbKKeHgTehplAcRJW5QNQPGKjVj23pC8So+zFB68FDhhDTwea4Vxxewbw/C9qtvWmkgQEEoj5b0cnrYCfbwGV10JiJz0vtZ8808YDSxYsoUY2wExNe/M8uRcIaN59UOuiiQRv8oyBS1Zv42ta3qYWRmqyGaxI2vy/g6o6oYAKmYGxqTZ4SKB+GjZGkqVnfsUR4rBRonKLB5ZKrCVmRtd02l8ZJFfqT42RRBlx/AE5tuWVHzBUkF6u3u6M37c9Hh9pg+InuA==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=oss.nxp.com;
  • Cc: Bertrand.Marquis@xxxxxxx, sstabellini@xxxxxxxxxx, julien@xxxxxxx, Volodymyr_Babchuk@xxxxxxxx, rahul.singh@xxxxxxx, Andrei Cherechesu <andrei.cherechesu@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>
  • Delivery-date: Thu, 09 Mar 2023 16:20:07 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

From: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>

Moved implementation for the function which parses the IRQs of a DT
node by the "interrupt-names" property from the SMMU-v3 driver
to the IRQ core code and made it non-static to be used as helper.

Also changed it to receive a "struct dt_device_node*" as parameter,
like its counterpart, platform_get_irq(). Updated its usage inside
the SMMU-v3 driver accordingly.

Signed-off-by: Andrei Cherechesu <andrei.cherechesu@xxxxxxx>
Reviewed-by: Bertrand Marquis <bertrand.marquis@xxxxxxx>
---
 xen/arch/arm/include/asm/irq.h        |  2 ++
 xen/arch/arm/irq.c                    | 14 +++++++++++
 xen/drivers/passthrough/arm/smmu-v3.c | 35 +++++----------------------
 3 files changed, 22 insertions(+), 29 deletions(-)

diff --git a/xen/arch/arm/include/asm/irq.h b/xen/arch/arm/include/asm/irq.h
index 245f49dcba..af94f41994 100644
--- a/xen/arch/arm/include/asm/irq.h
+++ b/xen/arch/arm/include/asm/irq.h
@@ -89,6 +89,8 @@ int irq_set_type(unsigned int irq, unsigned int type);
 
 int platform_get_irq(const struct dt_device_node *device, int index);
 
+int platform_get_irq_byname(struct dt_device_node *np, const char *name);
+
 void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask);
 
 /*
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 79718f68e7..ded495792b 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -718,6 +718,20 @@ int platform_get_irq(const struct dt_device_node *device, 
int index)
     return irq;
 }
 
+int platform_get_irq_byname(struct dt_device_node *np, const char *name)
+{
+       int index;
+
+       if ( unlikely(!name) )
+               return -EINVAL;
+
+       index = dt_property_match_string(np, "interrupt-names", name);
+       if ( index < 0 )
+               return index;
+
+       return platform_get_irq(np, index);
+}
+
 /*
  * Local variables:
  * mode: C
diff --git a/xen/drivers/passthrough/arm/smmu-v3.c 
b/xen/drivers/passthrough/arm/smmu-v3.c
index d58c5cd0bf..bfdb62b395 100644
--- a/xen/drivers/passthrough/arm/smmu-v3.c
+++ b/xen/drivers/passthrough/arm/smmu-v3.c
@@ -200,30 +200,6 @@ static inline void dev_iommu_priv_set(struct device *dev, 
void *priv)
        fwspec->iommu_priv = priv;
 }
 
-static int platform_get_irq_byname_optional(struct device *dev,
-                               const char *name)
-{
-       int index, ret;
-       struct dt_device_node *np  = dev_to_dt(dev);
-
-       if (unlikely(!name))
-               return -EINVAL;
-
-       index = dt_property_match_string(np, "interrupt-names", name);
-       if (index < 0) {
-               dev_info(dev, "IRQ %s not found\n", name);
-               return index;
-       }
-
-       ret = platform_get_irq(np, index);
-       if (ret < 0) {
-               dev_err(dev, "failed to get irq index %d\n", index);
-               return -ENODEV;
-       }
-
-       return ret;
-}
-
 /* Start of Linux SMMUv3 code */
 static bool disable_bypass = 1;
 
@@ -2434,6 +2410,7 @@ static int arm_smmu_device_probe(struct platform_device 
*pdev)
        int irq, ret;
        paddr_t ioaddr, iosize;
        struct arm_smmu_device *smmu;
+       struct dt_device_node *np = dev_to_dt(pdev);
 
        smmu = xzalloc(struct arm_smmu_device);
        if (!smmu)
@@ -2451,7 +2428,7 @@ static int arm_smmu_device_probe(struct platform_device 
*pdev)
        }
 
        /* Base address */
-       ret = dt_device_get_address(dev_to_dt(pdev), 0, &ioaddr, &iosize);
+       ret = dt_device_get_address(np, 0, &ioaddr, &iosize);
        if (ret)
                goto out_free_smmu;
 
@@ -2484,19 +2461,19 @@ static int arm_smmu_device_probe(struct platform_device 
*pdev)
 
        /* Interrupt lines */
 
-       irq = platform_get_irq_byname_optional(pdev, "combined");
+       irq = platform_get_irq_byname(np, "combined");
        if (irq > 0)
                smmu->combined_irq = irq;
        else {
-               irq = platform_get_irq_byname_optional(pdev, "eventq");
+               irq = platform_get_irq_byname(np, "eventq");
                if (irq > 0)
                        smmu->evtq.q.irq = irq;
 
-               irq = platform_get_irq_byname_optional(pdev, "priq");
+               irq = platform_get_irq_byname(np, "priq");
                if (irq > 0)
                        smmu->priq.q.irq = irq;
 
-               irq = platform_get_irq_byname_optional(pdev, "gerror");
+               irq = platform_get_irq_byname(np, "gerror");
                if (irq > 0)
                        smmu->gerr_irq = irq;
        }
-- 
2.35.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.