All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] irqchip: stm32: don't set rising configuration registers at init
@ 2019-03-07 16:15 ` Fabien Dessenne
  0 siblings, 0 replies; 10+ messages in thread
From: Fabien Dessenne @ 2019-03-07 16:15 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Maxime Coquelin,
	Alexandre Torgue, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Fabien Dessenne, Benjamin Gaignard

The rising configuration status register (rtsr) is not banked.
As it is shared with the co-processor, it should not be written at probe
time, else the co-processor configuration will be lost.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/irqchip/irq-stm32-exti.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index 6edfd4b..ff8a84f 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -716,7 +716,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
 	const struct stm32_exti_bank *stm32_bank;
 	struct stm32_exti_chip_data *chip_data;
 	void __iomem *base = h_data->base;
-	u32 irqs_mask;
 
 	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
 	chip_data = &h_data->chips_data[bank_idx];
@@ -725,10 +724,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
 
 	raw_spin_lock_init(&chip_data->rlock);
 
-	/* Determine number of irqs supported */
-	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
-	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
-
 	/*
 	 * This IP has no reset, so after hot reboot we should
 	 * clear registers to avoid residue
-- 
2.7.4


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

* [PATCH] irqchip: stm32: don't set rising configuration registers at init
@ 2019-03-07 16:15 ` Fabien Dessenne
  0 siblings, 0 replies; 10+ messages in thread
From: Fabien Dessenne @ 2019-03-07 16:15 UTC (permalink / raw)
  To: Thomas Gleixner, Jason Cooper, Marc Zyngier, Maxime Coquelin,
	Alexandre Torgue, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin Gaignard, Fabien Dessenne

The rising configuration status register (rtsr) is not banked.
As it is shared with the co-processor, it should not be written at probe
time, else the co-processor configuration will be lost.

Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
---
 drivers/irqchip/irq-stm32-exti.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
index 6edfd4b..ff8a84f 100644
--- a/drivers/irqchip/irq-stm32-exti.c
+++ b/drivers/irqchip/irq-stm32-exti.c
@@ -716,7 +716,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
 	const struct stm32_exti_bank *stm32_bank;
 	struct stm32_exti_chip_data *chip_data;
 	void __iomem *base = h_data->base;
-	u32 irqs_mask;
 
 	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
 	chip_data = &h_data->chips_data[bank_idx];
@@ -725,10 +724,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
 
 	raw_spin_lock_init(&chip_data->rlock);
 
-	/* Determine number of irqs supported */
-	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
-	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
-
 	/*
 	 * This IP has no reset, so after hot reboot we should
 	 * clear registers to avoid residue
-- 
2.7.4


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

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

* Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
  2019-03-07 16:15 ` Fabien Dessenne
@ 2019-03-07 16:39   ` Marc Zyngier
  -1 siblings, 0 replies; 10+ messages in thread
From: Marc Zyngier @ 2019-03-07 16:39 UTC (permalink / raw)
  To: Fabien Dessenne, Thomas Gleixner, Jason Cooper, Maxime Coquelin,
	Alexandre Torgue, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin Gaignard

On 07/03/2019 16:15, Fabien Dessenne wrote:
> The rising configuration status register (rtsr) is not banked.
> As it is shared with the co-processor, it should not be written at probe
> time, else the co-processor configuration will be lost.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>

Fixes:?

> ---
>  drivers/irqchip/irq-stm32-exti.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
> index 6edfd4b..ff8a84f 100644
> --- a/drivers/irqchip/irq-stm32-exti.c
> +++ b/drivers/irqchip/irq-stm32-exti.c
> @@ -716,7 +716,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
>  	const struct stm32_exti_bank *stm32_bank;
>  	struct stm32_exti_chip_data *chip_data;
>  	void __iomem *base = h_data->base;
> -	u32 irqs_mask;
>  
>  	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
>  	chip_data = &h_data->chips_data[bank_idx];
> @@ -725,10 +724,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
>  
>  	raw_spin_lock_init(&chip_data->rlock);
>  
> -	/* Determine number of irqs supported */
> -	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
> -	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
> -

And I guess you don't need to find out the number of supported IRQs?

Also, a handful of lines down, you're writing again to the same
register. Why isn't that a problem?

>  	/*
>  	 * This IP has no reset, so after hot reboot we should
>  	 * clear registers to avoid residue
> 

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
@ 2019-03-07 16:39   ` Marc Zyngier
  0 siblings, 0 replies; 10+ messages in thread
From: Marc Zyngier @ 2019-03-07 16:39 UTC (permalink / raw)
  To: Fabien Dessenne, Thomas Gleixner, Jason Cooper, Maxime Coquelin,
	Alexandre Torgue, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin Gaignard

On 07/03/2019 16:15, Fabien Dessenne wrote:
> The rising configuration status register (rtsr) is not banked.
> As it is shared with the co-processor, it should not be written at probe
> time, else the co-processor configuration will be lost.
> 
> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>

Fixes:?

> ---
>  drivers/irqchip/irq-stm32-exti.c | 5 -----
>  1 file changed, 5 deletions(-)
> 
> diff --git a/drivers/irqchip/irq-stm32-exti.c b/drivers/irqchip/irq-stm32-exti.c
> index 6edfd4b..ff8a84f 100644
> --- a/drivers/irqchip/irq-stm32-exti.c
> +++ b/drivers/irqchip/irq-stm32-exti.c
> @@ -716,7 +716,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
>  	const struct stm32_exti_bank *stm32_bank;
>  	struct stm32_exti_chip_data *chip_data;
>  	void __iomem *base = h_data->base;
> -	u32 irqs_mask;
>  
>  	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
>  	chip_data = &h_data->chips_data[bank_idx];
> @@ -725,10 +724,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data *h_data,
>  
>  	raw_spin_lock_init(&chip_data->rlock);
>  
> -	/* Determine number of irqs supported */
> -	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
> -	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
> -

And I guess you don't need to find out the number of supported IRQs?

Also, a handful of lines down, you're writing again to the same
register. Why isn't that a problem?

>  	/*
>  	 * This IP has no reset, so after hot reboot we should
>  	 * clear registers to avoid residue
> 

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

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

* RE: [PATCH] irqchip: stm32: don't set rising configuration registers at init
  2019-03-07 16:39   ` Marc Zyngier
@ 2019-03-07 17:24     ` Fabien DESSENNE
  -1 siblings, 0 replies; 10+ messages in thread
From: Fabien DESSENNE @ 2019-03-07 17:24 UTC (permalink / raw)
  To: Marc Zyngier, Thomas Gleixner, Jason Cooper, Maxime Coquelin,
	Alexandre TORGUE, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin GAIGNARD

Hi


> -----Original Message-----
> From: Marc Zyngier <marc.zyngier@arm.com>
> Sent: jeudi 7 mars 2019 17:40
> To: Fabien DESSENNE <fabien.dessenne@st.com>; Thomas Gleixner
> <tglx@linutronix.de>; Jason Cooper <jason@lakedaemon.net>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>; linux-kernel@vger.kernel.org; linux-stm32@st-md-
> mailman.stormreply.com; linux-arm-kernel@lists.infradead.org
> Cc: Benjamin GAIGNARD <benjamin.gaignard@st.com>
> Subject: Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
> 
> On 07/03/2019 16:15, Fabien Dessenne wrote:
> > The rising configuration status register (rtsr) is not banked.
> > As it is shared with the co-processor, it should not be written at
> > probe time, else the co-processor configuration will be lost.
> >
> > Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> 
> Fixes:?
> 
> > ---
> >  drivers/irqchip/irq-stm32-exti.c | 5 -----
> >  1 file changed, 5 deletions(-)
> >
> > diff --git a/drivers/irqchip/irq-stm32-exti.c
> > b/drivers/irqchip/irq-stm32-exti.c
> > index 6edfd4b..ff8a84f 100644
> > --- a/drivers/irqchip/irq-stm32-exti.c
> > +++ b/drivers/irqchip/irq-stm32-exti.c
> > @@ -716,7 +716,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct
> stm32_exti_host_data *h_data,
> >  	const struct stm32_exti_bank *stm32_bank;
> >  	struct stm32_exti_chip_data *chip_data;
> >  	void __iomem *base = h_data->base;
> > -	u32 irqs_mask;
> >
> >  	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
> >  	chip_data = &h_data->chips_data[bank_idx]; @@ -725,10 +724,6 @@
> > stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data
> > *h_data,
> >
> >  	raw_spin_lock_init(&chip_data->rlock);
> >
> > -	/* Determine number of irqs supported */
> > -	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
> > -	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
> > -
> 
> And I guess you don't need to find out the number of supported IRQs?

That's correct, this informed is useless : irqs_mask is never used (it used to be output in a log for debug purpose.and the log has been removed)


> 
> Also, a handful of lines down, you're writing again to the same register. Why isn't
> that a problem?

It's obviously a problem : another patch is missing, I am going to add it in v2.
Thanks for pointing this out!


> 
> >  	/*
> >  	 * This IP has no reset, so after hot reboot we should
> >  	 * clear registers to avoid residue
> >
> 
> Thanks,
> 
> 	M.
> --
> Jazz is not dead. It just smells funny...

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

* RE: [PATCH] irqchip: stm32: don't set rising configuration registers at init
@ 2019-03-07 17:24     ` Fabien DESSENNE
  0 siblings, 0 replies; 10+ messages in thread
From: Fabien DESSENNE @ 2019-03-07 17:24 UTC (permalink / raw)
  To: Marc Zyngier, Thomas Gleixner, Jason Cooper, Maxime Coquelin,
	Alexandre TORGUE, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin GAIGNARD

Hi


> -----Original Message-----
> From: Marc Zyngier <marc.zyngier@arm.com>
> Sent: jeudi 7 mars 2019 17:40
> To: Fabien DESSENNE <fabien.dessenne@st.com>; Thomas Gleixner
> <tglx@linutronix.de>; Jason Cooper <jason@lakedaemon.net>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>; linux-kernel@vger.kernel.org; linux-stm32@st-md-
> mailman.stormreply.com; linux-arm-kernel@lists.infradead.org
> Cc: Benjamin GAIGNARD <benjamin.gaignard@st.com>
> Subject: Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
> 
> On 07/03/2019 16:15, Fabien Dessenne wrote:
> > The rising configuration status register (rtsr) is not banked.
> > As it is shared with the co-processor, it should not be written at
> > probe time, else the co-processor configuration will be lost.
> >
> > Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> 
> Fixes:?
> 
> > ---
> >  drivers/irqchip/irq-stm32-exti.c | 5 -----
> >  1 file changed, 5 deletions(-)
> >
> > diff --git a/drivers/irqchip/irq-stm32-exti.c
> > b/drivers/irqchip/irq-stm32-exti.c
> > index 6edfd4b..ff8a84f 100644
> > --- a/drivers/irqchip/irq-stm32-exti.c
> > +++ b/drivers/irqchip/irq-stm32-exti.c
> > @@ -716,7 +716,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct
> stm32_exti_host_data *h_data,
> >  	const struct stm32_exti_bank *stm32_bank;
> >  	struct stm32_exti_chip_data *chip_data;
> >  	void __iomem *base = h_data->base;
> > -	u32 irqs_mask;
> >
> >  	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
> >  	chip_data = &h_data->chips_data[bank_idx]; @@ -725,10 +724,6 @@
> > stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data
> > *h_data,
> >
> >  	raw_spin_lock_init(&chip_data->rlock);
> >
> > -	/* Determine number of irqs supported */
> > -	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
> > -	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
> > -
> 
> And I guess you don't need to find out the number of supported IRQs?

That's correct, this informed is useless : irqs_mask is never used (it used to be output in a log for debug purpose.and the log has been removed)


> 
> Also, a handful of lines down, you're writing again to the same register. Why isn't
> that a problem?

It's obviously a problem : another patch is missing, I am going to add it in v2.
Thanks for pointing this out!


> 
> >  	/*
> >  	 * This IP has no reset, so after hot reboot we should
> >  	 * clear registers to avoid residue
> >
> 
> Thanks,
> 
> 	M.
> --
> Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
  2019-03-07 17:24     ` Fabien DESSENNE
@ 2019-03-07 17:46       ` Marc Zyngier
  -1 siblings, 0 replies; 10+ messages in thread
From: Marc Zyngier @ 2019-03-07 17:46 UTC (permalink / raw)
  To: Fabien DESSENNE, Thomas Gleixner, Jason Cooper, Maxime Coquelin,
	Alexandre TORGUE, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin GAIGNARD

On 07/03/2019 17:24, Fabien DESSENNE wrote:
> Hi
> 
> 
>> -----Original Message-----
>> From: Marc Zyngier <marc.zyngier@arm.com>
>> Sent: jeudi 7 mars 2019 17:40
>> To: Fabien DESSENNE <fabien.dessenne@st.com>; Thomas Gleixner
>> <tglx@linutronix.de>; Jason Cooper <jason@lakedaemon.net>; Maxime Coquelin
>> <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
>> <alexandre.torgue@st.com>; linux-kernel@vger.kernel.org; linux-stm32@st-md-
>> mailman.stormreply.com; linux-arm-kernel@lists.infradead.org
>> Cc: Benjamin GAIGNARD <benjamin.gaignard@st.com>
>> Subject: Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
>>
>> On 07/03/2019 16:15, Fabien Dessenne wrote:
>>> The rising configuration status register (rtsr) is not banked.
>>> As it is shared with the co-processor, it should not be written at
>>> probe time, else the co-processor configuration will be lost.
>>>
>>> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
>>
>> Fixes:?
>>
>>> ---
>>>  drivers/irqchip/irq-stm32-exti.c | 5 -----
>>>  1 file changed, 5 deletions(-)
>>>
>>> diff --git a/drivers/irqchip/irq-stm32-exti.c
>>> b/drivers/irqchip/irq-stm32-exti.c
>>> index 6edfd4b..ff8a84f 100644
>>> --- a/drivers/irqchip/irq-stm32-exti.c
>>> +++ b/drivers/irqchip/irq-stm32-exti.c
>>> @@ -716,7 +716,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct
>> stm32_exti_host_data *h_data,
>>>  	const struct stm32_exti_bank *stm32_bank;
>>>  	struct stm32_exti_chip_data *chip_data;
>>>  	void __iomem *base = h_data->base;
>>> -	u32 irqs_mask;
>>>
>>>  	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
>>>  	chip_data = &h_data->chips_data[bank_idx]; @@ -725,10 +724,6 @@
>>> stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data
>>> *h_data,
>>>
>>>  	raw_spin_lock_init(&chip_data->rlock);
>>>
>>> -	/* Determine number of irqs supported */
>>> -	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
>>> -	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
>>> -
>>
>> And I guess you don't need to find out the number of supported IRQs?
> 
> That's correct, this informed is useless : irqs_mask is never used (it used to be output in a log for debug purpose.and the log has been removed)
> 
> 
>>
>> Also, a handful of lines down, you're writing again to the same register. Why isn't
>> that a problem?
> 
> It's obviously a problem : another patch is missing, I am going to add it in v2.
> Thanks for pointing this out!

You are also happily writing to that register in other places via
stm32_exti_set_bit and co. All that is done without any cooperation with
the coprocessor (whatever that is...), so I really wonder if it all
works by magic or luck...

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

* Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
@ 2019-03-07 17:46       ` Marc Zyngier
  0 siblings, 0 replies; 10+ messages in thread
From: Marc Zyngier @ 2019-03-07 17:46 UTC (permalink / raw)
  To: Fabien DESSENNE, Thomas Gleixner, Jason Cooper, Maxime Coquelin,
	Alexandre TORGUE, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin GAIGNARD

On 07/03/2019 17:24, Fabien DESSENNE wrote:
> Hi
> 
> 
>> -----Original Message-----
>> From: Marc Zyngier <marc.zyngier@arm.com>
>> Sent: jeudi 7 mars 2019 17:40
>> To: Fabien DESSENNE <fabien.dessenne@st.com>; Thomas Gleixner
>> <tglx@linutronix.de>; Jason Cooper <jason@lakedaemon.net>; Maxime Coquelin
>> <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
>> <alexandre.torgue@st.com>; linux-kernel@vger.kernel.org; linux-stm32@st-md-
>> mailman.stormreply.com; linux-arm-kernel@lists.infradead.org
>> Cc: Benjamin GAIGNARD <benjamin.gaignard@st.com>
>> Subject: Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
>>
>> On 07/03/2019 16:15, Fabien Dessenne wrote:
>>> The rising configuration status register (rtsr) is not banked.
>>> As it is shared with the co-processor, it should not be written at
>>> probe time, else the co-processor configuration will be lost.
>>>
>>> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
>>
>> Fixes:?
>>
>>> ---
>>>  drivers/irqchip/irq-stm32-exti.c | 5 -----
>>>  1 file changed, 5 deletions(-)
>>>
>>> diff --git a/drivers/irqchip/irq-stm32-exti.c
>>> b/drivers/irqchip/irq-stm32-exti.c
>>> index 6edfd4b..ff8a84f 100644
>>> --- a/drivers/irqchip/irq-stm32-exti.c
>>> +++ b/drivers/irqchip/irq-stm32-exti.c
>>> @@ -716,7 +716,6 @@ stm32_exti_chip_data *stm32_exti_chip_init(struct
>> stm32_exti_host_data *h_data,
>>>  	const struct stm32_exti_bank *stm32_bank;
>>>  	struct stm32_exti_chip_data *chip_data;
>>>  	void __iomem *base = h_data->base;
>>> -	u32 irqs_mask;
>>>
>>>  	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
>>>  	chip_data = &h_data->chips_data[bank_idx]; @@ -725,10 +724,6 @@
>>> stm32_exti_chip_data *stm32_exti_chip_init(struct stm32_exti_host_data
>>> *h_data,
>>>
>>>  	raw_spin_lock_init(&chip_data->rlock);
>>>
>>> -	/* Determine number of irqs supported */
>>> -	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
>>> -	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
>>> -
>>
>> And I guess you don't need to find out the number of supported IRQs?
> 
> That's correct, this informed is useless : irqs_mask is never used (it used to be output in a log for debug purpose.and the log has been removed)
> 
> 
>>
>> Also, a handful of lines down, you're writing again to the same register. Why isn't
>> that a problem?
> 
> It's obviously a problem : another patch is missing, I am going to add it in v2.
> Thanks for pointing this out!

You are also happily writing to that register in other places via
stm32_exti_set_bit and co. All that is done without any cooperation with
the coprocessor (whatever that is...), so I really wonder if it all
works by magic or luck...

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

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

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

* RE: [PATCH] irqchip: stm32: don't set rising configuration registers at init
  2019-03-07 17:46       ` Marc Zyngier
@ 2019-03-07 17:57         ` Fabien DESSENNE
  -1 siblings, 0 replies; 10+ messages in thread
From: Fabien DESSENNE @ 2019-03-07 17:57 UTC (permalink / raw)
  To: Marc Zyngier, Thomas Gleixner, Jason Cooper, Maxime Coquelin,
	Alexandre TORGUE, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin GAIGNARD



> -----Original Message-----
> From: Marc Zyngier <marc.zyngier@arm.com>
> Sent: jeudi 7 mars 2019 18:46
> To: Fabien DESSENNE <fabien.dessenne@st.com>; Thomas Gleixner
> <tglx@linutronix.de>; Jason Cooper <jason@lakedaemon.net>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>; linux-kernel@vger.kernel.org; linux-stm32@st-md-
> mailman.stormreply.com; linux-arm-kernel@lists.infradead.org
> Cc: Benjamin GAIGNARD <benjamin.gaignard@st.com>
> Subject: Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
> 
> On 07/03/2019 17:24, Fabien DESSENNE wrote:
> > Hi
> >
> >
> >> -----Original Message-----
> >> From: Marc Zyngier <marc.zyngier@arm.com>
> >> Sent: jeudi 7 mars 2019 17:40
> >> To: Fabien DESSENNE <fabien.dessenne@st.com>; Thomas Gleixner
> >> <tglx@linutronix.de>; Jason Cooper <jason@lakedaemon.net>; Maxime
> >> Coquelin <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> >> <alexandre.torgue@st.com>; linux-kernel@vger.kernel.org;
> >> linux-stm32@st-md- mailman.stormreply.com;
> >> linux-arm-kernel@lists.infradead.org
> >> Cc: Benjamin GAIGNARD <benjamin.gaignard@st.com>
> >> Subject: Re: [PATCH] irqchip: stm32: don't set rising configuration
> >> registers at init
> >>
> >> On 07/03/2019 16:15, Fabien Dessenne wrote:
> >>> The rising configuration status register (rtsr) is not banked.
> >>> As it is shared with the co-processor, it should not be written at
> >>> probe time, else the co-processor configuration will be lost.
> >>>
> >>> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> >>
> >> Fixes:?
> >>
> >>> ---
> >>>  drivers/irqchip/irq-stm32-exti.c | 5 -----
> >>>  1 file changed, 5 deletions(-)
> >>>
> >>> diff --git a/drivers/irqchip/irq-stm32-exti.c
> >>> b/drivers/irqchip/irq-stm32-exti.c
> >>> index 6edfd4b..ff8a84f 100644
> >>> --- a/drivers/irqchip/irq-stm32-exti.c
> >>> +++ b/drivers/irqchip/irq-stm32-exti.c
> >>> @@ -716,7 +716,6 @@ stm32_exti_chip_data
> >>> *stm32_exti_chip_init(struct
> >> stm32_exti_host_data *h_data,
> >>>  	const struct stm32_exti_bank *stm32_bank;
> >>>  	struct stm32_exti_chip_data *chip_data;
> >>>  	void __iomem *base = h_data->base;
> >>> -	u32 irqs_mask;
> >>>
> >>>  	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
> >>>  	chip_data = &h_data->chips_data[bank_idx]; @@ -725,10 +724,6 @@
> >>> stm32_exti_chip_data *stm32_exti_chip_init(struct
> >>> stm32_exti_host_data *h_data,
> >>>
> >>>  	raw_spin_lock_init(&chip_data->rlock);
> >>>
> >>> -	/* Determine number of irqs supported */
> >>> -	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
> >>> -	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
> >>> -
> >>
> >> And I guess you don't need to find out the number of supported IRQs?
> >
> > That's correct, this informed is useless : irqs_mask is never used (it
> > used to be output in a log for debug purpose.and the log has been
> > removed)
> >
> >
> >>
> >> Also, a handful of lines down, you're writing again to the same
> >> register. Why isn't that a problem?
> >
> > It's obviously a problem : another patch is missing, I am going to add it in v2.
> > Thanks for pointing this out!
> 
> You are also happily writing to that register in other places via stm32_exti_set_bit
> and co. All that is done without any cooperation with the coprocessor (whatever
> that is...), so I really wonder if it all works by magic or luck...

There is certainly some magic and luck! But there is a bit more : the access to both rtsr and ftsr regs are controlled with a call to stm32_exti_hwspin_lock() which uses an HWSpinlock shared with the coprocessor.
The other registers are not accessed by the coprocessor, hence are not hwspinlock-protected.


> 
> Thanks,
> 
> 	M.
> --
> Jazz is not dead. It just smells funny...

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

* RE: [PATCH] irqchip: stm32: don't set rising configuration registers at init
@ 2019-03-07 17:57         ` Fabien DESSENNE
  0 siblings, 0 replies; 10+ messages in thread
From: Fabien DESSENNE @ 2019-03-07 17:57 UTC (permalink / raw)
  To: Marc Zyngier, Thomas Gleixner, Jason Cooper, Maxime Coquelin,
	Alexandre TORGUE, linux-kernel, linux-stm32, linux-arm-kernel
  Cc: Benjamin GAIGNARD



> -----Original Message-----
> From: Marc Zyngier <marc.zyngier@arm.com>
> Sent: jeudi 7 mars 2019 18:46
> To: Fabien DESSENNE <fabien.dessenne@st.com>; Thomas Gleixner
> <tglx@linutronix.de>; Jason Cooper <jason@lakedaemon.net>; Maxime Coquelin
> <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> <alexandre.torgue@st.com>; linux-kernel@vger.kernel.org; linux-stm32@st-md-
> mailman.stormreply.com; linux-arm-kernel@lists.infradead.org
> Cc: Benjamin GAIGNARD <benjamin.gaignard@st.com>
> Subject: Re: [PATCH] irqchip: stm32: don't set rising configuration registers at init
> 
> On 07/03/2019 17:24, Fabien DESSENNE wrote:
> > Hi
> >
> >
> >> -----Original Message-----
> >> From: Marc Zyngier <marc.zyngier@arm.com>
> >> Sent: jeudi 7 mars 2019 17:40
> >> To: Fabien DESSENNE <fabien.dessenne@st.com>; Thomas Gleixner
> >> <tglx@linutronix.de>; Jason Cooper <jason@lakedaemon.net>; Maxime
> >> Coquelin <mcoquelin.stm32@gmail.com>; Alexandre TORGUE
> >> <alexandre.torgue@st.com>; linux-kernel@vger.kernel.org;
> >> linux-stm32@st-md- mailman.stormreply.com;
> >> linux-arm-kernel@lists.infradead.org
> >> Cc: Benjamin GAIGNARD <benjamin.gaignard@st.com>
> >> Subject: Re: [PATCH] irqchip: stm32: don't set rising configuration
> >> registers at init
> >>
> >> On 07/03/2019 16:15, Fabien Dessenne wrote:
> >>> The rising configuration status register (rtsr) is not banked.
> >>> As it is shared with the co-processor, it should not be written at
> >>> probe time, else the co-processor configuration will be lost.
> >>>
> >>> Signed-off-by: Fabien Dessenne <fabien.dessenne@st.com>
> >>
> >> Fixes:?
> >>
> >>> ---
> >>>  drivers/irqchip/irq-stm32-exti.c | 5 -----
> >>>  1 file changed, 5 deletions(-)
> >>>
> >>> diff --git a/drivers/irqchip/irq-stm32-exti.c
> >>> b/drivers/irqchip/irq-stm32-exti.c
> >>> index 6edfd4b..ff8a84f 100644
> >>> --- a/drivers/irqchip/irq-stm32-exti.c
> >>> +++ b/drivers/irqchip/irq-stm32-exti.c
> >>> @@ -716,7 +716,6 @@ stm32_exti_chip_data
> >>> *stm32_exti_chip_init(struct
> >> stm32_exti_host_data *h_data,
> >>>  	const struct stm32_exti_bank *stm32_bank;
> >>>  	struct stm32_exti_chip_data *chip_data;
> >>>  	void __iomem *base = h_data->base;
> >>> -	u32 irqs_mask;
> >>>
> >>>  	stm32_bank = h_data->drv_data->exti_banks[bank_idx];
> >>>  	chip_data = &h_data->chips_data[bank_idx]; @@ -725,10 +724,6 @@
> >>> stm32_exti_chip_data *stm32_exti_chip_init(struct
> >>> stm32_exti_host_data *h_data,
> >>>
> >>>  	raw_spin_lock_init(&chip_data->rlock);
> >>>
> >>> -	/* Determine number of irqs supported */
> >>> -	writel_relaxed(~0UL, base + stm32_bank->rtsr_ofst);
> >>> -	irqs_mask = readl_relaxed(base + stm32_bank->rtsr_ofst);
> >>> -
> >>
> >> And I guess you don't need to find out the number of supported IRQs?
> >
> > That's correct, this informed is useless : irqs_mask is never used (it
> > used to be output in a log for debug purpose.and the log has been
> > removed)
> >
> >
> >>
> >> Also, a handful of lines down, you're writing again to the same
> >> register. Why isn't that a problem?
> >
> > It's obviously a problem : another patch is missing, I am going to add it in v2.
> > Thanks for pointing this out!
> 
> You are also happily writing to that register in other places via stm32_exti_set_bit
> and co. All that is done without any cooperation with the coprocessor (whatever
> that is...), so I really wonder if it all works by magic or luck...

There is certainly some magic and luck! But there is a bit more : the access to both rtsr and ftsr regs are controlled with a call to stm32_exti_hwspin_lock() which uses an HWSpinlock shared with the coprocessor.
The other registers are not accessed by the coprocessor, hence are not hwspinlock-protected.


> 
> Thanks,
> 
> 	M.
> --
> Jazz is not dead. It just smells funny...
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-03-07 17:58 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-07 16:15 [PATCH] irqchip: stm32: don't set rising configuration registers at init Fabien Dessenne
2019-03-07 16:15 ` Fabien Dessenne
2019-03-07 16:39 ` Marc Zyngier
2019-03-07 16:39   ` Marc Zyngier
2019-03-07 17:24   ` Fabien DESSENNE
2019-03-07 17:24     ` Fabien DESSENNE
2019-03-07 17:46     ` Marc Zyngier
2019-03-07 17:46       ` Marc Zyngier
2019-03-07 17:57       ` Fabien DESSENNE
2019-03-07 17:57         ` Fabien DESSENNE

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.