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 20EAEC6FD1C for ; Wed, 22 Mar 2023 20:00:30 +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 D6A43EC2; Wed, 22 Mar 2023 20:59:37 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D6A43EC2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1679515227; bh=MjEEL8boqjlO56Osnd+473gjFPNIpRp9UcMS4Htxkr4=; h=From:To:Subject:Date:In-Reply-To:References:CC:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=DIhrvJiGf9w7n3Udm5ubyUXQNQWfvra9WKUIWSBgTP/XV3EOU4h+itrUctgweKWQp R04bzsdflwBFJlplSDREhC1LcYlHTD5u/IiPvHGSU3YGQYCMnzB2C9ZkArNYtkTP3l Uba3Mh9egpE3RQupRPH8RX8PsD/D3iMn8ckUjZ40= Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 105F4F80578; Wed, 22 Mar 2023 20:58:23 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 58278F80564; Wed, 22 Mar 2023 20:58:18 +0100 (CET) Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 08239F80549; Wed, 22 Mar 2023 20:58:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 08239F80549 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20201202 header.b=YYqIFnc/ Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 997D0B81DE8; Wed, 22 Mar 2023 19:58:11 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id BD0F0C433EF; Wed, 22 Mar 2023 19:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1679515090; bh=MjEEL8boqjlO56Osnd+473gjFPNIpRp9UcMS4Htxkr4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYqIFnc/bzj8vkKkvZSdiL9vr/9OMxzNTMiX5g28DLP9PnTjDgwMPnovn0FjN7Ewi uEkXF5MRSHPL45p52XeXfJOXXaBVN06PwVtjot+BMzp3G76DyA/T1BYdjwnjlkPhve AwlpqMTMFg653T4UUETxfmeIcgJ/nDZ0NoBy9tokRorga1fH0eH19jcf4NBTmXMkh+ ANlzbS0ammPLIKq1J8NHkbPP3T+yiv8jmcgK3hwDMhiGU3HpEThmx9t/qdPl8nFza1 75bp7jbj87wM8hiIA/txqTno2tvafxPOvzKzXHYLoiprIBj4zNokWyerZjlfT6Fwnw RfooXjwNbZNmg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH AUTOSEL 6.2 16/45] ASoC: SOF: Intel: pci-tng: revert invalid bar size setting Date: Wed, 22 Mar 2023 15:56:10 -0400 Message-Id: <20230322195639.1995821-16-sashal@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230322195639.1995821-1-sashal@kernel.org> References: <20230322195639.1995821-1-sashal@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Message-ID-Hash: KVJBEG4ERKZFFQ33GVPK2EVL6IODO4N6 X-Message-ID-Hash: KVJBEG4ERKZFFQ33GVPK2EVL6IODO4N6 X-MailFrom: sashal@kernel.org 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 CC: Pierre-Louis Bossart , Ferry Toth , =?UTF-8?q?P=C3=A9ter=20Ujfalusi?= , Ranjani Sridharan , Mark Brown , Sasha Levin , lgirdwood@gmail.com, yung-chuan.liao@linux.intel.com, daniel.baluta@nxp.com, tiwai@suse.com, rander.wang@intel.com, zheyuma97@gmail.com, sound-open-firmware@alsa-project.org, alsa-devel@alsa-project.org 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: Pierre-Louis Bossart [ Upstream commit ca09e2a351fbc7836ba9418304ff0c3e72addfe0 ] The logic for the ioremap is to find the resource index 3 (IRAM) and infer the BAR address by subtracting the IRAM offset. The BAR size defined in hardware specifications is 2MB. The commit 5947b2726beb6 ("ASoC: SOF: Intel: Check the bar size before remapping") tried to find the BAR size by querying the resource length instead of a pre-canned value, but by requesting the size for index 3 it only gets the size of the IRAM. That's obviously wrong and prevents the probe from proceeding. This commit attempted to fix an issue in a fuzzing/simulated environment but created another on actual devices, so the best course of action is to revert that change. Reported-by: Ferry Toth Tested-by: Ferry Toth (Intel Edison-Arduino) Link: https://github.com/thesofproject/linux/issues/3901 Signed-off-by: Pierre-Louis Bossart Reviewed-by: Péter Ujfalusi Reviewed-by: Ranjani Sridharan Signed-off-by: Peter Ujfalusi Link: https://lore.kernel.org/r/20230307095341.3222-1-peter.ujfalusi@linux.intel.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- sound/soc/sof/intel/pci-tng.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/sound/soc/sof/intel/pci-tng.c b/sound/soc/sof/intel/pci-tng.c index 5b2b409752c58..8c22a00266c06 100644 --- a/sound/soc/sof/intel/pci-tng.c +++ b/sound/soc/sof/intel/pci-tng.c @@ -75,11 +75,7 @@ static int tangier_pci_probe(struct snd_sof_dev *sdev) /* LPE base */ base = pci_resource_start(pci, desc->resindex_lpe_base) - IRAM_OFFSET; - size = pci_resource_len(pci, desc->resindex_lpe_base); - if (size < PCI_BAR_SIZE) { - dev_err(sdev->dev, "error: I/O region is too small.\n"); - return -ENODEV; - } + size = PCI_BAR_SIZE; dev_dbg(sdev->dev, "LPE PHY base at 0x%x size 0x%x", base, size); sdev->bar[DSP_BAR] = devm_ioremap(sdev->dev, base, size); -- 2.39.2