71 lines
2.8 KiB
Diff
71 lines
2.8 KiB
Diff
From cd9dc8fc95ff6cd04f4c9d8f19df6f3da99eb669 Mon Sep 17 00:00:00 2001
|
|
From: "Panwar, Ashish" <ashish.panwar@intel.com>
|
|
Date: Fri, 26 Feb 2016 02:02:48 +0530
|
|
Subject: [PATCH 106/550] ASoC: Intel: Skylake: Check buffer users and prevent
|
|
concurrent writers
|
|
|
|
More than one writer on log buffer will cause data corruption.
|
|
Fix this by checking for an existing writer and dropping log buffer
|
|
status notification if the prev writer is still writing. Despite the fear
|
|
of loosing some data, it helps in maintaining the sanity of logs.
|
|
|
|
Change-Id: Id85827221fa50b71da48087f82ac08ed488f9929
|
|
Signed-off-by: Panwar, Ashish <ashish.panwar@intel.com>
|
|
Reviewed-on:
|
|
Reviewed-by: Babu, Ramesh <ramesh.babu@intel.com>
|
|
Tested-by: Babu, Ramesh <ramesh.babu@intel.com>
|
|
---
|
|
sound/soc/intel/skylake/skl-fwlog.c | 7 +++++++
|
|
sound/soc/intel/skylake/skl-fwlog.h | 1 +
|
|
sound/soc/intel/skylake/skl-sst-ipc.c | 6 ++++++
|
|
3 files changed, 14 insertions(+)
|
|
|
|
diff --git a/sound/soc/intel/skylake/skl-fwlog.c b/sound/soc/intel/skylake/skl-fwlog.c
|
|
index bc25b9e22252..96c5d245849d 100644
|
|
--- a/sound/soc/intel/skylake/skl-fwlog.c
|
|
+++ b/sound/soc/intel/skylake/skl-fwlog.c
|
|
@@ -98,6 +98,13 @@ unsigned long skl_dsp_log_avail(struct sst_dsp *sst, int core)
|
|
}
|
|
EXPORT_SYMBOL(skl_dsp_log_avail);
|
|
|
|
+int skl_dsp_get_buff_users(struct sst_dsp *sst, int core)
|
|
+{
|
|
+ struct sst_dbg_rbuffer *buff = sst->trace_wind.dbg_buffers[core];
|
|
+
|
|
+ return refcount_read(&buff->refcount.refcount);
|
|
+}
|
|
+
|
|
void skl_dsp_write_log(struct sst_dsp *sst, void __iomem *src, int core,
|
|
int count)
|
|
{
|
|
diff --git a/sound/soc/intel/skylake/skl-fwlog.h b/sound/soc/intel/skylake/skl-fwlog.h
|
|
index 06304de3d2ab..d6307cafd156 100644
|
|
--- a/sound/soc/intel/skylake/skl-fwlog.h
|
|
+++ b/sound/soc/intel/skylake/skl-fwlog.h
|
|
@@ -17,4 +17,5 @@ int skl_dsp_copy_log_user(struct sst_dsp *sst, int core, void __user *dest,
|
|
void skl_dsp_get_log_buff(struct sst_dsp *sst, int core);
|
|
void skl_dsp_put_log_buff(struct sst_dsp *sst, int core);
|
|
void skl_dsp_done_log_buffer(struct sst_dsp *sst, int core);
|
|
+int skl_dsp_get_buff_users(struct sst_dsp *sst, int core);
|
|
#endif /* __SKL_FWLOG_H__ */
|
|
diff --git a/sound/soc/intel/skylake/skl-sst-ipc.c b/sound/soc/intel/skylake/skl-sst-ipc.c
|
|
index 9864801e9ed1..36c22c57cf90 100644
|
|
--- a/sound/soc/intel/skylake/skl-sst-ipc.c
|
|
+++ b/sound/soc/intel/skylake/skl-sst-ipc.c
|
|
@@ -363,6 +363,12 @@ skl_process_log_buffer(struct sst_dsp *sst, struct skl_ipc_header header)
|
|
dev_err(sst->dev, "Logging is disabled on dsp %d\n", core);
|
|
return;
|
|
}
|
|
+ if (skl_dsp_get_buff_users(sst, core) > 2) {
|
|
+ dev_err(sst->dev, "Can't handle log buffer notification, \
|
|
+ previous writer is not finished yet !\n \
|
|
+ dropping log buffer\n");
|
|
+ return;
|
|
+ }
|
|
skl_dsp_get_log_buff(sst, core);
|
|
size = sst->trace_wind.size/sst->trace_wind.nr_dsp;
|
|
base = (u8 *)sst->trace_wind.addr;
|
|
--
|
|
2.19.1
|
|
|