Skip to contentSkip to conversation

xen/arm: extend fdt_property_interrupts

PATCH Superseded Viktor Mitin 3 participants 5 messages Jul 26, 2019 – Jul 27, 2019

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xen/arm: extend fdt_property_interrupts

xen/arm: extend fdt_property_interrupts to deal with other domain than the hwdom

Tested with aarch64 qemu dom0 and dom0less boot.

---
See discussion in mail:
[PATCH] xen/arm: merge make_timer_node and make_timer_domU_node

 xen/arch/arm/domain_build.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
xen/arch/arm/domain_build.c +13 -9
index 4c8404155a..5f68603392 100644
@@ -621,17 +621,19 @@ static void __init set_interrupt(gic_interrupt_t interrupt,
  *  "interrupts": contains the list of interrupts
  *  "interrupt-parent": link to the GIC
  */
-static int __init fdt_property_interrupts(void *fdt, gic_interrupt_t *intr,
-                                          unsigned num_irq)
+static int __init fdt_property_interrupts(const struct kernel_info *kinfo,
+                            gic_interrupt_t *intr, unsigned num_irq)
 {
     int res;
+    uint32_t phandle = is_hardware_domain(kinfo->d) ? 
+                       dt_interrupt_controller->phandle : GUEST_PHANDLE_GIC;
 
-    res = fdt_property(fdt, "interrupts", intr, sizeof (intr[0]) * num_irq);
+    res = fdt_property(kinfo->fdt, "interrupts", 
+                       intr, sizeof (intr[0]) * num_irq);
     if ( res )
         return res;
 
-    res = fdt_property_cell(fdt, "interrupt-parent",
-                            dt_interrupt_controller->phandle);
+    res = fdt_property_cell(kinfo->fdt, "interrupt-parent", phandle);
 
     return res;
 }
@@ -733,7 +735,7 @@ static int __init make_hypervisor_node(struct domain *d,
      *  TODO: Handle properly the cpumask;
      */
     set_interrupt(intr, d->arch.evtchn_irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW);
-    res = fdt_property_interrupts(fdt, &intr, 1);
+    res = fdt_property_interrupts(kinfo, &intr, 1);
     if ( res )
         return res;
 
@@ -960,8 +962,10 @@ static int __init make_gic_node(const struct domain *d, void *fdt,
     return res;
 }
 
-static int __init make_timer_node(const struct domain *d, void *fdt)
+static int __init make_timer_node(const struct kernel_info *kinfo)
 {
+    void *fdt = kinfo->fdt;
+
     static const struct dt_device_match timer_ids[] __initconst =
     {
         DT_MATCH_COMPATIBLE("arm,armv7-timer"),
@@ -1016,7 +1020,7 @@ static int __init make_timer_node(const struct domain *d, void *fdt)
     dt_dprintk("  Virt interrupt %u\n", irq);
     set_interrupt(intrs[2], irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW);
 
-    res = fdt_property_interrupts(fdt, intrs, 3);
+    res = fdt_property_interrupts(kinfo, intrs, 3);
     if ( res )
         return res;
 
@@ -1377,7 +1381,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
     if ( device_get_class(node) == DEVICE_GIC )
         return make_gic_node(d, kinfo->fdt, node);
     if ( dt_match_node(timer_matches, node) )
-        return make_timer_node(d, kinfo->fdt);
+        return make_timer_node(kinfo);
 
     /* Skip nodes used by Xen */
     if ( dt_device_used_by(node) == DOMID_XEN )
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

Hello Vikor,

Quoted 2 lines · Viktor Mitin

xen/arm: extend fdt_property_interrupts to deal with other domain than the hwdom

It is unclear what problem you are facing. Could you please elaborate commit message?

Also, looks like your commit message is formatted incorrectly.

Quoted 18 lines

Tested with aarch64 qemu dom0 and dom0less boot.

---
See discussion in mail:
[PATCH] xen/arm: merge make_timer_node and make_timer_domU_node

 xen/arch/arm/domain_build.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
xen/arch/arm/domain_build.c +0 -0
index 4c8404155a..5f68603392 100644

xen/arch/arm/domain_build.c static void __init set_interrupt(gic_interrupt_t interrupt, · line 625

Quoted 7 lines
xen/arch/arm/domain_build.c +2 -2
@@ -621,17 +621,19 @@ static void __init set_interrupt(gic_interrupt_t interrupt,
  *  "interrupts": contains the list of interrupts
  *  "interrupt-parent": link to the GIC
  */
-static int __init fdt_property_interrupts(void *fdt, gic_interrupt_t *intr,
-                                          unsigned num_irq)
+static int __init fdt_property_interrupts(const struct kernel_info *kinfo,
+                            gic_interrupt_t *intr, unsigned num_irq)

Wrong indentation there.

xen/arch/arm/domain_build.c static void __init set_interrupt(gic_interrupt_t interrupt, · line 628

Quoted 3 lines
xen/arch/arm/domain_build.c +1 -0
 {
     int res;
+    uint32_t phandle = is_hardware_domain(kinfo->d) ? 

There is extra space at EOL.

xen/arch/arm/domain_build.c static void __init set_interrupt(gic_interrupt_t interrupt, · line 631

Quoted 4 lines
xen/arch/arm/domain_build.c +2 -1
+                       dt_interrupt_controller->phandle : GUEST_PHANDLE_GIC;
 
-    res = fdt_property(fdt, "interrupts", intr, sizeof (intr[0]) * num_irq);
+    res = fdt_property(kinfo->fdt, "interrupts", 

There is extra space at EOL.

Quoted 49 lines
xen/arch/arm/domain_build.c +8 -6
+                       intr, sizeof (intr[0]) * num_irq);
     if ( res )
         return res;
 
-    res = fdt_property_cell(fdt, "interrupt-parent",
-                            dt_interrupt_controller->phandle);
+    res = fdt_property_cell(kinfo->fdt, "interrupt-parent", phandle);
 
     return res;
 }
@@ -733,7 +735,7 @@ static int __init make_hypervisor_node(struct domain *d,
      *  TODO: Handle properly the cpumask;
      */
     set_interrupt(intr, d->arch.evtchn_irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW);
-    res = fdt_property_interrupts(fdt, &intr, 1);
+    res = fdt_property_interrupts(kinfo, &intr, 1);
     if ( res )
         return res;
 
@@ -960,8 +962,10 @@ static int __init make_gic_node(const struct domain *d, void *fdt,
     return res;
 }
 
-static int __init make_timer_node(const struct domain *d, void *fdt)
+static int __init make_timer_node(const struct kernel_info *kinfo)
 {
+    void *fdt = kinfo->fdt;
+
     static const struct dt_device_match timer_ids[] __initconst =
     {
         DT_MATCH_COMPATIBLE("arm,armv7-timer"),
@@ -1016,7 +1020,7 @@ static int __init make_timer_node(const struct domain *d, void *fdt)
     dt_dprintk("  Virt interrupt %u\n", irq);
     set_interrupt(intrs[2], irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW);
 
-    res = fdt_property_interrupts(fdt, intrs, 3);
+    res = fdt_property_interrupts(kinfo, intrs, 3);
     if ( res )
         return res;
 
@@ -1377,7 +1381,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
     if ( device_get_class(node) == DEVICE_GIC )
         return make_gic_node(d, kinfo->fdt, node);
     if ( dt_match_node(timer_matches, node) )
-        return make_timer_node(d, kinfo->fdt);
+        return make_timer_node(kinfo);
 
     /* Skip nodes used by Xen */
     if ( dt_device_used_by(node) == DOMID_XEN )
Signature · 5 lines
Volodymyr Babchuk at EPAM
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#2 lore raw

Hi Volodymyr,

Quoted 11 lines · Volodymyr Babchuk

Hello Vikor,

Quoted 2 lines · Viktor Mitin

xen/arm: extend fdt_property_interrupts to deal with other domain than the hwdom

It is unclear what problem you are facing. Could you please elaborate commit message?

Original goal is to merge make_timer_node and make_timer_domU_node functions. For background discussion please see discussion in mail (also mentioned in the patch):
[PATCH] xen/arm: merge make_timer_node and make_timer_domU_node
https://lists.xenproject.org/archives/html/xen-devel/2019-07/msg00914.html

Quoted 2 lines

Also, looks like your commit message is formatted incorrectly.

Please see below.

Quoted 13 lines
Quoted 13 lines

Tested with aarch64 qemu dom0 and dom0less boot.

---
See discussion in mail:
[PATCH] xen/arm: merge make_timer_node and make_timer_domU_node

 xen/arch/arm/domain_build.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
Quoted 13 lines

xen/arch/arm/domain_build.c static void __init set_interrupt(gic_interrupt_t interrupt, · line 625

Quoted 12 lines
xen/arch/arm/domain_build.c +2 -2
index 4c8404155a..5f68603392 100644
@@ -621,17 +621,19 @@ static void __init set_interrupt(gic_interrupt_t interrupt,
  *  "interrupts": contains the list of interrupts
  *  "interrupt-parent": link to the GIC
  */
-static int __init fdt_property_interrupts(void *fdt, gic_interrupt_t *intr,
-                                          unsigned num_irq)
+static int __init fdt_property_interrupts(const struct kernel_info *kinfo,
+                            gic_interrupt_t *intr, unsigned num_irq)

Wrong indentation there.

Such cases are not defined in the Coding Style document explicitly. See my clang-format coding style mail.

Quoted 10 lines

xen/arch/arm/domain_build.c static void __init set_interrupt(gic_interrupt_t interrupt, · line 628

Quoted 3 lines
xen/arch/arm/domain_build.c +1 -0
 {
     int res;
+    uint32_t phandle = is_hardware_domain(kinfo->d) ?

There is extra space at EOL.

xen/arch/arm/domain_build.c static void __init set_interrupt(gic_interrupt_t interrupt, · line 631

Quoted 4 lines
xen/arch/arm/domain_build.c +2 -1
+                       dt_interrupt_controller->phandle : GUEST_PHANDLE_GIC;
 
-    res = fdt_property(fdt, "interrupts", intr, sizeof (intr[0]) * num_irq);
+    res = fdt_property(kinfo->fdt, "interrupts",

There is extra space at EOL.

Will fix that.

Thanks

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw
Quoted 13 lines · Viktor Mitin

Hi Volodymyr,

Quoted 9 lines · Volodymyr Babchuk

Hello Vikor,

Quoted 2 lines · Viktor Mitin

xen/arm: extend fdt_property_interrupts to deal with other domain than the hwdom

Quoted 8 lines
Quoted 2 lines

It is unclear what problem you are facing. Could you please elaborate commit message?

Original goal is to merge make_timer_node and make_timer_domU_node functions. For background discussion please see discussion in mail (also mentioned in the patch):
[PATCH] xen/arm: merge make_timer_node and make_timer_domU_node
https://lists.xenproject.org/archives/html/xen-devel/2019-07/msg00914.html

This is mentioned below the tearline and newer will be included in the git history. Here is the rules:

Write a good description for each patch:

- The first line the top of the patch should contain a short description of what the patch does, and hints as to what code it touches

- The description should be useful for both the reviewers and people in the future trying to understand what the patch does. It can be as short as Code cleanup -- no functional changes, or as long as it takes to accurately describe the bug you are trying to solve or the new functionality you are introducing.

It is hard to say what you are trying to solve with this change.

I can't review functional changes in your patch, because I don't understand what you are trying to achieve.

Quoted 3 lines
Quoted 2 lines

Also, looks like your commit message is formatted incorrectly.

Please see below.

I was talking about commit message. I'm seeing "xen/arm:" tag both in the subject and in the e-mail body.

Quoted 27 lines
Quoted 13 lines
Quoted 13 lines

Tested with aarch64 qemu dom0 and dom0less boot.

---
See discussion in mail:
[PATCH] xen/arm: merge make_timer_node and make_timer_domU_node

 xen/arch/arm/domain_build.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
Quoted 13 lines

xen/arch/arm/domain_build.c static void __init set_interrupt(gic_interrupt_t interrupt, · line 625

Quoted 12 lines
xen/arch/arm/domain_build.c +2 -2
index 4c8404155a..5f68603392 100644
@@ -621,17 +621,19 @@ static void __init set_interrupt(gic_interrupt_t interrupt,
  *  "interrupts": contains the list of interrupts
  *  "interrupt-parent": link to the GIC
  */
-static int __init fdt_property_interrupts(void *fdt, gic_interrupt_t *intr,
-                                          unsigned num_irq)
+static int __init fdt_property_interrupts(const struct kernel_info *kinfo,
+                            gic_interrupt_t *intr, unsigned num_irq)

Wrong indentation there.

Quoted 2 lines

Such cases are not defined in the Coding Style document explicitly. See my clang-format coding style mail.

Yes, this is one of that rules that actually is not documented, but is widely enforced.

--
Volodymyr Babchuk at EPAM
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw
In reply to Viktor Mitin

Hi Viktor,

Thank you for the patch. In addition to Volodymyr's review, few comments below on the process and the patch.

Quoted 2 lines · Viktor Mitin

xen/arm: extend fdt_property_interrupts to deal with other domain than the hwdom

As mentioned by Volodymyr, the commit message should provide enough information for anyone to understand why this is done.

Additionally this patch standalone is not entirely useful. This is a preparatory for the patch "xen/arm: merge make_timer_node and make_timer_domU_node". So it would make sense to create a series with the 2 patches. This has the advantage to give some context to the reviewer how this is going to be used.

If you haven't done it yet, I would recommend to have a look through the wiki page [1]. This will give you some guidelines how to prepare a patch series. Feel free to ask any question if you have any doubt :).

Quoted 2 lines

Tested with aarch64 qemu dom0 and dom0less boot.

While testing is important this is not entirely useful to retain in the commit message. If you want to specify your setup, then I would recommend to add after the --- so it get strips when the patch is applied.

Quoted 7 lines

---
See discussion in mail:
[PATCH] xen/arm: merge make_timer_node and make_timer_domU_node

Finding a patch just with the subject can sometimes be tricky. So it is common to specify the Message-ID of the e-mail you refer too. For this e-mail, the Message-ID is:

<[email protected]>

This is an uniq identify so it is easily to lookup in your inbox or online archives if you don't have the e-mail.

Additionally, you can provide a link to the archived e-mail.

Quoted 44 lines

  xen/arch/arm/domain_build.c | 22 +++++++++++++---------
  1 file changed, 13 insertions(+), 9 deletions(-)
xen/arch/arm/domain_build.c +8 -6
index 4c8404155a..5f68603392 100644
@@ -621,17 +621,19 @@ static void __init set_interrupt(gic_interrupt_t interrupt,
   *  "interrupts": contains the list of interrupts
   *  "interrupt-parent": link to the GIC
   */
-static int __init fdt_property_interrupts(void *fdt, gic_interrupt_t *intr,
-                                          unsigned num_irq)
+static int __init fdt_property_interrupts(const struct kernel_info *kinfo,
+                            gic_interrupt_t *intr, unsigned num_irq)
  {
      int res;
+    uint32_t phandle = is_hardware_domain(kinfo->d) ?
+                       dt_interrupt_controller->phandle : GUEST_PHANDLE_GIC;
 
-    res = fdt_property(fdt, "interrupts", intr, sizeof (intr[0]) * num_irq);
+    res = fdt_property(kinfo->fdt, "interrupts",
+                       intr, sizeof (intr[0]) * num_irq);
      if ( res )
          return res;
 
-    res = fdt_property_cell(fdt, "interrupt-parent",
-                            dt_interrupt_controller->phandle);
+    res = fdt_property_cell(kinfo->fdt, "interrupt-parent", phandle);
 
      return res;
  }
@@ -733,7 +735,7 @@ static int __init make_hypervisor_node(struct domain *d,
       *  TODO: Handle properly the cpumask;
       */
      set_interrupt(intr, d->arch.evtchn_irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW);
-    res = fdt_property_interrupts(fdt, &intr, 1);
+    res = fdt_property_interrupts(kinfo, &intr, 1);
      if ( res )
          return res;
 

xen/arch/arm/domain_build.c static int __init make_gic_node(const struct domain *d, void *fdt, · line 965

Quoted 5 lines
xen/arch/arm/domain_build.c +1 -1
@@ -960,8 +962,10 @@ static int __init make_gic_node(const struct domain *d, void *fdt,
      return res;
  }
 
-static int __init make_timer_node(const struct domain *d, void *fdt)
+static int __init make_timer_node(const struct kernel_info *kinfo)

You wan to explain in your commit message why the prototype has been modified.

Quoted 17 lines
xen/arch/arm/domain_build.c +3 -1
  {
+    void *fdt = kinfo->fdt;
+
      static const struct dt_device_match timer_ids[] __initconst =
      {
          DT_MATCH_COMPATIBLE("arm,armv7-timer"),
@@ -1016,7 +1020,7 @@ static int __init make_timer_node(const struct domain *d, void *fdt)
      dt_dprintk("  Virt interrupt %u\n", irq);
      set_interrupt(intrs[2], irq, 0xf, DT_IRQ_TYPE_LEVEL_LOW);
 
-    res = fdt_property_interrupts(fdt, intrs, 3);
+    res = fdt_property_interrupts(kinfo, intrs, 3);
      if ( res )
          return res;
 

xen/arch/arm/domain_build.c static int __init handle_node(struct domain *d, struct kernel_info *kinfo, · line 1387

Quoted 8 lines
xen/arch/arm/domain_build.c +1 -1
@@ -1377,7 +1381,7 @@ static int __init handle_node(struct domain *d, struct kernel_info *kinfo,
      if ( device_get_class(node) == DEVICE_GIC )
          return make_gic_node(d, kinfo->fdt, node);
      if ( dt_match_node(timer_matches, node) )
-        return make_timer_node(d, kinfo->fdt);
+        return make_timer_node(kinfo);
 
      /* Skip nodes used by Xen */
      if ( dt_device_used_by(node) == DOMID_XEN )

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel