diff mbox series

mtd: cfi_cmdset_0002: Use status register where possible

Message ID 20201022154506.17639-1-joakim.tjernlund@infinera.com
State New
Headers show
Series mtd: cfi_cmdset_0002: Use status register where possible | expand

Commit Message

Joakim Tjernlund Oct. 22, 2020, 3:45 p.m. UTC
Commit "mtd: cfi_cmdset_0002: Add support for polling status register"
added support for polling the status rather than using DQ polling.
However, status register is used only when DQ polling is missing.
Lets use status register when available as it is superior to DQ polling.

Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>
Cc: stable@vger.kernel.org
---
 drivers/mtd/chips/cfi_cmdset_0002.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Miquel Raynal Oct. 30, 2020, 5:47 p.m. UTC | #1
Hi Joakim,

Please Cc the MTD maintainers, not only the list (get_maintainers.pl).

Joakim Tjernlund <joakim.tjernlund@infinera.com> wrote on Thu, 22 Oct
2020 17:45:06 +0200:

> Commit "mtd: cfi_cmdset_0002: Add support for polling status register"

> added support for polling the status rather than using DQ polling.

> However, status register is used only when DQ polling is missing.

> Lets use status register when available as it is superior to DQ polling.

> 


I will let vignesh comment about the content (looks fine by me) but you will
need a Fixes tag here.

> Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>

> Cc: stable@vger.kernel.org

> ---

>  drivers/mtd/chips/cfi_cmdset_0002.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c

> index a1f3e1031c3d..ee9b322e63bb 100644

> --- a/drivers/mtd/chips/cfi_cmdset_0002.c

> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c

> @@ -117,7 +117,7 @@ static struct mtd_chip_driver cfi_amdstd_chipdrv = {

>  static int cfi_use_status_reg(struct cfi_private *cfi)

>  {

>  	struct cfi_pri_amdstd *extp = cfi->cmdset_priv;

> -	u8 poll_mask = CFI_POLL_STATUS_REG | CFI_POLL_DQ;

> +	u8 poll_mask = CFI_POLL_STATUS_REG;

>  

>  	return extp->MinorVersion >= '5' &&

>  		(extp->SoftwareFeatures & poll_mask) == CFI_POLL_STATUS_REG;


Thanks,
Miquèl
Joakim Tjernlund Oct. 30, 2020, 6:39 p.m. UTC | #2
On Fri, 2020-10-30 at 18:47 +0100, Miquel Raynal wrote:
> 

> Hi Joakim,


Hi Miquel

> 

> Please Cc the MTD maintainers, not only the list (get_maintainers.pl).


I figure all maintainers are on the list ?

> 

> Joakim Tjernlund <joakim.tjernlund@infinera.com> wrote on Thu, 22 Oct

> 2020 17:45:06 +0200:

> 

> > Commit "mtd: cfi_cmdset_0002: Add support for polling status register"

> > added support for polling the status rather than using DQ polling.

> > However, status register is used only when DQ polling is missing.

> > Lets use status register when available as it is superior to DQ polling.

> > 

> 

> I will let vignesh comment about the content (looks fine by me) but you will

> need a Fixes tag here.


This is not a Fixes situation, no bug just a hw enabling thing.
Also, I would like to see the Status patches be backported to 4.19 as well.

 Jocke
Miquel Raynal Oct. 30, 2020, 6:52 p.m. UTC | #3
Hi Joakim,

Joakim Tjernlund <Joakim.Tjernlund@infinera.com> wrote on Fri, 30 Oct
2020 18:39:35 +0000:

> On Fri, 2020-10-30 at 18:47 +0100, Miquel Raynal wrote:

> > 

> > Hi Joakim,  

> 

> Hi Miquel

> 

> > 

> > Please Cc the MTD maintainers, not only the list (get_maintainers.pl).  

> 

> I figure all maintainers are on the list ?


I personally don't look at the list very often. I expect patches to be
directed to me (in the current case, Vignesh) when I am concerned.

> 

> > 

> > Joakim Tjernlund <joakim.tjernlund@infinera.com> wrote on Thu, 22 Oct

> > 2020 17:45:06 +0200:

> >   

> > > Commit "mtd: cfi_cmdset_0002: Add support for polling status register"

> > > added support for polling the status rather than using DQ polling.

> > > However, status register is used only when DQ polling is missing.

> > > Lets use status register when available as it is superior to DQ polling.

> > >   

> > 

> > I will let vignesh comment about the content (looks fine by me) but you will

> > need a Fixes tag here.  

> 

> This is not a Fixes situation, no bug just a hw enabling thing.

> Also, I would like to see the Status patches be backported to 4.19 as well.


Backporting features is IMHO not relevant. I guess stable kernel only
take fixes...

Thanks,
Miquèl
Joakim Tjernlund Oct. 31, 2020, 11:26 a.m. UTC | #4
On Fri, 2020-10-30 at 19:52 +0100, Miquel Raynal wrote:
> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

> 

> 

> Hi Joakim,

> 

> Joakim Tjernlund <Joakim.Tjernlund@infinera.com> wrote on Fri, 30 Oct

> 2020 18:39:35 +0000:

> 

> > On Fri, 2020-10-30 at 18:47 +0100, Miquel Raynal wrote:

> > > 

> > > Hi Joakim,

> > 

> > Hi Miquel

> > 

> > > 

> > > Please Cc the MTD maintainers, not only the list (get_maintainers.pl).

> > 

> > I figure all maintainers are on the list ?

> 

> I personally don't look at the list very often. I expect patches to be

> directed to me (in the current case, Vignesh) when I am concerned.


Added Vignesh

> 

> > 

> > > 

> > > Joakim Tjernlund <joakim.tjernlund@infinera.com> wrote on Thu, 22 Oct

> > > 2020 17:45:06 +0200:

> > > 

> > > > Commit "mtd: cfi_cmdset_0002: Add support for polling status register"

> > > > added support for polling the status rather than using DQ polling.

> > > > However, status register is used only when DQ polling is missing.

> > > > Lets use status register when available as it is superior to DQ polling.

> > > > 

> > > 

> > > I will let vignesh comment about the content (looks fine by me) but you will

> > > need a Fixes tag here.

> > 

> > This is not a Fixes situation, no bug just a hw enabling thing.

> > Also, I would like to see the Status patches be backported to 4.19 as well.

> 

> Backporting features is IMHO not relevant. I guess stable kernel only

> take fixes...


This is not a feature really and the 5.4 stable did get them, I ask 4.19 get them too.
Vignesh Raghavendra Nov. 4, 2020, 5:42 a.m. UTC | #5
Hi Joakim

On 10/31/20 4:56 PM, Joakim Tjernlund wrote:
> On Fri, 2020-10-30 at 19:52 +0100, Miquel Raynal wrote:
>> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>>
>>
>> Hi Joakim,
>>
>> Joakim Tjernlund <Joakim.Tjernlund@infinera.com> wrote on Fri, 30 Oct
>> 2020 18:39:35 +0000:
>>
>>> On Fri, 2020-10-30 at 18:47 +0100, Miquel Raynal wrote:
>>>>
>>>> Hi Joakim,
>>>
>>> Hi Miquel
>>>
>>>>
>>>> Please Cc the MTD maintainers, not only the list (get_maintainers.pl).
>>>
>>> I figure all maintainers are on the list ?
>>
>> I personally don't look at the list very often. I expect patches to be
>> directed to me (in the current case, Vignesh) when I am concerned.
> 
> Added Vignesh
> 

As Miquel suggested, I look at patches on mailing list at a lower
priority than patches that are CC'd to me.


>>
>>>
>>>>
>>>> Joakim Tjernlund <joakim.tjernlund@infinera.com> wrote on Thu, 22 Oct
>>>> 2020 17:45:06 +0200:
>>>>
>>>>> Commit "mtd: cfi_cmdset_0002: Add support for polling status register"
>>>>> added support for polling the status rather than using DQ polling.
>>>>> However, status register is used only when DQ polling is missing.
>>>>> Lets use status register when available as it is superior to DQ polling.
>>>>>
>>>>
>>>> I will let vignesh comment about the content (looks fine by me) but you will
>>>> need a Fixes tag here.
>>>
>>> This is not a Fixes situation, no bug just a hw enabling thing.
>>> Also, I would like to see the Status patches be backported to 4.19 as well.
>>
>> Backporting features is IMHO not relevant. I guess stable kernel only
>> take fixes...
> 
> This is not a feature really and the 5.4 stable did get them, I ask 4.19 get them too.
> 

commit 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling
status register") was added in 5.3 and therefore is part of 5.4. But
note that this is a "new feature" and therefore won't be backported to
kernels older than 5.3.

Similarly, this patch (when accepted) is not a candidate for stable
kernel backports because the intention of enabling polling status
register for Write Completion is to enable flashes that "don't" support
DQ polling at all (mainly HyperFlash).
Enabling this for all flashes that support the feature is not a bug fix
IMO. Also, there isn't enough testing to prove that feature works for
all CFI NOR flashes on all platforms and therefore would be risky to be
backported to stable kernels.

Regards
Vignehs
Joakim Tjernlund Nov. 4, 2020, 9:53 a.m. UTC | #6
On Wed, 2020-11-04 at 11:12 +0530, Vignesh Raghavendra wrote:
> Hi Joakim

> 

> On 10/31/20 4:56 PM, Joakim Tjernlund wrote:

> > On Fri, 2020-10-30 at 19:52 +0100, Miquel Raynal wrote:

> > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

> > > 

> > > 

> > > Hi Joakim,

> > > 

> > > Joakim Tjernlund <Joakim.Tjernlund@infinera.com> wrote on Fri, 30 Oct

> > > 2020 18:39:35 +0000:

> > > 

> > > > On Fri, 2020-10-30 at 18:47 +0100, Miquel Raynal wrote:

> > > > > 

> > > > > Hi Joakim,

> > > > 

> > > > Hi Miquel

> > > > 

> > > > > 

> > > > > Please Cc the MTD maintainers, not only the list (get_maintainers.pl).

> > > > 

> > > > I figure all maintainers are on the list ?

> > > 

> > > I personally don't look at the list very often. I expect patches to be

> > > directed to me (in the current case, Vignesh) when I am concerned.

> > 

> > Added Vignesh

> > 

> 

> As Miquel suggested, I look at patches on mailing list at a lower

> priority than patches that are CC'd to me.

> 

> 

> > > 

> > > > 

> > > > > 

> > > > > Joakim Tjernlund <joakim.tjernlund@infinera.com> wrote on Thu, 22 Oct

> > > > > 2020 17:45:06 +0200:

> > > > > 

> > > > > > Commit "mtd: cfi_cmdset_0002: Add support for polling status register"

> > > > > > added support for polling the status rather than using DQ polling.

> > > > > > However, status register is used only when DQ polling is missing.

> > > > > > Lets use status register when available as it is superior to DQ polling.

> > > > > > 

> > > > > 

> > > > > I will let vignesh comment about the content (looks fine by me) but you will

> > > > > need a Fixes tag here.

> > > > 

> > > > This is not a Fixes situation, no bug just a hw enabling thing.

> > > > Also, I would like to see the Status patches be backported to 4.19 as well.

> > > 

> > > Backporting features is IMHO not relevant. I guess stable kernel only

> > > take fixes...

> > 

> > This is not a feature really and the 5.4 stable did get them, I ask 4.19 get them too.

> > 

> 

> commit 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling

> status register") was added in 5.3 and therefore is part of 5.4. But

> note that this is a "new feature" and therefore won't be backported to

> kernels older than 5.3.


Oh, my memory is off then, sorry.

> Similarly, this patch (when accepted) is not a candidate for stable

> kernel backports because the intention of enabling polling status

> register for Write Completion is to enable flashes that "don't" support

> DQ polling at all (mainly HyperFlash).

> Enabling this for all flashes that support the feature is not a bug fix

> IMO. Also, there isn't enough testing to prove that feature works for

> all CFI NOR flashes on all platforms and therefore would be risky to be

> backported to stable kernels.


This is 2 things,
 1. making it possible to use Hyper flash (HW enablement)
 2. improving the flash driver to function more precise(getting an accurate error rather than a TMO) for most AMD flashes.

1. happens on a regular basis in stable.
2. can be discussed for stable but should at least go into master now that status has been in there for a while



 Jocke
Vignesh Raghavendra Nov. 5, 2020, 3:57 p.m. UTC | #7
Hi Joakim,

On 10/22/20 9:15 PM, Joakim Tjernlund wrote:
> Commit "mtd: cfi_cmdset_0002: Add support for polling status register"


Standard way to refer to a commit is:

Commit 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling status register")

> added support for polling the status rather than using DQ polling.

> However, status register is used only when DQ polling is missing.

> Lets use status register when available as it is superior to DQ polling.

> 

> Signed-off-by: Joakim Tjernlund <joakim.tjernlund@infinera.com>

> Cc: stable@vger.kernel.org

> ---

>  drivers/mtd/chips/cfi_cmdset_0002.c | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c

> index a1f3e1031c3d..ee9b322e63bb 100644

> --- a/drivers/mtd/chips/cfi_cmdset_0002.c

> +++ b/drivers/mtd/chips/cfi_cmdset_0002.c

> @@ -117,7 +117,7 @@ static struct mtd_chip_driver cfi_amdstd_chipdrv = {

>  static int cfi_use_status_reg(struct cfi_private *cfi)

>  {

>  	struct cfi_pri_amdstd *extp = cfi->cmdset_priv;

> -	u8 poll_mask = CFI_POLL_STATUS_REG | CFI_POLL_DQ;

> +	u8 poll_mask = CFI_POLL_STATUS_REG;


This local variable now looks pointless and can be dropped.. So,

>  	return extp->MinorVersion >= '5' &&

>  		(extp->SoftwareFeatures & poll_mask) == CFI_POLL_STATUS_REG;

> 


	return extp->MinorVersion >= '5' &&
  			(extp->SoftwareFeatures & CFI_POLL_STATUS_REG);

Regards
Vignesh
Vignesh Raghavendra Nov. 5, 2020, 4:04 p.m. UTC | #8
On 11/4/20 3:23 PM, Joakim Tjernlund wrote:
> On Wed, 2020-11-04 at 11:12 +0530, Vignesh Raghavendra wrote:
>> Hi Joakim
>>
>> On 10/31/20 4:56 PM, Joakim Tjernlund wrote:
>>> On Fri, 2020-10-30 at 19:52 +0100, Miquel Raynal wrote:
>>>> CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.
>>>>
>>>>
[...]
>> commit 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling
>> status register") was added in 5.3 and therefore is part of 5.4. But
>> note that this is a "new feature" and therefore won't be backported to
>> kernels older than 5.3.
> 
> Oh, my memory is off then, sorry.
> 
>> Similarly, this patch (when accepted) is not a candidate for stable
>> kernel backports because the intention of enabling polling status
>> register for Write Completion is to enable flashes that "don't" support
>> DQ polling at all (mainly HyperFlash).
>> Enabling this for all flashes that support the feature is not a bug fix
>> IMO. Also, there isn't enough testing to prove that feature works for
>> all CFI NOR flashes on all platforms and therefore would be risky to be
>> backported to stable kernels.
> 
> This is 2 things,
>  1. making it possible to use Hyper flash (HW enablement)
>  2. improving the flash driver to function more precise(getting an accurate error rather than a TMO) for most AMD flashes.
> 
> 1. happens on a regular basis in stable.
> 2. can be discussed for stable but should at least go into master now that status has been in there for a while
> 

Yes, but my objection is that there has not been enough testing to prove
that its safe to backport to stable kernels and there is nothing that's
broken in older kernels which this patch fixes.


Regards
Vignesh
Joakim Tjernlund Nov. 5, 2020, 4:44 p.m. UTC | #9
On Thu, 2020-11-05 at 21:34 +0530, Vignesh Raghavendra wrote:
> 

> On 11/4/20 3:23 PM, Joakim Tjernlund wrote:

> > On Wed, 2020-11-04 at 11:12 +0530, Vignesh Raghavendra wrote:

> > > Hi Joakim

> > > 

> > > On 10/31/20 4:56 PM, Joakim Tjernlund wrote:

> > > > On Fri, 2020-10-30 at 19:52 +0100, Miquel Raynal wrote:

> > > > > CAUTION: This email originated from outside of the organization. Do not click links or open attachments unless you recognize the sender and know the content is safe.

> > > > > 

> > > > > 

> [...]

> > > commit 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling

> > > status register") was added in 5.3 and therefore is part of 5.4. But

> > > note that this is a "new feature" and therefore won't be backported to

> > > kernels older than 5.3.

> > 

> > Oh, my memory is off then, sorry.

> > 

> > > Similarly, this patch (when accepted) is not a candidate for stable

> > > kernel backports because the intention of enabling polling status

> > > register for Write Completion is to enable flashes that "don't" support

> > > DQ polling at all (mainly HyperFlash).

> > > Enabling this for all flashes that support the feature is not a bug fix

> > > IMO. Also, there isn't enough testing to prove that feature works for

> > > all CFI NOR flashes on all platforms and therefore would be risky to be

> > > backported to stable kernels.

> > 

> > This is 2 things,

> >  1. making it possible to use Hyper flash (HW enablement)

> >  2. improving the flash driver to function more precise(getting an accurate error rather than a TMO) for most AMD flashes.

> > 

> > 1. happens on a regular basis in stable.

> > 2. can be discussed for stable but should at least go into master now that status has been in there for a while

> > 

> 

> Yes, but my objection is that there has not been enough testing to prove

> that its safe to backport to stable kernels and there is nothing that's

> broken in older kernels which this patch fixes.


Semi broken though. I stumbled upon some erase failures that just resulted in a super long TMO error
rather than report a failure directly(the page was locked).

There I no way to improve upon error handling without your status updates and this is
the main reason I want your patches backported to 4.19 as well.

My patch can be dropped for stable, giving it time to mature in master though.

 Jocke
diff mbox series

Patch

diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index a1f3e1031c3d..ee9b322e63bb 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -117,7 +117,7 @@  static struct mtd_chip_driver cfi_amdstd_chipdrv = {
 static int cfi_use_status_reg(struct cfi_private *cfi)
 {
 	struct cfi_pri_amdstd *extp = cfi->cmdset_priv;
-	u8 poll_mask = CFI_POLL_STATUS_REG | CFI_POLL_DQ;
+	u8 poll_mask = CFI_POLL_STATUS_REG;
 
 	return extp->MinorVersion >= '5' &&
 		(extp->SoftwareFeatures & poll_mask) == CFI_POLL_STATUS_REG;