Skip to contentSkip to conversation

irqchip: Skip contexts other supervisor in plic_init()

PATCH Superseded Alan Mikhak 5 participants 9 messages Oct 23, 2019 – Oct 24, 2019

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 irqchip: Skip contexts other supervisor in plic_init()

From: Alan Mikhak <[email protected]>

Modify plic_init() to skip .dts interrupt contexts other than supervisor external interrupt.

---
 drivers/irqchip/irq-sifive-plic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-sifive-plic.c +2 -2
index c72c036aea76..5f2a773d5669 100644
@@ -251,8 +251,8 @@ static int __init plic_init(struct device_node *node,
 			continue;
 		}
 
-		/* skip context holes */
-		if (parent.args[0] == -1)
+		/* skip contexts other than supervisor external interrupt */
+		if (parent.args[0] != IRQ_S_EXT)
 			continue;
 
 		hartid = plic_find_hart_id(parent.np);
Signature · 1 line
2.7.4
#1 lore raw

+ hch

Quoted 4 lines · Alan Mikhak

From: Alan Mikhak <[email protected]>

Modify plic_init() to skip .dts interrupt contexts other than supervisor external interrupt.

Might be good to explain the motivation here.

Quoted 11 lines
---
 drivers/irqchip/irq-sifive-plic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-sifive-plic.c +0 -0
index c72c036aea76..5f2a773d5669 100644

drivers/irqchip/irq-sifive-plic.c static int __init plic_init(struct device_node *node, · line 256

Quoted 8 lines
drivers/irqchip/irq-sifive-plic.c +2 -2
@@ -251,8 +251,8 @@ static int __init plic_init(struct device_node *node,
 			continue;
 		}
 
-		/* skip context holes */
-		if (parent.args[0] == -1)
+		/* skip contexts other than supervisor external interrupt */
+		if (parent.args[0] != IRQ_S_EXT)
 			continue;

Will this need to change for RISC-V M-mode Linux support?

https://lore.kernel.org/linux-riscv/[email protected]/

- Paul

#2 lore raw
Quoted 11 lines · Paul Walmsley

+ hch

Quoted 4 lines · Alan Mikhak

From: Alan Mikhak <[email protected]>

Modify plic_init() to skip .dts interrupt contexts other than supervisor external interrupt.

Might be good to explain the motivation here.

The .dts entry for plic may specify multiple interrupt contexts. For example, it may assign two entries IRQ_M_EXT and IRQ_S_EXT, in that order, to the same interrupt controller. This patch modifies plic_init() to skip the IRQ_M_EXT context since IRQ_S_EXT is currently the only supported context.

If IRQ_M_EXT is not skipped, plic_init() will report "handler already present for context" when it comes across the IRQ_S_EXT context in the next iteration of its loop.

Without this patch, .dts would have to be edited to replace the value of IRQ_M_EXT with -1 for it to be skipped.

I will add the above explanation in a v2 patch description, if it sounds reasonable.

Quoted 29 lines
Quoted 12 lines
---
 drivers/irqchip/irq-sifive-plic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-sifive-plic.c +0 -0
index c72c036aea76..5f2a773d5669 100644

drivers/irqchip/irq-sifive-plic.c static int __init plic_init(struct device_node *node, · line 256

Quoted 8 lines
drivers/irqchip/irq-sifive-plic.c +2 -2
@@ -251,8 +251,8 @@ static int __init plic_init(struct device_node *node,
                      continue;
              }
 
-             /* skip context holes */
-             if (parent.args[0] == -1)
+             /* skip contexts other than supervisor external interrupt */
+             if (parent.args[0] != IRQ_S_EXT)
                      continue;

Will this need to change for RISC-V M-mode Linux support?

https://lore.kernel.org/linux-riscv/[email protected]/

- Paul

Acked-by
#3 lore raw
Quoted 18 lines · Alan Mikhak
Quoted 6 lines · Paul Walmsley
Quoted 2 lines · Alan Mikhak

Modify plic_init() to skip .dts interrupt contexts other than supervisor external interrupt.

Might be good to explain the motivation here.

The .dts entry for plic may specify multiple interrupt contexts. For example, it may assign two entries IRQ_M_EXT and IRQ_S_EXT, in that order, to the same interrupt controller. This patch modifies plic_init() to skip the IRQ_M_EXT context since IRQ_S_EXT is currently the only supported context.

If IRQ_M_EXT is not skipped, plic_init() will report "handler already present for context" when it comes across the IRQ_S_EXT context in the next iteration of its loop.

Quoted 5 lines

Without this patch, .dts would have to be edited to replace the value of IRQ_M_EXT with -1 for it to be skipped.

I will add the above explanation in a v2 patch description, if it sounds reasonable.

Thanks, that explanation sounds good; and sounds like Christoph will flow with this change as well. So with the description expanded as you plan to, feel free to add an

- Paul

#4 lore raw
In reply to Paul Walmsley
Quoted 33 lines · Paul Walmsley

+ hch

Quoted 4 lines · Alan Mikhak

From: Alan Mikhak <[email protected]>

Modify plic_init() to skip .dts interrupt contexts other than supervisor external interrupt.

Might be good to explain the motivation here.

Quoted 11 lines
---
 drivers/irqchip/irq-sifive-plic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/irqchip/irq-sifive-plic.c +0 -0
index c72c036aea76..5f2a773d5669 100644

drivers/irqchip/irq-sifive-plic.c static int __init plic_init(struct device_node *node, · line 256

Quoted 8 lines
drivers/irqchip/irq-sifive-plic.c +2 -2
@@ -251,8 +251,8 @@ static int __init plic_init(struct device_node *node,
 			continue;
 		}
 
-		/* skip context holes */
-		if (parent.args[0] == -1)
+		/* skip contexts other than supervisor external interrupt */
+		if (parent.args[0] != IRQ_S_EXT)
 			continue;

Will this need to change for RISC-V M-mode Linux support?

Quoted 1 line

https://lore.kernel.org/linux-riscv/[email protected]/

Yes.

Quoted 3 lines

- Paul

#5 lore raw
Quoted 9 lines · Palmer Dabbelt
Quoted 7 lines

drivers/irqchip/irq-sifive-plic.c static int __init plic_init(struct device_node *node, · line 256

Quoted 3 lines
drivers/irqchip/irq-sifive-plic.c +2 -0
+		/* skip contexts other than supervisor external interrupt */
+		if (parent.args[0] != IRQ_S_EXT)
 			continue;

Will this need to change for RISC-V M-mode Linux support?

https://lore.kernel.org/linux-riscv/[email protected]/

Yes.

For M-mode we'll want to check IRQ_M_EXT above. So we should just merge this patch ASAP and then for my rebased M-mode series I'll fix the check to do that for the M-Mode case, which is much cleaner than my hack.

#6 lore raw
Quoted 7 lines · On Wed, 23 Oct 2019 18:30:19 -0700 Christoph Hellwig <[email protected]> wrote:
Quoted 6 lines · Palmer Dabbelt
Quoted 6 lines

drivers/irqchip/irq-sifive-plic.c static int __init plic_init(struct device_node *node, · line 256

Quoted 3 lines
drivers/irqchip/irq-sifive-plic.c +2 -0
+		/* skip contexts other than supervisor external interrupt */
+		if (parent.args[0] != IRQ_S_EXT)
 			continue;  

Will this need to change for RISC-V M-mode Linux support?

Quoted 8 lines
Quoted 3 lines
Quoted 1 line

https://lore.kernel.org/linux-riscv/[email protected]/

Yes.

For M-mode we'll want to check IRQ_M_EXT above. So we should just merge this patch ASAP and then for my rebased M-mode series I'll fix the check to do that for the M-Mode case, which is much cleaner than my hack.

Does this need to be taken as a fix, potentially Cc to stable? Or is that 5.5 material?

	M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Reviewed-by
#7 lore raw
Quoted 6 lines · Marc Zyngier
Quoted 6 lines
Quoted 5 lines
Quoted 3 lines

Will this need to change for RISC-V M-mode Linux support?

https://lore.kernel.org/linux-riscv/[email protected]/

Yes.

Quoted 7 lines
Quoted 4 lines

For M-mode we'll want to check IRQ_M_EXT above. So we should just merge this patch ASAP and then for my rebased M-mode series I'll fix the check to do that for the M-Mode case, which is much cleaner than my hack.

Does this need to be taken as a fix, potentially Cc to stable? Or is that 5.5 material?

So I though that the S-mode context were kinda aways to be sorted before M-mode, but I can't find anything guranteeing it. So I think this actually is a fix, and getting this queued up in the next -rc would really help me with the nommu stuff - otherwise we'd need to take it through the riscv tree for 5.5 to avoid conflicts.

Btw, here is my:

for the patch.

_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv

#8 lore raw
Quoted 23 lines · Christoph Hellwig
Quoted 7 lines · Marc Zyngier
Quoted 3 lines
Quoted 3 lines
Quoted 3 lines

Will this need to change for RISC-V M-mode Linux support?

https://lore.kernel.org/linux-riscv/[email protected]/

Quoted 3 lines
Quoted 2 lines

Yes.

Quoted 8 lines
Quoted 3 lines

For M-mode we'll want to check IRQ_M_EXT above. So we should just merge this patch ASAP and then for my rebased M-mode series I'll fix the check to do that for the M-Mode case, which is much

cleaner

Quoted 1 line

than my hack.

Does this need to be taken as a fix, potentially Cc to stable? Or is that 5.5 material?

So I though that the S-mode context were kinda aways to be sorted before M-mode, but I can't find anything guranteeing it. So I think this actually is a fix, and getting this queued up in the next -rc would really help me with the nommu stuff - otherwise we'd need to take it through the riscv tree for 5.5 to avoid conflicts.

Quoted 5 lines

Btw, here is my:

for the patch.

Thanks for that.

Alan, if you can respin this patch with an updated commit message, I'll queue it with a couple of other nits I have lying around, and send it to Thomas by the end of the week.

        M.
Signature · 1 line
Jazz is not dead. It just smells funny...