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 5943A1422B5; Thu, 13 Jun 2024 11:38:27 +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=1718278707; cv=none; b=p1rht2jKvWOXSZQdfNzQQZeIulksBt9UFvBwUUxft296kp3oe7qva4bDc+4MpZdt8QtF050nKAJcPmq6CNOk450QoSxZexQ3pGnG2FoQCLijmE0WJVQDmQQKI2kBBA/LF4fX6ID/3ks2mbVfPAeJ2seKt7KOAiJkPQUzbE5aLbs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718278707; c=relaxed/simple; bh=6hzJJU4IrNAYSUeLXeP9WyE7M5RIWLfA9jaht5ah+eg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kCzyaxj3261aj/k+N3aZsPzoEYdcnhCF5eTl+S6r4EpRzB+ALYl7pURQOhu+z10FTI5iLG1yZGrrw9L0JLr7FBDHMYl0fYzSPUSo57ICnPMDHpgtGatXcWZDNH4lWx5LWXUhwtBfI5GcTka++U/EshIFBVa9bnavMVTLvOtO/SM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=an/wC/mA; 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="an/wC/mA" Received: by smtp.kernel.org (Postfix) with ESMTPSA id CD7B5C32786; Thu, 13 Jun 2024 11:38:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718278707; bh=6hzJJU4IrNAYSUeLXeP9WyE7M5RIWLfA9jaht5ah+eg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=an/wC/mAp9stmkrbAjOi5Gapg/RR1dIwhOF01QJPO/X7NS0+T95fuOvnG89WbnpIA 6pc9xyjpOQBz5w0wNQCcPUFD/XAJHuhdO3j4D1Ub9LeGOkdwq3O0Zld8z1Wzsqg5ER POeWEoQUQ5NGzhAN1qmEM4Hx/zV32lpdsQd/AONY= 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 4.19 015/213] firmware: raspberrypi: Use correct device for DMA mappings Date: Thu, 13 Jun 2024 13:31:03 +0200 Message-ID: <20240613113228.576526511@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613113227.969123070@linuxfoundation.org> References: <20240613113227.969123070@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 4.19-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 44eb99807e337..ea3975b94d6a1 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -11,6 +11,7 @@ #include #include +#include #include #include #include @@ -91,8 +92,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; @@ -120,7 +121,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