[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250402140034.0fc4cbac@pumpkin>
Date: Wed, 2 Apr 2025 14:00:34 +0100
From: David Laight <david.laight.linux@...il.com>
To: Robin Murphy <robin.murphy@....com>
Cc: Xu Lu <luxu.kernel@...edance.com>, tjeznach@...osinc.com,
joro@...tes.org, will@...nel.org, alex@...ti.fr, lihangjing@...edance.com,
xieyongji@...edance.com, linux-riscv@...ts.infradead.org,
linux-kernel@...r.kernel.org, iommu@...ts.linux.dev
Subject: Re: [PATCH] iommu: riscv: Split 8-byte accesses on 32 bit I/O bus
platform
On Wed, 2 Apr 2025 12:28:54 +0100
Robin Murphy <robin.murphy@....com> wrote:
...
> It is not, in general, safe to do a split write to a running counter
> either way - low-high vs. high-low just moves the problem around,
> changing *which* combinations of values are problematic and capable of
> overflowing into each other between the writes. If the PMU driver can't
> write counters atomically, it will need to ensure that it only ever
> write them while stopped (at which point the order surely shouldn't
> matter). Conversely, though, reading from running counters is a bit more
> reasonable, but it needs more than just hi_lo_readq to guarantee it's
> not got a torn result.
Or have hardware that latches a value waiting for the following cycle.
That could be done in the bus interface logic.
In which case the cycle better come from the same cpu, not another
cpu accessing an entirely different register.
That requires a global lock for the device.
David
Powered by blists - more mailing lists