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 D90DC197544; Thu, 6 Jun 2024 14:13:15 +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=1717683195; cv=none; b=IlSvDFJLFTa6tfOA4ND7jErde94B5dEM/zbxoOqyj1pAcDQZc6ncifSwZqt4H3aBNXLPzKlSge65zej9P3QcVT3BX4+KpbsAdewBaJiL49V7dC291FeJ7DpOmLZJ8fMkGCXjAOA7pCt+RPswkEc1ItEH/0H/1q3KUtVS/KHJylw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717683195; c=relaxed/simple; bh=Gg1Wqf/2q+MQ1xW9v6cxGysBM7LySjTfiuH23GzPmVo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MSvVC2byBUP/meB2+3nEV+gjo0usfGzRDXOJqOxKMrkQxkYci1nMk4J5xHEUv1/T0LMAbxUFH1qVapBVzM0A/YnFHzz/FAyg0WF5PAuyhA8sdhxNjKlQAVEbXBjAIom4cArPmiP29SG8Q0tJu8fHjbjQ107Y5W75WCOPqJnbOsg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=wqsgYCEF; 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="wqsgYCEF" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B0476C32786; Thu, 6 Jun 2024 14:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1717683195; bh=Gg1Wqf/2q+MQ1xW9v6cxGysBM7LySjTfiuH23GzPmVo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=wqsgYCEF4JT6j+WFSkSuH/Yh5xPjS5gvp78Ix0iQwgSTFnIfg9pFbkeIEopVZxSQG z5UoCQ4mUmXba4ZEQMU+afH5Cr2Or9l4cPGV+lPdhDhN7I9CvgneC0jeOPuVbuAmic w4mdDkl0t8WdsQBwmswKPW2h966EvMMEbU2YxO98= 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 6.1 069/473] firmware: raspberrypi: Use correct device for DMA mappings Date: Thu, 6 Jun 2024 15:59:58 +0200 Message-ID: <20240606131702.164269177@linuxfoundation.org> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240606131659.786180261@linuxfoundation.org> References: <20240606131659.786180261@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 6.1-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 dba315f675bc7..ec223976c972d 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