All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Jones <lee.jones@linaro.org>
To: stable@vger.kernel.org
Cc: Maya Erez <merez@codeaurora.org>,
	Kalle Valo <kvalo@codeaurora.org>,
	Lee Jones <lee.jones@linaro.org>
Subject: [PATCH 4.19 06/13] wil6210: ignore HALP ICR if already handled
Date: Fri,  3 Apr 2020 13:18:52 +0100	[thread overview]
Message-ID: <20200403121859.901838-7-lee.jones@linaro.org> (raw)
In-Reply-To: <20200403121859.901838-1-lee.jones@linaro.org>

From: Maya Erez <merez@codeaurora.org>

[ Upstream commit 979c9d8d01c482b1befb44dc639ecb907b5a37bd ]

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 an atomic flag to indicate if HALP ICR should be handled.

Signed-off-by: Maya Erez <merez@codeaurora.org>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
Signed-off-by: Lee Jones <lee.jones@linaro.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 0655cd8845142..d161dc930313d 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
@@ -590,10 +590,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 10673fa9388ec..28d2bfd0fde79 100644
--- a/drivers/net/wireless/ath/wil6210/main.c
+++ b/drivers/net/wireless/ath/wil6210/main.c
@@ -1814,11 +1814,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 75fe1a3b70466..6a05f59ee58e9 100644
--- a/drivers/net/wireless/ath/wil6210/wil6210.h
+++ b/drivers/net/wireless/ath/wil6210/wil6210.h
@@ -778,6 +778,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 {
-- 
2.25.1


  parent reply	other threads:[~2020-04-03 12:18 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-03 12:18 [PATCH 4.19 00/13] Backported fixes taken from Sony's Vendor tree Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 01/13] clk: qcom: rcg: Return failure for RCG update Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 02/13] drm/msm: stop abusing dma_map/unmap for cache Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 03/13] arm64: Fix size of __early_cpu_boot_status Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 04/13] drm_dp_mst_topology: fix broken drm_dp_sideband_parse_remote_dpcd_read() Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 05/13] wil6210: check rx_buff_mgmt before accessing it Lee Jones
2020-04-03 12:18 ` Lee Jones [this message]
2020-04-03 12:18 ` [PATCH 4.19 07/13] wil6210: add general initialization/size checks Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 08/13] wil6210: make sure Rx ring sizes are correlated Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 09/13] rpmsg: glink: Remove chunk size word align warning Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 10/13] wil6210: remove reset file from debugfs Lee Jones
2020-04-11 11:47   ` Greg KH
2020-04-14  7:42     ` Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 11/13] perf/core: Reattach a misplaced comment Lee Jones
2020-04-03 12:26   ` Greg KH
2020-04-03 12:52     ` Lee Jones
2020-04-03 13:23       ` Alexander Shishkin
2020-04-11 11:49         ` Greg KH
2020-04-14  7:37           ` Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 12/13] mm/vmalloc.c: move 'area->pages' after if statement Lee Jones
2020-04-03 12:18 ` [PATCH 4.19 13/13] usb: dwc3: don't set gadget->is_otg flag Lee Jones
2020-04-20 11:24 ` [PATCH 4.19 00/13] Backported fixes taken from Sony's Vendor tree Greg KH

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=20200403121859.901838-7-lee.jones@linaro.org \
    --to=lee.jones@linaro.org \
    --cc=kvalo@codeaurora.org \
    --cc=merez@codeaurora.org \
    --cc=stable@vger.kernel.org \
    /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 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.