From: Maya Erez <merez@codeaurora.org>
To: Kalle Valo <kvalo@codeaurora.org>
Cc: Maya Erez <merez@codeaurora.org>,
linux-wireless@vger.kernel.org, wil6210@qti.qualcomm.com
Subject: [PATCH v2 09/12] wil6210: ignore HALP ICR if already handled
Date: Mon, 28 Jan 2019 17:36:23 +0200 [thread overview]
Message-ID: <1548689786-23288-10-git-send-email-merez@codeaurora.org> (raw)
In-Reply-To: <1548689786-23288-1-git-send-email-merez@codeaurora.org>
HALP ICR is set as long as the FW should stay awake.
To prevent its multiple handling the driver masks this IRQ bit.
However, if there is a different MISC ICR before the driver clears
this bit, there is a risk of race condition between HALP mask and
unmask. This race leads to HALP timeout, in case it is mistakenly
masked.
Add a flag to indicate if HALP ICR should be handled.
Signed-off-by: Maya Erez <merez@codeaurora.org>
---
drivers/net/wireless/ath/wil6210/interrupt.c | 12 ++++++++----
drivers/net/wireless/ath/wil6210/main.c | 3 +++
drivers/net/wireless/ath/wil6210/wil6210.h | 1 +
3 files changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/wireless/ath/wil6210/interrupt.c b/drivers/net/wireless/ath/wil6210/interrupt.c
index 5d287a8..3f5bd17 100644
--- a/drivers/net/wireless/ath/wil6210/interrupt.c
+++ b/drivers/net/wireless/ath/wil6210/interrupt.c
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2012-2017 Qualcomm Atheros, Inc.
- * Copyright (c) 2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2018-2019, The Linux Foundation. All rights reserved.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@@ -575,10 +575,14 @@ static irqreturn_t wil6210_irq_misc(int irq, void *cookie)
}
if (isr & BIT_DMA_EP_MISC_ICR_HALP) {
- wil_dbg_irq(wil, "irq_misc: HALP IRQ invoked\n");
- wil6210_mask_halp(wil);
isr &= ~BIT_DMA_EP_MISC_ICR_HALP;
- complete(&wil->halp.comp);
+ if (wil->halp.handle_icr) {
+ /* no need to handle HALP ICRs until next vote */
+ wil->halp.handle_icr = false;
+ wil_dbg_irq(wil, "irq_misc: HALP IRQ invoked\n");
+ wil6210_mask_halp(wil);
+ complete(&wil->halp.comp);
+ }
}
wil->isr_misc = isr;
diff --git a/drivers/net/wireless/ath/wil6210/main.c b/drivers/net/wireless/ath/wil6210/main.c
index 1c2823b..bd933a0 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -1899,11 +1899,14 @@ void wil_halp_vote(struct wil6210_priv *wil)
if (++wil->halp.ref_cnt == 1) {
reinit_completion(&wil->halp.comp);
+ /* mark to IRQ context to handle HALP ICR */
+ wil->halp.handle_icr = true;
wil6210_set_halp(wil);
rc = wait_for_completion_timeout(&wil->halp.comp, to_jiffies);
if (!rc) {
wil_err(wil, "HALP vote timed out\n");
/* Mask HALP as done in case the interrupt is raised */
+ wil->halp.handle_icr = false;
wil6210_mask_halp(wil);
} else {
wil_dbg_irq(wil,
diff --git a/drivers/net/wireless/ath/wil6210/wil6210.h b/drivers/net/wireless/ath/wil6210/wil6210.h
index cc46873..de97c4e 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -781,6 +781,7 @@ struct wil_halp {
struct mutex lock; /* protect halp ref_cnt */
unsigned int ref_cnt;
struct completion comp;
+ u8 handle_icr;
};
struct wil_blob_wrapper {
--
1.9.1
next prev parent reply other threads:[~2019-01-28 15:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 15:36 [PATCH v2 00/12] wil6210 patches Maya Erez
2019-01-28 15:36 ` [PATCH v2 01/12] wil6210: remove rtap_include_phy_info module param Maya Erez
2019-02-13 16:40 ` Kalle Valo
2019-02-14 16:54 ` merez
2019-01-28 15:36 ` [PATCH v2 02/12] wil6210: use platform specific configuration Maya Erez
2019-01-28 15:36 ` [PATCH v2 03/12] wil6210: support ndo_select_queue in net_device_ops Maya Erez
2019-01-28 15:36 ` [PATCH v2 04/12] wil6210: add support for AC queues per station Maya Erez
2019-01-28 15:36 ` [PATCH v2 05/12] wil6210: add option to drop Tx packets when tx ring is full Maya Erez
2019-01-28 15:36 ` [PATCH v2 06/12] wil6210: support up to 20 stations in AP mode Maya Erez
2019-01-28 15:36 ` [PATCH v2 07/12] wil6210: accessing 802.3 addresses via utility functions Maya Erez
2019-01-28 15:36 ` [PATCH v2 08/12] wil6210: fix invalid sta statistics update Maya Erez
2019-01-28 15:36 ` Maya Erez [this message]
2019-01-28 15:36 ` [PATCH v2 10/12] wil6210: check null pointer in _wil_cfg80211_merge_extra_ies Maya Erez
2019-01-28 15:36 ` [PATCH v2 11/12] wil6210: align to latest auto generated wmi.h Maya Erez
2019-01-28 15:36 ` [PATCH v2 12/12] wil6210: prevent device memory access while in reset or suspend Maya Erez
2019-02-22 14:29 ` [PATCH v2 00/12] wil6210 patches merez
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1548689786-23288-10-git-send-email-merez@codeaurora.org \
--to=merez@codeaurora.org \
--cc=kvalo@codeaurora.org \
--cc=linux-wireless@vger.kernel.org \
--cc=wil6210@qti.qualcomm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).