From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87ACC44C6F; Thu, 13 Jun 2024 12:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718280753; cv=none; b=owpjhxhLa468Cidz/WH42uI3RjUYiby8yw7g0ssNu3LXzWA/iO406yYj+ifpLAteBRG7W5m3MBnCCUtd9vgquVaB2+CDYfN9snYYMx39LuXC80xWdbUZ3z0ANbkTwfy1t+Rt0fIVn3eUkDqte+9Bta4StgXDR+QQkpPzEykMRNU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718280753; c=relaxed/simple; bh=KHX6I/TlGbqVZjxJRet493P+UqawNo5mFAEvJdsCzi4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ndu6S/uJfLhAq1BZcqZRw5CLZq7k+SBr0UzCETKJIHHeT72RQKX/+68dUu7OGktZ/kYRYyfL0OLddisVLe0iqIxgi/rhijL072uJGPB0uLowTKu7toi6ihfdr5qIw7mL2YG8fmV5g55p8C1cZueGr2AFGerLiGxCk6gkHF5ggHw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dYqUc1mc; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="dYqUc1mc" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B263EC4AF1C; Thu, 13 Jun 2024 12:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718280753; bh=KHX6I/TlGbqVZjxJRet493P+UqawNo5mFAEvJdsCzi4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dYqUc1mc3C+KDVp4VbLG9tOId1pj8eySWOkRjqXRmE/1q4+crC2mSLfiqaqYDyeNB CXpypG7YdZ1pjoNoPh5IhjQxDRAPLuIEHGoPWtpcj/uVAMxxeKdJ+8X5NTMfJdMoal TahZVqqRkys1xDbC6TTkGcbAcGfkyay5iAV01DqY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Laurent Pinchart , Stefan Wahren , "Ivan T. Ivanov" , Florian Fainelli , Sasha Levin Subject: [PATCH 5.10 022/317] firmware: raspberrypi: Use correct device for DMA mappings Date: Thu, 13 Jun 2024 13:30:40 +0200 Message-ID: <20240613113248.400015825@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613113247.525431100@linuxfoundation.org> References: <20240613113247.525431100@linuxfoundation.org> User-Agent: quilt/0.67 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Laurent Pinchart [ Upstream commit df518a0ae1b982a4dcf2235464016c0c4576a34d ] The buffer used to transfer data over the mailbox interface is mapped using the client's device. This is incorrect, as the device performing the DMA transfer is the mailbox itself. Fix it by using the mailbox controller device instead. This requires including the mailbox_controller.h header to dereference the mbox_chan and mbox_controller structures. The header is not meant to be included by clients. This could be fixed by extending the client API with a function to access the controller's device. Fixes: 4e3d60656a72 ("ARM: bcm2835: Add the Raspberry Pi firmware driver") Signed-off-by: Laurent Pinchart Reviewed-by: Stefan Wahren Tested-by: Ivan T. Ivanov Link: https://lore.kernel.org/r/20240326195807.15163-3-laurent.pinchart@ideasonboard.com Signed-off-by: Florian Fainelli Signed-off-by: Sasha Levin --- drivers/firmware/raspberrypi.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index 45ff03da234a6..c8a292df6fea5 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -96,8 +97,8 @@ int rpi_firmware_property_list(struct rpi_firmware *fw, if (size & 3) return -EINVAL; - buf = dma_alloc_coherent(fw->cl.dev, PAGE_ALIGN(size), &bus_addr, - GFP_ATOMIC); + buf = dma_alloc_coherent(fw->chan->mbox->dev, PAGE_ALIGN(size), + &bus_addr, GFP_ATOMIC); if (!buf) return -ENOMEM; @@ -125,7 +126,7 @@ int rpi_firmware_property_list(struct rpi_firmware *fw, ret = -EINVAL; } - dma_free_coherent(fw->cl.dev, PAGE_ALIGN(size), buf, bus_addr); + dma_free_coherent(fw->chan->mbox->dev, PAGE_ALIGN(size), buf, bus_addr); return ret; } -- 2.43.0