diff mbox series

ASoC: SOF: Intel: mtl: fix page fault in dspless mode when DSP is disabled

Message ID 20230412061457.27937-1-peter.ujfalusi@linux.intel.com (mailing list archive)
State Accepted
Commit ef0128afa1655f8d024dc5058fbfa0c6deecf117
Headers show
Series ASoC: SOF: Intel: mtl: fix page fault in dspless mode when DSP is disabled | expand

Commit Message

Peter Ujfalusi April 12, 2023, 6:14 a.m. UTC
From: Fred Oh <fred.oh@linux.intel.com>

The patch to make DSPless mode work even if the DSP is
disabled in BIOS missed to touch the MTL code to add
the needed checks.
If the DSP is disabled this can lead to page fault due to not
accesible registers.

Fixes: 9fc6786f549c ("ASoC: SOF: Intel: hda: make DSPless mode work with DSP disabled in BIOS")
Signed-off-by: Fred Oh <fred.oh@linux.intel.com>
Reviewed-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
---
 sound/soc/sof/intel/mtl.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Mark Brown April 12, 2023, 4:46 p.m. UTC | #1
On Wed, 12 Apr 2023 09:14:57 +0300, Peter Ujfalusi wrote:
> The patch to make DSPless mode work even if the DSP is
> disabled in BIOS missed to touch the MTL code to add
> the needed checks.
> If the DSP is disabled this can lead to page fault due to not
> accesible registers.
> 
> 
> [...]

Applied to

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

Thanks!

[1/1] ASoC: SOF: Intel: mtl: fix page fault in dspless mode when DSP is disabled
      commit: ef0128afa1655f8d024dc5058fbfa0c6deecf117

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
diff mbox series

Patch

diff --git a/sound/soc/sof/intel/mtl.c b/sound/soc/sof/intel/mtl.c
index 882ce5536ab6..9f969e07fc27 100644
--- a/sound/soc/sof/intel/mtl.c
+++ b/sound/soc/sof/intel/mtl.c
@@ -60,6 +60,9 @@  static bool mtl_dsp_check_ipc_irq(struct snd_sof_dev *sdev)
 	u32 irq_status;
 	u32 hfintipptr;
 
+	if (sdev->dspless_mode_selected)
+		return false;
+
 	/* read Interrupt IP Pointer */
 	hfintipptr = snd_sof_dsp_read(sdev, HDA_DSP_BAR, MTL_HFINTIPPTR) & MTL_HFINTIPPTR_PTR_MASK;
 	irq_status = snd_sof_dsp_read(sdev, HDA_DSP_BAR, hfintipptr + MTL_DSP_IRQSTS);
@@ -120,6 +123,9 @@  static void mtl_enable_ipc_interrupts(struct snd_sof_dev *sdev)
 	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 	const struct sof_intel_dsp_desc *chip = hda->desc;
 
+	if (sdev->dspless_mode_selected)
+		return;
+
 	/* enable IPC DONE and BUSY interrupts */
 	snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, chip->ipc_ctl,
 				MTL_DSP_REG_HFIPCXCTL_BUSY | MTL_DSP_REG_HFIPCXCTL_DONE,
@@ -131,6 +137,9 @@  static void mtl_disable_ipc_interrupts(struct snd_sof_dev *sdev)
 	struct sof_intel_hda_dev *hda = sdev->pdata->hw_pdata;
 	const struct sof_intel_dsp_desc *chip = hda->desc;
 
+	if (sdev->dspless_mode_selected)
+		return;
+
 	/* disable IPC DONE and BUSY interrupts */
 	snd_sof_dsp_update_bits(sdev, HDA_DSP_BAR, chip->ipc_ctl,
 				MTL_DSP_REG_HFIPCXCTL_BUSY | MTL_DSP_REG_HFIPCXCTL_DONE, 0);
@@ -143,6 +152,9 @@  static void mtl_enable_sdw_irq(struct snd_sof_dev *sdev, bool enable)
 	u32 val;
 	int ret;
 
+	if (sdev->dspless_mode_selected)
+		return;
+
 	/* Enable/Disable SoundWire interrupt */
 	mask = MTL_DSP_REG_HfSNDWIE_IE_MASK;
 	if (enable)
@@ -170,6 +182,9 @@  static int mtl_enable_interrupts(struct snd_sof_dev *sdev, bool enable)
 	u32 val;
 	int ret;
 
+	if (sdev->dspless_mode_selected)
+		return 0;
+
 	/* read Interrupt IP Pointer */
 	hfintipptr = snd_sof_dsp_read(sdev, HDA_DSP_BAR, MTL_HFINTIPPTR) & MTL_HFINTIPPTR_PTR_MASK;