From nobody Thu Jan 30 19:04:34 2025 Received: from mo4-p00-ob.smtp.rzone.de (mo4-p00-ob.smtp.rzone.de [81.169.146.162]) (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 2CC52135A63 for ; Mon, 27 Jan 2025 10:04:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=pass smtp.client-ip=81.169.146.162 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737972280; cv=pass; b=U0o0ItjX1OlwROUEIaSfO6JEepXpdonGuiX5clIHKhPm2E2DSMxz9dlXhWKjF/mi098KL6gVbIBrmaHx760eyDEQUaOP6eihCa8SpuLMfMtiFkhY7mi5hJjZM5Nv1mybAjqgRyHl6gsMABtd2ifP/Dfx2b/J2pxMCB9nGjv3m8k= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1737972280; c=relaxed/simple; bh=63GLCyPG30Ry1wrY53G8wiXswqVa2aHYeHsWnpTLMyw=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Type; b=CHnOiBS6nQ8EKQjVfhoR8gs94zwFrTYEYuEFxiwkjh01+fU/iy7LCjWiXGzwhPfKq/tmO0cL5RgjR4JETV5OvtkPp01UFqqkerp4KAD9nnPunJe6ZLFw7uG840Bhiw6Mm+nc0vdAaIJJo+jaFn3V9N+IPyBoBUJAVrxJQmTbN7M= 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=UgUHLWjK; dkim=permerror (0-bit key) header.d=outer-limits.org header.i=@outer-limits.org header.b=zCmcDZ4F; arc=pass smtp.client-ip=81.169.146.162 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="UgUHLWjK"; dkim=permerror (0-bit key) header.d=outer-limits.org header.i=@outer-limits.org header.b="zCmcDZ4F" ARC-Seal: i=1; a=rsa-sha256; t=1737972269; cv=none; d=strato.com; s=strato-dkim-0002; b=EB18UU0jCkr/qdv6vNVL0vjwzZIZ84q1N99W6d6UIaONr/43JmegTd9lFhXS9XxNLD Xovqqs+KVkqtCYZa6X+RfSguegLhFmOkQFnehrXwwgnQmaXjs615l4CdYT7ORqNtgRri EMm8yV5oZOek98tODlNJhHAJSTinkkzAk3Mls5ddmNCTCpbn/2vOrepfFHleEegeytxd 7Y+VzRi3GqwVkrFRC5P2EHys8ZtqoUmZlwgM+npTA0CS3MRulekcFnvI0uCzXJXl9vsB oMQ4WIl49y5R6pwHDYEOG+D+9f88VjoAQG7I0g/5aReO9kJfjH2r/48hXIkwWrfHuSIh 4P8A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1737972269; s=strato-dkim-0002; d=strato.com; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=CmExt4w2O4zyzm1RO4iw8evFrnp7drIMnN67Tbm1qYY=; b=r42p4Gl3LseRs+HGgyC2HVcNsIbEknr5QorgiQoeIify1uwCGQW+Mho2VQmvBNQ9XU rAdEUqBlHNrzZm860CJud3svAVtVK+MKhQqU19qdu1tJ91FjzARzc1uQzQv0Xn8sQ+tx j/C8gPbmAhrzlS2ZhVQbnJaH8xISlNbcJKopbdVJuzwhXbz8tMhOMW743kXdXXaFwXyZ dcr/uYH0XBNN0q1RWxy31M8ywBeqJdmKLD6ejmME7Rv7YfGFDzAbpSMf8SLmItdQGqac LmglfqDbCaNeoBLoFvYx+h1UWXJ0GR77jAy+gTGkQnmCrc6xpqcjxVLX87sbE+/PoaNw u2fA== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1737972269; s=strato-dkim-0002; d=outer-limits.org; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=CmExt4w2O4zyzm1RO4iw8evFrnp7drIMnN67Tbm1qYY=; b=UgUHLWjKRB9f2PfI5Eu2DIS1vnYqh5eGOqXIBezG1pCMX5ajXO9Ascaufpzj3E5TfM Dm7+2NllKjHyobi4SvCT5TwUCCAQsFMkYHc4kfwxAaY5M0PEx3gJIYhTgvzyOT6FilQZ B12AKiyPJ8++RnkPAjpnt292f9HdGibBSVstz57OH/5ib/z0f6ASAMUkG6rJbi4hLjiy eAoHmO2zBFdLlrJUtMl71XYGoxmtTON2HXQbThqR8j1qDopSstg60mXFRrIQyJ3FuIkw 6qv2/do8i2+4Il8B0v4u7mN6PzoXQ+IbaV+bN+oib7PxcIXcVCfmvXN/NaEjcO0nu3oh KRxQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; t=1737972269; s=strato-dkim-0003; d=outer-limits.org; h=Message-Id:Date:Subject:Cc:To:From:Cc:Date:From:Subject:Sender; bh=CmExt4w2O4zyzm1RO4iw8evFrnp7drIMnN67Tbm1qYY=; b=zCmcDZ4FzeRcUiGNBdg2WTqWsCSxoK0m94WHaAoQhwJnr1qLXmU0LIYgw3RHLqgCjt 3XzsJbfMP9Pz+ctuOWDQ== X-RZG-AUTH: ":JnkIfEGmW/AMJS6HttH4FbRVwc4dHlPLCp4e/IoHo8zEMMHAgwTfqBEHcVJSv9P5mRTGd2ImeA==" Received: from ws2104.lan.kalrayinc.com by smtp.strato.de (RZmta 51.2.17 AUTH) with ESMTPSA id J1a25110RA4TnsB (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Mon, 27 Jan 2025 11:04:29 +0100 (CET) From: Julian Vetter To: Arnd Bergmann , Andrew Morton Cc: linux-kernel@vger.kernel.org, Julian Vetter Subject: [PATCH] Add io_sync stubs to generic IO memcpy/memset Date: Mon, 27 Jan 2025 11:04:07 +0100 Message-Id: <20250127100407.866238-1-julian@outer-limits.org> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The recently added IO memcpy and memset functions lack support for barriers or other sync functions before and/or after the transaction. To convert more architectures to use the generic IO memcpy and memset functions, add empty __pre_io_sync and __post_io_sync defines that can be overwritten by individual architectures if needed. Signed-off-by: Julian Vetter --- lib/iomem_copy.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/lib/iomem_copy.c b/lib/iomem_copy.c index dec7eaea60e0..2e81182dd4d3 100644 --- a/lib/iomem_copy.c +++ b/lib/iomem_copy.c @@ -9,6 +9,14 @@ #include #include =20 +#ifndef __pre_io_sync +#define __pre_io_sync +#endif + +#ifndef __post_io_sync +#define __post_io_sync +#endif + #ifndef memset_io /** * memset_io() - Set a range of I/O memory to a constant value @@ -24,6 +32,8 @@ void memset_io(volatile void __iomem *addr, int val, size= _t count) =20 qc *=3D ~0UL / 0xff; =20 + __pre_io_sync; + while (count && !IS_ALIGNED((long)addr, sizeof(long))) { __raw_writeb(val, addr); addr++; @@ -46,6 +56,8 @@ void memset_io(volatile void __iomem *addr, int val, size= _t count) addr++; count--; } + + __post_io_sync; } EXPORT_SYMBOL(memset_io); #endif @@ -61,6 +73,8 @@ EXPORT_SYMBOL(memset_io); */ void memcpy_fromio(void *dst, const volatile void __iomem *src, size_t cou= nt) { + __pre_io_sync; + while (count && !IS_ALIGNED((long)src, sizeof(long))) { *(u8 *)dst =3D __raw_readb(src); src++; @@ -88,6 +102,8 @@ void memcpy_fromio(void *dst, const volatile void __iome= m *src, size_t count) dst++; count--; } + + __post_io_sync } EXPORT_SYMBOL(memcpy_fromio); #endif @@ -103,6 +119,8 @@ EXPORT_SYMBOL(memcpy_fromio); */ void memcpy_toio(volatile void __iomem *dst, const void *src, size_t count) { + __pre_io_sync; + while (count && !IS_ALIGNED((long)dst, sizeof(long))) { __raw_writeb(*(u8 *)src, dst); src++; @@ -129,6 +147,8 @@ void memcpy_toio(volatile void __iomem *dst, const void= *src, size_t count) dst++; count--; } + + __post_io_sync; } EXPORT_SYMBOL(memcpy_toio); #endif --=20 2.34.1