[PATCH 2/5] arm64: Add support for FEAT_{LS64, LS64_V, LS64_ACCDATA}

2024-12-02 Thread Yicong Yang
From: Yicong Yang Armv8.7 introduces single-copy atomic 64-byte loads and stores instructions and its variants named under FEAT_{LS64, LS64_V, LS64_ACCDATA}. These features are identified by ID_AA64ISAR1_EL1.LS64 and the use of such instructions in userspace (EL0) can be trapped. In order to

[PATCH 1/5] arm64: Provide basic EL2 setup for FEAT_{LS64, LS64_V, LS64_ACCDATA} usage at EL0/1

2024-12-02 Thread Yicong Yang
From: Yicong Yang Instructions introduced by FEAT_{LS64, LS64_V, LS64_ACCDATA} is controlled by HCRX_EL2.{EnALS, EnASR, EnAS0}. Additionally access of ACCDATA_EL1 for FEAT_LS64_ACCDATA is also affected by FGT. Configure all of these to allow usage at EL0/1. This doesn't mean these instruc

[PATCH 4/5] arm64: Add ESR.DFSC definition of unsupported exclusive or atomic access

2024-12-02 Thread Yicong Yang
From: Yicong Yang 0x35 indicates IMPLEMENTATION DEFINED fault for Unsupported Exclusive or Atomic access. Add ESR_ELx_FSC definition and corresponding wrapper. Signed-off-by: Yicong Yang --- arch/arm64/include/asm/esr.h | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm64

[PATCH 5/5] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2024-12-02 Thread Yicong Yang
From: Yicong Yang FEAT_LS64* instructions only support to access Device/Uncacheable memory, otherwise a data abort for unsupported Exclusive or atomic access (0x35) is generated per spec. It's implementation defined whether the target exception level is routed and is possible to implement

[PATCH 0/5] Add support for FEAT_{LS64, LS64_V, LS64_ACCDATA} and related tests

2024-12-02 Thread Yicong Yang
From: Yicong Yang Armv8.7 introduces single-copy atomic 64-byte loads and stores instructions and its variants named under FEAT_{LS64, LS64_V, LS64_ACCDATA}. Add support for Armv8.7 FEAT_{LS64, LS64_V, LS64_ACCDATA}: - Add identifying and enabling in the cpufeature list - Expose the support of

[PATCH 3/5] kselftest/arm64: Add HWCAP test for FEAT_{LS64, LS64_V, LS64_ACCDATA}

2024-12-02 Thread Yicong Yang
From: Yicong Yang Add tests for FEAT_{LS64, LS64_V, LS64_ACCDATA}. Issue related instructions if feature presents, no SIGILL should be received. Since such instructions can only operate on Device memory or non-cacheable memory, we may received a SIGBUS during the test. Just ignore it since we

Re: [PATCH 5/5] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2024-12-04 Thread Yicong Yang
On 2024/12/3 17:38, Marc Zyngier wrote: > On Mon, 02 Dec 2024 13:55:04 +, > Yicong Yang wrote: >> >> From: Yicong Yang >> >> FEAT_LS64* instructions only support to access Device/Uncacheable >> memory, otherwise a data abort for unsupported Exclusive o

Re: [PATCH 2/5] arm64: Add support for FEAT_{LS64, LS64_V, LS64_ACCDATA}

2024-12-04 Thread Yicong Yang
On 2024/12/3 17:38, Marc Zyngier wrote: > On Mon, 02 Dec 2024 13:55:01 +, > Yicong Yang wrote: >> >> From: Yicong Yang >> >> Armv8.7 introduces single-copy atomic 64-byte loads and stores >> instructions and its variants named under FEAT_{LS64, LS64_V,

[PATCH v2 6/6] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2025-04-04 Thread Yicong Yang
From: Yicong Yang If FEAT_LS64WB not supported, FEAT_LS64* instructions only support to access Device/Uncacheable memory, otherwise a data abort for unsupported Exclusive or atomic access (0x35) is generated per spec. It's implementation defined whether the target exception level is route

[PATCH v2 3/6] KVM: arm64: Enable FEAT_{LS64, LS64_V} in the supported guest

2025-04-05 Thread Yicong Yang
From: Yicong Yang Using FEAT_{LS64, LS64_V} instructions in a guest is also controlled by HCRX_EL2.{EnALS, EnASR}. Enable it if guest has related feature. Signed-off-by: Yicong Yang --- arch/arm64/include/asm/kvm_emulate.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64

Re: [PATCH v2 5/6] arm64: Add ESR.DFSC definition of unsupported exclusive or atomic access

2025-04-06 Thread Yicong Yang
On 2025/4/2 0:15, Oliver Upton wrote: > On Mon, Mar 31, 2025 at 05:43:19PM +0800, Yicong Yang wrote: >> From: Yicong Yang >> >> 0x35 indicates IMPLEMENTATION DEFINED fault for Unsupported Exclusive or >> Atomic access. Add ESR_ELx_FSC definition and corresponding w

Re: [PATCH v2 1/6] arm64: Provide basic EL2 setup for FEAT_{LS64, LS64_V} usage at EL0/1

2025-04-06 Thread Yicong Yang
On 2025/4/3 17:04, Suzuki K Poulose wrote: > On 31/03/2025 10:43, Yicong Yang wrote: >> From: Yicong Yang >> >> Instructions introduced by FEAT_{LS64, LS64_V} is controlled by >> HCRX_EL2.{EnALS, EnASR}. Configure all of these to allow usage >> at EL0/1. >>

Re: [PATCH v2 6/6] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2025-04-06 Thread Yicong Yang
On 2025/4/2 0:13, Oliver Upton wrote: > Hi Yicong, > > On Mon, Mar 31, 2025 at 05:43:20PM +0800, Yicong Yang wrote: >> From: Yicong Yang >> >> If FEAT_LS64WB not supported, FEAT_LS64* instructions only support >> to access Device/Uncacheable memory, otherwis

Re: [PATCH v2 6/6] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2025-04-08 Thread Yicong Yang
On 2025/4/7 13:35, Oliver Upton wrote: > On Mon, Apr 07, 2025 at 11:33:01AM +0800, Yicong Yang wrote: >> On 2025/4/2 0:13, Oliver Upton wrote: >>> On Mon, Mar 31, 2025 at 05:43:20PM +0800, Yicong Yang wrote: >>>> @@ -1658,6 +1658,25 @@ static int user_m

[PATCH v2 1/6] arm64: Provide basic EL2 setup for FEAT_{LS64, LS64_V} usage at EL0/1

2025-03-31 Thread Yicong Yang
From: Yicong Yang Instructions introduced by FEAT_{LS64, LS64_V} is controlled by HCRX_EL2.{EnALS, EnASR}. Configure all of these to allow usage at EL0/1. This doesn't mean these instructions are always available in EL0/1 if provided. The hypervisor still have the control at runtime. S

[PATCH v2 0/6] Add support for FEAT_{LS64, LS64_V} and related tests

2025-03-31 Thread Yicong Yang
From: Yicong Yang Armv8.7 introduces single-copy atomic 64-byte loads and stores instructions and its variants named under FEAT_{LS64, LS64_V}. Add support for Armv8.7 FEAT_{LS64, LS64_V}: - Add identifying and enabling in the cpufeature list - Expose the support of these features to userspace

[PATCH v2 2/6] arm64: Add support for FEAT_{LS64, LS64_V}

2025-03-31 Thread Yicong Yang
From: Yicong Yang Armv8.7 introduces single-copy atomic 64-byte loads and stores instructions and its variants named under FEAT_{LS64, LS64_V}. These features are identified by ID_AA64ISAR1_EL1.LS64 and the use of such instructions in userspace (EL0) can be trapped. In order to support the use

[PATCH v2 4/6] kselftest/arm64: Add HWCAP test for FEAT_{LS64, LS64_V}

2025-04-04 Thread Yicong Yang
From: Yicong Yang Add tests for FEAT_{LS64, LS64_V}. Issue related instructions if feature presents, no SIGILL should be received. When such instructions operate on Device memory or non-cacheable memory, we may received a SIGBUS during the test (w/o FEAT_LS64WB). Just ignore it since we only

[PATCH v2 5/6] arm64: Add ESR.DFSC definition of unsupported exclusive or atomic access

2025-04-04 Thread Yicong Yang
From: Yicong Yang 0x35 indicates IMPLEMENTATION DEFINED fault for Unsupported Exclusive or Atomic access. Add ESR_ELx_FSC definition and corresponding wrapper. Signed-off-by: Yicong Yang --- arch/arm64/include/asm/esr.h | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm64

[PATCH v3 2/7] KVM: arm64: Add documentation for KVM_EXIT_ARM_LDST64B

2025-06-26 Thread Yicong Yang
From: Marc Zyngier Add a bit of documentation for KVM_EXIT_ARM_LDST64B so that userspace knows what to expect. Signed-off-by: Marc Zyngier Signed-off-by: Yicong Yang --- Documentation/virt/kvm/api.rst | 43 -- 1 file changed, 36 insertions(+), 7 deletions

[PATCH v3 4/7] KVM: arm/arm64: Allow user injection of unsupported exclusive/atomic DABT

2025-06-26 Thread Yicong Yang
From: Yicong Yang The unsupported exclusive/atomic DABT exception is hand to the userspace. Provide a way for the userspace to inject this DABT to the guest if they want to imitate how this is handled on the host. Signed-off-by: Yicong Yang --- arch/arm64/include/asm/kvm_emulate.h | 1

[PATCH v3 5/7] arm64: Provide basic EL2 setup for FEAT_{LS64, LS64_V} usage at EL0/1

2025-06-26 Thread Yicong Yang
From: Yicong Yang Instructions introduced by FEAT_{LS64, LS64_V} is controlled by HCRX_EL2.{EnALS, EnASR}. Configure all of these to allow usage at EL0/1. This doesn't mean these instructions are always available in EL0/1 if provided. The hypervisor still have the control at runtime. S

[PATCH v3 6/7] arm64: Add support for FEAT_{LS64, LS64_V}

2025-06-26 Thread Yicong Yang
From: Yicong Yang Armv8.7 introduces single-copy atomic 64-byte loads and stores instructions and its variants named under FEAT_{LS64, LS64_V}. These features are identified by ID_AA64ISAR1_EL1.LS64 and the use of such instructions in userspace (EL0) can be trapped. In order to support the use

[PATCH v3 3/7] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2025-06-26 Thread Yicong Yang
From: Yicong Yang If FEAT_LS64WB not supported, FEAT_LS64* instructions only support to access Device/Uncacheable memory, otherwise a data abort for unsupported Exclusive or atomic access (0x35) is generated per spec. It's implementation defined whether the target exception level is route

[PATCH v3 1/7] KVM: arm64: Add exit to userspace on {LD,ST}64B* outside of memslots

2025-06-26 Thread Yicong Yang
f-by: Marc Zyngier Signed-off-by: Yicong Yang --- arch/arm64/kvm/mmio.c| 27 ++- include/uapi/linux/kvm.h | 3 ++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/mmio.c b/arch/arm64/kvm/mmio.c index ab365e839874..04520f2f6010 100644 --- a/

[PATCH v3 0/7] Add support for FEAT_{LS64, LS64_V} and related tests

2025-06-26 Thread Yicong Yang
From: Yicong Yang Armv8.7 introduces single-copy atomic 64-byte loads and stores instructions and its variants named under FEAT_{LS64, LS64_V}. Add support for Armv8.7 FEAT_{LS64, LS64_V}: - Add identifying and enabling in the cpufeature list - Expose the support of these features to userspace

[PATCH v3 7/7] KVM: arm64: Enable FEAT_{LS64, LS64_V} in the supported guest

2025-06-26 Thread Yicong Yang
From: Yicong Yang Using FEAT_{LS64, LS64_V} instructions in a guest is also controlled by HCRX_EL2.{EnALS, EnASR}. Enable it if guest has related feature. Signed-off-by: Yicong Yang --- arch/arm64/include/asm/kvm_emulate.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64

Re: [PATCH v3 4/7] KVM: arm/arm64: Allow user injection of unsupported exclusive/atomic DABT

2025-06-26 Thread Yicong Yang
On 2025/6/26 16:09, Yicong Yang wrote: > From: Yicong Yang > > The unsupported exclusive/atomic DABT exception is hand to the > userspace. Provide a way for the userspace to inject this DABT > to the guest if they want to imitate how this is handled on the > host. > Te

[PATCH v4 6/7] KVM: arm64: Enable FEAT_{LS64, LS64_V} in the supported guest

2025-07-15 Thread Yicong Yang
From: Yicong Yang Using FEAT_{LS64, LS64_V} instructions in a guest is also controlled by HCRX_EL2.{EnALS, EnASR}. Enable it if guest has related feature. Signed-off-by: Yicong Yang --- arch/arm64/include/asm/kvm_emulate.h | 6 ++ 1 file changed, 6 insertions(+) diff --git a/arch/arm64

[PATCH v4 0/7] Add support for FEAT_{LS64, LS64_V} and related tests

2025-07-15 Thread Yicong Yang
From: Yicong Yang Armv8.7 introduces single-copy atomic 64-byte loads and stores instructions and its variants named under FEAT_{LS64, LS64_V}. Add support for Armv8.7 FEAT_{LS64, LS64_V}: - Add identifying and enabling in the cpufeature list - Expose the support of these features to userspace

[PATCH v4 2/7] KVM: arm64: Add documentation for KVM_EXIT_ARM_LDST64B

2025-07-15 Thread Yicong Yang
From: Marc Zyngier Add a bit of documentation for KVM_EXIT_ARM_LDST64B so that userspace knows what to expect. Signed-off-by: Marc Zyngier Signed-off-by: Yicong Yang --- Documentation/virt/kvm/api.rst | 43 -- 1 file changed, 36 insertions(+), 7 deletions

[PATCH v4 1/7] KVM: arm64: Add exit to userspace on {LD,ST}64B* outside of memslots

2025-07-15 Thread Yicong Yang
f-by: Marc Zyngier Signed-off-by: Yicong Yang --- arch/arm64/kvm/mmio.c| 27 ++- include/uapi/linux/kvm.h | 3 ++- 2 files changed, 28 insertions(+), 2 deletions(-) diff --git a/arch/arm64/kvm/mmio.c b/arch/arm64/kvm/mmio.c index ab365e839874..04520f2f6010 100644 --- a/

[PATCH v4 5/7] arm64: Add support for FEAT_{LS64, LS64_V}

2025-07-15 Thread Yicong Yang
From: Yicong Yang Armv8.7 introduces single-copy atomic 64-byte loads and stores instructions and its variants named under FEAT_{LS64, LS64_V}. These features are identified by ID_AA64ISAR1_EL1.LS64 and the use of such instructions in userspace (EL0) can be trapped. In order to support the use

[PATCH v4 3/7] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2025-07-15 Thread Yicong Yang
From: Yicong Yang If FEAT_LS64WB not supported, FEAT_LS64* instructions only support to access Device/Uncacheable memory, otherwise a data abort for unsupported Exclusive or atomic access (0x35, UAoEF) is generated per spec. It's implementation defined whether the target exception lev

[PATCH v4 4/7] arm64: Provide basic EL2 setup for FEAT_{LS64, LS64_V} usage at EL0/1

2025-07-15 Thread Yicong Yang
From: Yicong Yang Instructions introduced by FEAT_{LS64, LS64_V} is controlled by HCRX_EL2.{EnALS, EnASR}. Configure all of these to allow usage at EL0/1. This doesn't mean these instructions are always available in EL0/1 if provided. The hypervisor still have the control at runtime. S

[PATCH v4 7/7] kselftest/arm64: Add HWCAP test for FEAT_{LS64, LS64_V}

2025-07-15 Thread Yicong Yang
From: Yicong Yang Add tests for FEAT_{LS64, LS64_V}. Issue related instructions if feature presents, no SIGILL should be received. When such instructions operate on Device memory or non-cacheable memory, we may received a SIGBUS during the test (w/o FEAT_LS64WB). Just ignore it since we only

Re: [PATCH v3 3/7] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2025-07-01 Thread Yicong Yang
On 2025/6/27 21:12, Marc Zyngier wrote: > On Thu, 26 Jun 2025 12:39:41 +0100, > Yicong Yang wrote: >> >> On 2025/6/26 16:51, Marc Zyngier wrote: >>> On Thu, 26 Jun 2025 09:09:02 +0100, >>> Yicong Yang wrote: > > [...] > >>>> >>>

Re: [PATCH v3 3/7] KVM: arm64: Handle DABT caused by LS64* instructions on unsupported memory

2025-06-26 Thread Yicong Yang
On 2025/6/26 16:51, Marc Zyngier wrote: > On Thu, 26 Jun 2025 09:09:02 +0100, > Yicong Yang wrote: >> >> From: Yicong Yang >> >> If FEAT_LS64WB not supported, FEAT_LS64* instructions only support >> to access Device/Uncacheable memory, otherwise a data a