From patchwork Fri May 6 13:26:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 570480 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 79AF1C433EF for ; Fri, 6 May 2022 13:27: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 EC05017DA; Fri, 6 May 2022 15:26:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EC05017DA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1651843655; bh=aAEPPHDWwvX/VSKkKZmrL+J1KgB/XxUHKZUmMwhq6Yk=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Bayp+YCRfd5WLy2hEwk6mE1ZHCWCeLsFXfZ4W4yxJEIT0sfVZR89PTCt3HJqtFGPa bWfjYZwQHYOga2X6WOfAc6G7xaxqmWUzp3nJWI75/DvJjsnpYsR4SxSrMv2sOG86Ar qVoie6MUS9MZDm6O/EU91eafp8FYzKyExXXKRvwM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6611DF8012F; Fri, 6 May 2022 15:26:44 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A152BF8012F; Fri, 6 May 2022 15:26:42 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 D844CF8012F for ; Fri, 6 May 2022 15:26:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D844CF8012F Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="GXPecVw3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651843597; x=1683379597; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=aAEPPHDWwvX/VSKkKZmrL+J1KgB/XxUHKZUmMwhq6Yk=; b=GXPecVw3Ehsm5f2K7U5GiM5W6gpNoTVOT5GWeiukC0gwU7NKSlUegBZ7 djPSm9FLGxmSspWRnNzU4Yh1KDsG5j499BY4YjMgIOJRZ6Rr+QRzwH8fi Iy7eYARlMUWcZNnkhJMEWJc8hHYXq/+0caVx9yRjx30oHBXyM8UGfQXEY Jhf8FCgI2QpnXXLMRvqqUCBvtvIoO8z8bETf/K4MTgrxSGrV08l1ZylgH jWYUOtgL575mo4O9at8E+JV6qJ0TPtia1QRbMkjYSR1K94kwbdh9C8nuk SCMD6Lgr4dZV3njB7zrRUd6TyfJpZkhbj9Zgg2sr0k4Ni1ANOGNOoJIso w==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="293672787" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="293672787" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:30 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="585971560" Received: from oelagadx-mobl2.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.61.230]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:27 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.intel.com, yung-chuan.liao@linux.intel.com, rander.wang@intel.com Subject: [PATCH 1/8] ASoC: SOF: sof-client: Add API to get the maximum IPC payload size Date: Fri, 6 May 2022 16:26:40 +0300 Message-Id: <20220506132647.18690-2-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> References: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, daniel.baluta@nxp.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com 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" Provide a way for the client drivers to query the maximum payload size of an IPC message. Currently clients do not have access to this information and they can only use the SOF_IPC_MSG_MAX_SIZE defined value. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao --- sound/soc/sof/sof-client.c | 8 ++++++++ sound/soc/sof/sof-client.h | 1 + 2 files changed, 9 insertions(+) diff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c index 5fb3eb21bf7d..18839a8a03c3 100644 --- a/sound/soc/sof/sof-client.c +++ b/sound/soc/sof/sof-client.c @@ -319,6 +319,14 @@ const struct sof_ipc_fw_version *sof_client_get_fw_version(struct sof_client_dev } EXPORT_SYMBOL_NS_GPL(sof_client_get_fw_version, SND_SOC_SOF_CLIENT); +size_t sof_client_get_ipc_max_payload_size(struct sof_client_dev *cdev) +{ + struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev); + + return sdev->ipc->max_payload_size; +} +EXPORT_SYMBOL_NS_GPL(sof_client_get_ipc_max_payload_size, SND_SOC_SOF_CLIENT); + /* module refcount management of SOF core */ int sof_client_core_module_get(struct sof_client_dev *cdev) { diff --git a/sound/soc/sof/sof-client.h b/sound/soc/sof/sof-client.h index 4b6394b4c694..4b5787156775 100644 --- a/sound/soc/sof/sof-client.h +++ b/sound/soc/sof/sof-client.h @@ -41,6 +41,7 @@ int sof_client_ipc_tx_message(struct sof_client_dev *cdev, void *ipc_msg, struct dentry *sof_client_get_debugfs_root(struct sof_client_dev *cdev); struct device *sof_client_get_dma_dev(struct sof_client_dev *cdev); const struct sof_ipc_fw_version *sof_client_get_fw_version(struct sof_client_dev *cdev); +size_t sof_client_get_ipc_max_payload_size(struct sof_client_dev *cdev); /* module refcount management of SOF core */ int sof_client_core_module_get(struct sof_client_dev *cdev); From patchwork Fri May 6 13:26:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 570478 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 32C5CC433EF for ; Fri, 6 May 2022 13:28:53 +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 570A61833; Fri, 6 May 2022 15:28:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 570A61833 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1651843731; bh=/Pdal9RU5tC2GH2TCscjt8n2KqTBGqMIAUIDOy9HIYM=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=i5krVVPgdWqPBFy9tlqNJaQNc7Y3sZQvNfGRXLd6Pp4Ybi6FbvpQv7TU42hiV9C24 N17xljSC6fMk8nOmDdy+GaC1vrZc8xjwmDPjCRS1khQ7PZJaGX9VAu3iiI9hRiDXRz KBFaPr1cC+xFszA4phkB4Sr3mO/chvZZJTM6+Ct8= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 1F37DF80526; Fri, 6 May 2022 15:26:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 203AFF8025C; Fri, 6 May 2022 15:26:49 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 92846F8014B for ; Fri, 6 May 2022 15:26:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 92846F8014B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="kXcxE2c3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651843600; x=1683379600; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/Pdal9RU5tC2GH2TCscjt8n2KqTBGqMIAUIDOy9HIYM=; b=kXcxE2c3tp0SUpMQY/+84NjVv9zo30VImUCc1pdKyJz/8E21GfiAqZe3 +AjHCxsOekdRiutnlIKVH5qMtJXL/vQTnOalGXd+19lQn5isuzJAghvD7 Nh/vKZ188O3j+G99EeZxCPApdLVG0O4v/EXECY2CnYpApoME3CkxmMQoG lsvG3tKMTHGU+LEB8ogamV02dROQ1eksM+1JGzJWrUeEhVyXEuVhaCm03 IOZN9onIg+OEYd2FfX/zeBqaZkxaRB49X8IXXzotuHS+uwFhpv6CY5yoI mjqo06WQPs8894IQOC9N5/GAHsUtgbK2xeqo5aqLfSFZalKxO9B7k+3xO g==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="293672798" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="293672798" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:33 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="585971575" Received: from oelagadx-mobl2.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.61.230]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:30 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.intel.com, yung-chuan.liao@linux.intel.com, rander.wang@intel.com Subject: [PATCH 2/8] ASoC: SOF: ipc-msg-injector: Query the maximum IPC payload size Date: Fri, 6 May 2022 16:26:41 +0300 Message-Id: <20220506132647.18690-3-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> References: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, daniel.baluta@nxp.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com 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" Instead of using the SOF_IPC_MSG_MAX_SIZE as the maximum payload size for and IPC message, use the provided API to query it. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao --- sound/soc/sof/sof-client-ipc-msg-injector.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/sound/soc/sof/sof-client-ipc-msg-injector.c b/sound/soc/sof/sof-client-ipc-msg-injector.c index c711981187aa..19bb6212cb56 100644 --- a/sound/soc/sof/sof-client-ipc-msg-injector.c +++ b/sound/soc/sof/sof-client-ipc-msg-injector.c @@ -22,6 +22,7 @@ struct sof_msg_inject_priv { struct dentry *dfs_file; + size_t max_msg_size; void *tx_buffer; void *rx_buffer; @@ -78,7 +79,7 @@ static ssize_t sof_msg_inject_dfs_write(struct file *file, const char __user *bu if (*ppos) return 0; - size = simple_write_to_buffer(priv->tx_buffer, SOF_IPC_MSG_MAX_SIZE, + size = simple_write_to_buffer(priv->tx_buffer, priv->max_msg_size, ppos, buffer, count); if (size != count) return size > 0 ? -EFAULT : size; @@ -90,9 +91,9 @@ static ssize_t sof_msg_inject_dfs_write(struct file *file, const char __user *bu } /* send the message */ - memset(priv->rx_buffer, 0, SOF_IPC_MSG_MAX_SIZE); + memset(priv->rx_buffer, 0, priv->max_msg_size); ret = sof_client_ipc_tx_message(cdev, priv->tx_buffer, priv->rx_buffer, - SOF_IPC_MSG_MAX_SIZE); + priv->max_msg_size); pm_runtime_mark_last_busy(dev); err = pm_runtime_put_autosuspend(dev); if (err < 0) @@ -135,8 +136,9 @@ static int sof_msg_inject_probe(struct auxiliary_device *auxdev, if (!priv) return -ENOMEM; - priv->tx_buffer = devm_kmalloc(dev, SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL); - priv->rx_buffer = devm_kzalloc(dev, SOF_IPC_MSG_MAX_SIZE, GFP_KERNEL); + priv->max_msg_size = sof_client_get_ipc_max_payload_size(cdev); + priv->tx_buffer = devm_kmalloc(dev, priv->max_msg_size, GFP_KERNEL); + priv->rx_buffer = devm_kzalloc(dev, priv->max_msg_size, GFP_KERNEL); if (!priv->tx_buffer || !priv->rx_buffer) return -ENOMEM; From patchwork Fri May 6 13:26:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 570479 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 6BE49C433F5 for ; Fri, 6 May 2022 13:28:27 +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 990A717F2; Fri, 6 May 2022 15:27:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 990A717F2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1651843705; bh=/n5ueKTd1X5snYFEwBDmgkQQR2X8QmPCGLPArljBqA8=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZY2fl4f6NIuW50HR30bN7CjlpiB+LficGzCVYc9kEeEOwJdIayYYd79CcXemuLR3g o+4eSzc5T0nnA83sYZA6aEX92kukYDHamLa8dPnJT5AUJBPpNG47C+Ibcl0QUnjwk0 Hfzcb4omQwUKU6gEB7prw4Ub0gIbuak+LNSiDv5U= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ECAEAF80508; Fri, 6 May 2022 15:26:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 28A7CF800F0; Fri, 6 May 2022 15:26:48 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 8357FF801D5 for ; Fri, 6 May 2022 15:26:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8357FF801D5 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="OyiEIwkX" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651843602; x=1683379602; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=/n5ueKTd1X5snYFEwBDmgkQQR2X8QmPCGLPArljBqA8=; b=OyiEIwkXI+Gfaudr4sJvS9iVwR6qiyKsxYSPgM+/+cBEzrsHs44lGGbR Z/8Xv/d0FjhZaiy0k/39o4AM9YaBCMKQhy4nhSmuyHNSVJekm/rioPLBq xh7wfWjUnepZ95hiTZLRGKqsopFzdBBLNtLS1xgnKpDcsuv6FZo/wljfM i4BYppInZ+igV44Fa+CD+jD7d2OADilqy5umBsNnNx+DNy8oMmGk4rHG0 DrCtkDAZ1erdQBiWB9qn42KQD04hhgJf4+/nVr+kGBodx0PfFKkc7UqrH GEOIO3F8rt2Gg1ENC0IVOZS8mchu6ZltvSxjuf363PnfvN5eylGlVvlJp w==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="293672814" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="293672814" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:39 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="585971597" Received: from oelagadx-mobl2.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.61.230]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:36 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.intel.com, yung-chuan.liao@linux.intel.com, rander.wang@intel.com Subject: [PATCH 4/8] ASoC: SOF: sof-client: Add API to get the ipc_type Date: Fri, 6 May 2022 16:26:43 +0300 Message-Id: <20220506132647.18690-5-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> References: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, daniel.baluta@nxp.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com 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" Provide a way for the client drivers to query the ipc_type used by the firmware. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao --- sound/soc/sof/sof-client.c | 8 ++++++++ sound/soc/sof/sof-client.h | 1 + 2 files changed, 9 insertions(+) diff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c index 18839a8a03c3..ce002815aa44 100644 --- a/sound/soc/sof/sof-client.c +++ b/sound/soc/sof/sof-client.c @@ -327,6 +327,14 @@ size_t sof_client_get_ipc_max_payload_size(struct sof_client_dev *cdev) } EXPORT_SYMBOL_NS_GPL(sof_client_get_ipc_max_payload_size, SND_SOC_SOF_CLIENT); +enum sof_ipc_type sof_client_get_ipc_type(struct sof_client_dev *cdev) +{ + struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev); + + return sdev->pdata->ipc_type; +} +EXPORT_SYMBOL_NS_GPL(sof_client_get_ipc_type, SND_SOC_SOF_CLIENT); + /* module refcount management of SOF core */ int sof_client_core_module_get(struct sof_client_dev *cdev) { diff --git a/sound/soc/sof/sof-client.h b/sound/soc/sof/sof-client.h index 4b5787156775..46b215d9200f 100644 --- a/sound/soc/sof/sof-client.h +++ b/sound/soc/sof/sof-client.h @@ -42,6 +42,7 @@ struct dentry *sof_client_get_debugfs_root(struct sof_client_dev *cdev); struct device *sof_client_get_dma_dev(struct sof_client_dev *cdev); const struct sof_ipc_fw_version *sof_client_get_fw_version(struct sof_client_dev *cdev); size_t sof_client_get_ipc_max_payload_size(struct sof_client_dev *cdev); +enum sof_ipc_type sof_client_get_ipc_type(struct sof_client_dev *cdev); /* module refcount management of SOF core */ int sof_client_core_module_get(struct sof_client_dev *cdev); From patchwork Fri May 6 13:26:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 570477 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 B5EB3C433EF for ; Fri, 6 May 2022 13:29:27 +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 ECCB61811; Fri, 6 May 2022 15:28:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz ECCB61811 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1651843766; bh=81ICnZrTHXX+1gQbGHLXKeCze0vykeEgh03pU+8j26Y=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=qeQjFHQej9ifVxltkreuT0Ao9fe76VueFBLCkgsljaWmPsaISmeKfmLrRDEfACZnX jXYhj91xiwB9jhRODZMkMHGxo9xsczSGKoNnhH6PxzfQnVg2bzDMSyz4872LdyAF2v 3ZpJppZT1yo8tn5P0x73Lqv+x/BINS/BS16fBjPg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3C822F80539; Fri, 6 May 2022 15:26:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EDC63F80506; Fri, 6 May 2022 15:26:52 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 9CC11F80506 for ; Fri, 6 May 2022 15:26:43 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9CC11F80506 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="CBoRN4Lk" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651843604; x=1683379604; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=81ICnZrTHXX+1gQbGHLXKeCze0vykeEgh03pU+8j26Y=; b=CBoRN4Lk0Np/cKjooZ6QKjK7Qbb/GZTtFtafceFmJ8UPmVKukLyOHI3z vuh/7GLDbtIDUUraw4SYL+YvyR0b7MLBIBGHKyoaXrxUgHdtRuKVXylYO jZtDoGVS8AYlF4FSqjVylVxTYRkbCJkoDis+KtiufdQl1jXs1B5koqAOk x5EqwViUGssaNXJyjGBA5lukt5tG/79+IAgQJoM1Hi2B0Gbmi8+MZcTIu BaJpd8Nc3cEQZVk4gFMvUKUfegh4LOKWPWzmNwlOd+LN2B5FyCCOI90b6 KkoPCP0lQrmQsuKDvUjUgcEhWLKmtFxIUFIRpi+Td++hAYYUijLFvipZm Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="293672824" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="293672824" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:42 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="585971606" Received: from oelagadx-mobl2.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.61.230]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:39 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.intel.com, yung-chuan.liao@linux.intel.com, rander.wang@intel.com Subject: [PATCH 5/8] ASoC: SOF: sof-client: Add support IPC4 message sending Date: Fri, 6 May 2022 16:26:44 +0300 Message-Id: <20220506132647.18690-6-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> References: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, daniel.baluta@nxp.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com 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" In order to be able to send an IPC4 message, the sof_client_ipc_tx_message() needs to parse the tx message differently to extract the size. The IPC notification registration is done by providing the notification type and the whole message is passed to the client when a match is found. Signed-off-by: Peter Ujfalusi Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan Reviewed-by: Bard Liao --- sound/soc/sof/sof-client.c | 47 +++++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) diff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c index ce002815aa44..a664e0eb81fe 100644 --- a/sound/soc/sof/sof-client.c +++ b/sound/soc/sof/sof-client.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "ops.h" #include "sof-client.h" #include "sof-priv.h" @@ -245,10 +246,19 @@ EXPORT_SYMBOL_NS_GPL(sof_client_dev_unregister, SND_SOC_SOF_CLIENT); int sof_client_ipc_tx_message(struct sof_client_dev *cdev, void *ipc_msg, void *reply_data, size_t reply_bytes) { - struct sof_ipc_cmd_hdr *hdr = ipc_msg; + if (cdev->sdev->pdata->ipc_type == SOF_IPC) { + struct sof_ipc_cmd_hdr *hdr = ipc_msg; - return sof_ipc_tx_message(cdev->sdev->ipc, ipc_msg, hdr->size, - reply_data, reply_bytes); + return sof_ipc_tx_message(cdev->sdev->ipc, ipc_msg, hdr->size, + reply_data, reply_bytes); + } else if (cdev->sdev->pdata->ipc_type == SOF_INTEL_IPC4) { + struct sof_ipc4_msg *msg = ipc_msg; + + return sof_ipc_tx_message(cdev->sdev->ipc, ipc_msg, msg->data_size, + reply_data, reply_bytes); + } + + return -EINVAL; } EXPORT_SYMBOL_NS_GPL(sof_client_ipc_tx_message, SND_SOC_SOF_CLIENT); @@ -358,9 +368,22 @@ EXPORT_SYMBOL_NS_GPL(sof_client_core_module_put, SND_SOC_SOF_CLIENT); /* IPC event handling */ void sof_client_ipc_rx_dispatcher(struct snd_sof_dev *sdev, void *msg_buf) { - struct sof_ipc_cmd_hdr *hdr = msg_buf; - u32 msg_type = hdr->cmd & SOF_GLB_TYPE_MASK; struct sof_ipc_event_entry *event; + u32 msg_type; + + if (sdev->pdata->ipc_type == SOF_IPC) { + struct sof_ipc_cmd_hdr *hdr = msg_buf; + + msg_type = hdr->cmd & SOF_GLB_TYPE_MASK; + } else if (sdev->pdata->ipc_type == SOF_INTEL_IPC4) { + struct sof_ipc4_msg *msg = msg_buf; + + msg_type = SOF_IPC4_NOTIFICATION_TYPE_GET(msg->primary); + } else { + dev_dbg_once(sdev->dev, "%s: Not supported IPC version: %d\n", + __func__, sdev->pdata->ipc_type); + return; + } mutex_lock(&sdev->client_event_handler_mutex); @@ -379,9 +402,21 @@ int sof_client_register_ipc_rx_handler(struct sof_client_dev *cdev, struct snd_sof_dev *sdev = sof_client_dev_to_sof_dev(cdev); struct sof_ipc_event_entry *event; - if (!callback || !(ipc_msg_type & SOF_GLB_TYPE_MASK)) + if (!callback) return -EINVAL; + if (cdev->sdev->pdata->ipc_type == SOF_IPC) { + if (!(ipc_msg_type & SOF_GLB_TYPE_MASK)) + return -EINVAL; + } else if (cdev->sdev->pdata->ipc_type == SOF_INTEL_IPC4) { + if (!(ipc_msg_type & SOF_IPC4_NOTIFICATION_TYPE_MASK)) + return -EINVAL; + } else { + dev_warn(sdev->dev, "%s: Not supported IPC version: %d\n", + __func__, sdev->pdata->ipc_type); + return -EINVAL; + } + event = kmalloc(sizeof(*event), GFP_KERNEL); if (!event) return -ENOMEM; From patchwork Fri May 6 13:26:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Ujfalusi X-Patchwork-Id: 570476 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 F27FDC433F5 for ; Fri, 6 May 2022 13:30:01 +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 2A85A1705; Fri, 6 May 2022 15:29:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2A85A1705 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1651843800; bh=WelG1cOSLJCohTRvLqWmqQGxEOibZNxF4DfVwNmPjTg=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=RMBK9JnbCR0hF34wAKVpMvkgoJV0C8GvPzJJbKOoAUL5kn5CnlUi9Xymes1IP1Kcm 97xuBfmoDSQ+25Em76PJMzWyfCP8SML0q2Xphj+s8b1fNZSYCr7p2YEAphUou7yOSI L5EkN87qbCNoqcPXkZMa7taZmrjneHwsmoxkNfrg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 4F474F80543; Fri, 6 May 2022 15:27:01 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 6503CF80529; Fri, 6 May 2022 15:26:59 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) (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 5FDA9F8053B for ; Fri, 6 May 2022 15:26:54 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5FDA9F8053B Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="ZH2noUHg" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1651843615; x=1683379615; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WelG1cOSLJCohTRvLqWmqQGxEOibZNxF4DfVwNmPjTg=; b=ZH2noUHgGgBf8dVIEVAHCHANcCUZ+SGxvMi+nITNnWh4spd03aRgEcql F0y9IBSeQ5auwl2rC4j18I8a6UG3LjX6JUEFhQ/uAahLmWS+XucrMLXi/ W9w6jEnLhpYVfGS5uBA3fVVm83a70ghIt3Nkly+gtXFT37KzS4A1j61oy EQ888ITdSit7iov6ePc23wnFwUxE6+pxGq2DyIUN/UKze2REJLD5WCz+G SUhr0s5FUjKIynXM8NK6JKC6ECFaUCoalkojv3dBOodw+ymcdxFks8g2a vbrwIeQ9TamWMeoFJ1CuBIBf/8U9QjpRn4p42laVVuLZRtZT7rcqgXwyU Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10339"; a="293672844" X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="293672844" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:51 -0700 X-IronPort-AV: E=Sophos;i="5.91,203,1647327600"; d="scan'208";a="585971631" Received: from oelagadx-mobl2.ger.corp.intel.com (HELO pujfalus-desk.ger.corp.intel.com) ([10.252.61.230]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 May 2022 06:26:48 -0700 From: Peter Ujfalusi To: lgirdwood@gmail.com, broonie@kernel.org, pierre-louis.bossart@linux.intel.com, yung-chuan.liao@linux.intel.com, rander.wang@intel.com Subject: [PATCH 8/8] ASoC: SOF: sof-client: IPC flood test can only work with SOF_IPC Date: Fri, 6 May 2022 16:26:47 +0300 Message-Id: <20220506132647.18690-9-peter.ujfalusi@linux.intel.com> X-Mailer: git-send-email 2.36.0 In-Reply-To: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> References: <20220506132647.18690-1-peter.ujfalusi@linux.intel.com> MIME-Version: 1.0 Cc: alsa-devel@alsa-project.org, daniel.baluta@nxp.com, ranjani.sridharan@linux.intel.com, kai.vehmanen@linux.intel.com 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" Currently the ipc flood test is only supported with SOF_IPC. Signed-off-by: Peter Ujfalusi Reviewed-by: Bard Liao Reviewed-by: Rander Wang Reviewed-by: Pierre-Louis Bossart Reviewed-by: Ranjani Sridharan --- sound/soc/sof/sof-client.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sound/soc/sof/sof-client.c b/sound/soc/sof/sof-client.c index a664e0eb81fe..16cca666bb85 100644 --- a/sound/soc/sof/sof-client.c +++ b/sound/soc/sof/sof-client.c @@ -73,6 +73,9 @@ static int sof_register_ipc_flood_test(struct snd_sof_dev *sdev) int ret = 0; int i; + if (sdev->pdata->ipc_type != SOF_IPC) + return 0; + for (i = 0; i < CONFIG_SND_SOC_SOF_DEBUG_IPC_FLOOD_TEST_NUM; i++) { ret = sof_client_dev_register(sdev, "ipc_flood", i, NULL, 0); if (ret < 0)