Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2908607pxb; Tue, 24 Aug 2021 10:21:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxk9VQdniaLZRu0QYS2UKs2rt1F+Bs3Nc8kK+SUAuFVrazVnOCyq0uXzTMBTC5h473pjnr0 X-Received: by 2002:a50:cc4b:: with SMTP id n11mr11234038edi.132.1629825682379; Tue, 24 Aug 2021 10:21:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629825682; cv=none; d=google.com; s=arc-20160816; b=XFuoOoi1U3lWBT0TGh82D7W2i3lT1THL8LrnfC/0+yMPUaBtSIru6t1ZDJq3R1Qkw6 IfbW+RByxvaeyQ/neveRuaFFefTT7nNxu4P5gVllkhx6BAmEqZRwvRkHqDzo7109LOox /LNiE4T0guPu543h4deBGCSa4//IvmeTaKtsMK0YTiruQnM2eemLFn44sIpP46b+N/RJ BSaHtIu4ss2lb+TXBQYDTVdQBrbW5mpMJAYLw9G/u0Y/unxyuN/Y6T4TWcW+UKuSsiNc yY23hAwPQTd0n5bB0CB75rt6RbJ3xvkB5i4CT7Ew8eJ1oTSDnefsJmBvxIPZrajO4E6E 8Czg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3jxN1RWuk2DP/GVBy8kicESGeLEqHzbWyWby9btXcCs=; b=Q0RUATUl4eHiDGrrcrHCOI95te/x4Chmm6EBrUsDqiJUNDmMoxianx81+8Vr8rcuU8 IatuiYhdygeLMelP0/XltefqOq97qWcmDGuAAji8v+l8iwj7yIgfgQU2+RZrzp4GyrQ1 pxs3fZRf7cT+6WkTjdQp2hfxC/DQlL5aMKf8HqbdW+AdjpTAtQqLx8dInpp0QpPiMgWo QxzjGA5QP6LRwHycH7zYohvjqdmGkhoYompXDCHn1ubKnJI+xF4T8cIei1mdFMDsFy2t v0RQs2i//Xn7hNwrCMPLKca6M+U9uTW5oQMToSlULh3XHWjHS04V77VneqkKZKw8AN7x gfhA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JBHOzOuA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id co26si12592546edb.564.2021.08.24.10.20.59; Tue, 24 Aug 2021 10:21:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=JBHOzOuA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240140AbhHXRUS (ORCPT + 99 others); Tue, 24 Aug 2021 13:20:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:56444 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239574AbhHXRRt (ORCPT ); Tue, 24 Aug 2021 13:17:49 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB37261A7E; Tue, 24 Aug 2021 17:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1629824523; bh=ES0Oh9tqry4HEN7FJWg6mna5tu/5qSPa7G6Jp3S2Blo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JBHOzOuAtY9/jInN/vgq+f4ChWvFFGzStpyrp8Il1Mw56NDV1niG5yhUlqMsibMox oNMIso4wnlEEYVlVtjYwZ+g10SADXuPHn82kATpqq3ijDKv5LIy+o4NHmoNBGu3wrF NmQXv/oy6reNS/aTtk1BZx2vbtoPCfs5e52xNy/5eDUpFxFqnZy4mSBjBqIYg8vA4O 5bE5MXfDRFNUBUAjv6kMpiq0zq1HlE026bILpXyExBLP1guDEVFFDTo2O5G+1KiUC+ 4DhkCTnwK3cQbaR3zWDt2xQtxQY9Rjmwy/1XZCGvsHgguV9S2A2JkuMsIPujxAL6Hy DlWpvg1P6C96A== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Takashi Iwai , Hans de Goede , Mark Brown , Sasha Levin Subject: [PATCH 5.4 56/61] ASoC: intel: atom: Fix breakage for PCM buffer address setup Date: Tue, 24 Aug 2021 13:01:01 -0400 Message-Id: <20210824170106.710221-57-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824170106.710221-1-sashal@kernel.org> References: <20210824170106.710221-1-sashal@kernel.org> MIME-Version: 1.0 X-KernelTest-Patch: http://kernel.org/pub/linux/kernel/v5.x/stable-review/patch-5.4.143-rc1.gz X-KernelTest-Tree: git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git X-KernelTest-Branch: linux-5.4.y X-KernelTest-Patches: git://git.kernel.org/pub/scm/linux/kernel/git/stable/stable-queue.git X-KernelTest-Version: 5.4.143-rc1 X-KernelTest-Deadline: 2021-08-26T17:01+00:00 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Takashi Iwai [ Upstream commit 65ca89c2b12cca0d473f3dd54267568ad3af55cc ] The commit 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM buffer address") changed the reference of PCM buffer address to substream->runtime->dma_addr as the buffer address may change dynamically. However, I forgot that the dma_addr field is still not set up for the CONTINUOUS buffer type (that this driver uses) yet in 5.14 and earlier kernels, and it resulted in garbage I/O. The problem will be fixed in 5.15, but we need to address it quickly for now. The fix is to deduce the address again from the DMA pointer with virt_to_phys(), but from the right one, substream->runtime->dma_area. Fixes: 2e6b836312a4 ("ASoC: intel: atom: Fix reference to PCM buffer address") Reported-and-tested-by: Hans de Goede Cc: Acked-by: Mark Brown Link: https://lore.kernel.org/r/2048c6aa-2187-46bd-6772-36a4fb3c5aeb@redhat.com Link: https://lore.kernel.org/r/20210819152945.8510-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin --- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 216e88624c5f..7d59846808b5 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -127,7 +127,7 @@ static void sst_fill_alloc_params(struct snd_pcm_substream *substream, snd_pcm_uframes_t period_size; ssize_t periodbytes; ssize_t buffer_bytes = snd_pcm_lib_buffer_bytes(substream); - u32 buffer_addr = substream->runtime->dma_addr; + u32 buffer_addr = virt_to_phys(substream->runtime->dma_area); channels = substream->runtime->channels; period_size = substream->runtime->period_size; -- 2.30.2