From: Mark Rutland <mark.rutland@arm.com>
To: David Laight <david.laight.linux@gmail.com>
Cc: Chenghai Huang <huangchenghai2@huawei.com>,
arnd@arndb.de, catalin.marinas@arm.com, will@kernel.org,
akpm@linux-foundation.org, anshuman.khandual@arm.com,
ryan.roberts@arm.com, andriy.shevchenko@linux.intel.com,
herbert@gondor.apana.org.au, linux-kernel@vger.kernel.org,
linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-crypto@vger.kernel.org, linux-api@vger.kernel.org,
fanghao11@huawei.com, shenyang39@huawei.com,
liulongfang@huawei.com, qianweili@huawei.com
Subject: Re: [PATCH RFC 4/4] arm64/io: Add {__raw_read|__raw_write}128 support
Date: Wed, 12 Nov 2025 14:17:49 +0000 [thread overview]
Message-ID: <aRSXDTT44_3iutEg@J2N7QTR9R3> (raw)
In-Reply-To: <20251112140157.24ff4f2e@pumpkin>
On Wed, Nov 12, 2025 at 02:01:57PM +0000, David Laight wrote:
> On Wed, 12 Nov 2025 12:28:01 +0000
> Mark Rutland <mark.rutland@arm.com> wrote:
>
> > On Wed, Nov 12, 2025 at 09:58:46AM +0800, Chenghai Huang wrote:
> > > From: Weili Qian <qianweili@huawei.com>
> > >
> > > Starting from ARMv8.4, stp and ldp instructions become atomic.
> >
> > That's not true for accesses to Device memory types.
> >
> > Per ARM DDI 0487, L.b, section B2.2.1.1 ("Changes to single-copy atomicity in
> > Armv8.4"):
> >
> > If FEAT_LSE2 is implemented, LDP, LDNP, and STP instructions that load
> > or store two 64-bit registers are single-copy atomic when all of the
> > following conditions are true:
> > • The overall memory access is aligned to 16 bytes.
> > • Accesses are to Inner Write-Back, Outer Write-Back Normal cacheable memory.
> >
> > IIUC when used for Device memory types, those can be split, and a part
> > of the access could be replayed multiple times (e.g. due to an
> > intetrupt).
>
> That can't be right.
For better or worse, the architecture permits this, and I understand
that there are implementations on which this can happen.
> IO accesses can reference hardware FIFO so must only happen once.
This has nothing to do with the endpoint, and so any FIFO in the
endpoint is immaterial.
I agree that we want to ensure that the accesses only happen once, which
is why I have raised that it is unsound to use LDP/LDNP/STP in this way.
> (Or is 'Device memory' something different from 'Device register'?
I specifically said "Device memory type", which is an attribute that the
MMU associates with a VA, and determines how the MMU (and memory system
as a whole) treats accesses to that VA.
You can find the architecture documentation I referenced at:
https://developer.arm.com/documentation/ddi0487/lb/
> I'm also not sure that the bus cycles could get split by an interrupt,
> that would require a mid-instruction interrupt - very unlikely.
There are various reasons why an implementation might split the accesses
made by a single instruction, and why an interrupt (or other event)
might occur between accesses and cause a replay of some of the
constituent accesses. This has nothing to do with splitting bus cycles.
Mark.
next prev parent reply other threads:[~2025-11-12 14:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-12 1:58 [PATCH RFC 0/4] Introduce 128-bit IO access Chenghai Huang
2025-11-12 1:58 ` [PATCH RFC 1/4] UAPI: Introduce 128-bit types and byteswap operations Chenghai Huang
2025-11-12 1:58 ` [PATCH RFC 2/4] asm-generic/io.h: add io{read,write}128 accessors Chenghai Huang
2025-11-12 1:58 ` [PATCH RFC 3/4] io-128-nonatomic: introduce io{read|write}128_{lo_hi|hi_lo} Chenghai Huang
2025-11-12 14:48 ` Ben Dooks
2025-11-13 11:10 ` huangchenghai
2025-11-12 1:58 ` [PATCH RFC 4/4] arm64/io: Add {__raw_read|__raw_write}128 support Chenghai Huang
2025-11-12 12:28 ` Mark Rutland
2025-11-12 14:01 ` David Laight
2025-11-12 14:17 ` Mark Rutland [this message]
2025-11-13 14:19 ` huangchenghai
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=aRSXDTT44_3iutEg@J2N7QTR9R3 \
--to=mark.rutland@arm.com \
--cc=akpm@linux-foundation.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=anshuman.khandual@arm.com \
--cc=arnd@arndb.de \
--cc=catalin.marinas@arm.com \
--cc=david.laight.linux@gmail.com \
--cc=fanghao11@huawei.com \
--cc=herbert@gondor.apana.org.au \
--cc=huangchenghai2@huawei.com \
--cc=linux-api@vger.kernel.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liulongfang@huawei.com \
--cc=qianweili@huawei.com \
--cc=ryan.roberts@arm.com \
--cc=shenyang39@huawei.com \
--cc=will@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