From patchwork Fri Jun 16 10:00:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Louis Bossart X-Patchwork-Id: 693263 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 5DF76EB64D8 for ; Fri, 16 Jun 2023 10:04:38 +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 5BA7883A; Fri, 16 Jun 2023 12:03:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5BA7883A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1686909876; bh=euc1LNyU/gOBdaoUs/unm7pIRjpPLm0R/Sx438RYDVY=; 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=UY98dGykkcNi2d6Nr6AjbZHqeMxGTCtNQTZPQxDd7zq2HedPOPXOtm4yF27diXXia dUgAIxNuJAu4BTL0u3ACvwrsGdg2jj0QZPrmqp909QL7E8G6N8q+Mz/Tw67kSind6v r6AgQFKz1N1rEvs6Q0MajBLe7L9iQaWnwRA/MGlw= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3A043F805D9; Fri, 16 Jun 2023 12:01:54 +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 DEB17F80548; Fri, 16 Jun 2023 12:01:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 55DFFF805BE; Fri, 16 Jun 2023 12:01:48 +0200 (CEST) Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 A7A6BF80155 for ; Fri, 16 Jun 2023 12:01:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz A7A6BF80155 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=OtrmcSSb DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686909664; x=1718445664; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=euc1LNyU/gOBdaoUs/unm7pIRjpPLm0R/Sx438RYDVY=; b=OtrmcSSbPpftShvaqPCL5XsfoIs6m5i5xJ+hISK9Lz1ukWn4jONHaE+9 HlwRIHB9nl7rw8aZlLxqrUDCa4em4lO+UsXf2fi46+K8G8v9dcSKP0dXa Q7AhQD9n1V+Avn9+u/iBG/EdCSArG7UDaz6lf6b1gBbDQkCV/YG8UScqa PZaTCfdZnUnbFoz9eKhA/6D8/IXSV5bizCC3hn2D2IEp1mrysgoRWqzU5 G0qZEyxFsdBCliFfmneqD9rapR84dAIFiGx9imNWHujW43sRwh7IelPRf 0pLnsoDkvKbJcs/VP+CNHqlrsVw0+yw3I/LK+bFDIrDjOvjzw2PVFg3rm g==; X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="362591608" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="362591608" Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:01:03 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10742"; a="825689393" X-IronPort-AV: E=Sophos;i="6.00,247,1681196400"; d="scan'208";a="825689393" Received: from kjaffe-mobl.amr.corp.intel.com (HELO pbossart-mobl3.intel.com) ([10.254.114.132]) by fmsmga002-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 16 Jun 2023 03:00:59 -0700 From: Pierre-Louis Bossart To: alsa-devel@alsa-project.org Cc: tiwai@suse.de, broonie@kernel.org, Peter Ujfalusi , Kai Vehmanen , Daniel Baluta , Ranjani Sridharan , Rander Wang , Bard Liao , Pierre-Louis Bossart Subject: [PATCH 3/8] ASoC: SOF: core: Free the firmware trace before calling snd_sof_shutdown() Date: Fri, 16 Jun 2023 12:00:34 +0200 Message-Id: <20230616100039.378150-4-pierre-louis.bossart@linux.intel.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> References: <20230616100039.378150-1-pierre-louis.bossart@linux.intel.com> MIME-Version: 1.0 Message-ID-Hash: FOP4ZTRPE7WI7H7FLXO6SSCI4LMUXPTC X-Message-ID-Hash: FOP4ZTRPE7WI7H7FLXO6SSCI4LMUXPTC X-MailFrom: pierre-louis.bossart@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: Peter Ujfalusi The shutdown is called on reboot/shutdown of the machine. At this point the firmware tracing cannot be used anymore but in case of IPC3 it is using and keeping a DMA channel active (dtrace). For Tiger Lake platforms we have a quirk in place to fix rare reboot issues when a DMA was active before rebooting the system. If the tracing is enabled this quirk will be always used and a print appears on the kernel log which might be misleading or not even correct. Release the fw tracing before executing the shutdown to make sure that this known DMA user is cleared away. Reviewed-by: Kai Vehmanen Reviewed-by: Daniel Baluta Reviewed-by: Ranjani Sridharan Reviewed-by: Rander Wang Reviewed-by: Bard Liao Signed-off-by: Peter Ujfalusi Signed-off-by: Pierre-Louis Bossart --- sound/soc/sof/core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sound/soc/sof/core.c b/sound/soc/sof/core.c index 9a9d82220fd0..30db685cc5f4 100644 --- a/sound/soc/sof/core.c +++ b/sound/soc/sof/core.c @@ -504,8 +504,10 @@ int snd_sof_device_shutdown(struct device *dev) if (IS_ENABLED(CONFIG_SND_SOC_SOF_PROBE_WORK_QUEUE)) cancel_work_sync(&sdev->probe_work); - if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) + if (sdev->fw_state == SOF_FW_BOOT_COMPLETE) { + sof_fw_trace_free(sdev); return snd_sof_shutdown(sdev); + } return 0; }