From patchwork Wed Mar 30 20:19:16 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 556264 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AA0EEC433EF for ; Wed, 30 Mar 2022 20:21:13 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C307C1AB9; Wed, 30 Mar 2022 22:20:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C307C1AB9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671671; bh=aAUqSmW6XkCA6aP1LCihLXXsOlY+IckZB/cQyjzqU08=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NRB+ANVgVzPQSgiOr1XzPeJ2tLN3pqEe1l1422flEZ/tF/kVenyqo846LoJ2rsoj2 hb7VZ1y5KZsss+pB33CfWiIu8junlQq/HlndcZuCb4cKJT+36rmu4Hjsw1dub6/obp hsKwwocM0xAj+mHpPoW4sos7Tp92t9i/GELAVja8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7E291F804B4; Wed, 30 Mar 2022 22:19:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DBA54F8051A; Wed, 30 Mar 2022 22:19:47 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 91F11F80253 for ; Wed, 30 Mar 2022 22:19:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 91F11F80253 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="nE+Q5wjS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671581; x=1680207581; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aAUqSmW6XkCA6aP1LCihLXXsOlY+IckZB/cQyjzqU08=; b=nE+Q5wjS0lrDAeN52dsNAQq1nDhhufZRpTEqYDLcD0N1adnp/1npULT+ 9n0vB0TYHLFYl/W212YrkVx9zcOsOLD2LjvU0l5leqEObOkzutHwl9fr5 ICHLo9qC1fPc2qsMcxUm46XFPJIW4t8uDJp/VdY/Cj5jplLMCXB+JOEaM Gdp2j7DXE/gIG4zGr+KPVv0ZSPr7a0ZQd0azmjQcnpGTIZfZRmNFXnDCT f1k8DU71o8jya8gdrcb6nF8JTWNQzvUkd0iSPcQxqtHAlbY59PM4veK5Z oXQpoGHT3rAxeJj2zFNECKbSFZZBH2nzY/NPHLDQvYTQEHiTbaiIGAb7/ A==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819823" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819823" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:36 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045016" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:35 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 01/11] ASoC: SOF: Intel: hda-loader: Use local snd_dma_buffer Date: Wed, 30 Mar 2022 13:19:16 -0700 Message-Id: <20220330201926.1330402-2-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Pierre-Louis Bossart , Ranjani Sridharan X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi There is no reason to use the sdev->dmab and sdev->dmab_bdl as the buffers are only used locally: allocated used and freed in the same function. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Signed-off-by: Ranjani Sridharan --- sound/soc/sof/intel/hda-loader.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/intel/hda-loader.c b/sound/soc/sof/intel/hda-loader.c index 2ac5d9d0719b..697d18a41a6e 100644 --- a/sound/soc/sof/intel/hda-loader.c +++ b/sound/soc/sof/intel/hda-loader.c @@ -313,6 +313,7 @@ int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev) struct hdac_ext_stream *iccmax_stream; struct hdac_bus *bus = sof_to_bus(sdev); struct firmware stripped_firmware; + struct snd_dma_buffer dmab_bdl; int ret, ret1; u8 original_gb; @@ -328,7 +329,7 @@ int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev) /* prepare capture stream for ICCMAX */ iccmax_stream = cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, stripped_firmware.size, - &sdev->dmab_bdl, SNDRV_PCM_STREAM_CAPTURE); + &dmab_bdl, SNDRV_PCM_STREAM_CAPTURE); if (IS_ERR(iccmax_stream)) { dev_err(sdev->dev, "error: dma prepare for ICCMAX stream failed\n"); return PTR_ERR(iccmax_stream); @@ -340,7 +341,7 @@ int hda_dsp_cl_boot_firmware_iccmax(struct snd_sof_dev *sdev) * Perform iccmax stream cleanup. This should be done even if firmware loading fails. * If the cleanup also fails, we return the initial error */ - ret1 = cl_cleanup(sdev, &sdev->dmab_bdl, iccmax_stream); + ret1 = cl_cleanup(sdev, &dmab_bdl, iccmax_stream); if (ret1 < 0) { dev_err(sdev->dev, "error: ICCMAX stream cleanup failed\n"); @@ -395,6 +396,7 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) const struct sof_intel_dsp_desc *chip_info; struct hdac_ext_stream *hext_stream; struct firmware stripped_firmware; + struct snd_dma_buffer dmab; int ret, ret1, i; if ((sdev->fw_ready.flags & SOF_IPC_INFO_D3_PERSISTENT) && @@ -419,13 +421,13 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) /* prepare DMA for code loader stream */ hext_stream = cl_stream_prepare(sdev, HDA_CL_STREAM_FORMAT, stripped_firmware.size, - &sdev->dmab, SNDRV_PCM_STREAM_PLAYBACK); + &dmab, SNDRV_PCM_STREAM_PLAYBACK); if (IS_ERR(hext_stream)) { dev_err(sdev->dev, "error: dma prepare for fw loading failed\n"); return PTR_ERR(hext_stream); } - memcpy(sdev->dmab.area, stripped_firmware.data, + memcpy(dmab.area, stripped_firmware.data, stripped_firmware.size); /* try ROM init a few times before giving up */ @@ -486,7 +488,7 @@ int hda_dsp_cl_boot_firmware(struct snd_sof_dev *sdev) * This should be done even if firmware loading fails. * If the cleanup also fails, we return the initial error */ - ret1 = cl_cleanup(sdev, &sdev->dmab, hext_stream); + ret1 = cl_cleanup(sdev, &dmab, hext_stream); if (ret1 < 0) { dev_err(sdev->dev, "error: Code loader DSP cleanup failed\n"); From patchwork Wed Mar 30 20:19:17 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 556263 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9E5E9C433EF for ; Wed, 30 Mar 2022 20:21:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id C3CB0112; Wed, 30 Mar 2022 22:20:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C3CB0112 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671704; bh=//VLX0NSVXpvaYf1bPnlh5QRE3lJwScoas6Df7RnmF4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=uviwEv14SrFsYzd0zn44BKEssyIb4MK/JpPm3Fb5cbrOvjBlpSRA7FyeMI2Qo/TjF +zbpKfnJStl4kRggODQegI0ISBbF1/cY7RkatZ5MhMw6UAzTQr+IBZKc+aFbOGOwKf 6toTwT2QWnXbUkZ1v8EmqcO77IuyytxrChNyYkkU= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3919EF8051E; Wed, 30 Mar 2022 22:19:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CAF93F8051A; Wed, 30 Mar 2022 22:19:50 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C6DC1F80155 for ; Wed, 30 Mar 2022 22:19:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C6DC1F80155 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="LTWOsOZ8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671582; x=1680207582; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=//VLX0NSVXpvaYf1bPnlh5QRE3lJwScoas6Df7RnmF4=; b=LTWOsOZ8/YwGenNhm06kKBQvJvTA7yXrnoyyFC4ci7cCLK8kA2JZJd9j ep2XGTIdxNr0zY/tX8LrRSzESaVKnuBnTml4wqJSvVqEQuNfuzgv3JoZ4 5es5Rg6Ilh6yEtCu/FMtihYHGpV9EDFvcuk+yHl6BCm+FfSqxqtKq7sbh c4BWSkkE+eM+96a2nvOivWcT3KbKqIjOGxoD/Gkh543bPT3/SpVB6kgoJ LTEdeI4m9cIDD/3Zaek7seKfAtJrwDkI1rPa7wcKklyIOHlC/g2yQzHk8 kKA24/V1QnKKEihhMcZWF1hDHg+i4VK5K/rskXm9Ky/TKNaaBHM5HuY75 Q==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819825" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819825" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:36 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045017" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:36 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 02/11] ASoC: SOF: Remove dmab and dmab_bdl from snd_sof_dev struct Date: Wed, 30 Mar 2022 13:19:17 -0700 Message-Id: <20220330201926.1330402-3-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Pierre-Louis Bossart , Ranjani Sridharan X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi The dmab and dmab_bdl is not used by any platform, it can be removed from struct snd_sof_dev. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Signed-off-by: Ranjani Sridharan --- sound/soc/sof/sof-priv.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 0d9b640ae24c..93de5547b952 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -457,8 +457,6 @@ struct snd_sof_dev { bool ipc_dump_printed; /* firmware loader */ - struct snd_dma_buffer dmab; - struct snd_dma_buffer dmab_bdl; struct sof_ipc_fw_ready fw_ready; struct sof_ipc_fw_version fw_version; struct sof_ipc_cc_version *cc_version; From patchwork Wed Mar 30 20:19:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 555124 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 51D98C433EF for ; Wed, 30 Mar 2022 20:22:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 946BE1ACB; Wed, 30 Mar 2022 22:21:11 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 946BE1ACB DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671721; bh=219w+WAhFOLOTuSWfHn8ygxlqsJUkzHLHdtOW7b9fFY=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=srRJ4pIgzOU14UehmHElPv3GBzvMv6F7k4Lq/Dwbheutsf4PbX+vAtUt9/M+euz8N I9jdzM7wkPrycKz9mKpSSyabqOFk3SbVLoNDOgkW85FySPhfvpYVXjnCK/GUm8y0Ye 78/2KmxP1e+wXnIAoA99ATjGFQeM9EtxdB8yMaGo= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C13F5F80524; Wed, 30 Mar 2022 22:19:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 36E5CF80254; Wed, 30 Mar 2022 22:19:51 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 97B37F8025A for ; Wed, 30 Mar 2022 22:19:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 97B37F8025A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="clJh/wdM" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671583; x=1680207583; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=219w+WAhFOLOTuSWfHn8ygxlqsJUkzHLHdtOW7b9fFY=; b=clJh/wdMRyXQjfmQJF9SbP6ANPLMBOk1D94EKByMkqmmJvtOb65F5+he bn8WE25R1nJ2co54BheGPc+ZHUug6QeJVb9Y57cUOuXTdQgOquVw8w6F0 AtDGj0GwGbAQqW/B6P0iuABRWxPm0D1Z7prFs22RfeK/pJwIv55350Kc/ VoCK/2AYlpX20ufQRhkHbEyT4jMhDBBcFzgGOf8WqGRWLqUtfozMxiLus E0emZj/Y0Z0x0SGjdRrl1oCQCnq4jRXwYLXs6pzmLgsLUvGImy8sldP8M i2P3Sl+azK4b//JEM+nD77QZapIjOyAqpxozBt4mpnkS5umdWl98W3SOT g==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819826" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819826" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:36 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045022" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:36 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 03/11] ASoC: SOF: ipc: Add max_payload_size field in struct snd_sof_ipc Date: Wed, 30 Mar 2022 13:19:18 -0700 Message-Id: <20220330201926.1330402-4-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: Daniel Baluta , Kai Vehmanen , tiwai@suse.de, Peter Ujfalusi , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi The max_payload_size is an IPC level constraint. Add a new field, max_payload_size to struct snd_sof_ipc and set it during IPC init. Signed-off-by: Peter Ujfalusi Reviewed-by: Kai Vehmanen Reviewed-by: Bard Liao Reviewed-by: Daniel Baluta Reviewed-by: Rander Wang Reviewed-by: Pierre-Louis Bossart Signed-off-by: Ranjani Sridharan --- sound/soc/sof/ipc.c | 2 ++ sound/soc/sof/sof-priv.h | 3 +++ 2 files changed, 5 insertions(+) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index 5f5753608c79..af2efc1c8436 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -1005,6 +1005,8 @@ int sof_ipc_init_msg_memory(struct snd_sof_dev *sdev) if (!msg->reply_data) return -ENOMEM; + sdev->ipc->max_payload_size = SOF_IPC_MSG_MAX_SIZE; + return 0; } diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 93de5547b952..f75c6f76297e 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -394,6 +394,9 @@ struct snd_sof_ipc { /* disables further sending of ipc's */ bool disable_ipc_tx; + /* Maximum allowed size of a single IPC message/reply */ + size_t max_payload_size; + struct snd_sof_ipc_msg msg; /* IPC ops based on version */ From patchwork Wed Mar 30 20:19:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 555125 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9373FC433F5 for ; Wed, 30 Mar 2022 20:21:30 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id AEEFB1AAD; Wed, 30 Mar 2022 22:20:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz AEEFB1AAD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671688; bh=v1AKXMhBFfjEwWOxrOxven0a28qinAa9HORzeGn2m/c=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=SYpDGXnL2L0zUOK3RRF3MeIF+QnD4t7sslSLd1Foj6zA/UBVV71iB9i0BT7WwZyH0 zTkLBBI+/jXW54fmPEBO3+HIN5JvqzvM5Ck8BFYJRG3FUhaNLwYpCheTi3oSyx0zNi B+xWirakkoTazoixhOvGvy0vi2wOmQSN7g1bxWqQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E7479F80254; Wed, 30 Mar 2022 22:19:54 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 25FC1F8051C; Wed, 30 Mar 2022 22:19:51 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AE387F80254 for ; Wed, 30 Mar 2022 22:19:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AE387F80254 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="JffgXHXq" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671583; x=1680207583; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v1AKXMhBFfjEwWOxrOxven0a28qinAa9HORzeGn2m/c=; b=JffgXHXqnCdY6KReLyyDra9y5cgsldbKPdT7RA1/pZNQdNGYyqa1VhdD AvyBn812nUDsm5b5sbbR7rtHzNbVB+3i/51IOckVCyaEI8hoX43xYMXFO iSw/Aw+PtsMs9BJvy1HOS/hzfigmVZlYQfjJi0wxHaK+Ik0kgIJrTyQ9I XyAmdVGJuxc0SoZwkfwEAI/9sM4H7xuPjCIHomAlIu+2T+7bK03GgIGkg PQGCUHbyfpoJPH5qkDAI8/3NbfwlTdqWyXV4zkoe19+VTMYc5JqsEvbOn fI2bMTSue90pbSWap+O/Iq81bxTRX6zsyeYsbZb6t+tklBuK/jiHFhXri w==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819828" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819828" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045026" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:36 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 04/11] ASoC: SOF: ipc: Use ipc->max_payload_size for message/reply size checking Date: Wed, 30 Mar 2022 13:19:19 -0700 Message-Id: <20220330201926.1330402-5-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: Daniel Baluta , Kai Vehmanen , tiwai@suse.de, Peter Ujfalusi , Pierre-Louis Bossart , Rander Wang , broonie@kernel.org, Ranjani Sridharan , Bard Liao X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi Use the ipc->max_payload_size for validating that the message or reply size can be supported. Signed-off-by: Peter Ujfalusi Reviewed-by: Kai Vehmanen Reviewed-by: Bard Liao Reviewed-by: Daniel Baluta Reviewed-by: Rander Wang Reviewed-by: Pierre-Louis Bossart Signed-off-by: Ranjani Sridharan --- sound/soc/sof/ipc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index af2efc1c8436..166d4906698b 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -373,8 +373,8 @@ int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, u32 header, { int ret; - if (msg_bytes > SOF_IPC_MSG_MAX_SIZE || - reply_bytes > SOF_IPC_MSG_MAX_SIZE) + if (msg_bytes > ipc->max_payload_size || + reply_bytes > ipc->max_payload_size) return -ENOBUFS; /* Serialise IPC TX */ From patchwork Wed Mar 30 20:19:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 556262 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1D6A2C433F5 for ; Wed, 30 Mar 2022 20:22:21 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 33F281AD4; Wed, 30 Mar 2022 22:21:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 33F281AD4 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671739; bh=JmxjxkctsBbCt8FQmgaxOp19DTK3oUUVnv7oCGuBITA=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Ptw7C9qqkqjkKLVaM+zRxWUSPBKPwXrfKf9TFZQ95xbVv4UeytQ1swgDGW9scWp41 21KiKtt8o6SR5sk7aumMK7D/VZ32s0LN4hAE29XWdcMwitVoeAA+odPzwPII1Hz9Nj 9BIqN9y++b9CpsTNkzI7AYe6LVYugCrM52qZu1qk= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7DF5EF80528; Wed, 30 Mar 2022 22:19:57 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 45886F80155; Wed, 30 Mar 2022 22:19:51 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id BB781F804B4 for ; Wed, 30 Mar 2022 22:19:42 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BB781F804B4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PiwsU77I" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671583; x=1680207583; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JmxjxkctsBbCt8FQmgaxOp19DTK3oUUVnv7oCGuBITA=; b=PiwsU77Irk5qsLo6iQ4xf1X5eXhj9nln8vpuJkQtJbr25yG69oL3Z+oh cNTBwczbCCgM0IqVFI5kG9OfYgFqzg6oNLslU9xiXiSTQoNNP/UTfHG3I lhJxtWXmMg688zuTBk6YC5YIVS8bhIBFNXGpi/YqaZLPSv1nVAj1xm9BD 6z2NWILhWEuu6Q1QZabyEMyK+V+xzV1BlFmRUkGM7TdVREJeeWqjuS9wD StIrpfrLBQRz/9m3yx0RBsC8CNq9i6gdveMnh6fWc6A0yrYMZjivMXrnH 0c7HV5PMx2wzov34m2pr7d4+lY3yZPgoLlxXZq2HWKZXZ7jmfYEphCBDn A==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819829" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819829" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045031" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:37 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 05/11] ASoC: SOF: Drop support for mapped control data Date: Wed, 30 Mar 2022 13:19:20 -0700 Message-Id: <20220330201926.1330402-6-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, Pierre-Louis Bossart , Ranjani Sridharan , Kai Vehmanen , broonie@kernel.org, Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi Access through mmapped memory is not supported and it is explicitly disabled with scontrol->readback_offset = 0; when a control is created. Remove the dead code and the confusion around this feature. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Kai Vehmanen Signed-off-by: Ranjani Sridharan --- sound/soc/sof/ipc.c | 22 ---------------------- sound/soc/sof/sof-audio.c | 3 --- sound/soc/sof/sof-audio.h | 1 - 3 files changed, 26 deletions(-) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index 166d4906698b..c722ca0b00a6 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -823,7 +823,6 @@ int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol, bool set) enum sof_ipc_ctrl_type ctrl_type; struct snd_sof_widget *swidget; bool widget_found = false; - size_t send_bytes; u32 ipc_cmd; int err; @@ -847,27 +846,6 @@ int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol, bool set) if (!swidget->use_count) return 0; - /* read or write firmware volume */ - if (scontrol->readback_offset != 0) { - /* write/read value header via mmaped region */ - send_bytes = sizeof(struct sof_ipc_ctrl_value_chan) * - cdata->num_elems; - if (set) - err = snd_sof_dsp_block_write(sdev, SOF_FW_BLK_TYPE_IRAM, - scontrol->readback_offset, - cdata->chanv, send_bytes); - - else - err = snd_sof_dsp_block_read(sdev, SOF_FW_BLK_TYPE_IRAM, - scontrol->readback_offset, - cdata->chanv, send_bytes); - - if (err) - dev_err_once(sdev->dev, "error: %s TYPE_IRAM failed\n", - set ? "write to" : "read from"); - return err; - } - /* * Select the IPC cmd and the ctrl_type based on the ctrl_cmd and the * direction diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c index b2f009a0c5b7..49fdfe06a9a3 100644 --- a/sound/soc/sof/sof-audio.c +++ b/sound/soc/sof/sof-audio.c @@ -16,9 +16,6 @@ static int sof_kcontrol_setup(struct snd_sof_dev *sdev, struct snd_sof_control * { int ret; - /* reset readback offset for scontrol */ - scontrol->readback_offset = 0; - ret = snd_sof_ipc_set_get_comp_data(scontrol, true); if (ret < 0) dev_err(sdev->dev, "error: failed kcontrol value set for widget: %d\n", diff --git a/sound/soc/sof/sof-audio.h b/sound/soc/sof/sof-audio.h index 7f15b3bc8196..4a8cd7f2a0eb 100644 --- a/sound/soc/sof/sof-audio.h +++ b/sound/soc/sof/sof-audio.h @@ -247,7 +247,6 @@ struct snd_sof_control { int max_volume_step; /* max volume step for volume_table */ int num_channels; unsigned int access; - u32 readback_offset; /* offset to mmapped data if used */ int info_type; int index; /* pipeline ID */ void *priv; /* private data copied from topology */ From patchwork Wed Mar 30 20:19:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 556260 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id B4BB7C433EF for ; Wed, 30 Mar 2022 20:23:28 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EB5A91A95; Wed, 30 Mar 2022 22:22:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EB5A91A95 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671807; bh=v11+v2k1DlGBmwphV6cblvuhJSgKZv8bXM99X6gnTfk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=BidtqCPt8cPED+A5FoqUJgVpa6rpWXLhexGJTqHYVhaGH0bx/fmbaFXQYhWbOyLdK bpZpHH2uLquaK3Fp/Bzxye0pIbxbD8XdGoFzECGXDMWzGNZKBEDpBbiRgL9pYcCKde gvwue6s+H2+kDoQBDC6GXfXbopZPfCAWJcNxZA6Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 92610F80542; Wed, 30 Mar 2022 22:20:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 825B0F8052E; Wed, 30 Mar 2022 22:19:58 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 26F66F804E4 for ; Wed, 30 Mar 2022 22:19:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 26F66F804E4 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="j/K6FUw3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671586; x=1680207586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=v11+v2k1DlGBmwphV6cblvuhJSgKZv8bXM99X6gnTfk=; b=j/K6FUw38OnClq1LqKlIFtrQHrbufb4uPr1CXU09M1/2astYIO6c5znY VFrq0ceWyjaTJ8+56r6K9zzzqBpR8kXMBfUpJumDpe8iaKqf3JivvdihF tvinYtZyWf3AQG+KHL2/e8c4wJxxfg72Jv0SSQ3uWTxL5L5u1pn89B2Ze YI2XTxM3/UUcOOrNV0aqX7WV9C4AyMfT8DVl2u/pgrF4CiiiPTe8Vmzvo 71w2Zh4vRJtfWLExUO+0DNdW+P3mjZKhrUKpRS2reYIDvUkPWRTTXglbZ dPJR/n08rk89CzA1Geyr/SkFfOHYrt6iLoBTDTqLxJQkSIs3gSFknQ1uP g==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819831" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819831" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:37 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045034" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:37 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 06/11] ASoC: SOF: extend the interface to stop DMA trace Date: Wed, 30 Mar 2022 13:19:21 -0700 Message-Id: <20220330201926.1330402-7-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: Libin Yang , tiwai@suse.de, Ranjani Sridharan , Kai Vehmanen , broonie@kernel.org, Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Libin Yang Change the interface to stop the DMA trace for suspend. Replace the snd_sof_init_trace_ipc() and snd_sof_release_trace() calls with more explicit interface for PM (the sole user for this interface). The new snd_sof_trace_suspend() call takes the target PM state as argument, allowing the trace implementation to decide how to handle the transition. Use this information to release DMA resources only if DSP is suspended and will not remain in D0. Signed-off-by: Peter Ujfalusi Signed-off-by: Libin Yang Reviewed-by: Kai Vehmanen Reviewed-by: Péter Ujfalusi Signed-off-by: Ranjani Sridharan --- sound/soc/sof/pm.c | 8 +++---- sound/soc/sof/sof-priv.h | 12 +++++++--- sound/soc/sof/trace.c | 52 +++++++++++++++++++++++++++++----------- 3 files changed, 51 insertions(+), 21 deletions(-) diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index 1c319582ca6f..a1a645a13c6d 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -135,8 +135,8 @@ static int sof_resume(struct device *dev, bool runtime_resume) return ret; } - /* resume DMA trace, only need send ipc */ - ret = snd_sof_init_trace_ipc(sdev); + /* resume DMA trace */ + ret = snd_sof_trace_resume(sdev); if (ret < 0) { /* non fatal */ dev_warn(sdev->dev, @@ -209,8 +209,8 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) if (tplg_ops->tear_down_all_pipelines) tplg_ops->tear_down_all_pipelines(sdev, false); - /* release trace */ - snd_sof_release_trace(sdev); + /* suspend DMA trace */ + snd_sof_trace_suspend(sdev, pm_state); /* Notify clients not managed by pm framework about core suspend */ sof_suspend_clients(sdev, pm_state); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index f75c6f76297e..0fb1db0ed7cd 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -403,6 +403,12 @@ struct snd_sof_ipc { const struct sof_ipc_ops *ops; }; +enum sof_dtrace_state { + SOF_DTRACE_DISABLED, + SOF_DTRACE_STOPPED, + SOF_DTRACE_ENABLED, +}; + /* * SOF Device Level. */ @@ -489,9 +495,9 @@ struct snd_sof_dev { wait_queue_head_t trace_sleep; u32 host_offset; bool dtrace_is_supported; /* set with Kconfig or module parameter */ - bool dtrace_is_enabled; bool dtrace_error; bool dtrace_draining; + enum sof_dtrace_state dtrace_state; bool msi_enabled; @@ -595,7 +601,6 @@ static inline void snd_sof_ipc_process_reply(struct snd_sof_dev *sdev, u32 msg_i * Trace/debug */ int snd_sof_init_trace(struct snd_sof_dev *sdev); -void snd_sof_release_trace(struct snd_sof_dev *sdev); void snd_sof_free_trace(struct snd_sof_dev *sdev); int snd_sof_dbg_init(struct snd_sof_dev *sdev); void snd_sof_free_debug(struct snd_sof_dev *sdev); @@ -609,7 +614,8 @@ void sof_print_oops_and_stack(struct snd_sof_dev *sdev, const char *level, u32 panic_code, u32 tracep_code, void *oops, struct sof_ipc_panic_info *panic_info, void *stack, size_t stack_words); -int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev); +void snd_sof_trace_suspend(struct snd_sof_dev *sdev, pm_message_t pm_state); +int snd_sof_trace_resume(struct snd_sof_dev *sdev); void snd_sof_handle_fw_exception(struct snd_sof_dev *sdev); int snd_sof_dbg_memory_info_init(struct snd_sof_dev *sdev); int snd_sof_debugfs_add_region_item_iomem(struct snd_sof_dev *sdev, diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c index ea8e4506d02e..26d9381596ff 100644 --- a/sound/soc/sof/trace.c +++ b/sound/soc/sof/trace.c @@ -11,6 +11,7 @@ #include #include #include "sof-priv.h" +#include "sof-audio.h" #include "ops.h" #include "sof-utils.h" @@ -263,7 +264,7 @@ static size_t sof_wait_trace_avail(struct snd_sof_dev *sdev, if (ret) return ret; - if (!sdev->dtrace_is_enabled && sdev->dtrace_draining) { + if (sdev->dtrace_state != SOF_DTRACE_ENABLED && sdev->dtrace_draining) { /* * tracing has ended and all traces have been * read by client, return EOF @@ -344,7 +345,7 @@ static int sof_dfsentry_trace_release(struct inode *inode, struct file *file) struct snd_sof_dev *sdev = dfse->sdev; /* avoid duplicate traces at next open */ - if (!sdev->dtrace_is_enabled) + if (sdev->dtrace_state != SOF_DTRACE_ENABLED) sdev->host_offset = 0; return 0; @@ -384,7 +385,7 @@ static int trace_debugfs_create(struct snd_sof_dev *sdev) return 0; } -int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev) +static int snd_sof_enable_trace(struct snd_sof_dev *sdev) { struct sof_ipc_fw_ready *ready = &sdev->fw_ready; struct sof_ipc_fw_version *v = &ready->version; @@ -395,9 +396,12 @@ int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev) if (!sdev->dtrace_is_supported) return 0; - if (sdev->dtrace_is_enabled || !sdev->dma_trace_pages) + if (sdev->dtrace_state == SOF_DTRACE_ENABLED || !sdev->dma_trace_pages) return -EINVAL; + if (sdev->dtrace_state == SOF_DTRACE_STOPPED) + goto start; + /* set IPC parameters */ params.hdr.cmd = SOF_IPC_GLB_TRACE_MSG; /* PARAMS_EXT is only supported from ABI 3.7.0 onwards */ @@ -435,6 +439,7 @@ int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev) goto trace_release; } +start: ret = snd_sof_dma_trace_trigger(sdev, SNDRV_PCM_TRIGGER_START); if (ret < 0) { dev_err(sdev->dev, @@ -442,7 +447,7 @@ int snd_sof_init_trace_ipc(struct snd_sof_dev *sdev) goto trace_release; } - sdev->dtrace_is_enabled = true; + sdev->dtrace_state = SOF_DTRACE_ENABLED; return 0; @@ -459,7 +464,7 @@ int snd_sof_init_trace(struct snd_sof_dev *sdev) return 0; /* set false before start initialization */ - sdev->dtrace_is_enabled = false; + sdev->dtrace_state = SOF_DTRACE_DISABLED; /* allocate trace page table buffer */ ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, sdev->dev, @@ -498,7 +503,7 @@ int snd_sof_init_trace(struct snd_sof_dev *sdev) init_waitqueue_head(&sdev->trace_sleep); - ret = snd_sof_init_trace_ipc(sdev); + ret = snd_sof_enable_trace(sdev); if (ret < 0) goto table_err; @@ -518,7 +523,8 @@ int snd_sof_trace_update_pos(struct snd_sof_dev *sdev, if (!sdev->dtrace_is_supported) return 0; - if (sdev->dtrace_is_enabled && sdev->host_offset != posn->host_offset) { + if (sdev->dtrace_state == SOF_DTRACE_ENABLED && + sdev->host_offset != posn->host_offset) { sdev->host_offset = posn->host_offset; wake_up(&sdev->trace_sleep); } @@ -537,14 +543,14 @@ void snd_sof_trace_notify_for_error(struct snd_sof_dev *sdev) if (!sdev->dtrace_is_supported) return; - if (sdev->dtrace_is_enabled) { + if (sdev->dtrace_state == SOF_DTRACE_ENABLED) { sdev->dtrace_error = true; wake_up(&sdev->trace_sleep); } } EXPORT_SYMBOL(snd_sof_trace_notify_for_error); -void snd_sof_release_trace(struct snd_sof_dev *sdev) +static void snd_sof_release_trace(struct snd_sof_dev *sdev, bool only_stop) { struct sof_ipc_fw_ready *ready = &sdev->fw_ready; struct sof_ipc_fw_version *v = &ready->version; @@ -552,13 +558,14 @@ void snd_sof_release_trace(struct snd_sof_dev *sdev) struct sof_ipc_reply ipc_reply; int ret; - if (!sdev->dtrace_is_supported || !sdev->dtrace_is_enabled) + if (!sdev->dtrace_is_supported || sdev->dtrace_state == SOF_DTRACE_DISABLED) return; ret = snd_sof_dma_trace_trigger(sdev, SNDRV_PCM_TRIGGER_STOP); if (ret < 0) dev_err(sdev->dev, "error: snd_sof_dma_trace_trigger: stop: %d\n", ret); + sdev->dtrace_state = SOF_DTRACE_STOPPED; /* * stop and free trace DMA in the DSP. TRACE_DMA_FREE is only supported from @@ -574,23 +581,40 @@ void snd_sof_release_trace(struct snd_sof_dev *sdev) dev_err(sdev->dev, "DMA_TRACE_FREE failed with error: %d\n", ret); } + if (only_stop) + goto out; + ret = snd_sof_dma_trace_release(sdev); if (ret < 0) dev_err(sdev->dev, "error: fail in snd_sof_dma_trace_release %d\n", ret); - sdev->dtrace_is_enabled = false; + sdev->dtrace_state = SOF_DTRACE_DISABLED; + +out: sdev->dtrace_draining = true; wake_up(&sdev->trace_sleep); } -EXPORT_SYMBOL(snd_sof_release_trace); + +void snd_sof_trace_suspend(struct snd_sof_dev *sdev, pm_message_t pm_state) +{ + snd_sof_release_trace(sdev, pm_state.event == SOF_DSP_PM_D0); +} +EXPORT_SYMBOL(snd_sof_trace_suspend); + +int snd_sof_trace_resume(struct snd_sof_dev *sdev) +{ + return snd_sof_enable_trace(sdev); +} +EXPORT_SYMBOL(snd_sof_trace_resume); void snd_sof_free_trace(struct snd_sof_dev *sdev) { if (!sdev->dtrace_is_supported) return; - snd_sof_release_trace(sdev); + /* release trace */ + snd_sof_release_trace(sdev, false); if (sdev->dma_trace_pages) { snd_dma_free_pages(&sdev->dmatb); From patchwork Wed Mar 30 20:19:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 555123 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5D356C433EF for ; Wed, 30 Mar 2022 20:22:37 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 906FE1AB8; Wed, 30 Mar 2022 22:21:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 906FE1AB8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671755; bh=+CWO3E0FqqR57eXIy8K3/SJkwOMxql9KJrJ5lLu4+uU=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=mtk+A0Pjn/Gsd80e9c0HMYyfHLiPyXepGtK6mdhNl6mHRVrcR2cD3dcWM8abpnKGo dZJkENt1CoQzqmdLZaK0bsOpU6fQlr47Nxwa/RLNp3KjihpMnANpmgFLJVeq355Mxd lh5GuHwvXzKlCPlmkdBP21dyjNpoO/13ZXx6DsAI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 07207F8052F; Wed, 30 Mar 2022 22:19:58 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4D0AFF8051A; Wed, 30 Mar 2022 22:19:53 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1EE8BF800F2 for ; Wed, 30 Mar 2022 22:19:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1EE8BF800F2 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="AVnOn2EW" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671586; x=1680207586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+CWO3E0FqqR57eXIy8K3/SJkwOMxql9KJrJ5lLu4+uU=; b=AVnOn2EWFapg48XzKz0LWWvbn3JpKgggYP6GotWZdmVESoDBWT1o+WOM nDaNVBBVUBTeUWIwXge3t/0dSEVJe4/KbX7o/8Bx/Vpt4Q9BawFO79SC+ FNooaeHlHT+QI4HfJBw8WlNz7goiCpG+qEb7+4ZRBjJ1OmBDFJuModcG2 cbDANNopkU/2g0EELcYx8NRs1eXDUc3IGpZGNFgfToTFZt1n+4P+TSuQy ghQUlIwC02x604M4NsK7ZYbkgq3+isEpw36mydOXc0k8TbgwFs1w5W3qg O8iyxBNtzHAs90ttN14cn8N/f+I/IHfjujJKwu12QGp/t5k6ptkEBrCXT A==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819832" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819832" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:38 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045039" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:37 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 07/11] ASoC: SOF: disable dma trace in s0ix Date: Wed, 30 Mar 2022 13:19:22 -0700 Message-Id: <20220330201926.1330402-8-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: Libin Yang , tiwai@suse.de, Ranjani Sridharan , Kai Vehmanen , broonie@kernel.org, =?utf-8?q?P?= =?utf-8?q?=C3=A9ter_Ujfalusi?= X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Libin Yang When system enters s0ix, the dma trace won't be used. Otherwise, the DMA will access the host memory, which will prevent entering S0ix. Driver has notified firmware not to send message through dma trace. Let's also trigger stop dma trace in driver side. Signed-off-by: Libin Yang Reviewed-by: Kai Vehmanen Reviewed-by: Péter Ujfalusi Signed-off-by: Ranjani Sridharan --- sound/soc/sof/pm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index a1a645a13c6d..44008dd075c2 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -102,11 +102,18 @@ static int sof_resume(struct device *dev, bool runtime_resume) /* * Nothing further to be done for platforms that support the low power - * D0 substate. + * D0 substate. Resume trace and return when resuming from + * low-power D0 substate */ if (!runtime_resume && sof_ops(sdev)->set_power_state && - old_state == SOF_DSP_PM_D0) + old_state == SOF_DSP_PM_D0) { + ret = snd_sof_trace_resume(sdev); + if (ret < 0) + /* non fatal */ + dev_warn(sdev->dev, + "failed to enable trace after resume %d\n", ret); return 0; + } sof_set_fw_state(sdev, SOF_FW_BOOT_PREPARE); @@ -201,6 +208,7 @@ static int sof_suspend(struct device *dev, bool runtime_suspend) /* Skip to platform-specific suspend if DSP is entering D0 */ if (target_state == SOF_DSP_PM_D0) { + snd_sof_trace_suspend(sdev, pm_state); /* Notify clients not managed by pm framework about core suspend */ sof_suspend_clients(sdev, pm_state); goto suspend; From patchwork Wed Mar 30 20:19:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 555122 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9556AC433F5 for ; Wed, 30 Mar 2022 20:23:12 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CA9B81AEC; Wed, 30 Mar 2022 22:22:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CA9B81AEC DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671790; bh=OqFKwt4A9we7mD2JOnrn8nl7vvqgCI6+8961qBDqWCw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FSEfs2lMv4BJtZpvUn5sA5RjxAtiFK5esM75gEb9dSB/qmOvRGVAm0KILxvPAJMPh GJzkGSeVVfvqsHGo+K9MiKSoD1dDHxGZspjiH8eAjieUfIOwCLUW/nZiur3R6fjo4Z VcX7FEp+V3s9M54iTRmE1Xq04Ey/hy8nGSYwJoGw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ECE2AF8053B; Wed, 30 Mar 2022 22:20:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 77B48F80536; Wed, 30 Mar 2022 22:19:58 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 46B48F8050F for ; Wed, 30 Mar 2022 22:19:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 46B48F8050F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="lzJUDUff" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671586; x=1680207586; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=OqFKwt4A9we7mD2JOnrn8nl7vvqgCI6+8961qBDqWCw=; b=lzJUDUffGP4wOWi951Ax49dA0SWiUtZzC/P94aucoUC3l4BtBmka0fgC nDfLXhAtnmwptJ2NE7KTg5QM+YvtvbgnujQKqGhMZ61Wcj+i/Y7Y2CVYU Y+znq6yELKTEUod+1hkCYSOedV03mp22sBI8jrS+TkOVlOisbwp7BF4uk wH4DJQu7HjA1L8b6PY2qKGUIiKLX3lnwIHOVo38rU2NYogeyrMWqi5J8l o+QEiQfnx1ecUWubm1xaYZHd09iYy/uHM2eYjlaeydHlPU0IUyQNZiDcg DfIGGSth+ppnZtdyAUX/+TIW3h1cYiyYgttVIPlGA7pxljFru08kI7xof A==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819833" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819833" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:38 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045040" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:38 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 08/11] ASoC: SOF: ipc: Use msg->reply_data directly in snd_sof_ipc_get_reply() Date: Wed, 30 Mar 2022 13:19:23 -0700 Message-Id: <20220330201926.1330402-9-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: Bard Liao , tiwai@suse.de, Peter Ujfalusi , Ranjani Sridharan , broonie@kernel.org, Daniel Baluta X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi Instead of using a local reply to first read out the header from the mailbox then memcpy it or read it again to msg->reply_data, read it directly to it's final place from the start. If we received an error we do not need to do a memcpy anymore. If the reply is reporting a success then we don not need to read the reply again from the mailbox if the reply_size equals to the already read header size. Signed-off-by: Peter Ujfalusi Reviewed-by: Daniel Baluta Reviewed-by: Bard Liao Signed-off-by: Ranjani Sridharan --- sound/soc/sof/ipc.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index c722ca0b00a6..46c40dfd9f2b 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -393,7 +393,7 @@ EXPORT_SYMBOL(sof_ipc_tx_message_no_pm); void snd_sof_ipc_get_reply(struct snd_sof_dev *sdev) { struct snd_sof_ipc_msg *msg = sdev->msg; - struct sof_ipc_reply reply; + struct sof_ipc_reply *reply; int ret = 0; /* @@ -407,13 +407,12 @@ void snd_sof_ipc_get_reply(struct snd_sof_dev *sdev) } /* get the generic reply */ - snd_sof_dsp_mailbox_read(sdev, sdev->host_box.offset, &reply, - sizeof(reply)); + reply = msg->reply_data; + snd_sof_dsp_mailbox_read(sdev, sdev->host_box.offset, reply, sizeof(*reply)); - if (reply.error < 0) { - memcpy(msg->reply_data, &reply, sizeof(reply)); - ret = reply.error; - } else if (!reply.hdr.size) { + if (reply->error < 0) { + ret = reply->error; + } else if (!reply->hdr.size) { /* Reply should always be >= sizeof(struct sof_ipc_reply) */ if (msg->reply_size) dev_err(sdev->dev, @@ -424,24 +423,27 @@ void snd_sof_ipc_get_reply(struct snd_sof_dev *sdev) ret = -EINVAL; } else if (msg->reply_size > 0) { - if (reply.hdr.size == msg->reply_size) { + if (reply->hdr.size == msg->reply_size) { ret = 0; - } else if (reply.hdr.size < msg->reply_size) { + } else if (reply->hdr.size < msg->reply_size) { dev_dbg(sdev->dev, "reply size (%u) is less than expected (%zu)\n", - reply.hdr.size, msg->reply_size); + reply->hdr.size, msg->reply_size); - msg->reply_size = reply.hdr.size; + msg->reply_size = reply->hdr.size; ret = 0; } else { dev_err(sdev->dev, "reply size (%u) exceeds the buffer size (%zu)\n", - reply.hdr.size, msg->reply_size); + reply->hdr.size, msg->reply_size); ret = -EINVAL; } - /* get the full message if reply.hdr.size <= msg->reply_size */ - if (!ret) + /* + * get the full message if reply->hdr.size <= msg->reply_size + * and the reply->hdr.size > sizeof(struct sof_ipc_reply) + */ + if (!ret && msg->reply_size > sizeof(*reply)) snd_sof_dsp_mailbox_read(sdev, sdev->host_box.offset, msg->reply_data, msg->reply_size); } From patchwork Wed Mar 30 20:19:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 556261 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EB274C433F5 for ; Wed, 30 Mar 2022 20:22:56 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2B2E61AE3; Wed, 30 Mar 2022 22:22:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2B2E61AE3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671775; bh=a/fqv2IiV7jD0KVsUmmipo1DOaRBsw1fFQV9HqWxGH8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=NdxkZe5FjTf6NLXBgztoYAOd+MMLKoTEpJG4rdGgvcgmB4FAsVoWfs8QNvoHwNLV+ 55ipBMfvjRczt9/5TVhNVgGLTSieKigvRKzcf2Oa7WZb2+qxLD+SyoJxhM6CDESyXs 55XF4htCCqTYO9KO7m+uCnT1v8uJw+MDqRSKK6WY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 61E9BF80537; Wed, 30 Mar 2022 22:20:05 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A445FF80520; Wed, 30 Mar 2022 22:19:56 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 1FD9BF80518 for ; Wed, 30 Mar 2022 22:19:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1FD9BF80518 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="DZDO8xz8" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671588; x=1680207588; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=a/fqv2IiV7jD0KVsUmmipo1DOaRBsw1fFQV9HqWxGH8=; b=DZDO8xz8BN+LKjwSazbDuQbxy93/1L3S9rFriESRZehe18UCjCSpsYxM K/rVuqfN4xs/7Vo/diR3r8GIP1lBJa4bHdObtJP+BHE/HODNjScOYw+tm lHPmsEclBToOVIxqxt6R22j/cmoI1AmcATDuD2a8RWL8jLlI7b5N08Xld NrZ4jrsjYrMAhAMW652DTLEjmPbWSTH1hJwsWm7FOf2jXUTuLaZR+7YU+ maFTQZN5TLJbaUvaAxeRnxIQj/W6djkuaUFZptBjIvPco75QPqKgtCiMz EAjT/RCxaumHKscjJQgMocdDx2FU3/6zTMPhQLJ0uurb/tUYKLJRp+JKO w==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819834" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819834" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:38 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045045" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:38 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 09/11] ASoC: SOF: Drop 'header' parameter from tx_message() API Date: Wed, 30 Mar 2022 13:19:24 -0700 Message-Id: <20220330201926.1330402-10-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, Rander Wang , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi The header parameter is not used anymore and now it can be dropped from the parameter list of tx_message(). Signed-off-by: Peter Ujfalusi Reviewed-by: Rander Wang Reviewed-by: Pierre-Louis Bossart Signed-off-by: Ranjani Sridharan --- sound/soc/sof/compress.c | 8 +++----- sound/soc/sof/debug.c | 2 +- sound/soc/sof/intel/hda-dsp.c | 8 +++----- sound/soc/sof/intel/tgl.c | 6 ++---- sound/soc/sof/ipc.c | 18 +++++++----------- sound/soc/sof/ipc3-pcm.c | 8 +++----- sound/soc/sof/ipc3-topology.c | 25 +++++++++++-------------- sound/soc/sof/ipc3.c | 4 ++-- sound/soc/sof/sof-client.c | 2 +- sound/soc/sof/sof-priv.h | 8 +++----- sound/soc/sof/trace.c | 9 +++------ 11 files changed, 39 insertions(+), 59 deletions(-) diff --git a/sound/soc/sof/compress.c b/sound/soc/sof/compress.c index a8e908e50101..47639b6344c8 100644 --- a/sound/soc/sof/compress.c +++ b/sound/soc/sof/compress.c @@ -147,8 +147,7 @@ static int sof_compr_free(struct snd_soc_component *component, stream.comp_id = spcm->stream[cstream->direction].comp_id; if (spcm->prepared[cstream->direction]) { - ret = sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, - &stream, sizeof(stream), + ret = sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply)); if (!ret) spcm->prepared[cstream->direction] = false; @@ -209,7 +208,7 @@ static int sof_compr_set_params(struct snd_soc_component *component, snd_pcm_format_physical_width(SNDRV_PCM_FORMAT_S32) >> 3; pcm.params.host_period_bytes = params->buffer.fragment_size; - ret = sof_ipc_tx_message(sdev->ipc, pcm.hdr.cmd, &pcm, sizeof(pcm), + ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm), &ipc_params_reply, sizeof(ipc_params_reply)); if (ret < 0) { dev_err(component->dev, "error ipc failed\n"); @@ -268,8 +267,7 @@ static int sof_compr_trigger(struct snd_soc_component *component, break; } - return sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, - &stream, sizeof(stream), + return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply)); } diff --git a/sound/soc/sof/debug.c b/sound/soc/sof/debug.c index 7b1139961a99..8a77245b5182 100644 --- a/sound/soc/sof/debug.c +++ b/sound/soc/sof/debug.c @@ -236,7 +236,7 @@ static int memory_info_update(struct snd_sof_dev *sdev, char *buf, size_t buff_s goto error; } - ret = sof_ipc_tx_message(sdev->ipc, msg.cmd, &msg, msg.size, reply, SOF_IPC_MSG_MAX_SIZE); + ret = sof_ipc_tx_message(sdev->ipc, &msg, msg.size, reply, SOF_IPC_MSG_MAX_SIZE); pm_runtime_mark_last_busy(sdev->dev); pm_runtime_put_autosuspend(sdev->dev); if (ret < 0 || reply->rhdr.error < 0) { diff --git a/sound/soc/sof/intel/hda-dsp.c b/sound/soc/sof/intel/hda-dsp.c index 8ddde60c56b3..ad11df345be7 100644 --- a/sound/soc/sof/intel/hda-dsp.c +++ b/sound/soc/sof/intel/hda-dsp.c @@ -363,9 +363,8 @@ static int hda_dsp_send_pm_gate_ipc(struct snd_sof_dev *sdev, u32 flags) pm_gate.flags = flags; /* send pm_gate ipc to dsp */ - return sof_ipc_tx_message_no_pm(sdev->ipc, pm_gate.hdr.cmd, - &pm_gate, sizeof(pm_gate), &reply, - sizeof(reply)); + return sof_ipc_tx_message_no_pm(sdev->ipc, &pm_gate, sizeof(pm_gate), + &reply, sizeof(reply)); } static int hda_dsp_update_d0i3c_register(struct snd_sof_dev *sdev, u8 value) @@ -985,8 +984,7 @@ int hda_dsp_core_get(struct snd_sof_dev *sdev, int core) return 0; /* Now notify DSP for secondary cores */ - ret = sof_ipc_tx_message(sdev->ipc, pm_core_config.hdr.cmd, - &pm_core_config, sizeof(pm_core_config), + ret = sof_ipc_tx_message(sdev->ipc, &pm_core_config, sizeof(pm_core_config), &pm_core_config, sizeof(pm_core_config)); if (ret < 0) { dev_err(sdev->dev, "failed to enable secondary core '%d' failed with %d\n", diff --git a/sound/soc/sof/intel/tgl.c b/sound/soc/sof/intel/tgl.c index cb1c319d5bee..72d92ff6cef5 100644 --- a/sound/soc/sof/intel/tgl.c +++ b/sound/soc/sof/intel/tgl.c @@ -35,8 +35,7 @@ static int tgl_dsp_core_get(struct snd_sof_dev *sdev, int core) return hda_dsp_enable_core(sdev, BIT(core)); /* notify DSP for secondary cores */ - return sof_ipc_tx_message(sdev->ipc, pm_core_config.hdr.cmd, - &pm_core_config, sizeof(pm_core_config), + return sof_ipc_tx_message(sdev->ipc, &pm_core_config, sizeof(pm_core_config), &pm_core_config, sizeof(pm_core_config)); } @@ -55,8 +54,7 @@ static int tgl_dsp_core_put(struct snd_sof_dev *sdev, int core) return hda_dsp_core_reset_power_down(sdev, BIT(core)); /* notify DSP for secondary cores */ - return sof_ipc_tx_message(sdev->ipc, pm_core_config.hdr.cmd, - &pm_core_config, sizeof(pm_core_config), + return sof_ipc_tx_message(sdev->ipc, &pm_core_config, sizeof(pm_core_config), &pm_core_config, sizeof(pm_core_config)); } diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c index 46c40dfd9f2b..17dd51d342cf 100644 --- a/sound/soc/sof/ipc.c +++ b/sound/soc/sof/ipc.c @@ -341,9 +341,8 @@ static int sof_ipc_tx_message_unlocked(struct snd_sof_ipc *ipc, } /* send IPC message from host to DSP */ -int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header, - void *msg_data, size_t msg_bytes, void *reply_data, - size_t reply_bytes) +int sof_ipc_tx_message(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, + void *reply_data, size_t reply_bytes) { const struct sof_dsp_power_state target_state = { .state = SOF_DSP_PM_D0, @@ -357,7 +356,7 @@ int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header, return ret; } - return sof_ipc_tx_message_no_pm(ipc, header, msg_data, msg_bytes, + return sof_ipc_tx_message_no_pm(ipc, msg_data, msg_bytes, reply_data, reply_bytes); } EXPORT_SYMBOL(sof_ipc_tx_message); @@ -367,8 +366,7 @@ EXPORT_SYMBOL(sof_ipc_tx_message); * This will be used for IPC's that can be handled by the DSP * even in a low-power D0 substate. */ -int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, u32 header, - void *msg_data, size_t msg_bytes, +int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, void *reply_data, size_t reply_bytes) { int ret; @@ -701,8 +699,7 @@ int snd_sof_ipc_stream_posn(struct snd_soc_component *scomp, stream.comp_id = spcm->stream[direction].comp_id; /* send IPC to the DSP */ - err = sof_ipc_tx_message(sdev->ipc, - stream.hdr.cmd, &stream, sizeof(stream), posn, + err = sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), posn, sizeof(*posn)); if (err < 0) { dev_err(sdev->dev, "error: failed to get stream %d position\n", @@ -893,9 +890,8 @@ int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol, bool set) /* send normal size ipc in one part */ if (cdata->rhdr.hdr.size <= SOF_IPC_MSG_MAX_SIZE) { - err = sof_ipc_tx_message(sdev->ipc, cdata->rhdr.hdr.cmd, cdata, - cdata->rhdr.hdr.size, cdata, - cdata->rhdr.hdr.size); + err = sof_ipc_tx_message(sdev->ipc, cdata, cdata->rhdr.hdr.size, + cdata, cdata->rhdr.hdr.size); if (err < 0) dev_err(sdev->dev, "error: set/get ctrl ipc comp %d\n", diff --git a/sound/soc/sof/ipc3-pcm.c b/sound/soc/sof/ipc3-pcm.c index 58b75943cf6d..d7b6c67b2180 100644 --- a/sound/soc/sof/ipc3-pcm.c +++ b/sound/soc/sof/ipc3-pcm.c @@ -34,8 +34,7 @@ static int sof_ipc3_pcm_hw_free(struct snd_soc_component *component, stream.comp_id = spcm->stream[substream->stream].comp_id; /* send IPC to the DSP */ - return sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, &stream, - sizeof(stream), &reply, sizeof(reply)); + return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply)); } static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component, @@ -119,7 +118,7 @@ static int sof_ipc3_pcm_hw_params(struct snd_soc_component *component, dev_dbg(component->dev, "stream_tag %d", pcm.params.stream_tag); /* send hw_params IPC to the DSP */ - ret = sof_ipc_tx_message(sdev->ipc, pcm.hdr.cmd, &pcm, sizeof(pcm), + ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm), &ipc_params_reply, sizeof(ipc_params_reply)); if (ret < 0) { dev_err(component->dev, "HW params ipc failed for stream %d\n", @@ -175,8 +174,7 @@ static int sof_ipc3_pcm_trigger(struct snd_soc_component *component, } /* send IPC to the DSP */ - return sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, &stream, - sizeof(stream), &reply, sizeof(reply)); + return sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply)); } static void ssp_dai_config_pcm_params_match(struct snd_sof_dev *sdev, const char *link_name, diff --git a/sound/soc/sof/ipc3-topology.c b/sound/soc/sof/ipc3-topology.c index 2f8450a8c0a1..8320c25bd221 100644 --- a/sound/soc/sof/ipc3-topology.c +++ b/sound/soc/sof/ipc3-topology.c @@ -1551,8 +1551,7 @@ static int sof_ipc3_route_setup(struct snd_sof_dev *sdev, struct snd_sof_route * sroute->sink_widget->widget->name); /* send ipc */ - ret = sof_ipc_tx_message(sdev->ipc, connect.hdr.cmd, &connect, sizeof(connect), - &reply, sizeof(reply)); + ret = sof_ipc_tx_message(sdev->ipc, &connect, sizeof(connect), &reply, sizeof(reply)); if (ret < 0) dev_err(sdev->dev, "%s: route %s -> %s failed\n", __func__, sroute->src_widget->widget->name, sroute->sink_widget->widget->name); @@ -1697,7 +1696,7 @@ static int sof_ipc3_control_free(struct snd_sof_dev *sdev, struct snd_sof_contro fcomp.id = scontrol->comp_id; /* send IPC to the DSP */ - return sof_ipc_tx_message(sdev->ipc, fcomp.hdr.cmd, &fcomp, sizeof(fcomp), NULL, 0); + return sof_ipc_tx_message(sdev->ipc, &fcomp, sizeof(fcomp), NULL, 0); } /* send pcm params ipc */ @@ -1749,7 +1748,7 @@ static int sof_ipc3_keyword_detect_pcm_params(struct snd_sof_widget *swidget, in } /* send IPC to the DSP */ - ret = sof_ipc_tx_message(sdev->ipc, pcm.hdr.cmd, &pcm, sizeof(pcm), + ret = sof_ipc_tx_message(sdev->ipc, &pcm, sizeof(pcm), &ipc_params_reply, sizeof(ipc_params_reply)); if (ret < 0) dev_err(scomp->dev, "%s: PCM params failed for %s\n", __func__, @@ -1773,8 +1772,7 @@ static int sof_ipc3_keyword_detect_trigger(struct snd_sof_widget *swidget, int c stream.comp_id = swidget->comp_id; /* send IPC to the DSP */ - ret = sof_ipc_tx_message(sdev->ipc, stream.hdr.cmd, &stream, - sizeof(stream), &reply, sizeof(reply)); + ret = sof_ipc_tx_message(sdev->ipc, &stream, sizeof(stream), &reply, sizeof(reply)); if (ret < 0) dev_err(scomp->dev, "%s: Failed to trigger %s\n", __func__, swidget->widget->name); @@ -1902,8 +1900,7 @@ static int sof_ipc3_complete_pipeline(struct snd_sof_dev *sdev, struct snd_sof_w ready.hdr.cmd = SOF_IPC_GLB_TPLG_MSG | SOF_IPC_TPLG_PIPE_COMPLETE; ready.comp_id = swidget->comp_id; - ret = sof_ipc_tx_message(sdev->ipc, ready.hdr.cmd, &ready, sizeof(ready), &reply, - sizeof(reply)); + ret = sof_ipc_tx_message(sdev->ipc, &ready, sizeof(ready), &reply, sizeof(reply)); if (ret < 0) return ret; @@ -1939,7 +1936,7 @@ static int sof_ipc3_widget_free(struct snd_sof_dev *sdev, struct snd_sof_widget break; } - ret = sof_ipc_tx_message(sdev->ipc, ipc_free.hdr.cmd, &ipc_free, sizeof(ipc_free), + ret = sof_ipc_tx_message(sdev->ipc, &ipc_free, sizeof(ipc_free), &reply, sizeof(reply)); if (ret < 0) dev_err(sdev->dev, "failed to free widget %s\n", swidget->widget->name); @@ -2003,7 +2000,7 @@ static int sof_ipc3_dai_config(struct snd_sof_dev *sdev, struct snd_sof_widget * /* only send the IPC if the widget is set up in the DSP */ if (swidget->use_count > 0) { - ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size, + ret = sof_ipc_tx_message(sdev->ipc, config, config->hdr.size, &reply, sizeof(reply)); if (ret < 0) dev_err(sdev->dev, "Failed to set dai config for %s\n", dai->name); @@ -2028,7 +2025,7 @@ static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget struct sof_dai_private_data *dai_data = dai->private; struct sof_ipc_comp *comp = &dai_data->comp_dai->comp; - ret = sof_ipc_tx_message(sdev->ipc, comp->hdr.cmd, dai_data->comp_dai, + ret = sof_ipc_tx_message(sdev->ipc, dai_data->comp_dai, comp->hdr.size, &reply, sizeof(reply)); break; } @@ -2037,8 +2034,8 @@ static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget struct sof_ipc_pipe_new *pipeline; pipeline = swidget->private; - ret = sof_ipc_tx_message(sdev->ipc, pipeline->hdr.cmd, pipeline, - sizeof(*pipeline), &reply, sizeof(reply)); + ret = sof_ipc_tx_message(sdev->ipc, pipeline, sizeof(*pipeline), + &reply, sizeof(reply)); break; } default: @@ -2046,7 +2043,7 @@ static int sof_ipc3_widget_setup(struct snd_sof_dev *sdev, struct snd_sof_widget struct sof_ipc_cmd_hdr *hdr; hdr = swidget->private; - ret = sof_ipc_tx_message(sdev->ipc, hdr->cmd, swidget->private, hdr->size, + ret = sof_ipc_tx_message(sdev->ipc, swidget->private, hdr->size, &reply, sizeof(reply)); break; } diff --git a/sound/soc/sof/ipc3.c b/sound/soc/sof/ipc3.c index 03e914b62728..a7289804efda 100644 --- a/sound/soc/sof/ipc3.c +++ b/sound/soc/sof/ipc3.c @@ -19,8 +19,8 @@ static int sof_ipc3_ctx_ipc(struct snd_sof_dev *sdev, int cmd) struct sof_ipc_reply reply; /* send ctx save ipc to dsp */ - return sof_ipc_tx_message(sdev->ipc, pm_ctx.hdr.cmd, &pm_ctx, - sizeof(pm_ctx), &reply, sizeof(reply)); + return sof_ipc_tx_message(sdev->ipc, &pm_ctx, sizeof(pm_ctx), + &reply, sizeof(reply)); } static int sof_ipc3_ctx_save(struct snd_sof_dev *sdev) diff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c index 686ad0c3bb61..5fb3eb21bf7d 100644 --- a/sound/soc/sof/sof-client.c +++ b/sound/soc/sof/sof-client.c @@ -247,7 +247,7 @@ int sof_client_ipc_tx_message(struct sof_client_dev *cdev, void *ipc_msg, { struct sof_ipc_cmd_hdr *hdr = ipc_msg; - return sof_ipc_tx_message(cdev->sdev->ipc, hdr->cmd, ipc_msg, hdr->size, + return sof_ipc_tx_message(cdev->sdev->ipc, ipc_msg, hdr->size, reply_data, reply_bytes); } EXPORT_SYMBOL_NS_GPL(sof_client_ipc_tx_message, SND_SOC_SOF_CLIENT); diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index 0fb1db0ed7cd..fd815ae7f20a 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -584,11 +584,9 @@ void snd_sof_ipc_get_reply(struct snd_sof_dev *sdev); void snd_sof_ipc_reply(struct snd_sof_dev *sdev, u32 msg_id); void snd_sof_ipc_msgs_rx(struct snd_sof_dev *sdev); int snd_sof_ipc_valid(struct snd_sof_dev *sdev); -int sof_ipc_tx_message(struct snd_sof_ipc *ipc, u32 header, - void *msg_data, size_t msg_bytes, void *reply_data, - size_t reply_bytes); -int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, u32 header, - void *msg_data, size_t msg_bytes, +int sof_ipc_tx_message(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, + void *reply_data, size_t reply_bytes); +int sof_ipc_tx_message_no_pm(struct snd_sof_ipc *ipc, void *msg_data, size_t msg_bytes, void *reply_data, size_t reply_bytes); int sof_ipc_init_msg_memory(struct snd_sof_dev *sdev); static inline void snd_sof_ipc_process_reply(struct snd_sof_dev *sdev, u32 msg_id) diff --git a/sound/soc/sof/trace.c b/sound/soc/sof/trace.c index 26d9381596ff..ba6361b5d64b 100644 --- a/sound/soc/sof/trace.c +++ b/sound/soc/sof/trace.c @@ -152,8 +152,7 @@ static int sof_ipc_trace_update_filter(struct snd_sof_dev *sdev, int num_elems, dev_err(sdev->dev, "error: enabling device failed: %d\n", ret); goto error; } - ret = sof_ipc_tx_message(sdev->ipc, msg->hdr.cmd, msg, msg->hdr.size, - &reply, sizeof(reply)); + ret = sof_ipc_tx_message(sdev->ipc, msg, msg->hdr.size, &reply, sizeof(reply)); pm_runtime_mark_last_busy(sdev->dev); pm_runtime_put_autosuspend(sdev->dev); @@ -430,9 +429,7 @@ static int snd_sof_enable_trace(struct snd_sof_dev *sdev) dev_dbg(sdev->dev, "%s: stream_tag: %d\n", __func__, params.stream_tag); /* send IPC to the DSP */ - ret = sof_ipc_tx_message(sdev->ipc, - params.hdr.cmd, ¶ms, sizeof(params), - &ipc_reply, sizeof(ipc_reply)); + ret = sof_ipc_tx_message(sdev->ipc, ¶ms, sizeof(params), &ipc_reply, sizeof(ipc_reply)); if (ret < 0) { dev_err(sdev->dev, "error: can't set params for DMA for trace %d\n", ret); @@ -575,7 +572,7 @@ static void snd_sof_release_trace(struct snd_sof_dev *sdev, bool only_stop) hdr.size = sizeof(hdr); hdr.cmd = SOF_IPC_GLB_TRACE_MSG | SOF_IPC_TRACE_DMA_FREE; - ret = sof_ipc_tx_message(sdev->ipc, hdr.cmd, &hdr, hdr.size, + ret = sof_ipc_tx_message(sdev->ipc, &hdr, hdr.size, &ipc_reply, sizeof(ipc_reply)); if (ret < 0) dev_err(sdev->dev, "DMA_TRACE_FREE failed with error: %d\n", ret); From patchwork Wed Mar 30 20:19:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 555121 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C75D7C433F5 for ; Wed, 30 Mar 2022 20:23:46 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id EF14B16DE; Wed, 30 Mar 2022 22:22:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EF14B16DE DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671825; bh=4BnXKvZKuSID7h2I+0QNQw18nHyoNl3kL/EGdhEs0G8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=KhAhvhEqcOO0n6cHiDYi2q/ppoFexg3iI/LkUj+wgOeLnHWptRcaeemYXMcDVCHGW 4hZZYJtD+bBsB9Up++N7l4i7KWtMZl/CVG81vXG+e4LvwAOYtR4hMrZQMsKoEHGJwq 35yVokMLEewRVOhxLW4AxiQfaBzW5Mmm2Tg6DB1Y= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 2F005F80549; Wed, 30 Mar 2022 22:20:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id E3329F80536; Wed, 30 Mar 2022 22:19:58 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 64914F80519 for ; Wed, 30 Mar 2022 22:19:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 64914F80519 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CYPHQWVO" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671588; x=1680207588; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=4BnXKvZKuSID7h2I+0QNQw18nHyoNl3kL/EGdhEs0G8=; b=CYPHQWVOlfAtRhvhe/YWNfZzApkrpWK7l98MJLw0dvmFli+gQPUyU7y9 R5h7St2TXqv2ykvrClkPRQZBQkE0PTviWsklaWKLPQ0D7M+xdkItcTl2A oYfQCL/ZFHkinTSjYvdTwMC/sxnVnVvFe5TTmsaya1vNUOyQ3ZvCGTOPv CqzkxHEhfXmSTbUM/qy55132xmV4IFlhEHjYEFR4DqchmxJwDW8N+vkbR NA4ZZrVYUFKodNSSTUTnLpZz9x8qLu+gTthHLUQwgM3dZxoEfPr5SsVRD BHQlSiJnBMyOopdZ+0W4l0Tx299kl6V1P+jZF31VzVue9YBnrLOgSQjZ/ A==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819835" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819835" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:39 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045048" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:38 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 10/11] ASoC: SOF: Remove header from struct snd_sof_ipc_msg Date: Wed, 30 Mar 2022 13:19:25 -0700 Message-Id: <20220330201926.1330402-11-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, Ranjani Sridharan , Pierre-Louis Bossart , broonie@kernel.org, Rander Wang , Peter Ujfalusi X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Peter Ujfalusi The header field is no longer used by the underlying code and can be dropped from the snd_sof_ipc_msg struct. Signed-off-by: Peter Ujfalusi Reviewed-by: Rander Wang Reviewed-by: Pierre-Louis Bossart Signed-off-by: Ranjani Sridharan --- sound/soc/sof/sof-priv.h | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/sof/sof-priv.h b/sound/soc/sof/sof-priv.h index fd815ae7f20a..414413932b06 100644 --- a/sound/soc/sof/sof-priv.h +++ b/sound/soc/sof/sof-priv.h @@ -349,7 +349,6 @@ struct snd_sof_mailbox { /* IPC message descriptor for host <-> DSP IO */ struct snd_sof_ipc_msg { /* message data */ - u32 header; void *msg_data; void *reply_data; size_t msg_size; From patchwork Wed Mar 30 20:19:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 556259 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DD230C433EF for ; Wed, 30 Mar 2022 20:24:03 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 163F61AE2; Wed, 30 Mar 2022 22:23:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 163F61AE2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1648671842; bh=q3y09Q4+2MYqqMm3rWuuzbvhMnK3N+8P3Skff+My+Cw=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=aba49CAkecmZrY9EcJfNDlRp90oF397C4ol1IkNkZbI6SOkZDdJN+EoOq6iBvfYBR Adc3hEX872zGjqfTxXHDy8kaGKZhsFoS+qOU3AeGlcUemTQ2dB3V0ATJr3U3T9GyEt BhSikigDex+6kdXb+kjamCpdHmqPCfuIggKEtCTA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id BF4E6F80553; Wed, 30 Mar 2022 22:20:07 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C1826F80537; Wed, 30 Mar 2022 22:19:59 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8AF0AF8051B for ; Wed, 30 Mar 2022 22:19:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8AF0AF8051B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="gte5sARB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1648671588; x=1680207588; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q3y09Q4+2MYqqMm3rWuuzbvhMnK3N+8P3Skff+My+Cw=; b=gte5sARBmBeIcU/DXPSvU7Od8Do0mlPWmLSeJOxevVqpKhCmjw/1JGX5 HpA/7FYjj688O2h+ob3KKwo+C1eyUNF8V20vm7eZKQtKTrL1Uq+J3y22z wkPgH+YTACfRunjHGU2hfB/dVRxaeYKyjRknBnQU65QFmYsOo9y57tf8j WtwEIl2TzTUJGuRond8subpujcVrQ2v+rR1ITtP6WOrFXJSner31N6Ccr N4p2ATVDodqNHUSTSw/AkLStWOwAszWm5wkcf4ebQwdLDPA763PJX/Xh2 f8utv8iJ1z0KaOPSK23sGYc3UDfxZAsnRfvSkWNvl5YGuVqlyUPjuvPMD g==; X-IronPort-AV: E=McAfee;i="6200,9189,10302"; a="322819836" X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="322819836" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:39 -0700 X-IronPort-AV: E=Sophos;i="5.90,223,1643702400"; d="scan'208";a="522045049" Received: from ggunnam-mobl.amr.corp.intel.com (HELO rsridh2-mobl1.localdomain) ([10.254.28.195]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 30 Mar 2022 13:19:39 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Subject: [PATCH 11/11] ASoC: SOF: Remove redundant return statements Date: Wed, 30 Mar 2022 13:19:26 -0700 Message-Id: <20220330201926.1330402-12-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> References: <20220330201926.1330402-1-ranjani.sridharan@linux.intel.com> MIME-Version: 1.0 Cc: tiwai@suse.de, tangmeng , =?utf-8?q?P=C3=A9ter_U?= =?utf-8?q?jfalusi?= , Pierre-Louis Bossart , Ranjani Sridharan , broonie@kernel.org, Daniel Baluta X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: tangmeng After the free PCM action is executed, no matter what the return result is, it will return directly in sof_pcm_trigger. So the return statement here is redundant. Signed-off-by: tangmeng Reviewed-by: Pierre-Louis Bossart Reviewed-by: Daniel Baluta Reviewed-by: Péter Ujfalusi Signed-off-by: Ranjani Sridharan --- sound/soc/sof/pcm.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/sound/soc/sof/pcm.c b/sound/soc/sof/pcm.c index 658cd8966c9a..b5cbc8b5c0ee 100644 --- a/sound/soc/sof/pcm.c +++ b/sound/soc/sof/pcm.c @@ -347,12 +347,9 @@ static int sof_pcm_trigger(struct snd_soc_component *component, snd_sof_pcm_platform_trigger(sdev, substream, cmd); /* free PCM if reset_hw_params is set and the STOP IPC is successful */ - if (!ret && reset_hw_params) { + if (!ret && reset_hw_params) ret = sof_pcm_stream_free(sdev, substream, spcm, substream->stream, free_widget_list); - if (ret < 0) - return ret; - } return ret; }