From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796061782; b=C98HABRlQ1waNaBF9sBrIBm3F51WyapOq0LDQfUwacAfBodNDSNuBYt97xjkc0+Ok6No 2sd9Y1BzTDKNqHsNFRyRASkuODnW/wDRV6C2U8axszgMrU9wDSYm/CgwYxZhKHUmQjQxu 9f8LenDmCSmKXZ1UI43OOe2kMYDtA4f/x14Lf/HVRHxhSZKpTuJ3l4IvV5VSio+/M6dqW 3pQeYGUxGJO4Zkl2bxGw+b7RGFEZe+NWopENM1gOs4JHXc0fjMB3AX9bakedgEwcegmWH ifHyE7950RPkJiBEM8DCnysePWXhsexTVph5L9IKVlGRdshCEJqwNhNquSY9vmg4new== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796061782; h=DMARC-Filter:Received:Received:DKIM-Signature:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To; bh=sQ05FHIarWJMy1IrAOnSk/6CVWRLmzZ48YwJuqN9n3g=; b=XgLJOd0CqpzKMLSR8HFqduvOp8I2Z27M+3nL4GXXcabCjCL8bJeo4maV3ptMn3ywt81X 6AZcoMOvVh6vPROdO+r20MO/AxRfboUPJth5PfLYmML/yDMHvVoWUVifTippTVOHuYz27 nWnn/F+UGDDip/d+sbiyqU4DOvMqi6QJLCV6lNfsx5flekkYyRkRUQzmNd4gbf6FfG1+4 3hVpukEI7LQGm4/QQhOhCm/6jP5LxYP4xH9oTfLUw8+49W/xfKHeXyeziXu5M5mO4Hfe0 TmiDnn01NgmPE/MSOI03EJd1ym4LlTJ2GUNnOxEKHnMPEcxkwNSJYjv5Du1NeAWWPBA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=YUn6u2kT; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 5A922606A320; Mon, 30 Nov 2026 18:03:02 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5A922606A320 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=YUn6u2kT 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-Mailing-List: kvm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261126155339.1349218-3-arnd@kernel.org> 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