[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <CO1PR11MB4835D217B78F17BA6AD79F0096449@CO1PR11MB4835.namprd11.prod.outlook.com>
Date: Wed, 29 Dec 2021 16:13:56 +0000
From: "Khandelwal, Rajat" <rajat.khandelwal@...el.com>
To: "mika.westerberg@...ux.intel.com" <mika.westerberg@...ux.intel.com>,
"Westerberg, Mika" <mika.westerberg@...el.com>
CC: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>
Subject: RE: [PATCH] Keep polling IPC status if it reads IPC_STATUS_BUSY or
IPC_STATUS_ERR until timeout expires
Hi @Westerberg, Mika
This was the original message!
-----Original Message-----
From: Khandelwal, Rajat <rajat.khandelwal@...el.com>
Sent: Wednesday, December 29, 2021 7:00 PM
To: mika.westerberg@...ux.intel.com
Cc: Khandelwal, Rajat <rajat.khandelwal@...el.com>; linux-kernel@...r.kernel.org; platform-driver-x86@...r.kernel.org
Subject: [PATCH] Keep polling IPC status if it reads IPC_STATUS_BUSY or IPC_STATUS_ERR until timeout expires
The current implementation returns -EIO if and when IPC_STATUS_ERR is returned and returns -ETIMEDOUT even if the status is busy.
This patch polls the IPC status even if IPC_STATUS_ERR is returned until timeout expires and returns -EBUSY if the status shows busy.
Observed in multiple scenarios, trying to fetch the status of IPC after it shows ERR sometimes eradicates the ERR status.
Signed-off-by: Rajat-Khandelwal <rajat.khandelwal@...el.com>
---
drivers/platform/x86/intel_scu_ipc.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/platform/x86/intel_scu_ipc.c b/drivers/platform/x86/intel_scu_ipc.c
index 7cc9089d1e14..91f716e84474 100644
--- a/drivers/platform/x86/intel_scu_ipc.c
+++ b/drivers/platform/x86/intel_scu_ipc.c
@@ -233,17 +233,19 @@ static inline u32 ipc_data_readl(struct intel_scu_ipc_dev *scu, u32 offset) static inline int busy_loop(struct intel_scu_ipc_dev *scu) {
unsigned long end = jiffies + IPC_TIMEOUT;
+ u32 status;
do {
- u32 status;
-
status = ipc_read_status(scu);
if (!(status & IPC_STATUS_BUSY)) {
- return (status & IPC_STATUS_ERR) ? -EIO : 0;
+ if (!(status & IPC_STATUS_ERR))
+ return 0;
+ }
usleep_range(50, 100);
} while (time_before(jiffies, end));
+ if (status & IPC_STATUS_BUSY)
+ return -EBUSY;
+ if (status & IPC_STATUS_ERR)
+ return -EIO;
+
return -ETIMEDOUT;
}
--
2.17.1
Powered by blists - more mailing lists