Skip to contentSkip to conversation

ASoC: Intel: baytrail: Fix register access

PATCH In review Amadeusz Sławiński 4 participants 7 messages May 7, 2020 – May 12, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ASoC: Intel: baytrail: Fix register access

Baytrail has 64 bit registers, so we should use *read64* to read from it and then use proper mask values to check status.

---
 sound/soc/intel/baytrail/sst-baytrail-ipc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/intel/baytrail/sst-baytrail-ipc.c +2 -2
index 74274bd38f7a..34746fd871b0 100644
@@ -666,8 +666,8 @@ static bool byt_is_dsp_busy(struct sst_dsp *dsp)
 {
 	u64 ipcx;
 
-	ipcx = sst_dsp_shim_read_unlocked(dsp, SST_IPCX);
-	return (ipcx & (SST_IPCX_BUSY | SST_IPCX_DONE));
+	ipcx = sst_dsp_shim_read64_unlocked(dsp, SST_IPCX);
+	return (ipcx & (SST_BYT_IPCX_BUSY | SST_BYT_IPCX_DONE));
 }
 
 int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
Signature · 1 line
2.17.1
#1 lore raw

PATCH 2/2 ASoC: Intel: Use readq to read 64 bit registers

In order to fix issue described in:
"ASoC: Intel: sst: ipc command timeout"
https://patchwork.kernel.org/patch/11482829/

use readq function, which is meant to read 64 bit values from registers. On 32 bit platforms it falls back to two readl calls.

---
 sound/soc/intel/common/sst-dsp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
sound/soc/intel/common/sst-dsp.c +3 -6
index ec66be269b69..36c077aa386e 100644
@@ -10,7 +10,7 @@
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/io.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/delay.h>
 
 #include "sst-dsp.h"
@@ -34,16 +34,13 @@ EXPORT_SYMBOL_GPL(sst_shim32_read);
 
 void sst_shim32_write64(void __iomem *addr, u32 offset, u64 value)
 {
-	memcpy_toio(addr + offset, &value, sizeof(value));
+	writeq(value, addr + offset);
 }
 EXPORT_SYMBOL_GPL(sst_shim32_write64);
 
 u64 sst_shim32_read64(void __iomem *addr, u32 offset)
 {
-	u64 val;
-
-	memcpy_fromio(&val, addr + offset, sizeof(val));
-	return val;
+	return readq(addr + offset);
 }
 EXPORT_SYMBOL_GPL(sst_shim32_read64);
 
Signature · 1 line
2.17.1
maintainer Acked-by on v1 2/2
#2 lore raw

Re: [PATCH 2/2] ASoC: Intel: Use readq to read 64 bit registers

Quoted 36 lines · Amadeusz Sławiński

In order to fix issue described in:
"ASoC: Intel: sst: ipc command timeout"
https://patchwork.kernel.org/patch/11482829/

use readq function, which is meant to read 64 bit values from registers. On 32 bit platforms it falls back to two readl calls.

---
  sound/soc/intel/common/sst-dsp.c | 9 +++------
  1 file changed, 3 insertions(+), 6 deletions(-)
sound/soc/intel/common/sst-dsp.c +2 -2
index ec66be269b69..36c077aa386e 100644
@@ -10,7 +10,7 @@
  #include <linux/interrupt.h>
  #include <linux/module.h>
  #include <linux/platform_device.h>
-#include <linux/io.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
  #include <linux/delay.h>
 
  #include "sst-dsp.h"
@@ -34,16 +34,13 @@ EXPORT_SYMBOL_GPL(sst_shim32_read);
 
  void sst_shim32_write64(void __iomem *addr, u32 offset, u64 value)
  {
-	memcpy_toio(addr + offset, &value, sizeof(value));
+	writeq(value, addr + offset);
  }
  EXPORT_SYMBOL_GPL(sst_shim32_write64);
 

sound/soc/intel/common/sst-dsp.c EXPORT_SYMBOL_GPL(sst_shim32_read); · line 46

Quoted 10 lines
sound/soc/intel/common/sst-dsp.c +1 -4
  u64 sst_shim32_read64(void __iomem *addr, u32 offset)
  {
-	u64 val;
-
-	memcpy_fromio(&val, addr + offset, sizeof(val));
-	return val;
+	return readq(addr + offset);
  }
  EXPORT_SYMBOL_GPL(sst_shim32_read64);
 

Looks good, thanks Amadeo.

Tested-by on v1 2/2
#3 lore raw

RE: [PATCH 2/2] ASoC: Intel: Use readq to read 64 bit registers

In reply to Amadeusz Sławiński
Quoted 16 lines

-----Original Message-----
From: Alsa-devel <[email protected]> On Behalf Of Amadeusz Slawinski
Sent: Thursday, May 7, 2020 9:34 PM
To: Rojewski, Cezary <[email protected]>; Pierre-Louis Bossart <[email protected]>; Liam Girdwood <[email protected]>; Jie Yang <[email protected]>; Mark Brown <[email protected]>; Takashi Iwai <[email protected]>
Cc: [email protected]; Amadeusz Sławiński <[email protected]>
Subject: [PATCH 2/2] ASoC: Intel: Use readq to read 64 bit registers

In order to fix issue described in:
"ASoC: Intel: sst: ipc command timeout"
https://patchwork.kernel.org/patch/11482829/

Quoted 5 lines

use readq function, which is meant to read 64 bit values from registers. On 32 bit platforms it falls back to two readl calls.

Regards,
Brent

Quoted 37 lines
---
 sound/soc/intel/common/sst-dsp.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
sound/soc/intel/common/sst-dsp.c +3 -7
index ec66be269b69..36c077aa386e 100644
@@ -10,7 +10,7 @@
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/platform_device.h>
-#include <linux/io.h>
+#include <linux/io-64-nonatomic-lo-hi.h>
 #include <linux/delay.h>
 
 #include "sst-dsp.h"
@@ -34,16 +34,13 @@ EXPORT_SYMBOL_GPL(sst_shim32_read);
 
 void sst_shim32_write64(void __iomem *addr, u32 offset, u64 value)  {
-	memcpy_toio(addr + offset, &value, sizeof(value));
+	writeq(value, addr + offset);
 }
 EXPORT_SYMBOL_GPL(sst_shim32_write64);
 
 u64 sst_shim32_read64(void __iomem *addr, u32 offset)  {
-	u64 val;
-
-	memcpy_fromio(&val, addr + offset, sizeof(val));
-	return val;
+	return readq(addr + offset);
 }
 EXPORT_SYMBOL_GPL(sst_shim32_read64);
 
--

2.17.1

Tested-by on v1 1/2
#4 lore raw
In reply to Amadeusz Sławiński
Quoted 12 lines

-----Original Message-----
From: Alsa-devel <[email protected]> On Behalf Of Amadeusz Slawinski
Sent: Thursday, May 7, 2020 9:34 PM
To: Rojewski, Cezary <[email protected]>; Pierre-Louis Bossart <[email protected]>; Liam Girdwood <[email protected]>; Jie Yang <[email protected]>; Mark Brown <[email protected]>; Takashi Iwai <[email protected]>
Cc: [email protected]; Amadeusz Sławiński <[email protected]>
Subject: [PATCH 1/2] ASoC: Intel: baytrail: Fix register access

Quoted 4 lines

Baytrail has 64 bit registers, so we should use *read64* to read from it and then use proper mask values to check status.

Regards,
Brent

Quoted 21 lines
---
 sound/soc/intel/baytrail/sst-baytrail-ipc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/intel/baytrail/sst-baytrail-ipc.c +2 -3
index 74274bd38f7a..34746fd871b0 100644
@@ -666,8 +666,8 @@ static bool byt_is_dsp_busy(struct sst_dsp *dsp)  {
 	u64 ipcx;
 
-	ipcx = sst_dsp_shim_read_unlocked(dsp, SST_IPCX);
-	return (ipcx & (SST_IPCX_BUSY | SST_IPCX_DONE));
+	ipcx = sst_dsp_shim_read64_unlocked(dsp, SST_IPCX);
+	return (ipcx & (SST_BYT_IPCX_BUSY | SST_BYT_IPCX_DONE));
 }
 
 int sst_byt_dsp_init(struct device *dev, struct sst_pdata *pdata)
--

2.17.1

maintainer Acked-by
#5 lore raw
Quoted 15 lines · Brent
Quoted 15 lines

-----Original Message-----
From: Alsa-devel <[email protected]> On Behalf Of Amadeusz Slawinski
Sent: Thursday, May 7, 2020 9:34 PM
To: Rojewski, Cezary <[email protected]>; Pierre-Louis Bossart <[email protected]>; Liam Girdwood <[email protected]>; Jie Yang <[email protected]>; Mark Brown <[email protected]>; Takashi Iwai <[email protected]>
Cc: [email protected]; Amadeusz Sławiński <[email protected]>
Subject: [PATCH 1/2] ASoC: Intel: baytrail: Fix register access

Baytrail has 64 bit registers, so we should use *read64* to read from it and then use proper mask values to check status.

Quoted 8 lines
Quoted 1 line

Regards,
Brent

Thanks Brent!

maintainer
#6 lore raw
In reply to Amadeusz Sławiński
Quoted 2 lines · Amadeusz Sławiński

Baytrail has 64 bit registers, so we should use *read64* to read from it and then use proper mask values to check status.

Applied to

https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.7

Thanks!

[1/2] ASoC: Intel: baytrail: Fix register access

      commit: 6a5d6fd332624e4eee9a450bb3d18f761548822f
[2/2] ASoC: Intel: Use readq to read 64 bit registers
      commit: 6c47660e3c3acad9401f8fe1d288d4234f05549c

All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying to this mail.

Thanks,
Mark