From: Oleksandr Tyshchenko <olekstysh@gmail.com> To: xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>, julien.grall@arm.com, sstabellini@kernel.org Subject: [PATCH V1 2/2] xen/device-tree: Add ability to handle nodes with interrupts-extended prop Date: Tue, 21 May 2019 20:37:34 +0300 [thread overview] Message-ID: <1558460254-7127-3-git-send-email-olekstysh@gmail.com> (raw) In-Reply-To: <1558460254-7127-1-git-send-email-olekstysh@gmail.com> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> The "interrupts-extended" property is a special form for use when a node needs to reference multiple interrupt parents. According to the: Linux/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt But, there are cases when "interrupts-extended" property is used for "outside /soc node" with a single interrupt parent as an equivalent of pairs ("interrupt-parent" + "interrupts"). The good example here is ARCH timer node for R-Car Gen3/Gen2 family, which is mandatory device for Xen usage on ARM. And without ability to handle such nodes, Xen fails to operate. So, this patch adds required support for Xen to be able to handle nodes with that property. Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> --- Changes RFC -> V1: - Explain in the commit message regarding property usage, add a link to the bindings. - Don't try to look for "interrupts" property if "interrupts-extended" property is present, but doesn't contain any interrupts (dt_count_phandle_with_args returns 0). - Add messages to tell which property is used. --- xen/common/device_tree.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 65862b5..e107c6f 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -987,15 +987,27 @@ unsigned int dt_number_of_irq(const struct dt_device_node *device) const struct dt_device_node *p; const __be32 *intspec, *tmp; u32 intsize, intlen; + int intnum; dt_dprintk("dt_irq_number: dev=%s\n", device->full_name); + /* Try the new-style interrupts-extended first */ + intnum = dt_count_phandle_with_args(device, "interrupts-extended", + "#interrupt-cells"); + if ( intnum >= 0 ) + { + dt_dprintk(" using 'interrupts-extended' property\n"); + dt_dprintk(" intnum=%d\n", intnum); + return intnum; + } + /* Get the interrupts property */ intspec = dt_get_property(device, "interrupts", &intlen); if ( intspec == NULL ) return 0; intlen /= sizeof(*intspec); + dt_dprintk(" using 'interrupts' property\n"); dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); /* Look for the interrupt parent. */ @@ -1420,21 +1432,39 @@ int dt_device_get_raw_irq(const struct dt_device_node *device, const __be32 *intspec, *tmp, *addr; u32 intsize, intlen; int res = -EINVAL; + struct dt_phandle_args args; + int i; dt_dprintk("dt_device_get_raw_irq: dev=%s, index=%u\n", device->full_name, index); + /* Get the reg property (if any) */ + addr = dt_get_property(device, "reg", NULL); + + /* Try the new-style interrupts-extended first */ + res = dt_parse_phandle_with_args(device, "interrupts-extended", + "#interrupt-cells", index, &args); + if ( !res ) + { + dt_dprintk(" using 'interrupts-extended' property\n"); + dt_dprintk(" intspec=%d intsize=%d\n", args.args[0], args.args_count); + + for ( i = 0; i < args.args_count; i++ ) + args.args[i] = cpu_to_be32(args.args[i]); + + return dt_irq_map_raw(args.np, args.args, args.args_count, + addr, out_irq); + } + /* Get the interrupts property */ intspec = dt_get_property(device, "interrupts", &intlen); if ( intspec == NULL ) return -EINVAL; intlen /= sizeof(*intspec); + dt_dprintk(" using 'interrupts' property\n"); dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); - /* Get the reg property (if any) */ - addr = dt_get_property(device, "reg", NULL); - /* Look for the interrupt parent. */ p = dt_irq_find_parent(device); if ( p == NULL ) -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
WARNING: multiple messages have this Message-ID (diff)
From: Oleksandr Tyshchenko <olekstysh@gmail.com> To: xen-devel@lists.xenproject.org Cc: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com>, julien.grall@arm.com, sstabellini@kernel.org Subject: [Xen-devel] [PATCH V1 2/2] xen/device-tree: Add ability to handle nodes with interrupts-extended prop Date: Tue, 21 May 2019 20:37:34 +0300 [thread overview] Message-ID: <1558460254-7127-3-git-send-email-olekstysh@gmail.com> (raw) Message-ID: <20190521173734.Qm7zw0TjWLVd_FIEl1vdQ1voceTOzPaZkneU7nS1Swc@z> (raw) In-Reply-To: <1558460254-7127-1-git-send-email-olekstysh@gmail.com> From: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> The "interrupts-extended" property is a special form for use when a node needs to reference multiple interrupt parents. According to the: Linux/Documentation/devicetree/bindings/interrupt-controller/interrupts.txt But, there are cases when "interrupts-extended" property is used for "outside /soc node" with a single interrupt parent as an equivalent of pairs ("interrupt-parent" + "interrupts"). The good example here is ARCH timer node for R-Car Gen3/Gen2 family, which is mandatory device for Xen usage on ARM. And without ability to handle such nodes, Xen fails to operate. So, this patch adds required support for Xen to be able to handle nodes with that property. Signed-off-by: Oleksandr Tyshchenko <oleksandr_tyshchenko@epam.com> --- Changes RFC -> V1: - Explain in the commit message regarding property usage, add a link to the bindings. - Don't try to look for "interrupts" property if "interrupts-extended" property is present, but doesn't contain any interrupts (dt_count_phandle_with_args returns 0). - Add messages to tell which property is used. --- xen/common/device_tree.c | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index 65862b5..e107c6f 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -987,15 +987,27 @@ unsigned int dt_number_of_irq(const struct dt_device_node *device) const struct dt_device_node *p; const __be32 *intspec, *tmp; u32 intsize, intlen; + int intnum; dt_dprintk("dt_irq_number: dev=%s\n", device->full_name); + /* Try the new-style interrupts-extended first */ + intnum = dt_count_phandle_with_args(device, "interrupts-extended", + "#interrupt-cells"); + if ( intnum >= 0 ) + { + dt_dprintk(" using 'interrupts-extended' property\n"); + dt_dprintk(" intnum=%d\n", intnum); + return intnum; + } + /* Get the interrupts property */ intspec = dt_get_property(device, "interrupts", &intlen); if ( intspec == NULL ) return 0; intlen /= sizeof(*intspec); + dt_dprintk(" using 'interrupts' property\n"); dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); /* Look for the interrupt parent. */ @@ -1420,21 +1432,39 @@ int dt_device_get_raw_irq(const struct dt_device_node *device, const __be32 *intspec, *tmp, *addr; u32 intsize, intlen; int res = -EINVAL; + struct dt_phandle_args args; + int i; dt_dprintk("dt_device_get_raw_irq: dev=%s, index=%u\n", device->full_name, index); + /* Get the reg property (if any) */ + addr = dt_get_property(device, "reg", NULL); + + /* Try the new-style interrupts-extended first */ + res = dt_parse_phandle_with_args(device, "interrupts-extended", + "#interrupt-cells", index, &args); + if ( !res ) + { + dt_dprintk(" using 'interrupts-extended' property\n"); + dt_dprintk(" intspec=%d intsize=%d\n", args.args[0], args.args_count); + + for ( i = 0; i < args.args_count; i++ ) + args.args[i] = cpu_to_be32(args.args[i]); + + return dt_irq_map_raw(args.np, args.args, args.args_count, + addr, out_irq); + } + /* Get the interrupts property */ intspec = dt_get_property(device, "interrupts", &intlen); if ( intspec == NULL ) return -EINVAL; intlen /= sizeof(*intspec); + dt_dprintk(" using 'interrupts' property\n"); dt_dprintk(" intspec=%d intlen=%d\n", be32_to_cpup(intspec), intlen); - /* Get the reg property (if any) */ - addr = dt_get_property(device, "reg", NULL); - /* Look for the interrupt parent. */ p = dt_irq_find_parent(device); if ( p == NULL ) -- 2.7.4 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel
next prev parent reply other threads:[~2019-05-21 17:37 UTC|newest] Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-21 17:37 [PATCH V1 0/2] Add ability to handle nodes with interrupts-extended property Oleksandr Tyshchenko 2019-05-21 17:37 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-21 17:37 ` [PATCH V1 1/2] xen/device-tree: Add dt_count_phandle_with_args helper Oleksandr Tyshchenko 2019-05-21 17:37 ` [Xen-devel] " Oleksandr Tyshchenko 2019-05-29 17:34 ` Julien Grall 2019-05-29 17:34 ` [Xen-devel] " Julien Grall 2019-05-21 17:37 ` Oleksandr Tyshchenko [this message] 2019-05-21 17:37 ` [Xen-devel] [PATCH V1 2/2] xen/device-tree: Add ability to handle nodes with interrupts-extended prop Oleksandr Tyshchenko 2019-05-29 17:44 ` Julien Grall 2019-05-29 17:44 ` [Xen-devel] " Julien Grall 2019-05-29 17:58 ` Oleksandr 2019-05-29 17:58 ` [Xen-devel] " Oleksandr 2019-05-29 18:18 ` Julien Grall 2019-05-29 18:18 ` [Xen-devel] " Julien Grall 2019-06-10 19:45 ` Julien Grall 2019-06-11 16:15 ` Oleksandr
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=1558460254-7127-3-git-send-email-olekstysh@gmail.com \ --to=olekstysh@gmail.com \ --cc=julien.grall@arm.com \ --cc=oleksandr_tyshchenko@epam.com \ --cc=sstabellini@kernel.org \ --cc=xen-devel@lists.xenproject.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.