All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] scsi: Cache align temporary buffer
@ 2023-08-07  0:26 Marek Vasut
  2023-08-18 17:50 ` Tom Rini
  0 siblings, 1 reply; 2+ messages in thread
From: Marek Vasut @ 2023-08-07  0:26 UTC (permalink / raw)
  To: u-boot; +Cc: Marek Vasut, Simon Glass, Tom Rini

The temporary buffer may be passed to DMA capable device,
make sure it is cache aligned.

Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>
---
Cc: Simon Glass <sjg@chromium.org>
Cc: Tom Rini <trini@konsulko.com>
---
V2: Add missing pointer update
---
 drivers/scsi/scsi.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 6caeb3fcdd0..77c75240d5a 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -14,6 +14,7 @@
 #include <env.h>
 #include <libata.h>
 #include <log.h>
+#include <memalign.h>
 #include <part.h>
 #include <pci.h>
 #include <scsi.h>
@@ -42,7 +43,7 @@ const struct pci_device_id scsi_device_list[] = { SCSI_DEV_LIST };
 #endif
 static struct scsi_cmd tempccb;	/* temporary scsi command buffer */
 
-static unsigned char tempbuff[512]; /* temporary data buffer */
+DEFINE_CACHE_ALIGN_BUFFER(u8, tempbuff, 512);	/* temporary data buffer */
 
 #if !defined(CONFIG_DM_SCSI)
 static int scsi_max_devs; /* number of highest available scsi device */
@@ -490,7 +491,7 @@ static int scsi_detect_dev(struct udevice *dev, int target, int lun,
 
 	pccb->target = target;
 	pccb->lun = lun;
-	pccb->pdata = (unsigned char *)&tempbuff;
+	pccb->pdata = tempbuff;
 	pccb->datalen = 512;
 	pccb->dma_dir = DMA_FROM_DEVICE;
 	scsi_setup_inquiry(pccb);
-- 
2.40.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] scsi: Cache align temporary buffer
  2023-08-07  0:26 [PATCH v2] scsi: Cache align temporary buffer Marek Vasut
@ 2023-08-18 17:50 ` Tom Rini
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Rini @ 2023-08-18 17:50 UTC (permalink / raw)
  To: Marek Vasut; +Cc: u-boot, Simon Glass

[-- Attachment #1: Type: text/plain, Size: 274 bytes --]

On Mon, Aug 07, 2023 at 02:26:12AM +0200, Marek Vasut wrote:

> The temporary buffer may be passed to DMA capable device,
> make sure it is cache aligned.
> 
> Signed-off-by: Marek Vasut <marek.vasut+renesas@mailbox.org>

Applied to u-boot/next, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-18 17:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-07  0:26 [PATCH v2] scsi: Cache align temporary buffer Marek Vasut
2023-08-18 17:50 ` Tom Rini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.