Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5894500rdb; Thu, 14 Dec 2023 02:48:10 -0800 (PST) X-Google-Smtp-Source: AGHT+IFvpEs7/xxh8dDBB6NgpoxVxyW+he+94m09+bs5HC5OAtqmswplF+tYdUpWd0IrCiRhuReD X-Received: by 2002:a05:6a20:29a5:b0:18f:97c:384f with SMTP id f37-20020a056a2029a500b0018f097c384fmr9488412pzh.41.1702550890052; Thu, 14 Dec 2023 02:48:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702550890; cv=none; d=google.com; s=arc-20160816; b=oqwJcUw1tEYe1Ao+unGrGaUgAI9K6DHOn0vR/WiQjc4WWnOtCaDoUvA0x20dpUpoPJ 9Yokuo7UzhpPp0lP2AMGWE+1JAgDNXI3pIiWkGhmutOtIPFjMDGpEhlRwA1KiTf+cOGx CsYfb+pKgtDOJPvMabqcUiCGHktQpVPr6j7kGSuEqC4cffMsYEikYmWKID9S3CndbHpV dx3YmUOtA+oGjrDtm2YzatIPggYdbLjQEwi4YGg+zFIEiUDZWrqlhqW7QF2CkIbIJKCN auA0vwlsjzLMh73SFi8QLtQSMDIYKUMCsnhsgq2AGfdOTm7qQQTQ3p6a7JcUM4jcLi2V X9HA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=voMEhVxow+ksj6skmk5sK84LNbETYWA2CBhrDr6bHhY=; fh=pSHviuv9UvNdK5dqZoOfppUiTK/poW05377GWUBFjIA=; b=aFN/t8Ak9Blim/wzUZ0qz3OmyHR+1jZuChjbW8MWFqL0j4RxUrqDyUApkzwiys4fK+ aWxWcbQECvlloLs0NDslReh9cHA6fhfNFpH7eODLqPmli8IdwY4Z0bBwjbky+B9K6y0b bO8K3749uHi8diSwhOKo3wWc9AP+sRi4aNEGS9YHmGGcS6PiqvR3eyOSiJnw4gNj+URg WZnO2Y1mqHVX7vOwJX/X2/8DqTY6oZqgYIZ/sk7nWX9QRkYxf+RiaT+DHV2DGZMgafj1 bwliB11PcXd/oVtUoXnYxrY5rFIsOhJ5SZujmFargHrQD0DTTVo+Txz0cSo/Eq3TqNrg vCZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ar7erZYh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id 13-20020a63124d000000b005859c255ce8si10925533pgs.819.2023.12.14.02.48.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Dec 2023 02:48:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=Ar7erZYh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 1EF9680EE78B; Thu, 14 Dec 2023 02:48:07 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1443734AbjLNKrk (ORCPT + 99 others); Thu, 14 Dec 2023 05:47:40 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1443738AbjLNKrj (ORCPT ); Thu, 14 Dec 2023 05:47:39 -0500 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6555A10F; Thu, 14 Dec 2023 02:47:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1702550865; x=1734086865; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=aec2TwbH6Tp8RgodgqRz7F5TydcQWe862+obcvNGQMY=; b=Ar7erZYhq2KwNC7G68Jwdm528slfH6dclO80vgIvFayAH36TycsTjRHg WyscVxde+A4N0RFZqsyaNXjDlSHYXd18aKsCZMkuaxCLT9DY4mukNKMMS NuUIc0pqxt/CXf96tt7uvPaFi3AJz9X6C0DgEQ8zT/h/XT90q1McqfPDW jp7eN+o5iVwnb4Am6EJGg93Z/3Bn7QcOso6eiNt4wtt6LlDImtnSP35zE hbucJ+cEfDhud7mjn4zkU1gM9wEFfZmaH0HrN3MivqFRJaY06Oowjr2vu /OgRweUBGOkZWlWk7qYB9jGkpKMpFpyIZQYZE8EyA11HAGiBZxtw0izNG Q==; X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="398938996" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="398938996" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 02:47:39 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10923"; a="1021470584" X-IronPort-AV: E=Sophos;i="6.04,275,1695711600"; d="scan'208";a="1021470584" Received: from eborisov-mobl2.ger.corp.intel.com (HELO [10.249.34.72]) ([10.249.34.72]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2023 02:47:31 -0800 Message-ID: <6e52c5a2-24d5-422a-9a40-a0053729c98e@linux.intel.com> Date: Thu, 14 Dec 2023 12:48:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 07/11] ASoC: SOF: core: Skip firmware test for undefined fw_name Content-Language: en-US To: Cristian Ciocaltea , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Pierre-Louis Bossart , Bard Liao , Ranjani Sridharan , Daniel Baluta , Kai Vehmanen , Venkata Prasad Potturu , Alper Nebi Yasak , Syed Saba Kareem , Kuninori Morimoto , Marian Postevca , Vijendar Mukunda , V sujith kumar Reddy , Mastan Katragadda , Ajit Kumar Pandey Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, sound-open-firmware@alsa-project.org, kernel@collabora.com References: <20231209205351.880797-1-cristian.ciocaltea@collabora.com> <20231209205351.880797-8-cristian.ciocaltea@collabora.com> From: =?UTF-8?Q?P=C3=A9ter_Ujfalusi?= In-Reply-To: <20231209205351.880797-8-cristian.ciocaltea@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Thu, 14 Dec 2023 02:48:07 -0800 (PST) On 09/12/2023 22:53, Cristian Ciocaltea wrote: > Some SOF drivers like AMD ACP do not always rely on a single static > firmware file, but may require multiple files having their names > dynamically computed on probe time, e.g. based on chip name. I see, AMD vangogh needs two binary files to be loaded sometimes, it is not using the default name as it hints via the sof_dev_desc ("sof-vangogh.ri"). The constructed names for the two files are just using different pattern: sof-%PLAT%.ri vs sof-%PLAT%-code.bin sof-%PLAT%-data.bin iow, instead of the combined .ri file which includes the code and data segment it has 'raw' bin files and cannot use the core for loading the firmware. What is the reason for this? an .ri file can have two 'modules' one to be written to IRAM the other to DRAM. sof_ipc3_load_fw_to_dsp() > In those cases, providing an invalid default_fw_filename in their > sof_dev_desc struct will prevent probing due to 'SOF firmware > and/or topology file not found' error. > Fix the issue by allowing drivers to omit initialization for this member > (or alternatively provide a dynamic override via ipc_file_profile_base) > and update sof_test_firmware_file() to verify the given profile data and > skip firmware testing if either fw_path or fw_name is not defined. > > Fixes: 6c393ebbd74a ("ASoC: SOF: core: Implement IPC version fallback if firmware files are missing") > Signed-off-by: Cristian Ciocaltea > --- > sound/soc/sof/fw-file-profile.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/sound/soc/sof/fw-file-profile.c b/sound/soc/sof/fw-file-profile.c > index 138a1ca2c4a8..e63700234df0 100644 > --- a/sound/soc/sof/fw-file-profile.c > +++ b/sound/soc/sof/fw-file-profile.c > @@ -21,6 +21,9 @@ static int sof_test_firmware_file(struct device *dev, > const u32 *magic; > int ret; > > + if (!profile->fw_path || !profile->fw_name || !*profile->fw_name) > + return 0; I would rather make the firmware file skipping based on custom loader use and print a dev_dbg() alongside: diff --git a/sound/soc/sof/fw-file-profile.c b/sound/soc/sof/fw-file-profile.c index 138a1ca2c4a8..7b91c9551ada 100644 --- a/sound/soc/sof/fw-file-profile.c +++ b/sound/soc/sof/fw-file-profile.c @@ -89,6 +89,15 @@ static int sof_test_topology_file(struct device *dev, return ret; } +static bool sof_platform_uses_generic_loader(struct snd_sof_dev *sdev) +{ + if (sdev->pdata->desc->ops->load_firmware == snd_sof_load_firmware_raw || + sdev->pdata->desc->ops->load_firmware == snd_sof_load_firmware_memcpy) + return true; + + return false; +} + static int sof_file_profile_for_ipc_type(struct snd_sof_dev *sdev, enum sof_ipc_type ipc_type, @@ -130,7 +139,8 @@ sof_file_profile_for_ipc_type(struct snd_sof_dev *sdev, * For default path and firmware name do a verification before * continuing further. */ - if (base_profile->fw_path || base_profile->fw_name) { + if ((base_profile->fw_path || base_profile->fw_name) && + sof_platform_uses_generic_loader(sdev)) { ret = sof_test_firmware_file(dev, out_profile, &ipc_type); if (ret) return ret; @@ -181,7 +191,8 @@ sof_file_profile_for_ipc_type(struct snd_sof_dev *sdev, out_profile->ipc_type = ipc_type; /* Test only default firmware file */ - if (!base_profile->fw_path && !base_profile->fw_name) + if ((!base_profile->fw_path && !base_profile->fw_name) && + sof_platform_uses_generic_loader(sdev)) ret = sof_test_firmware_file(dev, out_profile, NULL); if (!ret) @@ -265,7 +276,9 @@ static void sof_print_profile_info(struct snd_sof_dev *sdev, "Using fallback IPC type %d (requested type was %d)\n", profile->ipc_type, ipc_type); - dev_info(dev, "Firmware paths/files for ipc type %d:\n", profile->ipc_type); + /* The firmware path only valid when generic loader is used */ + if (sof_platform_uses_generic_loader(sdev)) + dev_info(dev, "Firmware paths/files for ipc type %d:\n", profile->ipc_type); dev_info(dev, " Firmware file: %s/%s\n", profile->fw_path, profile->fw_name); if (profile->fw_lib_path) > + > fw_filename = kasprintf(GFP_KERNEL, "%s/%s", profile->fw_path, > profile->fw_name); > if (!fw_filename) checking for custom loader allows you to drop the next patch. I would also skip the fw path printing in case of a custom loader. -- Péter