From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pegase2.c-s.fr (pegase2.c-s.fr [93.17.235.10]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4AD161A9B3E for ; Tue, 28 Jan 2025 14:50:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=93.17.235.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738075805; cv=none; b=hNDxGwstCjUZnag0v2o3K99m4aDay1pqNGRpXtwqz2xtNT6SUV9uJ25b0rKcLPBA0GnC5LxUtDmKQFxruj4BJH3luHdMwXAzSO+Z0upzagS3MbA6WweqE/DcWUa7VkiORBHGE+kCxOUqaCq15Cu5TkjOXky+Ad3hALYVOOL+NnY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738075805; c=relaxed/simple; bh=UhImcpvAH707clGeqrRsCZMWizA8DOOZfkRhCKCvcy0=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=oi/KtvxW58YmO4mgFjSGTznCUZiOzqS/LXOSgKPlIVtu09Zjc6daTkVdd06D8ytIw4oiOuzrkeQxTVCZRoYNSZF4SIxyhZ8HpWK1xduqirJ1/MNVfuAdveogdWgKjO44rzk1Is+32qZQhyEgTDYW2wM5WeaDoXW2vSzEi0tXSpM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu; spf=pass smtp.mailfrom=csgroup.eu; arc=none smtp.client-ip=93.17.235.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=csgroup.eu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=csgroup.eu Received: from localhost (mailhub3.si.c-s.fr [172.26.127.67]) by localhost (Postfix) with ESMTP id 4Yj6lr3jtZz9sSK; Tue, 28 Jan 2025 15:16:24 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from pegase2.c-s.fr ([172.26.127.65]) by localhost (pegase2.c-s.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0LWxEzj7XUTG; Tue, 28 Jan 2025 15:16:24 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase2.c-s.fr (Postfix) with ESMTP id 4Yj6lr2pLWz9sSH; Tue, 28 Jan 2025 15:16:24 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 4E9F98B76C; Tue, 28 Jan 2025 15:16:24 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 4LnEuDnMqUOR; Tue, 28 Jan 2025 15:16:24 +0100 (CET) Received: from [192.168.235.99] (unknown [192.168.235.99]) by messagerie.si.c-s.fr (Postfix) with ESMTP id D63C48B763; Tue, 28 Jan 2025 15:16:23 +0100 (CET) Message-ID: <81ee3098-1e43-4b88-975a-d223bc2338e8@csgroup.eu> Date: Tue, 28 Jan 2025 15:16:23 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] powerpc: Remove eieio in _memcpy_fromio To: Julian Vetter , Arnd Bergmann , Madhavan Srinivasan , Michael Ellerman , Nicholas Piggin , Naveen N Rao Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20250128135711.1625747-1-julian@outer-limits.org> Content-Language: fr-FR From: Christophe Leroy In-Reply-To: <20250128135711.1625747-1-julian@outer-limits.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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 > --- > 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 >