From patchwork Fri Sep 29 11:24:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 727637 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 9CF67E80A98 for ; Fri, 29 Sep 2023 11:26:40 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id CED67DEF; Fri, 29 Sep 2023 13:25:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz CED67DEF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695986798; bh=2eC/pDdXmqeCZgHb5SmIzEM/IqoWfbYMuUrEu4qs/94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jkUzqInm81CTlPlP3rJJQ7QGYJRW0NhdbeWl4qnxSLgJXgE/6PO8HVPFA2QOgpZsy wpZziJWHmUTrLd6Zn3vF0GvRrMttObRTVi2/pTRfLoqQk0HbjLEgkXxI913+uZGagG fuh/fhwO3zTMhoUtkDTFyj91UWFjh1okSibURjGI= Received: by alsa1.perex.cz (Postfix, from userid 50401) id CB3B2F80567; Fri, 29 Sep 2023 13:24:59 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 43BDCF801D5; Fri, 29 Sep 2023 13:24:59 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 67600F8047D; Fri, 29 Sep 2023 13:24:51 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 E02ABF800AE for ; Fri, 29 Sep 2023 13:24:35 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz E02ABF800AE Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=F1Je6PJj DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695986678; x=1727522678; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2eC/pDdXmqeCZgHb5SmIzEM/IqoWfbYMuUrEu4qs/94=; b=F1Je6PJjgpolvMHkNcimU5x4icerb1vz2JKrtlnmV1a/uJtH4z+zCn4v ikClIZ8fbpMkVjZ8W1Jsat7rwqGbIY7xjV1STVyo3WyMcHCbWHaQu1SaP dOeJSMezrftWKniRMzgYXa5Lyy3ZZwDAiF2pEJIEhvwW8nNg3IC/Eq8H5 BVHIDwqIANQJfS1IS7sNbY/EcAN2CkAg4HrnlnnoWBh+dO1DlE4VvqS2l E/pbUqM9YJhwhuqUtqKJuzyKO3XoxGiTYfeA1yLO+LZGDQPrHngKrD/3/ JNAs7lQXQ7Sw/uL9m8xwSoEUzmjPV0DG5wZsLnuWBIpIV7IxpEx30ICg8 w==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="880236" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="880236" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 04:24:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="753353640" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="753353640" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga007.fm.intel.com with ESMTP; 29 Sep 2023 04:24:28 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH 1/6] ASoC: Intel: avs: Move IPC error messages one level down Date: Fri, 29 Sep 2023 13:24:31 +0200 Message-Id: <20230929112436.787058-2-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> References: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: H6UJI72LRLWPCY3EFP2T4ULFIVMGH2EZ X-Message-ID-Hash: H6UJI72LRLWPCY3EFP2T4ULFIVMGH2EZ X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: <> List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Cezary Rojewski Code size can be reduced if avs_dsp_send_xxx_msg()s take responsibility for dumping logs in case of an IPC message failure. In consequence, avs_ipc_err() helper is removed. Signed-off-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/avs.h | 37 +++-------- sound/soc/intel/avs/ipc.c | 52 ++++++++++----- sound/soc/intel/avs/messages.c | 112 ++++++--------------------------- 3 files changed, 65 insertions(+), 136 deletions(-) diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h index 0cf38c9e768e..0012f989b24f 100644 --- a/sound/soc/intel/avs/avs.h +++ b/sound/soc/intel/avs/avs.h @@ -224,39 +224,22 @@ struct avs_ipc { #define AVS_IPC_RET(ret) \ (((ret) <= 0) ? (ret) : -AVS_EIPC) -static inline void avs_ipc_err(struct avs_dev *adev, struct avs_ipc_msg *tx, - const char *name, int error) -{ - /* - * If IPC channel is blocked e.g.: due to ongoing recovery, - * -EPERM error code is expected and thus it's not an actual error. - * - * Unsupported IPCs are of no harm either. - */ - if (error == -EPERM || error == AVS_IPC_NOT_SUPPORTED) - dev_dbg(adev->dev, "%s 0x%08x 0x%08x failed: %d\n", name, - tx->glb.primary, tx->glb.ext.val, error); - else - dev_err(adev->dev, "%s 0x%08x 0x%08x failed: %d\n", name, - tx->glb.primary, tx->glb.ext.val, error); -} - irqreturn_t avs_dsp_irq_handler(int irq, void *dev_id); irqreturn_t avs_dsp_irq_thread(int irq, void *dev_id); void avs_dsp_process_response(struct avs_dev *adev, u64 header); -int avs_dsp_send_msg_timeout(struct avs_dev *adev, - struct avs_ipc_msg *request, - struct avs_ipc_msg *reply, int timeout); -int avs_dsp_send_msg(struct avs_dev *adev, - struct avs_ipc_msg *request, struct avs_ipc_msg *reply); +int avs_dsp_send_msg_timeout(struct avs_dev *adev, struct avs_ipc_msg *request, + struct avs_ipc_msg *reply, int timeout, const char *name); +int avs_dsp_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request, + struct avs_ipc_msg *reply, const char *name); /* Two variants below are for messages that control DSP power states. */ int avs_dsp_send_pm_msg_timeout(struct avs_dev *adev, struct avs_ipc_msg *request, - struct avs_ipc_msg *reply, int timeout, bool wake_d0i0); + struct avs_ipc_msg *reply, int timeout, bool wake_d0i0, + const char *name); int avs_dsp_send_pm_msg(struct avs_dev *adev, struct avs_ipc_msg *request, - struct avs_ipc_msg *reply, bool wake_d0i0); -int avs_dsp_send_rom_msg_timeout(struct avs_dev *adev, - struct avs_ipc_msg *request, int timeout); -int avs_dsp_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *request); + struct avs_ipc_msg *reply, bool wake_d0i0, const char *name); +int avs_dsp_send_rom_msg_timeout(struct avs_dev *adev, struct avs_ipc_msg *request, int timeout, + const char *name); +int avs_dsp_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *request, const char *name); void avs_dsp_interrupt_control(struct avs_dev *adev, bool enable); int avs_ipc_init(struct avs_ipc *ipc, struct device *dev); void avs_ipc_block(struct avs_ipc *ipc); diff --git a/sound/soc/intel/avs/ipc.c b/sound/soc/intel/avs/ipc.c index bdf013c3dd12..65bfc83bd1f0 100644 --- a/sound/soc/intel/avs/ipc.c +++ b/sound/soc/intel/avs/ipc.c @@ -455,7 +455,7 @@ static void avs_dsp_send_tx(struct avs_dev *adev, struct avs_ipc_msg *tx, bool r } static int avs_dsp_do_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request, - struct avs_ipc_msg *reply, int timeout) + struct avs_ipc_msg *reply, int timeout, const char *name) { struct avs_ipc *ipc = adev->ipc; int ret; @@ -482,6 +482,19 @@ static int avs_dsp_do_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request } ret = ipc->rx.rsp.status; + /* + * If IPC channel is blocked e.g.: due to ongoing recovery, + * -EPERM error code is expected and thus it's not an actual error. + * + * Unsupported IPCs are of no harm either. + */ + if (ret == -EPERM || ret == AVS_IPC_NOT_SUPPORTED) + dev_dbg(adev->dev, "%s (0x%08x 0x%08x) failed: %d\n", + name, request->glb.primary, request->glb.ext.val, ret); + else if (ret) + dev_err(adev->dev, "%s (0x%08x 0x%08x) failed: %d\n", + name, request->glb.primary, request->glb.ext.val, ret); + if (reply) { reply->header = ipc->rx.header; reply->size = ipc->rx.size; @@ -496,7 +509,7 @@ static int avs_dsp_do_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request static int avs_dsp_send_msg_sequence(struct avs_dev *adev, struct avs_ipc_msg *request, struct avs_ipc_msg *reply, int timeout, bool wake_d0i0, - bool schedule_d0ix) + bool schedule_d0ix, const char *name) { int ret; @@ -507,7 +520,7 @@ static int avs_dsp_send_msg_sequence(struct avs_dev *adev, struct avs_ipc_msg *r return ret; } - ret = avs_dsp_do_send_msg(adev, request, reply, timeout); + ret = avs_dsp_do_send_msg(adev, request, reply, timeout, name); if (ret) return ret; @@ -519,34 +532,37 @@ static int avs_dsp_send_msg_sequence(struct avs_dev *adev, struct avs_ipc_msg *r } int avs_dsp_send_msg_timeout(struct avs_dev *adev, struct avs_ipc_msg *request, - struct avs_ipc_msg *reply, int timeout) + struct avs_ipc_msg *reply, int timeout, const char *name) { bool wake_d0i0 = avs_dsp_op(adev, d0ix_toggle, request, true); bool schedule_d0ix = avs_dsp_op(adev, d0ix_toggle, request, false); - return avs_dsp_send_msg_sequence(adev, request, reply, timeout, wake_d0i0, schedule_d0ix); + return avs_dsp_send_msg_sequence(adev, request, reply, timeout, wake_d0i0, schedule_d0ix, + name); } int avs_dsp_send_msg(struct avs_dev *adev, struct avs_ipc_msg *request, - struct avs_ipc_msg *reply) + struct avs_ipc_msg *reply, const char *name) { - return avs_dsp_send_msg_timeout(adev, request, reply, adev->ipc->default_timeout_ms); + return avs_dsp_send_msg_timeout(adev, request, reply, adev->ipc->default_timeout_ms, name); } int avs_dsp_send_pm_msg_timeout(struct avs_dev *adev, struct avs_ipc_msg *request, - struct avs_ipc_msg *reply, int timeout, bool wake_d0i0) + struct avs_ipc_msg *reply, int timeout, bool wake_d0i0, + const char *name) { - return avs_dsp_send_msg_sequence(adev, request, reply, timeout, wake_d0i0, false); + return avs_dsp_send_msg_sequence(adev, request, reply, timeout, wake_d0i0, false, name); } int avs_dsp_send_pm_msg(struct avs_dev *adev, struct avs_ipc_msg *request, - struct avs_ipc_msg *reply, bool wake_d0i0) + struct avs_ipc_msg *reply, bool wake_d0i0, const char *name) { return avs_dsp_send_pm_msg_timeout(adev, request, reply, adev->ipc->default_timeout_ms, - wake_d0i0); + wake_d0i0, name); } -static int avs_dsp_do_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *request, int timeout) +static int avs_dsp_do_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *request, int timeout, + const char *name) { struct avs_ipc *ipc = adev->ipc; int ret; @@ -568,20 +584,24 @@ static int avs_dsp_do_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *req ret = wait_for_completion_timeout(&ipc->done_completion, msecs_to_jiffies(timeout)); ret = ret ? 0 : -ETIMEDOUT; } + if (ret) + dev_err(adev->dev, "%s (0x%08x 0x%08x) failed: %d\n", + name, request->glb.primary, request->glb.ext.val, ret); mutex_unlock(&ipc->msg_mutex); return ret; } -int avs_dsp_send_rom_msg_timeout(struct avs_dev *adev, struct avs_ipc_msg *request, int timeout) +int avs_dsp_send_rom_msg_timeout(struct avs_dev *adev, struct avs_ipc_msg *request, int timeout, + const char *name) { - return avs_dsp_do_send_rom_msg(adev, request, timeout); + return avs_dsp_do_send_rom_msg(adev, request, timeout, name); } -int avs_dsp_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *request) +int avs_dsp_send_rom_msg(struct avs_dev *adev, struct avs_ipc_msg *request, const char *name) { - return avs_dsp_send_rom_msg_timeout(adev, request, adev->ipc->default_timeout_ms); + return avs_dsp_send_rom_msg_timeout(adev, request, adev->ipc->default_timeout_ms, name); } void avs_dsp_interrupt_control(struct avs_dev *adev, bool enable) diff --git a/sound/soc/intel/avs/messages.c b/sound/soc/intel/avs/messages.c index f887ab5b0311..06b4394cabd2 100644 --- a/sound/soc/intel/avs/messages.c +++ b/sound/soc/intel/avs/messages.c @@ -16,71 +16,52 @@ int avs_ipc_set_boot_config(struct avs_dev *adev, u32 dma_id, u32 purge) { union avs_global_msg msg = AVS_GLOBAL_REQUEST(ROM_CONTROL); struct avs_ipc_msg request = {{0}}; - int ret; msg.boot_cfg.rom_ctrl_msg_type = AVS_ROM_SET_BOOT_CONFIG; msg.boot_cfg.dma_id = dma_id; msg.boot_cfg.purge_request = purge; request.header = msg.val; - ret = avs_dsp_send_rom_msg(adev, &request); - if (ret) - avs_ipc_err(adev, &request, "set boot config", ret); - - return ret; + return avs_dsp_send_rom_msg(adev, &request, "set boot config"); } int avs_ipc_load_modules(struct avs_dev *adev, u16 *mod_ids, u32 num_mod_ids) { union avs_global_msg msg = AVS_GLOBAL_REQUEST(LOAD_MULTIPLE_MODULES); struct avs_ipc_msg request; - int ret; msg.load_multi_mods.mod_cnt = num_mod_ids; request.header = msg.val; request.data = mod_ids; request.size = sizeof(*mod_ids) * num_mod_ids; - ret = avs_dsp_send_msg_timeout(adev, &request, NULL, AVS_CL_TIMEOUT_MS); - if (ret) - avs_ipc_err(adev, &request, "load multiple modules", ret); - - return ret; + return avs_dsp_send_msg_timeout(adev, &request, NULL, AVS_CL_TIMEOUT_MS, + "load multiple modules"); } int avs_ipc_unload_modules(struct avs_dev *adev, u16 *mod_ids, u32 num_mod_ids) { union avs_global_msg msg = AVS_GLOBAL_REQUEST(UNLOAD_MULTIPLE_MODULES); struct avs_ipc_msg request; - int ret; msg.load_multi_mods.mod_cnt = num_mod_ids; request.header = msg.val; request.data = mod_ids; request.size = sizeof(*mod_ids) * num_mod_ids; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "unload multiple modules", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "unload multiple modules"); } int avs_ipc_load_library(struct avs_dev *adev, u32 dma_id, u32 lib_id) { union avs_global_msg msg = AVS_GLOBAL_REQUEST(LOAD_LIBRARY); struct avs_ipc_msg request = {{0}}; - int ret; msg.load_lib.dma_id = dma_id; msg.load_lib.lib_id = lib_id; request.header = msg.val; - ret = avs_dsp_send_msg_timeout(adev, &request, NULL, AVS_CL_TIMEOUT_MS); - if (ret) - avs_ipc_err(adev, &request, "load library", ret); - - return ret; + return avs_dsp_send_msg_timeout(adev, &request, NULL, AVS_CL_TIMEOUT_MS, "load library"); } int avs_ipc_create_pipeline(struct avs_dev *adev, u16 req_size, u8 priority, @@ -88,7 +69,6 @@ int avs_ipc_create_pipeline(struct avs_dev *adev, u16 req_size, u8 priority, { union avs_global_msg msg = AVS_GLOBAL_REQUEST(CREATE_PIPELINE); struct avs_ipc_msg request = {{0}}; - int ret; msg.create_ppl.ppl_mem_size = req_size; msg.create_ppl.ppl_priority = priority; @@ -97,27 +77,18 @@ int avs_ipc_create_pipeline(struct avs_dev *adev, u16 req_size, u8 priority, msg.ext.create_ppl.attributes = attributes; request.header = msg.val; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "create pipeline", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "create pipeline"); } int avs_ipc_delete_pipeline(struct avs_dev *adev, u8 instance_id) { union avs_global_msg msg = AVS_GLOBAL_REQUEST(DELETE_PIPELINE); struct avs_ipc_msg request = {{0}}; - int ret; msg.ppl.instance_id = instance_id; request.header = msg.val; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "delete pipeline", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "delete pipeline"); } int avs_ipc_set_pipeline_state(struct avs_dev *adev, u8 instance_id, @@ -125,17 +96,12 @@ int avs_ipc_set_pipeline_state(struct avs_dev *adev, u8 instance_id, { union avs_global_msg msg = AVS_GLOBAL_REQUEST(SET_PIPELINE_STATE); struct avs_ipc_msg request = {{0}}; - int ret; msg.set_ppl_state.ppl_id = instance_id; msg.set_ppl_state.state = state; request.header = msg.val; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "set pipeline state", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "set pipeline state"); } int avs_ipc_get_pipeline_state(struct avs_dev *adev, u8 instance_id, @@ -149,13 +115,9 @@ int avs_ipc_get_pipeline_state(struct avs_dev *adev, u8 instance_id, msg.get_ppl_state.ppl_id = instance_id; request.header = msg.val; - ret = avs_dsp_send_msg(adev, &request, &reply); - if (ret) { - avs_ipc_err(adev, &request, "get pipeline state", ret); - return ret; - } - - *state = reply.rsp.ext.get_ppl_state.state; + ret = avs_dsp_send_msg(adev, &request, &reply, "get pipeline state"); + if (!ret) + *state = reply.rsp.ext.get_ppl_state.state; return ret; } @@ -183,7 +145,6 @@ int avs_ipc_init_instance(struct avs_dev *adev, u16 module_id, u8 instance_id, { union avs_module_msg msg = AVS_MODULE_REQUEST(INIT_INSTANCE); struct avs_ipc_msg request; - int ret; msg.module_id = module_id; msg.instance_id = instance_id; @@ -197,11 +158,7 @@ int avs_ipc_init_instance(struct avs_dev *adev, u16 module_id, u8 instance_id, request.data = param; request.size = param_size; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "init instance", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "init instance"); } /* @@ -222,17 +179,12 @@ int avs_ipc_delete_instance(struct avs_dev *adev, u16 module_id, u8 instance_id) { union avs_module_msg msg = AVS_MODULE_REQUEST(DELETE_INSTANCE); struct avs_ipc_msg request = {{0}}; - int ret; msg.module_id = module_id; msg.instance_id = instance_id; request.header = msg.val; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "delete instance", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "delete instance"); } /* @@ -252,7 +204,6 @@ int avs_ipc_bind(struct avs_dev *adev, u16 module_id, u8 instance_id, { union avs_module_msg msg = AVS_MODULE_REQUEST(BIND); struct avs_ipc_msg request = {{0}}; - int ret; msg.module_id = module_id; msg.instance_id = instance_id; @@ -262,11 +213,7 @@ int avs_ipc_bind(struct avs_dev *adev, u16 module_id, u8 instance_id, msg.ext.bind_unbind.src_queue = src_queue; request.header = msg.val; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "bind modules", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "bind modules"); } /* @@ -286,7 +233,6 @@ int avs_ipc_unbind(struct avs_dev *adev, u16 module_id, u8 instance_id, { union avs_module_msg msg = AVS_MODULE_REQUEST(UNBIND); struct avs_ipc_msg request = {{0}}; - int ret; msg.module_id = module_id; msg.instance_id = instance_id; @@ -296,11 +242,7 @@ int avs_ipc_unbind(struct avs_dev *adev, u16 module_id, u8 instance_id, msg.ext.bind_unbind.src_queue = src_queue; request.header = msg.val; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "unbind modules", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "unbind modules"); } static int __avs_ipc_set_large_config(struct avs_dev *adev, u16 module_id, u8 instance_id, @@ -309,7 +251,6 @@ static int __avs_ipc_set_large_config(struct avs_dev *adev, u16 module_id, u8 in { union avs_module_msg msg = AVS_MODULE_REQUEST(LARGE_CONFIG_SET); struct avs_ipc_msg request; - int ret; msg.module_id = module_id; msg.instance_id = instance_id; @@ -322,11 +263,7 @@ static int __avs_ipc_set_large_config(struct avs_dev *adev, u16 module_id, u8 in request.data = request_data; request.size = request_size; - ret = avs_dsp_send_msg(adev, &request, NULL); - if (ret) - avs_ipc_err(adev, &request, "large config set", ret); - - return ret; + return avs_dsp_send_msg(adev, &request, NULL, "large config set"); } int avs_ipc_set_large_config(struct avs_dev *adev, u16 module_id, @@ -398,9 +335,8 @@ int avs_ipc_get_large_config(struct avs_dev *adev, u16 module_id, u8 instance_id request.size = request_size; reply.size = AVS_MAILBOX_SIZE; - ret = avs_dsp_send_msg(adev, &request, &reply); + ret = avs_dsp_send_msg(adev, &request, &reply, "large config get"); if (ret) { - avs_ipc_err(adev, &request, "large config get", ret); kfree(reply.data); return ret; } @@ -422,7 +358,6 @@ int avs_ipc_set_dx(struct avs_dev *adev, u32 core_mask, bool powerup) union avs_module_msg msg = AVS_MODULE_REQUEST(SET_DX); struct avs_ipc_msg request; struct avs_dxstate_info dx; - int ret; dx.core_mask = core_mask; dx.dx_mask = powerup ? core_mask : 0; @@ -430,11 +365,7 @@ int avs_ipc_set_dx(struct avs_dev *adev, u32 core_mask, bool powerup) request.data = &dx; request.size = sizeof(dx); - ret = avs_dsp_send_pm_msg(adev, &request, NULL, true); - if (ret) - avs_ipc_err(adev, &request, "set dx", ret); - - return ret; + return avs_dsp_send_pm_msg(adev, &request, NULL, true, "set dx"); } /* @@ -447,18 +378,13 @@ int avs_ipc_set_d0ix(struct avs_dev *adev, bool enable_pg, bool streaming) { union avs_module_msg msg = AVS_MODULE_REQUEST(SET_D0IX); struct avs_ipc_msg request = {{0}}; - int ret; msg.ext.set_d0ix.wake = enable_pg; msg.ext.set_d0ix.streaming = streaming; request.header = msg.val; - ret = avs_dsp_send_pm_msg(adev, &request, NULL, false); - if (ret) - avs_ipc_err(adev, &request, "set d0ix", ret); - - return ret; + return avs_dsp_send_pm_msg(adev, &request, NULL, false, "set d0ix"); } int avs_ipc_get_fw_config(struct avs_dev *adev, struct avs_fw_cfg *cfg) From patchwork Fri Sep 29 11:24:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 728124 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 DE4ABE7F154 for ; Fri, 29 Sep 2023 11:26:50 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B3010DFA; Fri, 29 Sep 2023 13:25:58 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B3010DFA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695986808; bh=X3mZH5mj+m+yAXocSk20zTN+YXsT00bGyvoyMS4JOgU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=sYMpSncG9C+iE6Snd6iMtX43b2zDVjk6xZf+ZN/qMeBSMmbQaybJzA+V3yW4BvMUS nzuIWOd4Bk4U7Vuq8SqJlcsm35RWdojcrLEw0aMA1jmYVLM7zi0XOFU/RaAhboyCuw u+lryiwWDD1Yg7uKzLt8bFH6FEeeIgdjDBg2p4Ns= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 259A0F8057B; Fri, 29 Sep 2023 13:25:02 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 6D9D1F8056F; Fri, 29 Sep 2023 13:25:02 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 64BC0F8047D; Fri, 29 Sep 2023 13:24:53 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 2FF52F8007C for ; Fri, 29 Sep 2023 13:24:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 2FF52F8007C Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=euAkse7I DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695986679; x=1727522679; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=X3mZH5mj+m+yAXocSk20zTN+YXsT00bGyvoyMS4JOgU=; b=euAkse7I3CU7+JDkpJ7XVfj0u1IylMOVrNSDdq3sNcbXzDDWcbFC288i SpMBY22ptMG0mxxu60jVmtc0EliNfPodimD6Rhpspz4eFw8rZEqKWDM5/ luj3R07e7iQT+K5S8+RmG4MTsrly2gs5ipDtWbDbZeHfv64faMO8KsEO2 uKay+itl1cdGu99lAkoGbY38r6pZn1UzdK6FeHpgQMES6xGPj4gKXtQ47 5xSfaBJLrHBBonRdXZtHseV1MUCrhNhnYhE8cgxHcCZYODadSf5Gvs7xY iC7q+E+opg4B3DYRl6HgsMyfYkfMP1XSPzumzyYS7/mqytOshcHVxsLvA g==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="880244" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="880244" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 04:24:32 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="753353669" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="753353669" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga007.fm.intel.com with ESMTP; 29 Sep 2023 04:24:30 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH 2/6] ASoC: Intel: avs: Use generic size defines Date: Fri, 29 Sep 2023 13:24:32 +0200 Message-Id: <20230929112436.787058-3-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> References: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: RTRZ34BDWZKEEVNR4524MYQGWPAK4MCR X-Message-ID-Hash: RTRZ34BDWZKEEVNR4524MYQGWPAK4MCR X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Instead of using PAGE_SIZE as base of definitions in headers, use generic size defines. While x86 platforms use 4096 as page size, there are platforms which use different page sizes. Two of changed defines are for memory windows on DSP side, which have fixed size independent of host side page size. Another one is for CLDMA buffer which also doesn't need to change with page size. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/cldma.h | 4 +++- sound/soc/intel/avs/messages.h | 4 +++- sound/soc/intel/avs/registers.h | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sound/soc/intel/avs/cldma.h b/sound/soc/intel/avs/cldma.h index 754fcf9ee585..223d3431ab81 100644 --- a/sound/soc/intel/avs/cldma.h +++ b/sound/soc/intel/avs/cldma.h @@ -8,7 +8,9 @@ #ifndef __SOUND_SOC_INTEL_AVS_CLDMA_H #define __SOUND_SOC_INTEL_AVS_CLDMA_H -#define AVS_CL_DEFAULT_BUFFER_SIZE (32 * PAGE_SIZE) +#include + +#define AVS_CL_DEFAULT_BUFFER_SIZE SZ_128K struct hda_cldma; extern struct hda_cldma code_loader; diff --git a/sound/soc/intel/avs/messages.h b/sound/soc/intel/avs/messages.h index 7f23a304b4a9..d0344e242e5b 100644 --- a/sound/soc/intel/avs/messages.h +++ b/sound/soc/intel/avs/messages.h @@ -9,9 +9,11 @@ #ifndef __SOUND_SOC_INTEL_AVS_MSGS_H #define __SOUND_SOC_INTEL_AVS_MSGS_H +#include + struct avs_dev; -#define AVS_MAILBOX_SIZE 4096 +#define AVS_MAILBOX_SIZE SZ_4K enum avs_msg_target { AVS_FW_GEN_MSG = 0, diff --git a/sound/soc/intel/avs/registers.h b/sound/soc/intel/avs/registers.h index 2b464e466ed5..078a0ebafa42 100644 --- a/sound/soc/intel/avs/registers.h +++ b/sound/soc/intel/avs/registers.h @@ -9,6 +9,8 @@ #ifndef __SOUND_SOC_INTEL_AVS_REGS_H #define __SOUND_SOC_INTEL_AVS_REGS_H +#include + #define AZX_PCIREG_PGCTL 0x44 #define AZX_PCIREG_CGCTL 0x48 #define AZX_PGCTL_LSRMD_MASK BIT(4) @@ -59,7 +61,7 @@ #define AVS_FW_REG_STATUS(adev) (AVS_FW_REG_BASE(adev) + 0x0) #define AVS_FW_REG_ERROR_CODE(adev) (AVS_FW_REG_BASE(adev) + 0x4) -#define AVS_WINDOW_CHUNK_SIZE PAGE_SIZE +#define AVS_WINDOW_CHUNK_SIZE SZ_4K #define AVS_FW_REGS_SIZE AVS_WINDOW_CHUNK_SIZE #define AVS_FW_REGS_WINDOW 0 /* DSP -> HOST communication window */ From patchwork Fri Sep 29 11:24:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 728122 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 B17A2E80ABE for ; Fri, 29 Sep 2023 11:27:53 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id E7B77E12; Fri, 29 Sep 2023 13:27:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E7B77E12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695986872; bh=wY+MFQfxwOFJRbRs7VbXqiXr5EOF2bJnom5UQoo7m5I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=bwIEKeO01YrcFCnOvD28/frjwKInBqfq/UfFkj9d+r6NvPdMsVvSXjy0OewtmykMF 5NTbiiYm2E9AEaCA9isOoZX1C3VUA81owOkkMpRqLIyjS063uAcz5bci0Rb4sRA4Eh wWnYtEQsxASZ+uq2MVaeOasWYVZSjSxETlcxMZf0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id EFEFFF805C7; Fri, 29 Sep 2023 13:25:12 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 41BE4F805C3; Fri, 29 Sep 2023 13:25:12 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id F41B7F80579; Fri, 29 Sep 2023 13:25:01 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 27F8CF8016A for ; Fri, 29 Sep 2023 13:24:38 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 27F8CF8016A Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=ZNzrOWT1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695986680; x=1727522680; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wY+MFQfxwOFJRbRs7VbXqiXr5EOF2bJnom5UQoo7m5I=; b=ZNzrOWT1ZXnL1o2IqI2WqZhIWcPHdLvLOWrs5j0YjYAYUTyyJWEuXJTN XM+xm5J65a71cM+eYCIOE+XNK6TJ9KSGmuz3GOrsj7mrQ9GrMc650R4Bw EAVSfH+tkBBzLDaaOCeRagYzJSHj81aK3ot9kFbEEdHMVaSFOK2KJ2Li1 6geDeugTUiQUqaOI1xHlPIecfSceJvKgnTxzWevbAgQ9mIffbJ0cdOIL8 IyDxeXUALbmnjNtrugdSJJgabXJrGEOFVQT+7VkAgKjg82q+fuOFIMqih 4IU/GXJbssSgeFZ3WgH19Qa9xZJB6EwwH+KisPJJTHWhWR+IYigRrHRrm A==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="880250" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="880250" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 04:24:33 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="753353700" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="753353700" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga007.fm.intel.com with ESMTP; 29 Sep 2023 04:24:32 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH 3/6] ASoC: Intel: avs: Preallocate memory for module configuration Date: Fri, 29 Sep 2023 13:24:33 +0200 Message-Id: <20230929112436.787058-4-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> References: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: LC6ESYBMXQFLML3WRWPBFWNRUBEL2DN6 X-Message-ID-Hash: LC6ESYBMXQFLML3WRWPBFWNRUBEL2DN6 X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: In order to instantiate modules on the firmware side, the driver sends payload with module configuration. In some case size of this information is not known before hand, so driver allocates temporary memory during module creation and frees it after use. Optimize the flow a bit, by preallocating maximum buffer. This removes the time spend on allocating memory, as well as potential OOM errors during module initialization. Handlers for modules, where configuration data fits on stack, are left as is. Reviewed-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/avs.h | 1 + sound/soc/intel/avs/core.c | 5 +++++ sound/soc/intel/avs/path.c | 31 +++++++++++++++---------------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/sound/soc/intel/avs/avs.h b/sound/soc/intel/avs/avs.h index 0012f989b24f..d694e08e44e1 100644 --- a/sound/soc/intel/avs/avs.h +++ b/sound/soc/intel/avs/avs.h @@ -121,6 +121,7 @@ struct avs_dev { struct avs_mods_info *mods_info; struct ida **mod_idas; struct mutex modres_mutex; + void *modcfg_buf; /* module configuration buffer */ struct ida ppl_ida; struct list_head fw_list; int *core_refs; /* reference count per core */ diff --git a/sound/soc/intel/avs/core.c b/sound/soc/intel/avs/core.c index 859b217fc761..62fd60d5b660 100644 --- a/sound/soc/intel/avs/core.c +++ b/sound/soc/intel/avs/core.c @@ -26,6 +26,7 @@ #include "../../codecs/hda.h" #include "avs.h" #include "cldma.h" +#include "messages.h" static u32 pgctl_mask = AZX_PGCTL_LSRMD_MASK; module_param(pgctl_mask, uint, 0444); @@ -380,6 +381,10 @@ static int avs_bus_init(struct avs_dev *adev, struct pci_dev *pci, const struct if (ret < 0) return ret; + adev->modcfg_buf = devm_kzalloc(dev, AVS_MAILBOX_SIZE, GFP_KERNEL); + if (!adev->modcfg_buf) + return -ENOMEM; + adev->dev = dev; adev->spec = (const struct avs_spec *)id->driver_data; adev->ipc = ipc; diff --git a/sound/soc/intel/avs/path.c b/sound/soc/intel/avs/path.c index adbe23a47847..aa8b50b931c3 100644 --- a/sound/soc/intel/avs/path.c +++ b/sound/soc/intel/avs/path.c @@ -237,11 +237,11 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod) /* Every config-BLOB contains gateway attributes. */ if (data_size) cfg_size -= sizeof(cfg->gtw_cfg.config.attrs); + if (cfg_size > AVS_MAILBOX_SIZE) + return -EINVAL; - cfg = kzalloc(cfg_size, GFP_KERNEL); - if (!cfg) - return -ENOMEM; - + cfg = adev->modcfg_buf; + memset(cfg, 0, cfg_size); cfg->base.cpc = t->cfg_base->cpc; cfg->base.ibs = t->cfg_base->ibs; cfg->base.obs = t->cfg_base->obs; @@ -261,7 +261,6 @@ static int avs_copier_create(struct avs_dev *adev, struct avs_path_module *mod) ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id, t->domain, cfg, cfg_size, &mod->instance_id); - kfree(cfg); return ret; } @@ -294,7 +293,7 @@ static int avs_peakvol_create(struct avs_dev *adev, struct avs_path_module *mod) struct avs_control_data *ctl_data; struct avs_peakvol_cfg *cfg; int volume = S32_MAX; - size_t size; + size_t cfg_size; int ret; ctl_data = avs_get_module_control(mod); @@ -302,11 +301,12 @@ static int avs_peakvol_create(struct avs_dev *adev, struct avs_path_module *mod) volume = ctl_data->volume; /* As 2+ channels controls are unsupported, have a single block for all channels. */ - size = struct_size(cfg, vols, 1); - cfg = kzalloc(size, GFP_KERNEL); - if (!cfg) - return -ENOMEM; + cfg_size = struct_size(cfg, vols, 1); + if (cfg_size > AVS_MAILBOX_SIZE) + return -EINVAL; + cfg = adev->modcfg_buf; + memset(cfg, 0, cfg_size); cfg->base.cpc = t->cfg_base->cpc; cfg->base.ibs = t->cfg_base->ibs; cfg->base.obs = t->cfg_base->obs; @@ -318,9 +318,8 @@ static int avs_peakvol_create(struct avs_dev *adev, struct avs_path_module *mod) cfg->vols[0].curve_duration = 0; ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id, - t->domain, cfg, size, &mod->instance_id); + t->domain, cfg, cfg_size, &mod->instance_id); - kfree(cfg); return ret; } @@ -480,10 +479,11 @@ static int avs_modext_create(struct avs_dev *adev, struct avs_path_module *mod) num_pins = tcfg->generic.num_input_pins + tcfg->generic.num_output_pins; cfg_size = struct_size(cfg, pin_fmts, num_pins); - cfg = kzalloc(cfg_size, GFP_KERNEL); - if (!cfg) - return -ENOMEM; + if (cfg_size > AVS_MAILBOX_SIZE) + return -EINVAL; + cfg = adev->modcfg_buf; + memset(cfg, 0, cfg_size); cfg->base.cpc = t->cfg_base->cpc; cfg->base.ibs = t->cfg_base->ibs; cfg->base.obs = t->cfg_base->obs; @@ -505,7 +505,6 @@ static int avs_modext_create(struct avs_dev *adev, struct avs_path_module *mod) ret = avs_dsp_init_module(adev, mod->module_id, mod->owner->instance_id, t->core_id, t->domain, cfg, cfg_size, &mod->instance_id); - kfree(cfg); return ret; } From patchwork Fri Sep 29 11:24:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 727636 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 2F115E7F154 for ; Fri, 29 Sep 2023 11:27:05 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 2BF22E72; Fri, 29 Sep 2023 13:26:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2BF22E72 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695986823; bh=WIqnqrnEYC+eHAAe0XmX0Kua+R3ZcYduhStPWHo56H4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ZGIXwCghD+WXXCvNt28m75bp4kY/6JOPQu/mE7gaZhrpG9M1xBgIa5ON6L2sFABwY ooqVnhujHJCn5Ter1Ka4RLXmwhufBZZ/MuhmwCCfRxRMvzP8qYVP8bMY8IzQOpvlBh zJCvOC+AcniuGzLrnmF7jLyBrCgdJ3fX8MHxzoB8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 52D3CF805A0; Fri, 29 Sep 2023 13:25:06 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 37E14F80588; Fri, 29 Sep 2023 13:25:06 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 415BBF801D5; Fri, 29 Sep 2023 13:24:55 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 3A663F80290 for ; Fri, 29 Sep 2023 13:24:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 3A663F80290 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=d1D/MuAQ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695986681; x=1727522681; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WIqnqrnEYC+eHAAe0XmX0Kua+R3ZcYduhStPWHo56H4=; b=d1D/MuAQwtG1w+84Gd9BfOrBxdtS+AmZNUxjE37T/OnzblgEJwJ9rgFl plyWMfcWldPot2w8HniHQ8KFdiFqQoBeVSqkfxIFfREWvbREL2yj7mRrv 8oGAuLMRbHw21e7BO13g8NQFWRHuQ70YJTifmFPO7XM4ln3hEn+fQM4/C 6UPefZS7LmlarzCtPkPK6pBYH3VZwDVzaWzMsytSYleX6Hp+E516BVtks rHl8sgHAaC5WJx/S+x5oZybqSduDJD5M5kj9/V4AJCT8mmAfkJZcgXuK5 ORBXyhk2h9gAGqUXebAoPB1L1YuIuM3Z/SfBgX8K4JlpqsnP0QWw/XlEG g==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="880256" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="880256" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 04:24:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="753353726" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="753353726" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga007.fm.intel.com with ESMTP; 29 Sep 2023 04:24:33 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH 4/6] ASoC: Intel: avs: Keep module refcount up when gathering traces Date: Fri, 29 Sep 2023 13:24:34 +0200 Message-Id: <20230929112436.787058-5-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> References: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: G6GDGLZXGN2QVGI2O3XQMJ7A5YVXAYEQ X-Message-ID-Hash: G6GDGLZXGN2QVGI2O3XQMJ7A5YVXAYEQ X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Cezary Rojewski To prevent rmmod and similar behave unexpectedly when invoked on snd_soc_avs module while the AudioDSP firmware tracing is ongoing, increase the module refcount until the tracing is stopped. Signed-off-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/debugfs.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/intel/avs/debugfs.c b/sound/soc/intel/avs/debugfs.c index bdd388ec01ea..4dfbff0ce508 100644 --- a/sound/soc/intel/avs/debugfs.c +++ b/sound/soc/intel/avs/debugfs.c @@ -236,6 +236,9 @@ static int strace_open(struct inode *inode, struct file *file) struct avs_dev *adev = inode->i_private; int ret; + if (!try_module_get(adev->dev->driver->owner)) + return -ENODEV; + if (kfifo_initialized(&adev->trace_fifo)) return -EBUSY; @@ -270,6 +273,7 @@ static int strace_release(struct inode *inode, struct file *file) spin_unlock_irqrestore(&adev->trace_lock, flags); + module_put(adev->dev->driver->owner); return 0; } From patchwork Fri Sep 29 11:24:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 727635 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 6CDB9E80ABE for ; Fri, 29 Sep 2023 11:27:37 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 75C94DF6; Fri, 29 Sep 2023 13:26:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 75C94DF6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695986855; bh=y6Mwcl6axdFMs+v5QocUpeNfVhM+JKBzo1ifiiJ1gB0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Y1pix0IAF/fDHCk3qWGW8PB5U30mxl1JYWXIRYiulUiTxwVvWU2BimLwENo3FjACI /exdji5NDACMpHRNU2IqgB9OdXFwlN3dXqzs8xB+sT9NS+Y7wEvLS/a4QGigbhEnf/ En9fa9mYPxVHf2Net6irRFdp1u8p11xpFaOJSyy4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D4798F805B3; Fri, 29 Sep 2023 13:25:10 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 37A50F805B5; Fri, 29 Sep 2023 13:25:10 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 87493F8055B; Fri, 29 Sep 2023 13:24:58 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 8F559F80549 for ; Fri, 29 Sep 2023 13:24:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8F559F80549 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=LmQ3tTfd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695986681; x=1727522681; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=y6Mwcl6axdFMs+v5QocUpeNfVhM+JKBzo1ifiiJ1gB0=; b=LmQ3tTfdNFmAUqmtAdziZ+dcdlOpR2H49RkqIAeCBjXZcvgrjt1tTB1L Q8+bzEojj1oHSEilx7VgbjFdmUi0KzU/lxytE2+bxp7ql7b6Vjh70oZ9o O8duQNlH7f0O9pJlSBPgpEjj6hqZSqZ3QxxjtzGi8V7MXtjxTgva3VVLu i8e1PK6UvOgY1o5yOijI+wlcCPCi3CkueRMRJ7kFHQ5WLARfCevUGUedb ng0AFuGRcJm3K63M+j2NVaZAwutIaSANUlC9dFYoFVeScJfrmIg6yyZbX Pin2d4MKO6L3kJ2X44jdkuaLLSLtQi5htdT6MK4Sjld86Guk3IFT8XMhB g==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="880261" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="880261" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 04:24:37 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="753353760" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="753353760" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga007.fm.intel.com with ESMTP; 29 Sep 2023 04:24:35 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, Wu Zhou , Libin Yang , =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH 5/6] ASoC: Intel: avs: Disable DSP before loading basefw Date: Fri, 29 Sep 2023 13:24:35 +0200 Message-Id: <20230929112436.787058-6-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> References: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: XEVE4MOMS2ILJFIDDULFFD5I4LAKDXYO X-Message-ID-Hash: XEVE4MOMS2ILJFIDDULFFD5I4LAKDXYO X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Wu Zhou When audio controller is passed-through to the guest machine in virtualized environment, the basefw load will fail the next time guest OS reboots. Disable the DSP main core before loading the base firmware to sanitize the environment. Signed-off-by: Wu Zhou Signed-off-by: Libin Yang Signed-off-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/loader.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sound/soc/intel/avs/loader.c b/sound/soc/intel/avs/loader.c index 56bb0a59249d..65dd8f140fc1 100644 --- a/sound/soc/intel/avs/loader.c +++ b/sound/soc/intel/avs/loader.c @@ -662,6 +662,10 @@ int avs_dsp_first_boot_firmware(struct avs_dev *adev) } } + ret = avs_dsp_core_disable(adev, AVS_MAIN_CORE_MASK); + if (ret < 0) + return ret; + ret = avs_dsp_boot_firmware(adev, true); if (ret < 0) { dev_err(adev->dev, "firmware boot failed: %d\n", ret); From patchwork Fri Sep 29 11:24:36 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= X-Patchwork-Id: 728123 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 2E3D4E80ABE for ; Fri, 29 Sep 2023 11:27:31 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 233B51F1; Fri, 29 Sep 2023 13:26:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 233B51F1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1695986849; bh=n6j/8JbNexZ4eZNndUruxtY9Vtx+V07GnvEiTnjwOq4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XR0XbLAKGFZLobeGCYYTM7cO7mpmEVXRmiPaZx5xq6yufVtVRGQNb9KcLsfYtX1sD e4yxsKZnkh7pqroGVWKSNE2OuPxwKpsc3UMa0bBp12619bMVEttyrJeVDkGFmmUMy4 Aam9lbDDTpQpEZu4lr5XCCvlNnuzQ3lMAR7Ee5mA= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D955CF805AC; Fri, 29 Sep 2023 13:25:08 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 50BE1F805AC; Fri, 29 Sep 2023 13:25:08 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3F275F8047D; Fri, 29 Sep 2023 13:24:56 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (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 17666F80551 for ; Fri, 29 Sep 2023 13:24:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 17666F80551 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=jeMLjf3J DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1695986682; x=1727522682; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=n6j/8JbNexZ4eZNndUruxtY9Vtx+V07GnvEiTnjwOq4=; b=jeMLjf3JvGDKKig28uQcWYKVAkfiA/OigU3FF2E0nPYr2oyxRFyk1U+8 gsYupMK1tUNUYkcBjbR2tTD8vOLPq5MXKc3lBJYKlqkAJ70cZTEhMBwyR gRRa9vd3gcKon0vjJKOhFhUuaiawJEa2JNc4wlfbGHKRCW11C8eWR7mM2 A49VTj+zYr3kfzuC+0Qj1P/EXsdgEk0V6GwL5XXdrj0XvL/OH/iAHNndg CeyEP5s5JzI14CO9ZHq2sOqfhWyaRJi4heYMdk70YOeaVfdTkSp6QMvzn ewU6Lumv8QMFk093hvv8L3GdWUuszyAI+uWgEsvput7+1HBMEb+1jlUyb Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="880267" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="880267" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 29 Sep 2023 04:24:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10847"; a="753353787" X-IronPort-AV: E=Sophos;i="6.03,187,1694761200"; d="scan'208";a="753353787" Received: from dev2 (HELO DEV2.igk.intel.com) ([10.237.148.94]) by fmsmga007.fm.intel.com with ESMTP; 29 Sep 2023 04:24:37 -0700 From: =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= To: Mark Brown Cc: Cezary Rojewski , Takashi Iwai , Jaroslav Kysela , alsa-devel@alsa-project.org, =?utf-8?q?Amadeusz_S=C5=82awi=C5=84ski?= Subject: [PATCH 6/6] ASoC: Intel: avs: Drop superfluous stream decoupling Date: Fri, 29 Sep 2023 13:24:36 +0200 Message-Id: <20230929112436.787058-7-amadeuszx.slawinski@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> References: <20230929112436.787058-1-amadeuszx.slawinski@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: SSIU5WDBU6DO2YNCOX2MS7JKEESFHA7W X-Message-ID-Hash: SSIU5WDBU6DO2YNCOX2MS7JKEESFHA7W X-MailFrom: amadeuszx.slawinski@linux.intel.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.8 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Cezary Rojewski HDAudio streams are decoupled on startup() and, decoupling them again on prepare() is redundant. Signed-off-by: Cezary Rojewski Signed-off-by: Amadeusz Sławiński --- sound/soc/intel/avs/pcm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/sound/soc/intel/avs/pcm.c b/sound/soc/intel/avs/pcm.c index 3f1f98e1a31a..7b84197bd8b9 100644 --- a/sound/soc/intel/avs/pcm.c +++ b/sound/soc/intel/avs/pcm.c @@ -350,7 +350,6 @@ static int avs_dai_hda_be_prepare(struct snd_pcm_substream *substream, struct sn format_val = snd_hdac_calc_stream_format(runtime->rate, runtime->channels, runtime->format, runtime->sample_bits, 0); - snd_hdac_ext_stream_decouple(bus, link_stream, true); snd_hdac_ext_stream_reset(link_stream); snd_hdac_ext_stream_setup(link_stream, format_val); @@ -615,7 +614,6 @@ static int avs_dai_fe_prepare(struct snd_pcm_substream *substream, struct snd_so return 0; bus = hdac_stream(host_stream)->bus; - snd_hdac_ext_stream_decouple(bus, data->host_stream, true); snd_hdac_stream_reset(hdac_stream(host_stream)); format_val = snd_hdac_calc_stream_format(runtime->rate, runtime->channels, runtime->format,