From: MaJun <majun...@huawei.com>

Add a new flag for ITS node in DT mode so we can disable/enable the
indirect route function.

Signed-off-by: MaJun <majun...@huawei.com>
---
 drivers/irqchip/irq-gic-v3-its.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index d278425..ee54133 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -46,6 +46,7 @@
 #define ITS_FLAGS_CMDQ_NEEDS_FLUSHING          (1ULL << 0)
 #define ITS_FLAGS_WORKAROUND_CAVIUM_22375      (1ULL << 1)
 #define ITS_FLAGS_WORKAROUND_CAVIUM_23144      (1ULL << 2)
+#define ITS_FLAGS_INDIRECT_ROUTE               (1ULL << 3)
 
 #define RDIST_FLAGS_PROPBASE_NEEDS_FLUSHING    (1 << 0)
 
@@ -967,7 +968,7 @@ static bool its_parse_baser_device(struct its_node *its, 
struct its_baser *baser
        bool indirect = false;
 
        /* No need to enable Indirection if memory requirement < (psz*2)bytes */
-       if ((esz << ids) > (psz * 2)) {
+       if ((its->flags & ITS_FLAGS_INDIRECT_ROUTE) && ((esz << ids) > (psz * 
2))) {
                /*
                 * Find out whether hw supports a single or two-level table by
                 * table by reading bit at offset '62' after writing '1' to it.
@@ -1673,8 +1674,8 @@ static int its_init_domain(struct fwnode_handle *handle, 
struct its_node *its)
        return 0;
 }
 
-static int __init its_probe_one(struct resource *res,
-                               struct fwnode_handle *handle, int numa_node)
+static int __init its_probe_one(struct resource *res, struct fwnode_handle 
*handle,
+                                       int numa_node, u8 flags)
 {
        struct its_node *its;
        void __iomem *its_base;
@@ -1716,6 +1717,7 @@ static int __init its_probe_one(struct resource *res,
        its->phys_base = res->start;
        its->ite_size = ((readl_relaxed(its_base + GITS_TYPER) >> 4) & 0xf) + 1;
        its->numa_node = numa_node;
+       its->flags |= flags;
 
        its->cmd_base = kzalloc(ITS_CMD_QUEUE_SZ, GFP_KERNEL);
        if (!its->cmd_base) {
@@ -1812,6 +1814,7 @@ static int __init its_of_probe(struct device_node *node)
 {
        struct device_node *np;
        struct resource res;
+       u8 flags = 0;
 
        for (np = of_find_matching_node(node, its_device_id); np;
             np = of_find_matching_node(np, its_device_id)) {
@@ -1826,7 +1829,10 @@ static int __init its_of_probe(struct device_node *node)
                        continue;
                }
 
-               its_probe_one(&res, &np->fwnode, of_node_to_nid(np));
+               if (of_property_read_bool(np, "two-level-route"))
+                       flags |= ITS_FLAGS_INDIRECT_ROUTE;
+
+               its_probe_one(&res, &np->fwnode, of_node_to_nid(np), flags);
        }
        return 0;
 }
@@ -1863,7 +1869,7 @@ static int __init gic_acpi_parse_madt_its(struct 
acpi_subtable_header *header,
                goto dom_err;
        }
 
-       err = its_probe_one(&res, dom_handle, NUMA_NO_NODE);
+       err = its_probe_one(&res, dom_handle, NUMA_NO_NODE, 0);
        if (!err)
                return 0;
 
-- 
1.7.12.4


Reply via email to