From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE7D6606A330 for ; Mon, 30 Nov 2026 18:03:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Eg3GGY/x; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=YUn6u2kT DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=sQ05FHIarWJMy1IrAOnSk/6CVWRLmzZ48YwJuqN9n3g=; b=Eg3GGY/xB/5A3vopsEAl/lVVeN DgatDXL0fWxRgc2pLOh8CJd5bOQee/d0JNBAi89MJ5PgEnnVhzn/fsopG0s1YNnxsSDZr3TQ2TlCP 3cwitNJKnmd4J/QJH9Uf7ro38lzFcBA1Nr3mBUliwuyknGU/u7+pEBbXZwYDdjCjh2DNoQUSlfPiK wGI7Px3jXS2a3QQUCpQ02rV0K/4mxkI1xihNfQa2V7dpNFatF0WCDY9g8r87e65KOki6IhtsQQ88m 8XwIEMtF1zMRik2MUDKjzFWVpJ9qRxtSX7d2bXX8Hc0YWatkQapnjhtt4lrIuEqBM63WJvsD8uWhV FOqFJjzw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xY5iR-00000005YMa-38O2; Mon, 30 Nov 2026 18:03:03 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xY5iP-00000005YLz-1TM4 for linux-arm-kernel@lists.infradead.org; Mon, 30 Nov 2026 18:03:02 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id B51C61655; Mon, 30 Nov 2026 10:02:57 -0800 (PST) Received: from arm.com (usa-sjc-mx-foss1.foss.arm.com [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B90503F86F; Mon, 30 Nov 2026 10:02:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796061780; bh=LU++7KCXMX7VFufm81kC4yGU6LZDKRkMjOx/ydHAjwM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YUn6u2kTP+jEgNktOwxkKkgJBW8oMxCk1ZToPKsq3xUnIyS4Cz/ly5Ab/Z6YTslrj mO4iYZLexCgSrcgx5rsE+3Ov5hj1VHhLF++vZN7gKToh50m/zympdxBxW3ccY/Z73A j1BT+OZHPGfZ7zh2fTKHGjfvWGavYhDugMoXUe8A= Date: Mon, 30 Nov 2026 18:02:52 +0000 From: Catalin Marinas To: Arnd Bergmann Cc: linux-arm-kernel@lists.infradead.org, Arnd Bergmann , apais@microsoft.com, Christian Borntraeger , Fuad Tabba , hargar@linux.microsoft.com, Joey Gouly , Marc Zyngier , Mark Rutland , Navneet Singh , Oliver Upton , rlmenge@gmail.com, Siddharth Chintamaneni , Steffen Eiden , Suzuki K Poulose , Sven Schnelle , Will Deacon , Zenghui Yu , Zhou Wang , kvmarm@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/3] arm64: add HWCAP3_LS64_ACCDATA Message-ID: References: <20261126155339.1349218-1-arnd@kernel.org> <20261126155339.1349218-3-arnd@kernel.org> X-Archived-By: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261126155339.1349218-3-arnd@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20261130_100301_469222_08FFEA21 X-CRM114-Status: GOOD ( 20.29 ) X-Spam-Score: -4.4 (----) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" X-Spam-Status: No, score=-10.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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