Linux-RISC-V Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] irqchip: Skip contexts other supervisor in plic_init()
@ 2019-10-23 16:22 Alan Mikhak
  2019-10-23 18:54 ` Paul Walmsley
  0 siblings, 1 reply; 9+ messages in thread
From: Alan Mikhak @ 2019-10-23 16:22 UTC (permalink / raw)
  To: linux-kernel, linux-riscv, tglx, jason, maz, palmer, paul.walmsley
  Cc: Alan Mikhak

From: Alan Mikhak <alan.mikhak@sifive.com>

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

Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
---
 drivers/irqchip/irq-sifive-plic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
index c72c036aea76..5f2a773d5669 100644
--- a/drivers/irqchip/irq-sifive-plic.c
+++ b/drivers/irqchip/irq-sifive-plic.c
@@ -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);
-- 
2.7.4


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] irqchip: Skip contexts other supervisor in plic_init()
  2019-10-23 16:22 [PATCH] irqchip: Skip contexts other supervisor in plic_init() Alan Mikhak
@ 2019-10-23 18:54 ` Paul Walmsley
  2019-10-23 21:34   ` Alan Mikhak
  2019-10-23 22:07   ` Palmer Dabbelt
  0 siblings, 2 replies; 9+ messages in thread
From: Paul Walmsley @ 2019-10-23 18:54 UTC (permalink / raw)
  To: Alan Mikhak; +Cc: jason, maz, palmer, linux-kernel, hch, linux-riscv, tglx

+ hch

On Wed, 23 Oct 2019, Alan Mikhak wrote:

> From: Alan Mikhak <alan.mikhak@sifive.com>
> 
> Modify plic_init() to skip .dts interrupt contexts other
> than supervisor external interrupt.

Might be good to explain the motivation here.

> 
> Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
> ---
>  drivers/irqchip/irq-sifive-plic.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
> index c72c036aea76..5f2a773d5669 100644
> --- a/drivers/irqchip/irq-sifive-plic.c
> +++ b/drivers/irqchip/irq-sifive-plic.c
> @@ -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/20191017173743.5430-1-hch@lst.de/


- Paul



_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] irqchip: Skip contexts other supervisor in plic_init()
  2019-10-23 18:54 ` Paul Walmsley
@ 2019-10-23 21:34   ` Alan Mikhak
  2019-10-24  2:21     ` Paul Walmsley
  2019-10-23 22:07   ` Palmer Dabbelt
  1 sibling, 1 reply; 9+ messages in thread
From: Alan Mikhak @ 2019-10-23 21:34 UTC (permalink / raw)
  To: Paul Walmsley
  Cc: jason, maz, Palmer Dabbelt, linux-kernel, Christoph Hellwig,
	linux-riscv, tglx

On Wed, Oct 23, 2019 at 11:54 AM Paul Walmsley <paul.walmsley@sifive.com> wrote:
>
> + hch
>
> On Wed, 23 Oct 2019, Alan Mikhak wrote:
>
> > From: Alan Mikhak <alan.mikhak@sifive.com>
> >
> > 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.

>
> >
> > Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
> > ---
> >  drivers/irqchip/irq-sifive-plic.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
> > index c72c036aea76..5f2a773d5669 100644
> > --- a/drivers/irqchip/irq-sifive-plic.c
> > +++ b/drivers/irqchip/irq-sifive-plic.c
> > @@ -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/20191017173743.5430-1-hch@lst.de/
>
>
> - Paul
>
>

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] irqchip: Skip contexts other supervisor in plic_init()
  2019-10-23 18:54 ` Paul Walmsley
  2019-10-23 21:34   ` Alan Mikhak
@ 2019-10-23 22:07   ` Palmer Dabbelt
  2019-10-24  1:30     ` Christoph Hellwig
  1 sibling, 1 reply; 9+ messages in thread
From: Palmer Dabbelt @ 2019-10-23 22:07 UTC (permalink / raw)
  To: Paul Walmsley
  Cc: jason, maz, linux-kernel, Christoph Hellwig, alan.mikhak, tglx,
	linux-riscv

On Wed, 23 Oct 2019 11:54:54 PDT (-0700), Paul Walmsley wrote:
> + hch
>
> On Wed, 23 Oct 2019, Alan Mikhak wrote:
>
>> From: Alan Mikhak <alan.mikhak@sifive.com>
>>
>> Modify plic_init() to skip .dts interrupt contexts other
>> than supervisor external interrupt.
>
> Might be good to explain the motivation here.
>
>>
>> Signed-off-by: Alan Mikhak <alan.mikhak@sifive.com>
>> ---
>>  drivers/irqchip/irq-sifive-plic.c | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/irqchip/irq-sifive-plic.c b/drivers/irqchip/irq-sifive-plic.c
>> index c72c036aea76..5f2a773d5669 100644
>> --- a/drivers/irqchip/irq-sifive-plic.c
>> +++ b/drivers/irqchip/irq-sifive-plic.c
>> @@ -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/20191017173743.5430-1-hch@lst.de/

Yes.

>
>
> - Paul

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] irqchip: Skip contexts other supervisor in plic_init()
  2019-10-23 22:07   ` Palmer Dabbelt
@ 2019-10-24  1:30     ` Christoph Hellwig
  2019-10-24  6:51       ` Marc Zyngier
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2019-10-24  1:30 UTC (permalink / raw)
  To: Palmer Dabbelt
  Cc: jason, maz, linux-kernel, Christoph Hellwig, alan.mikhak,
	Paul Walmsley, tglx, linux-riscv

On Wed, Oct 23, 2019 at 03:07:10PM -0700, Palmer Dabbelt wrote:
> > > +		/* 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/20191017173743.5430-1-hch@lst.de/
> 
> 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.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] irqchip: Skip contexts other supervisor in plic_init()
  2019-10-23 21:34   ` Alan Mikhak
@ 2019-10-24  2:21     ` Paul Walmsley
  0 siblings, 0 replies; 9+ messages in thread
From: Paul Walmsley @ 2019-10-24  2:21 UTC (permalink / raw)
  To: Alan Mikhak
  Cc: jason, maz, Palmer Dabbelt, linux-kernel, Christoph Hellwig,
	linux-riscv, tglx

On Wed, 23 Oct 2019, Alan Mikhak wrote:

> On Wed, Oct 23, 2019 at 11:54 AM Paul Walmsley <paul.walmsley@sifive.com> wrote:
> > On Wed, 23 Oct 2019, Alan Mikhak wrote:
> >
> > > 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.

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

Acked-by: Paul Walmsley <paul.walmsley@sifive.com> # arch/riscv 


- Paul

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] irqchip: Skip contexts other supervisor in plic_init()
  2019-10-24  1:30     ` Christoph Hellwig
@ 2019-10-24  6:51       ` Marc Zyngier
  2019-10-24  7:03         ` Christoph Hellwig
  0 siblings, 1 reply; 9+ messages in thread
From: Marc Zyngier @ 2019-10-24  6:51 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: jason, Palmer Dabbelt, linux-kernel, alan.mikhak, Paul Walmsley,
	tglx, linux-riscv

On Wed, 23 Oct 2019 18:30:19 -0700
Christoph Hellwig <hch@infradead.org> wrote:

> On Wed, Oct 23, 2019 at 03:07:10PM -0700, Palmer Dabbelt wrote:
> > > > +		/* 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/20191017173743.5430-1-hch@lst.de/  
> > 
> > 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.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] irqchip: Skip contexts other supervisor in plic_init()
  2019-10-24  6:51       ` Marc Zyngier
@ 2019-10-24  7:03         ` Christoph Hellwig
  2019-10-24  7:27           ` Marc Zyngier
  0 siblings, 1 reply; 9+ messages in thread
From: Christoph Hellwig @ 2019-10-24  7:03 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: jason, Palmer Dabbelt, linux-kernel, Christoph Hellwig,
	alan.mikhak, Paul Walmsley, linux-riscv, tglx

On Thu, Oct 24, 2019 at 07:51:16AM +0100, Marc Zyngier wrote:
> > > > Will this need to change for RISC-V M-mode Linux support?
> > > > 
> > > > https://lore.kernel.org/linux-riscv/20191017173743.5430-1-hch@lst.de/  
> > > 
> > > 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?

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:

Reviewed-by: Christoph Hellwig <hch@lst.de>

for the patch.

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH] irqchip: Skip contexts other supervisor in plic_init()
  2019-10-24  7:03         ` Christoph Hellwig
@ 2019-10-24  7:27           ` Marc Zyngier
  0 siblings, 0 replies; 9+ messages in thread
From: Marc Zyngier @ 2019-10-24  7:27 UTC (permalink / raw)
  To: Christoph Hellwig
  Cc: jason, Palmer Dabbelt, linux-kernel, alan.mikhak, Paul Walmsley,
	tglx, linux-riscv

On 2019-10-24 08:03, Christoph Hellwig wrote:
> On Thu, Oct 24, 2019 at 07:51:16AM +0100, Marc Zyngier wrote:
>> > > > Will this need to change for RISC-V M-mode Linux support?
>> > > >
>> > > > 
>> https://lore.kernel.org/linux-riscv/20191017173743.5430-1-hch@lst.de/
>> > >
>> > > 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?
>
> 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:
>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
> 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.
-- 
Jazz is not dead. It just smells funny...

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, back to index

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-23 16:22 [PATCH] irqchip: Skip contexts other supervisor in plic_init() Alan Mikhak
2019-10-23 18:54 ` Paul Walmsley
2019-10-23 21:34   ` Alan Mikhak
2019-10-24  2:21     ` Paul Walmsley
2019-10-23 22:07   ` Palmer Dabbelt
2019-10-24  1:30     ` Christoph Hellwig
2019-10-24  6:51       ` Marc Zyngier
2019-10-24  7:03         ` Christoph Hellwig
2019-10-24  7:27           ` Marc Zyngier

Linux-RISC-V Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-riscv/0 linux-riscv/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-riscv linux-riscv/ https://lore.kernel.org/linux-riscv \
		linux-riscv@lists.infradead.org
	public-inbox-index linux-riscv

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.infradead.lists.linux-riscv


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git