From: "Arnd Bergmann" <arnd@arndb.de>
To: "Julian Vetter" <julian@outer-limits.org>,
"James E . J . Bottomley" <James.Bottomley@hansenpartnership.com>,
"Helge Deller" <deller@gmx.de>
Cc: linux-parisc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] parisc: Remove memcpy_fromio
Date: Mon, 03 Feb 2025 11:49:28 +0100 [thread overview]
Message-ID: <93870187-086a-4536-9c7e-992f3bd7ecf7@app.fastmail.com> (raw)
In-Reply-To: <65e57211-7983-477a-af94-1bdab57574b4@outer-limits.org>
On Mon, Feb 3, 2025, at 11:21, Julian Vetter wrote:
> On 1/31/25 08:28, Arnd Bergmann wrote:
>> Those functions have been unchanged since before the git
>> history and there are some comments that I don't find helpful.
>> One thing they do is to deal with unaligned memory buffers,
>> which the generic ones don't, but that could be easily added
>> using get_unaligned/put_unaligned, expecting the compiler
>> to optimize the memory side of the transfer.
>
> I'm not sure what you suggest. Do you mean adding
> get_unaligned/put_unaligned in the generic include/asm-generic/io.h
> functions, or just adding get_unaligned/put_unaligned to the body of the
> parisc specific functions? Instead of all the "switch... case 0x2..." code?
I meant adding put_unaligned/get_unaligned like this:
--- a/include/asm-generic/io.h
+++ b/include/asm-generic/io.h
@@ -422,7 +422,8 @@ static inline void readsw(const volatile void __iomem *addr, void *buffer,
do {
u16 x = __raw_readw(addr);
- *buf++ = x;
+ put_unaligned(x, buf);
+ buf++;
} while (--count);
}
}
This has no effect on architectures that can handle unaligned
load/store on memory, and should behave the same way as the
parisc code otherwise. On powerpc and possibly others, there
needs to be a barrier (eieio() on powerpc) inside of the loop,
according to Segher's earlier comments.
Arnd
next prev parent reply other threads:[~2025-02-03 10:49 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-30 13:48 Julian Vetter
2025-01-31 7:28 ` Arnd Bergmann
2025-02-03 10:21 ` Julian Vetter
2025-02-03 10:49 ` Arnd Bergmann [this message]
2025-02-03 18:39 ` Helge Deller
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=93870187-086a-4536-9c7e-992f3bd7ecf7@app.fastmail.com \
--to=arnd@arndb.de \
--cc=James.Bottomley@hansenpartnership.com \
--cc=deller@gmx.de \
--cc=julian@outer-limits.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-parisc@vger.kernel.org \
/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®