From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Julian Vetter <julian@outer-limits.org>,
Arnd Bergmann <arnd@arndb.de>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
Naveen N Rao <naveen@kernel.org>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc: Remove eieio in _memcpy_fromio
Date: Tue, 28 Jan 2025 15:16:23 +0100 [thread overview]
Message-ID: <81ee3098-1e43-4b88-975a-d223bc2338e8@csgroup.eu> (raw)
In-Reply-To: <20250128135711.1625747-1-julian@outer-limits.org>
Le 28/01/2025 à 14:57, Julian Vetter a écrit :
> Remove the eieio() calls in _memcpy_fromio, to bring its implementation
> closer to the one from lib/iomem_copy.c. These eieio() calls don't seem
> to be necessary, because the _memcpy_toio completely omits them. Also
> the legacy code from ppc was not doing them.
What do you mean exactly by "legacy code" ?
As far as I can see they were already there before commit 68a64357d15a
("[POWERPC] Merge 32 and 64 bits asm-powerpc/io.h"):
-static inline void eeh_memcpy_fromio(void *dest, const volatile void
__iomem *src,
+static inline void eeh_memcpy_fromio(void *dest, const
+ volatile void __iomem *src,
unsigned long n)
{
- void *vsrc = (void __force *) src;
- void *destsave = dest;
- unsigned long nsave = n;
-
- __asm__ __volatile__ ("sync" : : : "memory");
- while(n && (!EEH_CHECK_ALIGN(vsrc, 4) || !EEH_CHECK_ALIGN(dest, 4))) {
- *((u8 *)dest) = *((volatile u8 *)vsrc);
- __asm__ __volatile__ ("eieio" : : : "memory");
- vsrc++;
- dest++;
- n--;
- }
- while(n > 4) {
- *((u32 *)dest) = *((volatile u32 *)vsrc);
- __asm__ __volatile__ ("eieio" : : : "memory");
- vsrc += 4;
- dest += 4;
- n -= 4;
- }
- while(n) {
- *((u8 *)dest) = *((volatile u8 *)vsrc);
- __asm__ __volatile__ ("eieio" : : : "memory");
- vsrc++;
- dest++;
- n--;
- }
- __asm__ __volatile__ ("sync" : : : "memory");
+ _memcpy_fromio(dest, src, n);
/* Look for ffff's here at dest[n]. Assume that at least 4 bytes
* were copied. Check all four bytes.
*/
- if ((nsave >= 4) &&
- (EEH_POSSIBLE_ERROR((*((u32 *) destsave+nsave-4)), u32))) {
- eeh_check_failure(src, (*((u32 *) destsave+nsave-4)));
- }
+ if (n >= 4 && EEH_POSSIBLE_ERROR(*((u32 *)(dest + n - 4)), u32))
+ eeh_check_failure(src, *((u32 *)(dest + n - 4)));
}
>
> Signed-off-by: Julian Vetter <julian@outer-limits.org>
> ---
> arch/powerpc/kernel/io.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/io.c b/arch/powerpc/kernel/io.c
> index 6af535905984..81e5d54260a1 100644
> --- a/arch/powerpc/kernel/io.c
> +++ b/arch/powerpc/kernel/io.c
> @@ -155,21 +155,18 @@ void _memcpy_fromio(void *dest, const volatile void __iomem *src,
> __asm__ __volatile__ ("sync" : : : "memory");
> while(n && (!IO_CHECK_ALIGN(vsrc, 4) || !IO_CHECK_ALIGN(dest, 4))) {
> *((u8 *)dest) = *((volatile u8 *)vsrc);
> - eieio();
> vsrc++;
> dest++;
> n--;
> }
> while(n >= 4) {
> *((u32 *)dest) = *((volatile u32 *)vsrc);
> - eieio();
> vsrc += 4;
> dest += 4;
> n -= 4;
> }
> while(n) {
> *((u8 *)dest) = *((volatile u8 *)vsrc);
> - eieio();
> vsrc++;
> dest++;
> n--;
> --
> 2.34.1
>
next prev parent reply other threads:[~2025-01-28 14:50 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-28 13:57 Julian Vetter
2025-01-28 14:16 ` Christophe Leroy [this message]
2025-01-28 15:07 ` Julian Vetter
2025-01-28 15:24 ` Christophe Leroy
2025-01-28 15:34 ` Christophe Leroy
2025-01-28 16:50 ` Arnd Bergmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=81ee3098-1e43-4b88-975a-d223bc2338e8@csgroup.eu \
--to=christophe.leroy@csgroup.eu \
--cc=arnd@arndb.de \
--cc=julian@outer-limits.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=naveen@kernel.org \
--cc=npiggin@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®