[PATCH v2 2/3] arm64: add HWCAP3_LS64_ACCDATA

Catalin Marinas catalin.marinas at arm.com
Mon Nov 30 10:02:52 PST 2026


On Thu, Nov 26, 2026 at 04:53:38PM +0100, Arnd Bergmann wrote:
> diff --git a/Documentation/arch/arm64/elf_hwcaps.rst b/Documentation/arch/arm64/elf_hwcaps.rst
> index f60ca5612daa..f63035696654 100644
> --- a/Documentation/arch/arm64/elf_hwcaps.rst
> +++ b/Documentation/arch/arm64/elf_hwcaps.rst
> @@ -478,6 +478,13 @@ HWCAP3_SVE_LUT6
>      Functionality implied by ID_AA64PFR0_EL1.SVE == 0b0001 and
>      ID_AA64ISAR2_EL1.LUT == 0b0010.
>  
> +HWCAP3_LS64_ACCDATA
> +    Functionality implied by ID_AA64ISAR1_EL1.LS64 >= 0b0011. Note that
> +    the function of instruction st64bv0 requires support by CPU, system
> +    and target (device) memory location and HWCAP3_LS64_ACCDATA implies
> +    the support of CPU. User should only use st64bv0 on supported target
> +    (device) memory location, otherwise fallback to the non-atomic
> +    alternatives.

Not sure where to document it but without a device and PASID the
instruction will trigger SIGBUS. I'm not even sure the fallback to
non-atomic alternatives is appropriate since user has no knowledge of
PASIDs. Something like (feel free to reword):

    Functionality implied by ID_AA64ISAR1_EL1.LS64 >= 0b0011. Note that
    the function of instruction st64bv0 requires support by CPU, system
    and target (device) memory location and HWCAP3_LS64_ACCDATA implies
    the support of CPU only.

    The kernel uses ACCDATA_EL1 to supply the Process Address Space ID
    (PASID) of the calling process. The CPU replaces bits [31:0] of the
    64-byte store data with this value. st64bv0 can only be used after a
    device driver has bound the process address space to a device that
    takes the PASID from the store payload. Otherwise, the instruction
    raises SIGBUS with si_code == BUS_OBJERR.

But a bit more below before deciding what this HWCAP means:

> diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
> index c88ea4b93138..dcbe024284e0 100644
> --- a/arch/arm64/kernel/cpufeature.c
> +++ b/arch/arm64/kernel/cpufeature.c
> @@ -3223,6 +3223,7 @@ static const struct arm64_cpu_capabilities arm64_elf_hwcaps[] = {
>  	HWCAP_CAP(ID_AA64ISAR1_EL1, DGH, IMP, CAP_HWCAP, KERNEL_HWCAP_DGH),
>  	HWCAP_CAP(ID_AA64ISAR1_EL1, I8MM, IMP, CAP_HWCAP, KERNEL_HWCAP_I8MM),
>  	HWCAP_CAP(ID_AA64ISAR1_EL1, LS64, LS64, CAP_HWCAP, KERNEL_HWCAP_LS64),
> +	HWCAP_CAP(ID_AA64ISAR1_EL1, LS64, LS64_ACCDATA, CAP_HWCAP, KERNEL_HWCAP_LS64_ACCDATA),

This HWCAP is advertised even with CONFIG_IOMMU_SVA=n but in such
configuration we'll get a SIGILL rather than SIGBUS since
system_supports_ls64_accdata() is false. It feels a bit inconsistent:
HWCAP_CAP() above suggests it's a CPU only feature but the behaviour,
SIGBUS etc. depends on the kernel configuration.

We could make this a CPU feature only (irrespective of iommu) but then
we'd need to inform the user somehow that PASIDs get passed to the
device. The easiest is to add #ifdef around this with a dedicated
CONFIG_ARM64_LS64_ACCDATA option which depends on IOMMU_SVA (same with
system_supports_ls64_accdata()).

-- 
Catalin



More information about the linux-arm-kernel mailing list