From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mo4-p01-ob.smtp.rzone.de (mo4-p01-ob.smtp.rzone.de [85.215.255.51]) (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 CB7DF1990C3 for ; Tue, 28 Jan 2025 15:19:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=85.215.255.51 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738077601; cv=pass; b=VrvSNen/HNljZJzMnrQM3pmp0j7BfxY6EbFXDrhE8maya716ZsLfCGM+qTnjWVP+BgfjRRe62N7KtCEnlHFGRqhToJPFwRPlXOHngpny3V9x/QMeYzJCXdVcJ9JEw13yNcyTS5TcQGj8iIVEblT+51BnvCzhxVHClUxwyc8vhfU= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1738077601; c=relaxed/simple; bh=RE+5DpV0vidHMehpsCFNQhcn2dQPNuXzt92U8PqLefw=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=W1V8kDXpGoiqv76wy1P4s/Z6Z7ookiuJeiyP88P4Z+DtLqMC94UKPC98ICQarejK3Hl0DceFglcu6kGWkaloWece0ngQddpuGYv6AdkN07alrGP6gQTM9oxRhXb8KuVth70srMcpcEiMFycuXvJHzxJTeo63mYCc16+dBigXTKg= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=outer-limits.org; spf=none smtp.mailfrom=outer-limits.org; dkim=pass (2048-bit key) header.d=outer-limits.org header.i=@outer-limits.org header.b=j2InN5mx; dkim=permerror (0-bit key) header.d=outer-limits.org header.i=@outer-limits.org header.b=nsrffby5; arc=pass smtp.client-ip=85.215.255.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=outer-limits.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=outer-limits.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=outer-limits.org header.i=@outer-limits.org header.b="j2InN5mx"; dkim=permerror (0-bit key) header.d=outer-limits.org header.i=@outer-limits.org header.b="nsrffby5" ARC-Seal: i=1; a=rsa-sha256; t=1738076876; cv=none; d=strato.com; s=strato-dkim-0002; b=MXac8AKc3ew22evFR4BuNWdmOJrPrJFNgFdFkYIoCcEA8/9SdgmTXT/Kpo5OAaQ5O8 2jfa4GP4uRHXf3zz4Bf7x5DocNXJ1/+c1sHWo9Fmt4P3XLz/rYQGNC4drdUekiifm1Si 95csREv+nyOwzCRHw0lKYLx+fGz9bT44EQnHfX63C6obKCY2GkwM3GaSnAvvL/ELSbjk N2GbMllKn7lvTQV+EPA2LqoXVzVjf1lZnS8TZPXPpX2A3x+SK2csCrYKQXiE0GLIl84y dTCpyjLZJaHwOIgDhM86goh3DAIquj/Fw0BvP+i1nQYSZcNOYYRDxvDgPaHi7XrN5ipj 6lEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1738076876; s=strato-dkim-0002; d=strato.com; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=k1hpW395twfgxrUZKuBtcG4bsKQnq9Y5eIRAEwTWI7A=; b=nt1ealIRQhrICd6NpSGegff3q7RQsMieu8Dl40LwoldE5EL5lMopWUtmxga5t4t/5Z h997UpZecXWnO3tmmDYB2zpgxBbsJIMgac86fzz0jjEx625sLq3DNxn+qTjq+RW38X4B iI5DjpTeW191BURpEI221gwuMLvO4KgbWGWBHkuaB3Tlk5TEDRW9L1m4QHJBlVbm7ztM G0l4Dmt85CiminXquOmhwdKMJcUo39REd1gqi3v+cHNC6F7XdnVG1jnmXlYf5x+F7p7g pTCSWAElnNsHgxtkTdFeo/KiNutosLnr8oa1ze1h08W2Ow1e+5IcGKz71HtKIIvwk4Di /H3Q== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo01 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1738076876; s=strato-dkim-0002; d=outer-limits.org; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=k1hpW395twfgxrUZKuBtcG4bsKQnq9Y5eIRAEwTWI7A=; b=j2InN5mxYRbxBhan0bbLZ5k1yKBZow84gJBXrtXpKd96dhONeROQ1qfN+O5uvT9MJs 2+QGiWwK9ERUvUhIfC8AVBDeV34MRyYVeanszk+gsfm4TExPR5U27qosHl/mVpFqC6zK 4Ji8bckq9jD7MyRjmVQUu5cQXzUfeh18c6ybcKmX3AFgpQWuGAennCGUeo7mSE3zlwhG QIVJrYS0AF66SBixTZilhFYXnksDkF0Dlt+wRj9ShwnQAWSAeLgon9G4uWUYBJu82po1 3Weo2ptRLDZoL511p3WE+tj9rV401NPTcwcHLnGZVkvTeR74IhsNf2F6riTJCbM4+1x1 Kq8Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1738076876; s=strato-dkim-0003; d=outer-limits.org; h=In-Reply-To:From:References:Cc:To:Subject:Date:Message-ID:Cc:Date: From:Subject:Sender; bh=k1hpW395twfgxrUZKuBtcG4bsKQnq9Y5eIRAEwTWI7A=; b=nsrffby5AVWvhjSuMaKNjxSi7zEyqymca1F+1ja1/208hy3KkdtCcs65NwlTYsZl6Y jvfEAFWeCC/XInTaF4DA== X-RZG-AUTH: ":JnkIfEGmW/AMJS6HttH4FbRVwc4dHlPLCp4e/IoHo8zEMMHAgwTfqBEHcVJSv9P5mRTGd2ImeA==" Received: from [192.168.37.162] by smtp.strato.de (RZmta 51.2.17 AUTH) with ESMTPSA id J1a25110SF7t52b (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Tue, 28 Jan 2025 16:07:55 +0100 (CET) Message-ID: Date: Tue, 28 Jan 2025 16:07:55 +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: Christophe Leroy , 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> <81ee3098-1e43-4b88-975a-d223bc2338e8@csgroup.eu> Content-Language: en-US From: Julian Vetter In-Reply-To: <81ee3098-1e43-4b88-975a-d223bc2338e8@csgroup.eu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 1/28/25 15:16, Christophe Leroy wrote: > > > 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"): > With 'ppc' I was refering to 'include/asm-ppc/io.h'. But you're right, when going back a bit, in the 'include/asm-powerpc/io.h' there are two cases, one (eeh_memcpy_fromio) which does the the 'eieio', and a second, i.e., 'iSeries_memcpy_fromio' which does a byte-wise copy. But in the ppc code ('include/asm-ppc/io.h') there is a simple memcpy. I was referring to this one. But my description is not very clear. Sorry for that. > -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 >> >