Skip to contentSkip to conversation

scsi: lpfc: Switch memcpy_fromio() to __read32_copy()

PATCH In review Huacai Chen 1 participant 3 messages Dec 19, 2018 – Jun 15, 2019 2 messages not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 scsi: lpfc: Switch memcpy_fromio() to __read32_copy()

In commit bc73905abf770192 ("[SCSI] lpfc 8.3.16: SLI Additions, updates, and code cleanup"), lpfc_memcpy_to_slim() have switched memcpy_toio() to __write32_copy() in order to prevent unaligned 64 bit copy. Recently, we found that lpfc_memcpy_from_slim() have similar issues, so let it switch memcpy_fromio() to __read32_copy().

As maintainer says, it seems that we can hardly see a real "unaligned 64 bit copy", but this patch is still useful. Because in our tests we found that lpfc doesn't support 128 bit access, but some optimized memcpy() use 128 bit access (at lease on Loongson).

---
V2: Update commit message.

 drivers/scsi/lpfc/lpfc_compat.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_compat.h +2 -2
index 43cf46a..0cd1e3c 100644
@@ -91,8 +91,8 @@ lpfc_memcpy_to_slim( void __iomem *dest, void *src, unsigned int bytes)
 static inline void
 lpfc_memcpy_from_slim( void *dest, void __iomem *src, unsigned int bytes)
 {
-	/* actually returns 1 byte past dest */
-	memcpy_fromio( dest, src, bytes);
+	/* convert bytes in argument list to word count for copy function */
+	__ioread32_copy(dest, src, bytes / sizeof(uint32_t));
 }
 
 #endif	/* __BIG_ENDIAN */
Signature · 1 line
2.7.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#2 lore raw

Hi, Sasha,

We should backport commit a9aec5881b9d4aca184b29d33484a6a5 ("lib/iomap_copy.c: add __ioread32_copy()") for linux-4.4, linux-3.18 and linux-3.16.

Huacai

------------------ Original ------------------

From:  "Sasha Levin"<[email protected]>;
Date:  Wed, Dec 19, 2018 09:47 PM
To:  "Sasha Levin"<[email protected]>; "Huacai Chen"<[email protected]>; "James E . J . Bottomley"<[email protected]>;

Cc: "Martin K . Petersen"<[email protected]>; "stable"<[email protected]>; "stable"<[email protected]>;
Subject: Re: [PATCH V2] scsi: lpfc: Switch memcpy_fromio() to __read32_copy()

Hi,

[This is an automated email]

This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v4.19.10, v4.14.89, v4.9.146, v4.4.168, v3.18.130,

v4.19.10: Build OK!
v4.14.89: Build OK!
v4.9.146: Build OK!
v4.4.168: Build failed! Errors:
drivers/scsi/lpfc/lpfc_compat.h:93:2: error: implicit declaration of function ‘__ioread32_copy’; did you mean ‘__iowrite32_copy’? [-Werror=implicit-function-declaration]

v3.18.130: Build failed! Errors:
drivers/scsi/lpfc/lpfc_compat.h:93:2: error: implicit declaration of function ‘__ioread32_copy’; did you mean ‘__iowrite32_copy’? [-Werror=implicit-function-declaration]

How should we proceed with this patch?

--
Thanks,
Sasha

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#4 lore raw

Please backport this commit for 4.4:
a9aec5881b9d4aca184b29d33484a6a58d23f7f2(lib/iomap_copy.c: add __ioread32_copy())

Huacai

----

This commit has been processed because it contains a -stable tag. The stable tag indicates that it's relevant for the following trees: all

The bot has tested the following trees: v5.1.9, v4.19.50, v4.14.125, v4.9.181, v4.4.181.

v5.1.9: Build OK!
v4.19.50: Build OK!
v4.14.125: Build OK!
v4.9.181: Build OK!
v4.4.181: Build failed! Errors:
drivers/scsi/lpfc/lpfc_compat.h:93:2: error: implicit declaration of function ‘__ioread32_copy’; did you mean ‘__iowrite32_copy’? [-Werror=implicit-function-declaration]

How should we proceed with this patch?

--
Thanks,
Sasha