All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtsx: pci: fix device aspm state bug
@ 2021-01-21  7:28 ricky_wu
  0 siblings, 0 replies; 9+ messages in thread
From: ricky_wu @ 2021-01-21  7:28 UTC (permalink / raw)
  To: arnd, gregkh, ricky_wu, sashal, levinale, keitasuzuki.park,
	kdlnx, linux-kernel

From: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>

changed rtsx_pci_disable_aspm() to rtsx_disable_aspm()
make sure pcr->aspm_enabled to sync with aspm state

BUG=b:175338107
TEST=chromeos-kernel-5_4

Signed-off-by: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>
Change-Id: I4b146dcdaaf2f2a965381c32780b0b110d751258
---
 drivers/misc/cardreader/rtsx_pcr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index f07b01125d19..f3645e72ecc4 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -1285,8 +1285,15 @@ int rtsx_ms_power_off_card3v3(struct rtsx_pcr *pcr)
 static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
 {
 	int err;
+	u8 val;
 
 	pcr->pcie_cap = pci_find_capability(pcr->pci, PCI_CAP_ID_EXP);
+	rtsx_pci_read_config_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL, &val);
+	if (val & 0x02)
+		pcr->aspm_enabled = true;
+	else
+		pcr->aspm_enabled = false;
+
 	rtsx_pci_writel(pcr, RTSX_HCBAR, pcr->host_cmds_addr);
 
 	rtsx_pci_enable_bus_int(pcr);
@@ -1307,7 +1314,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
 	/* Wait SSC power stable */
 	udelay(200);
 
-	rtsx_pci_disable_aspm(pcr);
+	rtsx_disable_aspm(pcr);
 	if (pcr->ops->optimize_phy) {
 		err = pcr->ops->optimize_phy(pcr);
 		if (err < 0)
-- 
2.17.1


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

* RE: [PATCH] rtsx: pci: fix device aspm state bug
  2021-01-21  8:27       ` gregkh
@ 2021-01-21 10:07         ` 吳昊澄 Ricky
  0 siblings, 0 replies; 9+ messages in thread
From: 吳昊澄 Ricky @ 2021-01-21 10:07 UTC (permalink / raw)
  To: gregkh
  Cc: arnd, ricky_wu, sashal, levinale, keitasuzuki.park, kdlnx, linux-kernel

> -----Original Message-----
> From: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
> Sent: Thursday, January 21, 2021 4:28 PM
> To: 吳昊澄 Ricky <ricky_wu@realtek.com>
> Cc: arnd@arndb.de; ricky_wu@realtek.corp-partner.google.com;
> sashal@kernel.org; levinale@google.com; keitasuzuki.park@sslab.ics.keio.ac.jp;
> kdlnx@doth.eu; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] rtsx: pci: fix device aspm state bug
> 
> On Thu, Jan 21, 2021 at 08:15:46AM +0000, 吳昊澄 Ricky wrote:
> > > -----Original Message-----
> > > From: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
> > > Sent: Thursday, January 21, 2021 4:07 PM
> > > To: 吳昊澄 Ricky <ricky_wu@realtek.com>
> > > Cc: arnd@arndb.de; ricky_wu@realtek.corp-partner.google.com;
> > > sashal@kernel.org; levinale@google.com;
> > > keitasuzuki.park@sslab.ics.keio.ac.jp;
> > > kdlnx@doth.eu; linux-kernel@vger.kernel.org
> > > Subject: Re: [PATCH] rtsx: pci: fix device aspm state bug
> > >
> > > On Thu, Jan 21, 2021 at 07:33:03AM +0000, 吳昊澄 Ricky wrote:
> > > > Hi Greg kh,
> > > >
> > > > This patch to fix misc: rtsx bug for kernel 5.4
> > >
> > > I do not understand what this means, sorry.  Can you please explain it?
> > >
> > On the newest upstream we don’t set config space for en/disable aspm,
> > so it will not happen this issue but on kernel 5.4 longterm version we
> > need to fix it
> 
> Please read
>     https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> for how to submit patches to the stable tree properly.
> 
> And if this is not an issue in Linus's tree, why not just backport the commits
> that fixed this issue?  That's the best way to do this.
> 
Thanks your advice
We discuss it internally

 
> ------Please consider the environment before printing this e-mail.

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

* Re: [PATCH] rtsx: pci: fix device aspm state bug
  2021-01-21  8:15     ` 吳昊澄 Ricky
@ 2021-01-21  8:27       ` gregkh
  2021-01-21 10:07         ` 吳昊澄 Ricky
  0 siblings, 1 reply; 9+ messages in thread
From: gregkh @ 2021-01-21  8:27 UTC (permalink / raw)
  To: 吳昊澄 Ricky
  Cc: arnd, ricky_wu, sashal, levinale, keitasuzuki.park, kdlnx, linux-kernel

On Thu, Jan 21, 2021 at 08:15:46AM +0000, 吳昊澄 Ricky wrote:
> > -----Original Message-----
> > From: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
> > Sent: Thursday, January 21, 2021 4:07 PM
> > To: 吳昊澄 Ricky <ricky_wu@realtek.com>
> > Cc: arnd@arndb.de; ricky_wu@realtek.corp-partner.google.com;
> > sashal@kernel.org; levinale@google.com; keitasuzuki.park@sslab.ics.keio.ac.jp;
> > kdlnx@doth.eu; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH] rtsx: pci: fix device aspm state bug
> > 
> > On Thu, Jan 21, 2021 at 07:33:03AM +0000, 吳昊澄 Ricky wrote:
> > > Hi Greg kh,
> > >
> > > This patch to fix misc: rtsx bug for kernel 5.4
> > 
> > I do not understand what this means, sorry.  Can you please explain it?
> > 
> On the newest upstream we don’t set config space for en/disable aspm, 
> so it will not happen this issue
> but on kernel 5.4 longterm version we need to fix it

Please read
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to submit patches to the stable tree properly.

And if this is not an issue in Linus's tree, why not just backport the
commits that fixed this issue?  That's the best way to do this.

thanks,

greg k-h

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

* RE: [PATCH] rtsx: pci: fix device aspm state bug
  2021-01-21  8:07   ` gregkh
@ 2021-01-21  8:15     ` 吳昊澄 Ricky
  2021-01-21  8:27       ` gregkh
  0 siblings, 1 reply; 9+ messages in thread
From: 吳昊澄 Ricky @ 2021-01-21  8:15 UTC (permalink / raw)
  To: gregkh
  Cc: arnd, ricky_wu, sashal, levinale, keitasuzuki.park, kdlnx, linux-kernel

> -----Original Message-----
> From: gregkh@linuxfoundation.org <gregkh@linuxfoundation.org>
> Sent: Thursday, January 21, 2021 4:07 PM
> To: 吳昊澄 Ricky <ricky_wu@realtek.com>
> Cc: arnd@arndb.de; ricky_wu@realtek.corp-partner.google.com;
> sashal@kernel.org; levinale@google.com; keitasuzuki.park@sslab.ics.keio.ac.jp;
> kdlnx@doth.eu; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] rtsx: pci: fix device aspm state bug
> 
> On Thu, Jan 21, 2021 at 07:33:03AM +0000, 吳昊澄 Ricky wrote:
> > Hi Greg kh,
> >
> > This patch to fix misc: rtsx bug for kernel 5.4
> 
> I do not understand what this means, sorry.  Can you please explain it?
> 
On the newest upstream we don’t set config space for en/disable aspm, 
so it will not happen this issue
but on kernel 5.4 longterm version we need to fix it

> 
> ------Please consider the environment before printing this e-mail.

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

* Re: [PATCH] rtsx: pci: fix device aspm state bug
  2021-01-21  7:33 ` 吳昊澄 Ricky
@ 2021-01-21  8:07   ` gregkh
  2021-01-21  8:15     ` 吳昊澄 Ricky
  0 siblings, 1 reply; 9+ messages in thread
From: gregkh @ 2021-01-21  8:07 UTC (permalink / raw)
  To: 吳昊澄 Ricky
  Cc: arnd, ricky_wu, sashal, levinale, keitasuzuki.park, kdlnx, linux-kernel

On Thu, Jan 21, 2021 at 07:33:03AM +0000, 吳昊澄 Ricky wrote:
> Hi Greg kh,
> 
> This patch to fix misc: rtsx bug for kernel 5.4

I do not understand what this means, sorry.  Can you please explain it?

greg k-h

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

* RE: [PATCH] rtsx: pci: fix device aspm state bug
  2021-01-21  7:45 ` Greg KH
@ 2021-01-21  7:59   ` 吳昊澄 Ricky
  0 siblings, 0 replies; 9+ messages in thread
From: 吳昊澄 Ricky @ 2021-01-21  7:59 UTC (permalink / raw)
  To: Greg KH
  Cc: arnd, ricky_wu, sashal, levinale, keitasuzuki.park, kdlnx,
	linux-kernel, yueherngl

> -----Original Message-----
> From: Greg KH <gregkh@linuxfoundation.org>
> Sent: Thursday, January 21, 2021 3:46 PM
> To: 吳昊澄 Ricky <ricky_wu@realtek.com>
> Cc: arnd@arndb.de; ricky_wu@realtek.corp-partner.google.com;
> sashal@kernel.org; levinale@google.com; keitasuzuki.park@sslab.ics.keio.ac.jp;
> kdlnx@doth.eu; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH] rtsx: pci: fix device aspm state bug
> 
> On Thu, Jan 21, 2021 at 03:28:58PM +0800, ricky_wu@realtek.com wrote:
> > From: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>
> >
> > changed rtsx_pci_disable_aspm() to rtsx_disable_aspm() make sure
> > pcr->aspm_enabled to sync with aspm state
> 
> Can you make this a bit more descriptive?
> 
Changed rtsx_pci_disable_aspm() to rtsx_disable_aspm() make sure
pcr->aspm_enabled to sync with aspm state.
rtsx_pci_disable_aspm() this function disable aspm by setting config space directly
did not change value of pcr->aspm_enabled so changed to use rtsx_disable_aspm().
Give initial value to pcr->aspm_enabled by reading config space setting at init_hw(). 

> 
> >
> > BUG=b:175338107
> > TEST=chromeos-kernel-5_4
> 
> What are these lines for?
> 
> >
> > Signed-off-by: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>
> 
> This email does not match your From: address :(
> 
> > Change-Id: I4b146dcdaaf2f2a965381c32780b0b110d751258
> 
> Please use checkpatch.pl before sending patches to us :(
> 
> And why did you send this twice?
> 
> thanks,
> 
> greg k-h
> 
> ------Please consider the environment before printing this e-mail.

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

* Re: [PATCH] rtsx: pci: fix device aspm state bug
  2021-01-21  7:28 ricky_wu
  2021-01-21  7:33 ` 吳昊澄 Ricky
@ 2021-01-21  7:45 ` Greg KH
  2021-01-21  7:59   ` 吳昊澄 Ricky
  1 sibling, 1 reply; 9+ messages in thread
From: Greg KH @ 2021-01-21  7:45 UTC (permalink / raw)
  To: ricky_wu
  Cc: arnd, ricky_wu, sashal, levinale, keitasuzuki.park, kdlnx, linux-kernel

On Thu, Jan 21, 2021 at 03:28:58PM +0800, ricky_wu@realtek.com wrote:
> From: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>
> 
> changed rtsx_pci_disable_aspm() to rtsx_disable_aspm()
> make sure pcr->aspm_enabled to sync with aspm state

Can you make this a bit more descriptive?


> 
> BUG=b:175338107
> TEST=chromeos-kernel-5_4

What are these lines for?

> 
> Signed-off-by: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>

This email does not match your From: address :(

> Change-Id: I4b146dcdaaf2f2a965381c32780b0b110d751258

Please use checkpatch.pl before sending patches to us :(

And why did you send this twice?

thanks,

greg k-h

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

* RE: [PATCH] rtsx: pci: fix device aspm state bug
  2021-01-21  7:28 ricky_wu
@ 2021-01-21  7:33 ` 吳昊澄 Ricky
  2021-01-21  8:07   ` gregkh
  2021-01-21  7:45 ` Greg KH
  1 sibling, 1 reply; 9+ messages in thread
From: 吳昊澄 Ricky @ 2021-01-21  7:33 UTC (permalink / raw)
  To: arnd, gregkh, ricky_wu, sashal, levinale, keitasuzuki.park,
	kdlnx, linux-kernel

Hi Greg kh,

This patch to fix misc: rtsx bug for kernel 5.4

Ricky



> -----Original Message-----
> From: 吳昊澄 Ricky <ricky_wu@realtek.com>
> Sent: Thursday, January 21, 2021 3:29 PM
> To: arnd@arndb.de; gregkh@linuxfoundation.org;
> ricky_wu@realtek.corp-partner.google.com; sashal@kernel.org;
> levinale@google.com; keitasuzuki.park@sslab.ics.keio.ac.jp; kdlnx@doth.eu;
> linux-kernel@vger.kernel.org; 吳昊澄 Ricky <ricky_wu@realtek.com>
> Subject: [PATCH] rtsx: pci: fix device aspm state bug
> 
> From: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>
> 
> changed rtsx_pci_disable_aspm() to rtsx_disable_aspm() make sure
> pcr->aspm_enabled to sync with aspm state
> 
> BUG=b:175338107
> TEST=chromeos-kernel-5_4
> 
> Signed-off-by: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>
> Change-Id: I4b146dcdaaf2f2a965381c32780b0b110d751258
> ---
>  drivers/misc/cardreader/rtsx_pcr.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/misc/cardreader/rtsx_pcr.c
> b/drivers/misc/cardreader/rtsx_pcr.c
> index f07b01125d19..f3645e72ecc4 100644
> --- a/drivers/misc/cardreader/rtsx_pcr.c
> +++ b/drivers/misc/cardreader/rtsx_pcr.c
> @@ -1285,8 +1285,15 @@ int rtsx_ms_power_off_card3v3(struct rtsx_pcr
> *pcr)  static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)  {
>  	int err;
> +	u8 val;
> 
>  	pcr->pcie_cap = pci_find_capability(pcr->pci, PCI_CAP_ID_EXP);
> +	rtsx_pci_read_config_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL, &val);
> +	if (val & 0x02)
> +		pcr->aspm_enabled = true;
> +	else
> +		pcr->aspm_enabled = false;
> +
>  	rtsx_pci_writel(pcr, RTSX_HCBAR, pcr->host_cmds_addr);
> 
>  	rtsx_pci_enable_bus_int(pcr);
> @@ -1307,7 +1314,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
>  	/* Wait SSC power stable */
>  	udelay(200);
> 
> -	rtsx_pci_disable_aspm(pcr);
> +	rtsx_disable_aspm(pcr);
>  	if (pcr->ops->optimize_phy) {
>  		err = pcr->ops->optimize_phy(pcr);
>  		if (err < 0)
> --
> 2.17.1


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

* [PATCH] rtsx: pci: fix device aspm state bug
@ 2021-01-21  7:28 ricky_wu
  2021-01-21  7:33 ` 吳昊澄 Ricky
  2021-01-21  7:45 ` Greg KH
  0 siblings, 2 replies; 9+ messages in thread
From: ricky_wu @ 2021-01-21  7:28 UTC (permalink / raw)
  To: arnd, gregkh, ricky_wu, sashal, levinale, keitasuzuki.park,
	kdlnx, linux-kernel, ricky_wu

From: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>

changed rtsx_pci_disable_aspm() to rtsx_disable_aspm()
make sure pcr->aspm_enabled to sync with aspm state

BUG=b:175338107
TEST=chromeos-kernel-5_4

Signed-off-by: Ricky Wu <ricky_wu@realtek.corp-partner.google.com>
Change-Id: I4b146dcdaaf2f2a965381c32780b0b110d751258
---
 drivers/misc/cardreader/rtsx_pcr.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/misc/cardreader/rtsx_pcr.c b/drivers/misc/cardreader/rtsx_pcr.c
index f07b01125d19..f3645e72ecc4 100644
--- a/drivers/misc/cardreader/rtsx_pcr.c
+++ b/drivers/misc/cardreader/rtsx_pcr.c
@@ -1285,8 +1285,15 @@ int rtsx_ms_power_off_card3v3(struct rtsx_pcr *pcr)
 static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
 {
 	int err;
+	u8 val;
 
 	pcr->pcie_cap = pci_find_capability(pcr->pci, PCI_CAP_ID_EXP);
+	rtsx_pci_read_config_byte(pcr, pcr->pcie_cap + PCI_EXP_LNKCTL, &val);
+	if (val & 0x02)
+		pcr->aspm_enabled = true;
+	else
+		pcr->aspm_enabled = false;
+
 	rtsx_pci_writel(pcr, RTSX_HCBAR, pcr->host_cmds_addr);
 
 	rtsx_pci_enable_bus_int(pcr);
@@ -1307,7 +1314,7 @@ static int rtsx_pci_init_hw(struct rtsx_pcr *pcr)
 	/* Wait SSC power stable */
 	udelay(200);
 
-	rtsx_pci_disable_aspm(pcr);
+	rtsx_disable_aspm(pcr);
 	if (pcr->ops->optimize_phy) {
 		err = pcr->ops->optimize_phy(pcr);
 		if (err < 0)
-- 
2.17.1


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

end of thread, other threads:[~2021-01-21 10:10 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-21  7:28 [PATCH] rtsx: pci: fix device aspm state bug ricky_wu
2021-01-21  7:28 ricky_wu
2021-01-21  7:33 ` 吳昊澄 Ricky
2021-01-21  8:07   ` gregkh
2021-01-21  8:15     ` 吳昊澄 Ricky
2021-01-21  8:27       ` gregkh
2021-01-21 10:07         ` 吳昊澄 Ricky
2021-01-21  7:45 ` Greg KH
2021-01-21  7:59   ` 吳昊澄 Ricky

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.