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 31FF613C69C; Thu, 13 Jun 2024 11:57: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=1718279853; cv=none; b=o7UJNmPitDcwztclfoDFFNy9C6xlWOMCtoL5B/SxlLvSeHo7/GQTItosQU5BG+U5kAOjfMxrc3EW5eBw+4qqu/juJrDWnEzR2WVDdPtEWG7SSYq3Pn3HDUmOGTIcb+Ufdl5zhRMHJY5pi1x+lD79Tbf7U9FwjeSfrs3ceGyuT90= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718279853; c=relaxed/simple; bh=bOtt8yJY3gkVUVZUfdkeNvZUpqjTlAnVO2BZhYtnt7I=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=aV18h+KZdBdlkRngu//vhmsxrNzGAEIxlZGankQgBLVfSoYqm3hNnmxQvlJnGkqdDGmowrnfW5mrgNkGKIwpAqj/oeZzBrOTa5fD032e45zunQECKEygKW5mme13v8hPll/pRbtzR1kqVFKQdFTSKYsLahktk9vgHfYAj/P18ZE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=SHmIfbvE; 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="SHmIfbvE" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B3EA3C2BBFC; Thu, 13 Jun 2024 11:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1718279853; bh=bOtt8yJY3gkVUVZUfdkeNvZUpqjTlAnVO2BZhYtnt7I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SHmIfbvENtqVs+kY/aUohsj7e0Mh/J4Qg2KoZ+5VOPBJk0ImtnzFYSYvuBw3IHxlE Qm8cel4Lxxf2XiilDmq/FYEQaeV0wc7QBFmqExDEfAk2366LJLfHBVNIhpepJJ5sV3 7UVjta0Mh4DWkjDaIKXTc53ESMIBqyNe6C9kgi3s= 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.4 018/202] firmware: raspberrypi: Use correct device for DMA mappings Date: Thu, 13 Jun 2024 13:31:56 +0200 Message-ID: <20240613113228.468969262@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240613113227.759341286@linuxfoundation.org> References: <20240613113227.759341286@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.4-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 1a690b2c1e2ff..9fdebb1171e55 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