Skip to contentSkip to conversation

arm: gic-v3: clear GICR active interrupts

PATCH In review Peng Fan 2 participants 9 messages Jan 22, 2019 – Jan 30, 2019

lore
Share & tools
lore

Peng Fan

author
#0 lore raw

PATCH 1/1 arm: gic-v3: clear GICR active interrupts

On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because hardware design.

The gic-v3 controller is configured with EOImode to 1, so during xen reboot, GIC_SGI_CALL_FUNCTION interrupt from CPU0 to other CPUs, but stop_cpu never return, that means other CPUs have no chance to deactive the interrupt. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because GIC_SGI_CALL_FUNCTION of other CPUs are active during the last reboot, interrupts could not be triggered unless we deactive the interrupt first.

So let's deactive the interrupts during GICv3 initialization to fix this issue.

---
 xen/arch/arm/gic-v3.c | 4 ++++
 1 file changed, 4 insertions(+)
xen/arch/arm/gic-v3.c +4 -0
index 6fbc106757..643d4a33f0 100644
@@ -824,8 +824,12 @@ static int gicv3_cpu_init(void)
     priority = (GIC_PRI_IPI << 24 | GIC_PRI_IPI << 16 | GIC_PRI_IPI << 8 |
                 GIC_PRI_IPI);
     for (i = 0; i < NR_GIC_SGI; i += 4)
+    {
         writel_relaxed(priority,
                 GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + (i / 4) * 4);
+        writel_relaxed(0xffffffff,
+                GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i / 4) * 4);
+    }
 
     priority = (GIC_PRI_IRQ << 24 | GIC_PRI_IRQ << 16 | GIC_PRI_IRQ << 8 |
                 GIC_PRI_IRQ);
Signature · 7 lines
2.14.1


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

Hi Peng,

The commit title is a bit confusing. It suggests that all interrupts should be deactivated at boot, however you are only deactivating the SGIs.

Quoted 3 lines · Peng Fan

On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because hardware design.

What do you mean by hardware design? Is it a defect?

Quoted 8 lines

The gic-v3 controller is configured with EOImode to 1, so during xen reboot, GIC_SGI_CALL_FUNCTION interrupt from CPU0 to other CPUs, but stop_cpu never return, that means other CPUs have no chance to deactive the interrupt. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because GIC_SGI_CALL_FUNCTION of other CPUs are active during the last reboot, interrupts could not be triggered unless we deactive the interrupt first.

From the description here, I think it not very sane to go to sleep with an interrupt activate.

A better solution would be to move the deactivation earlier on in do_sgi (maybe after eoi_irq) so we call stop_cpu() with all interrupts disabled.

Quoted 2 lines

So let's deactive the interrupts during GICv3 initialization to fix

s/deactivate/

Quoted 1 line

this issue.

Similarly to the commit title, you wrote the commit message very generically.

Quoted 14 lines
---
  xen/arch/arm/gic-v3.c | 4 ++++
  1 file changed, 4 insertions(+)
xen/arch/arm/gic-v3.c +0 -0
index 6fbc106757..643d4a33f0 100644
@@ -824,8 +824,12 @@ static int gicv3_cpu_init(void)
      priority = (GIC_PRI_IPI << 24 | GIC_PRI_IPI << 16 | GIC_PRI_IPI << 8 |
                  GIC_PRI_IPI);

xen/arch/arm/gic-v3.c static int gicv3_cpu_init(void) · line 835

Quoted 10 lines
xen/arch/arm/gic-v3.c +4 -0
      for (i = 0; i < NR_GIC_SGI; i += 4)
+    {
          writel_relaxed(priority,
                  GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + (i / 4) * 4);
+        writel_relaxed(0xffffffff,
+                GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i / 4) * 4);
+    }
 
      priority = (GIC_PRI_IRQ << 24 | GIC_PRI_IRQ << 16 | GIC_PRI_IRQ << 8 |
                  GIC_PRI_IRQ);

Cheers,

Signature · 6 lines
Julien Grall

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

Hi Julien

Quoted 8 lines

-----Original Message-----
From: Julien Grall [mailto:[email protected]]
Sent: 2019年1月22日 18:55
To: Peng Fan <[email protected]>; [email protected]
Cc: [email protected]; Andre Przywara <[email protected]>
Subject: Re: [PATCH] arm: gic-v3: clear GICR active interrupts

Quoted 4 lines

Hi Peng,

The commit title is a bit confusing. It suggests that all interrupts should be deactivated at boot, however you are only deactivating the SGIs.

"arm: gic-v3: deactivate SGI interrupts" seems better.

Quoted 7 lines · Peng Fan
Quoted 3 lines

On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because hardware design.

What do you mean by hardware design? Is it a defect?

Sorry. This is a wrong information. It is not defect, it is required that we not reset GIC when implementing partition reboot. We support Cluster reboot without affecting the other Cluster, so gic is not reset.

Quoted 8 lines
Quoted 7 lines

The gic-v3 controller is configured with EOImode to 1, so during xen reboot, GIC_SGI_CALL_FUNCTION interrupt from CPU0 to other CPUs, but stop_cpu never return, that means other CPUs have no chance to deactive the interrupt. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because

GIC_SGI_CALL_FUNCTION of

Quoted 8 lines
Quoted 2 lines

other CPUs are active during the last reboot, interrupts could not be triggered unless we deactive the interrupt first.

From the description here, I think it not very sane to go to sleep with an
interrupt activate.

A better solution would be to move the deactivation earlier on in do_sgi (maybe after eoi_irq) so we call stop_cpu() with all interrupts disabled.

Agree.

Quoted 5 lines
Quoted 3 lines

So let's deactive the interrupts during GICv3 initialization to fix

s/deactivate/

Fix in V2.

Quoted 4 lines
Quoted 2 lines

this issue.

Similarly to the commit title, you wrote the commit message very generically.

Are you ok with the following patch?

arm: gic: deactivate sgi immediately after eoi

On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because we also need to support A72 Cluster reboot without affecting A53 Cluster.

The gic-v3 controller is configured with EOImode to 1, so during xen reboot, there is a function call "smp_call_function(halt_this_cpu, NULL, 0);" ,but halt_this_cpu never return, that means other CPUs have no chance to deactive the SGI interrupt, because the deactivate_irq operation is at the end of do_sgi. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because GIC_SGI_CALL_FUNCTION of other CPUs are active during the last reboot, interrupts could not be triggered unless we deactivate the interrupt first.

To fix this issue, let's move the deactivate_irq operation just after eoi_irq, then the SGI interrupt will be in deactive state when smp_call_function_interrupt.

xen/arch/arm/gic.c +2 -3
index 6cc7dec706..300fdbd9ae 100644
@@ -347,6 +347,8 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)
 
     /* Lower the priority */
     gic_hw_ops->eoi_irq(desc);
+    /* Deactivate */
+    gic_hw_ops->deactivate_irq(desc);
 
     /*
      * Ensure any shared data written by the CPU sending
@@ -370,9 +372,6 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)
         panic("Unhandled SGI %d on CPU%d\n", sgi, smp_processor_id());
         break;
     }
-
-    /* Deactivate */
-    gic_hw_ops->deactivate_irq(desc);
 }
 

Thanks,
Peng.

Quoted 27 lines
Quoted 13 lines
---
  xen/arch/arm/gic-v3.c | 4 ++++
  1 file changed, 4 insertions(+)
xen/arch/arm/gic-v3.c +0 -0
index 6fbc106757..643d4a33f0 100644

xen/arch/arm/gic-v3.c static int gicv3_cpu_init(void) · line 824

Quoted 1 line
xen/arch/arm/gic-v3.c +0 -0
@@ -824,8 +824,12 @@ static int gicv3_cpu_init(void)
      priority = (GIC_PRI_IPI << 24 | GIC_PRI_IPI << 16 | GIC_PRI_IPI <<

8 |

xen/arch/arm/gic-v3.c static int gicv3_cpu_init(void) · line 829

Quoted 5 lines
xen/arch/arm/gic-v3.c +1 -0
                  GIC_PRI_IPI);
      for (i = 0; i < NR_GIC_SGI; i += 4)
+    {
          writel_relaxed(priority,
                  GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + (i / 4)

* 4);

xen/arch/arm/gic-v3.c static int gicv3_cpu_init(void) · line 831

Quoted 2 lines
xen/arch/arm/gic-v3.c +2 -0
+        writel_relaxed(0xffffffff,
+                GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i / 4) *

4);

xen/arch/arm/gic-v3.c static int gicv3_cpu_init(void) · line 834

Quoted 3 lines
xen/arch/arm/gic-v3.c +1 -0
+    }
 
      priority = (GIC_PRI_IRQ << 24 | GIC_PRI_IRQ << 16 | GIC_PRI_IRQ
Quoted 8 lines

<< 8 |

xen/arch/arm/gic-v3.c static int gicv3_cpu_init(void) · line 835

Quoted 2 lines
xen/arch/arm/gic-v3.c +0 -0
                  GIC_PRI_IRQ);

Cheers,

--
Julien Grall

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

#3 lore raw
Quoted 1 line · Peng Fan

Hi Julien

Hi Peng,

Quoted 1 line

Are you ok with the following patch?

This looks ok. Please resend it formally with the tag for-4.12 and the release manager ([email protected]) in CC.

Quoted 37 lines

arm: gic: deactivate sgi immediately after eoi

On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because we also need to support A72 Cluster reboot without affecting A53 Cluster.

The gic-v3 controller is configured with EOImode to 1, so during xen reboot, there is a function call "smp_call_function(halt_this_cpu, NULL, 0);" ,but halt_this_cpu never return, that means other CPUs have no chance to deactive the SGI interrupt, because the deactivate_irq operation is at the end of do_sgi. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because GIC_SGI_CALL_FUNCTION of other CPUs are active during the last reboot, interrupts could not be triggered unless we deactivate the interrupt first.

To fix this issue, let's move the deactivate_irq operation just after eoi_irq, then the SGI interrupt will be in deactive state when smp_call_function_interrupt.

xen/arch/arm/gic.c +2 -0
index 6cc7dec706..300fdbd9ae 100644
@@ -347,6 +347,8 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)
 
      /* Lower the priority */
      gic_hw_ops->eoi_irq(desc);
+    /* Deactivate */
+    gic_hw_ops->deactivate_irq(desc);
 
      /*
       * Ensure any shared data written by the CPU sending

xen/arch/arm/gic.c static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi) · line 375

Quoted 7 lines
xen/arch/arm/gic.c +0 -3
@@ -370,9 +372,6 @@ static void do_sgi(struct cpu_user_regs *regs, enum gic_sgi sgi)
          panic("Unhandled SGI %d on CPU%d\n", sgi, smp_processor_id());
          break;
      }
-
-    /* Deactivate */
-    gic_hw_ops->deactivate_irq(desc);
  }

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#4 lore raw
In reply to Julien Grall

Hi

Replying to this thread again.

Quoted 20 lines · Julien Grall

Hi Peng,

The commit title is a bit confusing. It suggests that all interrupts should be deactivated at boot, however you are only deactivating the SGIs.

Quoted 3 lines · Peng Fan

On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because hardware design.

What do you mean by hardware design? Is it a defect?

Quoted 8 lines

The gic-v3 controller is configured with EOImode to 1, so during xen reboot, GIC_SGI_CALL_FUNCTION interrupt from CPU0 to other CPUs, but stop_cpu never return, that means other CPUs have no chance to deactive the interrupt. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because GIC_SGI_CALL_FUNCTION of other CPUs are active during the last reboot, interrupts could not be triggered unless we deactive the interrupt first.

Quoted 2 lines

From the description here, I think it not very sane to go to sleep with an
interrupt activate.

It looks like I was wrong here. There are case where you can't avoid that (see my answer to your other patch) and the boot code cannot rely on the activate state of interrupt. So they have to be cleaned at boot.

This also have to be done for PPI and SPIs. Peng, would you mind to do that patch?

Quoted 19 lines

A better solution would be to move the deactivation earlier on in do_sgi (maybe after eoi_irq) so we call stop_cpu() with all interrupts disabled.

Quoted 2 lines

So let's deactive the interrupts during GICv3 initialization to fix

s/deactivate/

Quoted 1 line

this issue.

Similarly to the commit title, you wrote the commit message very generically.

Quoted 6 lines

---
  xen/arch/arm/gic-v3.c | 4 ++++

  1 file changed, 4 insertions(+)
Quoted 13 lines
Quoted 5 lines
xen/arch/arm/gic-v3.c +0 -0
index 6fbc106757..643d4a33f0 100644
@@ -824,8 +824,12 @@ static int gicv3_cpu_init(void)
Quoted 8 lines

      priority = (GIC_PRI_IPI << 24 | GIC_PRI_IPI << 16 | GIC_PRI_IPI << 8 | GIC_PRI_IPI);
      for (i = 0; i < NR_GIC_SGI; i += 4)
+    {
          writel_relaxed(priority,
                  GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 + (i / 4) * 4); +        writel_relaxed(0xffffffff,
+                GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i / 4) * 4);

Each ICACTIVER0 registers hold the active bit for 32 interrupts. However, this code assumes the register only hold 4 interrupts. So this will write to unwanted area.

There are only 16 SGIs, so it fits in one write to ICACTIVER0. As wrote above, you also need to deactivate the PPIs. So the following should be enough:

/*
* The activate state is unknown at boot, so make sure all SGIs and PPIs are
* de-activated.
*/
writel_relaxed(0xffffffff, GICD_RDIST_SGI_BASE + GICR_ICACTIVER0);

Cheers,

Signature · 6 lines
Julien Grall

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

Hi Julien

Quoted 38 lines

-----Original Message-----
From: Julien Grall [mailto:[email protected]]
Sent: 2019年1月30日 20:06
To: Peng Fan <[email protected]>; [email protected]
Cc: [email protected]; Andre Przywara <[email protected]>
Subject: Re: [PATCH] arm: gic-v3: clear GICR active interrupts

Hi

Replying to this thread again.

Quoted 5 lines · Julien Grall

Hi Peng,

The commit title is a bit confusing. It suggests that all interrupts should be deactivated at boot, however you are only deactivating the SGIs.

Quoted 13 lines
Quoted 3 lines · Peng Fan

On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because hardware design.

What do you mean by hardware design? Is it a defect?

Quoted 6 lines

The gic-v3 controller is configured with EOImode to 1, so during xen reboot, GIC_SGI_CALL_FUNCTION interrupt from CPU0 to other CPUs, but stop_cpu never return, that means other CPUs have no chance to deactive the interrupt. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because

GIC_SGI_CALL_FUNCTION of

Quoted 5 lines
Quoted 2 lines

other CPUs are active during the last reboot, interrupts could not be triggered unless we deactive the interrupt first.

From the description here, I think it not very sane to go to sleep
with an interrupt activate.

Quoted 6 lines

It looks like I was wrong here. There are case where you can't avoid that (see my answer to your other patch) and the boot code cannot rely on the activate state of interrupt. So they have to be cleaned at boot.

This also have to be done for PPI and SPIs. Peng, would you mind to do that patch?

I'll send out v2 patch soon.

Quoted 46 lines
Quoted 4 lines

A better solution would be to move the deactivation earlier on in do_sgi (maybe after eoi_irq) so we call stop_cpu() with all interrupts

disabled.

Quoted 9 lines
Quoted 3 lines

So let's deactive the interrupts during GICv3 initialization to fix

s/deactivate/

Quoted 1 line

this issue.

Similarly to the commit title, you wrote the commit message very

generically.

Quoted 8 lines
Quoted 8 lines

---
  xen/arch/arm/gic-v3.c | 4 ++++

  1 file changed, 4 insertions(+)
Quoted 12 lines
Quoted 5 lines
xen/arch/arm/gic-v3.c index renamed from xen/arch/arm/gic-v3.c +0 -0

6fbc106757..643d4a33f0 100644

xen/arch/arm/gic-v3.c +0 -0
@@ -824,8 +824,12 @@ static int gicv3_cpu_init(void)
Quoted 7 lines

      priority = (GIC_PRI_IPI << 24 | GIC_PRI_IPI << 16 | GIC_PRI_IPI << 8 |
                  GIC_PRI_IPI);
      for (i = 0; i < NR_GIC_SGI; i += 4)
+    {
          writel_relaxed(priority,
                  GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0 +

(i / 4) *

Quoted 3 lines
Quoted 3 lines

4);
+        writel_relaxed(0xffffffff,
+                GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i /

4) *

Quoted 1 line
Quoted 1 line

+4);

Each ICACTIVER0 registers hold the active bit for 32 interrupts. However, this code assumes the register only hold 4 interrupts. So this will write to unwanted area.

Quoted 8 lines

There are only 16 SGIs, so it fits in one write to ICACTIVER0. As wrote above, you also need to deactivate the PPIs. So the following should be enough:

/*
* The activate state is unknown at boot, so make sure all SGIs and PPIs are
* de-activated.
*/
writel_relaxed(0xffffffff, GICD_RDIST_SGI_BASE + GICR_ICACTIVER0);

Thanks,
Peng.

Quoted 5 lines

Cheers,

--
Julien Grall

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

author
#6 lore raw
Quoted 110 lines

-----Original Message-----
From: Xen-devel [mailto:[email protected]] On Behalf Of Peng Fan
Sent: 2019年1月30日 21:24
To: Julien Grall <[email protected]>; [email protected]
Cc: [email protected]; Andre Przywara <[email protected]>
Subject: Re: [Xen-devel] [PATCH] arm: gic-v3: clear GICR active interrupts

Hi Julien

Quoted 8 lines

-----Original Message-----
From: Julien Grall [mailto:[email protected]]
Sent: 2019年1月30日 20:06
To: Peng Fan <[email protected]>; [email protected]
Cc: [email protected]; Andre Przywara <[email protected]>
Subject: Re: [PATCH] arm: gic-v3: clear GICR active interrupts

Quoted 9 lines

Hi

Replying to this thread again.

Quoted 4 lines · Julien Grall

Hi Peng,

The commit title is a bit confusing. It suggests that all interrupts should be deactivated at boot, however you are only deactivating the

SGIs.

Quoted 21 lines
Quoted 6 lines · Peng Fan
Quoted 3 lines

On i.MX8, we implemented partition reboot which means Cortex-A reboot will not impact M4 cores and System control Unit core. However GICv3 is not reset because hardware design.

Quoted 8 lines

What do you mean by hardware design? Is it a defect?

Quoted 6 lines

The gic-v3 controller is configured with EOImode to 1, so during xen reboot, GIC_SGI_CALL_FUNCTION interrupt from CPU0 to other CPUs, but stop_cpu never return, that means other CPUs have no chance to deactive the interrupt. During xen booting again, CPU0 will issue GIC_SGI_CALL_FUNCTION to other CPUs. Because

GIC_SGI_CALL_FUNCTION of

Quoted 5 lines
Quoted 2 lines

other CPUs are active during the last reboot, interrupts could not be triggered unless we deactive the interrupt first.

From the description here, I think it not very sane to go to sleep
with an interrupt activate.

Quoted 6 lines

It looks like I was wrong here. There are case where you can't avoid that (see my answer to your other patch) and the boot code cannot rely on the activate state of interrupt. So they have to be cleaned at boot.

This also have to be done for PPI and SPIs. Peng, would you mind to do that patch?

I'll send out v2 patch soon.

Quoted 24 lines
Quoted 5 lines

A better solution would be to move the deactivation earlier on in do_sgi (maybe after eoi_irq) so we call stop_cpu() with all interrupts

disabled.

Quoted 9 lines
Quoted 3 lines

So let's deactive the interrupts during GICv3 initialization to fix

s/deactivate/

Quoted 1 line

this issue.

Similarly to the commit title, you wrote the commit message very

generically.

Quoted 8 lines
Quoted 8 lines

---
  xen/arch/arm/gic-v3.c | 4 ++++

  1 file changed, 4 insertions(+)
Quoted 12 lines
Quoted 4 lines
Quoted 4 lines
xen/arch/arm/gic-v3.c index renamed from xen/arch/arm/gic-v3.c +0 -0

6fbc106757..643d4a33f0 100644

xen/arch/arm/gic-v3.c +0 -0
Quoted 8 lines
Quoted 8 lines
xen/arch/arm/gic-v3.c +0 -0
@@ -824,8 +824,12 @@ static int gicv3_cpu_init(void)

      priority = (GIC_PRI_IPI << 24 | GIC_PRI_IPI << 16 | GIC_PRI_IPI << 8 |
                  GIC_PRI_IPI);
      for (i = 0; i < NR_GIC_SGI; i += 4)
+    {
          writel_relaxed(priority, GICD_RDIST_SGI_BASE + GICR_IPRIORITYR0

+

Quoted 4 lines

(i / 4) *

Quoted 3 lines
Quoted 3 lines

4);
+        writel_relaxed(0xffffffff,
+                GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i

/

Quoted 7 lines

4) *

Quoted 1 line
Quoted 1 line

+4);

Each ICACTIVER0 registers hold the active bit for 32 interrupts. However, this code assumes the register only hold 4 interrupts. So this will write to unwanted area.

Quoted 10 lines
Quoted 2 lines

There are only 16 SGIs, so it fits in one write to ICACTIVER0. As wrote above, you also need to deactivate the PPIs. So the following should

be enough:

Quoted 3 lines

/*
* The activate state is unknown at boot, so make sure all SGIs and PPIs

are

Quoted 3 lines

* de-activated.
*/
writel_relaxed(0xffffffff, GICD_RDIST_SGI_BASE + GICR_ICACTIVER0);

Just have a following up question, according to IHI0069D_gic_architecture_specification "8.11.3 GICR_ICACTIVER0, Interrupt Clear-Active Register 0 "
This field resets to a value that is architecturally UNKNOWN,
Do we need to take SPI into consideration as the following in gic_cpu_init? for (i = 0; i < nr_lines; i +=32)

	writel_relaxed(0xffffffff, GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i / 32) * 4);

and move nr_lines out from gic_dist_init to a static global varaiable.

Thanks,
Peng.

Quoted 9 lines

Thanks,
Peng.

Quoted 5 lines

Cheers,

--
Julien Grall

Quoted 9 lines

_______________________________________________
Xen-devel mailing list
[email protected]
https://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.
xenproject.org%2Fmailman%2Flistinfo%2Fxen-devel&amp;data=02%7C01%7 Cpeng.fan%40nxp.com%7Cba187bcf60464fda80f308d686b63c4a%7C686ea1 d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636844514593523457&amp;s data=2opQQEkJAqAon3amajrlQqGvKuZqiUbJp2BBRYrEzfQ%3D&amp;reserve d=0

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

#7 lore raw

Hi,

Quoted 15 lines · Peng Fan
Quoted 4 lines
Quoted 4 lines

Each ICACTIVER0 registers hold the active bit for 32 interrupts. However, this code assumes the register only hold 4 interrupts. So this will write to unwanted area.

Quoted 10 lines
Quoted 2 lines

There are only 16 SGIs, so it fits in one write to ICACTIVER0. As wrote above, you also need to deactivate the PPIs. So the following should

be enough:

Quoted 3 lines

/*
* The activate state is unknown at boot, so make sure all SGIs and PPIs

are

Quoted 3 lines

* de-activated.
*/
writel_relaxed(0xffffffff, GICD_RDIST_SGI_BASE + GICR_ICACTIVER0);

Quoted 8 lines

Just have a following up question, according to IHI0069D_gic_architecture_specification "8.11.3 GICR_ICACTIVER0, Interrupt Clear-Active Register 0"
This field resets to a value that is architecturally UNKNOWN,
Do we need to take SPI into consideration as the following in gic_cpu_init? for (i = 0; i < nr_lines; i +=32)

	writel_relaxed(0xffffffff, GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i / 32) * 4);

and move nr_lines out from gic_dist_init to a static global varaiable.

You can't clear SPIs through GICD_RDIST_SGI_BASE. You have to use the GICD.

Furthermore, gic_cpu_init is called for every CPU so this is not a good place for clearing shared interrupts. Shared interrupts should be cleared in gic_dist_init as this is called only once.

Cheers,

Signature · 6 lines
Julien Grall

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
author
#8 lore raw
Quoted 39 lines

-----Original Message-----
From: Julien Grall [mailto:[email protected]]
Sent: 2019年1月30日 21:49
To: Peng Fan <[email protected]>; [email protected]
Cc: [email protected]; Andre Przywara <[email protected]>
Subject: Re: [PATCH] arm: gic-v3: clear GICR active interrupts

Hi,

Quoted 26 lines · Peng Fan
Quoted 7 lines
Quoted 7 lines

Each ICACTIVER0 registers hold the active bit for 32 interrupts. However, this code assumes the register only hold 4 interrupts. So this will write to unwanted area.

There are only 16 SGIs, so it fits in one write to ICACTIVER0. As wrote above, you also need to deactivate the PPIs. So the following should

Quoted 9 lines

be enough:

Quoted 4 lines

/*
* The activate state is unknown at boot, so make sure all SGIs
and PPIs

are

Quoted 3 lines

* de-activated.
*/
writel_relaxed(0xffffffff, GICD_RDIST_SGI_BASE + GICR_ICACTIVER0);

Just have a following up question, according to IHI0069D_gic_architecture_specification
"8.11.3 GICR_ICACTIVER0, Interrupt Clear-Active Register 0" This field resets to a value that is architecturally UNKNOWN, Do we need to take SPI into consideration as the following in gic_cpu_init? for (i = 0; i < nr_lines; i +=32)

	writel_relaxed(0xffffffff, GICD_RDIST_SGI_BASE + GICR_ICACTIVER0 + (i

/ 32) * 4);

Quoted 4 lines
Quoted 1 line

and move nr_lines out from gic_dist_init to a static global varaiable.

You can't clear SPIs through GICD_RDIST_SGI_BASE. You have to use the GICD.

Oops. I got wrong.

Quoted 4 lines

Furthermore, gic_cpu_init is called for every CPU so this is not a good place for clearing shared interrupts. Shared interrupts should be cleared in gic_dist_init as this is called only once.

Yes.

Thanks,
Peng.

Quoted 5 lines

Cheers,

--
Julien Grall

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