2016-10-21 15:16:26

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 1/2] mwifiex: fix corner case power save issue

We may get SLEEP event from firmware even if TXDone for last Tx packet
is still pending. In this case, we may end up accessing PCIe memory for
handling TXDone after power save handshake is completed. This causes
kernel crash with external abort.

We will delay sending SLEEP confirm to firmware in
this case to resolve the problem.

Signed-off-by: Amitkumar Karwar <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
index 5347728..f582f61 100644
--- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
+++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
@@ -1118,7 +1118,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
void
mwifiex_check_ps_cond(struct mwifiex_adapter *adapter)
{
- if (!adapter->cmd_sent &&
+ if (!adapter->cmd_sent && !adapter->data_sent &&
!adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter))
mwifiex_dnld_sleep_confirm_cmd(adapter);
else
--
1.9.1


2016-10-24 23:07:17

by Brian Norris

[permalink] [raw]
Subject: Re: [PATCH 1/2] mwifiex: fix corner case power save issue

Hi,

On Fri, Oct 21, 2016 at 08:45:47PM +0530, Amitkumar Karwar wrote:
> We may get SLEEP event from firmware even if TXDone for last Tx packet
> is still pending. In this case, we may end up accessing PCIe memory for
> handling TXDone after power save handshake is completed. This causes
> kernel crash with external abort.
>
> We will delay sending SLEEP confirm to firmware in
> this case to resolve the problem.
>
> Signed-off-by: Amitkumar Karwar <[email protected]>
> ---
> drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/wireless/marvell/mwifiex/cmdevt.c b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> index 5347728..f582f61 100644
> --- a/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> +++ b/drivers/net/wireless/marvell/mwifiex/cmdevt.c
> @@ -1118,7 +1118,7 @@ mwifiex_cancel_pending_ioctl(struct mwifiex_adapter *adapter)
> void
> mwifiex_check_ps_cond(struct mwifiex_adapter *adapter)
> {
> - if (!adapter->cmd_sent &&
> + if (!adapter->cmd_sent && !adapter->data_sent &&
> !adapter->curr_cmd && !IS_CARD_RX_RCVD(adapter))
> mwifiex_dnld_sleep_confirm_cmd(adapter);
> else

Looks good to me, and tests out on my systems:

Tested-by: Brian Norris <[email protected]>
Reviewed-by: Brian Norris <[email protected]>

2016-10-21 15:16:31

by Amitkumar Karwar

[permalink] [raw]
Subject: [PATCH 2/2] mwifiex: ignore calibration data failure

Firmware may reject calibration data from host for certain OTP
settings. In that case, we should continue initialisation ignoring
the failure.

Signed-off-by: Amitkumar Karwar <[email protected]>
---
drivers/net/wireless/marvell/mwifiex/sta_cmd.c | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
index 2a162c3..638d30a 100644
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
@@ -2228,19 +2228,13 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
adapter->hs_cfg.gpio = data;
}

- ret = mwifiex_dnld_dt_cfgdata(priv, adapter->dt_node,
- "marvell,caldata");
- if (ret)
- return -1;
+ mwifiex_dnld_dt_cfgdata(priv, adapter->dt_node,
+ "marvell,caldata");
}

- if (adapter->cal_data) {
- ret = mwifiex_send_cmd(priv, HostCmd_CMD_CFG_DATA,
- HostCmd_ACT_GEN_SET, 0, NULL,
- true);
- if (ret)
- return -1;
- }
+ if (adapter->cal_data)
+ mwifiex_send_cmd(priv, HostCmd_CMD_CFG_DATA,
+ HostCmd_ACT_GEN_SET, 0, NULL, true);

/* Read MAC address from HW */
ret = mwifiex_send_cmd(priv, HostCmd_CMD_GET_HW_SPEC,
--
1.9.1

2016-11-17 11:28:26

by Kalle Valo

[permalink] [raw]
Subject: Re: [1/2] mwifiex: fix corner case power save issue

Amitkumar Karwar <[email protected]> wrote:
> We may get SLEEP event from firmware even if TXDone for last Tx packet
> is still pending. In this case, we may end up accessing PCIe memory for
> handling TXDone after power save handshake is completed. This causes
> kernel crash with external abort.
>
> We will delay sending SLEEP confirm to firmware in
> this case to resolve the problem.
>
> Signed-off-by: Amitkumar Karwar <[email protected]>
> Tested-by: Brian Norris <[email protected]>
> Reviewed-by: Brian Norris <[email protected]>

Dropped per request from Amitkumar.

Patch set to Changes Requested.

--
https://patchwork.kernel.org/patch/9389485/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

2016-11-01 16:41:58

by Amitkumar Karwar

[permalink] [raw]
Subject: RE: [PATCH 1/2] mwifiex: fix corner case power save issue

Hi Kalle,

> From: Amitkumar Karwar [mailto:[email protected]]
> Sent: Friday, October 21, 2016 8:46 PM
> To: [email protected]
> Cc: Cathy Luo; Nishant Sarmukadam; Amitkumar Karwar
> Subject: [PATCH 1/2] mwifiex: fix corner case power save issue
>
> We may get SLEEP event from firmware even if TXDone for last Tx packet
> is still pending. In this case, we may end up accessing PCIe memory for
> handling TXDone after power save handshake is completed. This causes
> kernel crash with external abort.
>
> We will delay sending SLEEP confirm to firmware in this case to resolve
> the problem.
>
> Signed-off-by: Amitkumar Karwar <[email protected]>
> ---
> drivers/net/wireless/marvell/mwifiex/cmdevt.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>

Please drop this patch.
Xinming Hu has better and complete solution for this issue as discussed at https://patchwork.kernel.org/patch/9405119/

Regards,
Amitkumar

2016-11-18 11:11:57

by Kalle Valo

[permalink] [raw]
Subject: Re: [2/2] mwifiex: ignore calibration data failure

Amitkumar Karwar <[email protected]> wrote:
> Firmware may reject calibration data from host for certain OTP
> settings. In that case, we should continue initialisation ignoring
> the failure.
>
> Signed-off-by: Amitkumar Karwar <[email protected]>

Patch applied to wireless-drivers-next.git, thanks.

14e5e9375926 mwifiex: ignore calibration data failure

--
https://patchwork.kernel.org/patch/9389487/

Documentation about submitting wireless patches and checking status
from patchwork:

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches