From patchwork Wed Jul 24 08:19:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 13740672 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E1773140397; Wed, 24 Jul 2024 08:18:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721809125; cv=none; b=NG8mIGL4hAfwCErIG1BZia/qnhFUrfHcj3n9p6yMVEI8ILvkdB7DuqSWwrgn7PSIdPJTCnOyz+hE/ZminjS7hNaHUFJpCJbP2hm1qb23B0rEN77cEce7b2Q19c9oRYVfQhxZ3IQmH+JJZguwcBRnoGGkZy0YBdb30VNV3w7Bs7Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721809125; c=relaxed/simple; bh=txGLNyTK4nbYXVaco3tmk9aPEaF4Eu7gOzpBGr6f6Fs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Fv0XI6tyGe0RhpC2Qbohll7/A4w8WwJ9wzgo/Y+ZCAPQezFDgCut9h7SbRotROVi/3t6vatxo37I6QAnWs1+mWwb1nvkpSvOrlTUdEQF5WEGJt0zwou19wriF6NSEUNOC9DzkizFKKp3hIVB/zgPZE3Yy/Wfhn+9YbXxMcpmLqU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=CJcppO5k; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CJcppO5k" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721809124; x=1753345124; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=txGLNyTK4nbYXVaco3tmk9aPEaF4Eu7gOzpBGr6f6Fs=; b=CJcppO5k1A3uYskBb82pnpXc28/nZETGC62He3SGiWFiBNk7PkKD8l23 TwsP/UuPY+G+HuLOzAlbyPSwA7KQkRjBbzIH7Q+ea+ZoW9TNksv55Eac+ HK8lyouR2UfmIi3uhJjmAec4k5UT0s6DJXuySj0typlUGjPwm/kK8Ssos xL1mBEpetCHk1wGLdmA3WUndIco8K9oDobFrcHBnXR5oa84zVrgKg4KEu LaYJcI/eN8H0YxTc7T4eIeAdZQXuG6y3TEPHI6XzMuvrzuCs//c3P+9mo n1j/VhHra7SNsQI6LLR+WuKH48cvf0wwzplL7ZD0Drlu3mRfCJeYQ/Hcw A==; X-CSE-ConnectionGUID: hHc7RS6WSUSM41GY2m3reA== X-CSE-MsgGUID: 3cFHbP18TY+LA7KGEcv/4w== X-IronPort-AV: E=McAfee;i="6700,10204,11142"; a="19166179" X-IronPort-AV: E=Sophos;i="6.09,232,1716274800"; d="scan'208";a="19166179" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2024 01:18:43 -0700 X-CSE-ConnectionGUID: n4J4W15KR7yKnLMNLtWRfw== X-CSE-MsgGUID: 1A54XBQPR66ezyMNjawKug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,232,1716274800"; d="scan'208";a="52221763" Received: from dhhellew-desk2.ger.corp.intel.com.ger.corp.intel.com (HELO pujfalus-desk.intel.com) ([10.245.244.68]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2024 01:18:41 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, kai.vehmanen@linux.intel.com, ranjani.sridharan@linux.intel.com, yung-chuan.liao@linux.intel.com, stable@vger.kernel.org Subject: [PATCH 1/2] ASoC: SOF: ipc4-topology: Only handle dai_config with HW_PARAMS for ChainDMA Date: Wed, 24 Jul 2024 11:19:31 +0300 Message-ID: <20240724081932.24542-2-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240724081932.24542-1-peter.ujfalusi@linux.intel.com> References: <20240724081932.24542-1-peter.ujfalusi@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The DMA Link ID is only valid in snd_sof_dai_config_data when the dai_config is called with HW_PARAMS. The commit that this patch fixes is actually moved a code section without changing it, the same bug exists in the original code, needing different patch to kernel prior to 6.9 kernels. Cc: stable@vger.kernel.org Fixes: 3858464de57b ("ASoC: SOF: ipc4-topology: change chain_dma handling in dai_config") Link: https://github.com/thesofproject/linux/issues/5116 Signed-off-by: Peter Ujfalusi Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/ipc4-topology.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index 90f6856ee80c..4a4234d5c941 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -3095,8 +3095,14 @@ static int sof_ipc4_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget * return 0; if (pipeline->use_chain_dma) { - pipeline->msg.primary &= ~SOF_IPC4_GLB_CHAIN_DMA_LINK_ID_MASK; - pipeline->msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_LINK_ID(data->dai_data); + /* + * Only configure the DMA Link ID for ChainDMA when this op is + * invoked with SOF_DAI_CONFIG_FLAGS_HW_PARAMS + */ + if (flags & SOF_DAI_CONFIG_FLAGS_HW_PARAMS) { + pipeline->msg.primary &= ~SOF_IPC4_GLB_CHAIN_DMA_LINK_ID_MASK; + pipeline->msg.primary |= SOF_IPC4_GLB_CHAIN_DMA_LINK_ID(data->dai_data); + } return 0; } From patchwork Wed Jul 24 08:19:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 13740673 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EAC64140397; Wed, 24 Jul 2024 08:18:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.198.163.19 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721809128; cv=none; b=Wwgo4VYlPFTuGW1RAqJQxFOITeYuzoFK2TpayqDaUDPBLFsbhF6hozu7paSqbxlNB0ahXMKCMJt0LmIXTpCUbZsIPXfXFakUHDVenstCxEf6dm/mvbdFss+qW1YJtjX0sw0aLtl98ZU1TA/RyNA927bpc/hXirEMQInohaigPhA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1721809128; c=relaxed/simple; bh=GVTqlhzIWAsTGoZvbf/CafZ28PBBGs54WSfwVjChil8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uOUvVcJH+ykhct4rdv+Pd/5a6j6Kun8DO9z8Kqwf6uyDWl2bhyXMnNLRBWvybrG1wFoDGkAuoNp3PekTn3/dNP6vRGdBIiCqWfYMdRBn0bfELD7iunzBjdrSplJU6fCx0AihAVRk+aeGxYDjLMiBlXrpRCdA3eInDnvKuOCg318= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PUDpyGnh; arc=none smtp.client-ip=192.198.163.19 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PUDpyGnh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1721809127; x=1753345127; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=GVTqlhzIWAsTGoZvbf/CafZ28PBBGs54WSfwVjChil8=; b=PUDpyGnhcTNy41wqopPUpBkvaQyVpts5OFYR7xtruFUoAo6rybnC1eVT VMsgTMxCB6utYs1yE8MIuyF/4zFBzNzqwDF+fdp5bW7wSI/Obr6Hk8xhQ u3WpgkUaAxpWvNi+aR3AeKtWeTK4tJ71QGgakizxx8VJK+vy0NYWWVny7 CmctpsehDJzDZ2rHXk+B55lEGc+f759x0RHQ/tphKGivt1VYa+tZ4a+El y+KBKdRL7mxphfyBihGMZ/JjsHgYNl1wBmLlVJf7RQbM29ds2HyKTuqqy P1KfT3Mll/bNuhR6WebCTCbWc9Pjl8qR8mQ/a0yPDP3cEd1/Wg0szmlvS g==; X-CSE-ConnectionGUID: KChGDK9FSKiDHqBfv0LSRg== X-CSE-MsgGUID: ihkE9i0ITGKpEvmukmDJKw== X-IronPort-AV: E=McAfee;i="6700,10204,11142"; a="19166185" X-IronPort-AV: E=Sophos;i="6.09,232,1716274800"; d="scan'208";a="19166185" Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by fmvoesa113.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2024 01:18:46 -0700 X-CSE-ConnectionGUID: LZjPVV5eR+SXXOwNJ1ABdw== X-CSE-MsgGUID: uO7LKwuBS5agCfttjtUDFw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.09,232,1716274800"; d="scan'208";a="52221769" Received: from dhhellew-desk2.ger.corp.intel.com.ger.corp.intel.com (HELO pujfalus-desk.intel.com) ([10.245.244.68]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jul 2024 01:18:44 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org Cc: linux-sound@vger.kernel.org, pierre-louis.bossart@linux.intel.com, kai.vehmanen@linux.intel.com, ranjani.sridharan@linux.intel.com, yung-chuan.liao@linux.intel.com, stable@vger.kernel.org Subject: [PATCH 2/2] ASoC: SOF: ipc4-topology: Preserve the DMA Link ID for ChainDMA on unprepare Date: Wed, 24 Jul 2024 11:19:32 +0300 Message-ID: <20240724081932.24542-3-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240724081932.24542-1-peter.ujfalusi@linux.intel.com> References: <20240724081932.24542-1-peter.ujfalusi@linux.intel.com> Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 The DMA Link ID is set to the IPC message's primary during dai_config, which is only during hw_params. During xrun handling the hw_params is not called and the DMA Link ID information will be lost. All other fields in the message expected to be 0 for re-configuration, only the DMA Link ID needs to be preserved and the in case of repeated dai_config, it is correctly updated (masked and then set). Cc: stable@vger.kernel.org Fixes: ca5ce0caa67f ("ASoC: SOF: ipc4/intel: Add support for chained DMA") Link: https://github.com/thesofproject/linux/issues/5116 Signed-off-by: Peter Ujfalusi Reviewed-by: Bard Liao Reviewed-by: Ranjani Sridharan Reviewed-by: Pierre-Louis Bossart --- sound/soc/sof/ipc4-topology.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/ipc4-topology.c b/sound/soc/sof/ipc4-topology.c index 4a4234d5c941..87be7f16e8c2 100644 --- a/sound/soc/sof/ipc4-topology.c +++ b/sound/soc/sof/ipc4-topology.c @@ -1358,7 +1358,13 @@ static void sof_ipc4_unprepare_copier_module(struct snd_sof_widget *swidget) ipc4_copier = dai->private; if (pipeline->use_chain_dma) { - pipeline->msg.primary = 0; + /* + * Preserve the DMA Link ID and clear other bits since + * the DMA Link ID is only configured once during + * dai_config, other fields are expected to be 0 for + * re-configuration + */ + pipeline->msg.primary &= SOF_IPC4_GLB_CHAIN_DMA_LINK_ID_MASK; pipeline->msg.extension = 0; }