Since Armv9.6, FEAT_LSUI supplies load/store instructions
for privileged level to access user memory without clearing PSTATE.PAN bit.
Add LSUI feature so that the unprevilieged load/store instrcutions
could be used when kernel accesses user memory without clearing PSTATE.PAN bit.
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
---
arch/arm64/kernel/cpufeature.c | 8 ++++++++
arch/arm64/tools/cpucaps | 1 +
2 files changed, 9 insertions(+)
diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c
index b34044e20128..d914982c7cee 100644
--- a/arch/arm64/kernel/cpufeature.c
+++ b/arch/arm64/kernel/cpufeature.c
@@ -278,6 +278,7 @@ static const struct arm64_ftr_bits ftr_id_aa64isar2[] = {
static const struct arm64_ftr_bits ftr_id_aa64isar3[] = {
ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_FPRCVT_SHIFT, 4, 0),
+ ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_LSUI_SHIFT, 4, ID_AA64ISAR3_EL1_LSUI_NI),
ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_FAMINMAX_SHIFT, 4, 0),
ARM64_FTR_END,
};
@@ -3061,6 +3062,13 @@ static const struct arm64_cpu_capabilities arm64_features[] = {
.matches = has_pmuv3,
},
#endif
+ {
+ .desc = "Unprivileged Load Store Instructions (LSUI)",
+ .capability = ARM64_HAS_LSUI,
+ .type = ARM64_CPUCAP_SYSTEM_FEATURE,
+ .matches = has_cpuid_feature,
+ ARM64_CPUID_FIELDS(ID_AA64ISAR3_EL1, LSUI, IMP)
+ },
{},
};
diff --git a/arch/arm64/tools/cpucaps b/arch/arm64/tools/cpucaps
index 10effd4cff6b..d625f4987aa7 100644
--- a/arch/arm64/tools/cpucaps
+++ b/arch/arm64/tools/cpucaps
@@ -59,6 +59,7 @@ HAS_TLB_RANGE
HAS_VA52
HAS_VIRT_HOST_EXTN
HAS_WFXT
+HAS_LSUI
HAFT
HW_DBM
KVM_HVHE
--
LEVI:{C3F47F37-75D8-414A-A8BA-3980EC8A46D7}
On Wed, 11 Jun 2025 11:49:11 +0100, Yeoreum Yun <yeoreum.yun@arm.com> wrote: > > Since Armv9.6, FEAT_LSUI supplies load/store instructions > for privileged level to access user memory without clearing PSTATE.PAN bit. > > Add LSUI feature so that the unprevilieged load/store instrcutions nit: instructions > could be used when kernel accesses user memory without clearing PSTATE.PAN bit. > > Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> > --- > arch/arm64/kernel/cpufeature.c | 8 ++++++++ > arch/arm64/tools/cpucaps | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > index b34044e20128..d914982c7cee 100644 > --- a/arch/arm64/kernel/cpufeature.c > +++ b/arch/arm64/kernel/cpufeature.c > @@ -278,6 +278,7 @@ static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { > > static const struct arm64_ftr_bits ftr_id_aa64isar3[] = { > ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_FPRCVT_SHIFT, 4, 0), > + ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_LSUI_SHIFT, 4, ID_AA64ISAR3_EL1_LSUI_NI), > ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_FAMINMAX_SHIFT, 4, 0), > ARM64_FTR_END, > }; Please enable the equivalent bits in KVM so that the feature can be exposed to a guest. Thanks, M. -- Without deviation from the norm, progress is not possible.
Hi Marc, > On Wed, 11 Jun 2025 11:49:11 +0100, > Yeoreum Yun <yeoreum.yun@arm.com> wrote: > > > > Since Armv9.6, FEAT_LSUI supplies load/store instructions > > for privileged level to access user memory without clearing PSTATE.PAN bit. > > > > Add LSUI feature so that the unprevilieged load/store instrcutions > > nit: instructions Thanks. > > could be used when kernel accesses user memory without clearing PSTATE.PAN bit. > > > > Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com> > > --- > > arch/arm64/kernel/cpufeature.c | 8 ++++++++ > > arch/arm64/tools/cpucaps | 1 + > > 2 files changed, 9 insertions(+) > > > > diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c > > index b34044e20128..d914982c7cee 100644 > > --- a/arch/arm64/kernel/cpufeature.c > > +++ b/arch/arm64/kernel/cpufeature.c > > @@ -278,6 +278,7 @@ static const struct arm64_ftr_bits ftr_id_aa64isar2[] = { > > > > static const struct arm64_ftr_bits ftr_id_aa64isar3[] = { > > ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_FPRCVT_SHIFT, 4, 0), > > + ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_LSUI_SHIFT, 4, ID_AA64ISAR3_EL1_LSUI_NI), > > ARM64_FTR_BITS(FTR_VISIBLE, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64ISAR3_EL1_FAMINMAX_SHIFT, 4, 0), > > ARM64_FTR_END, > > }; > > Please enable the equivalent bits in KVM so that the feature can be > exposed to a guest. Okay. I'll add in next round. Thanks! -- Sincerely, Yeoreum Yun
On Wed, Jun 11, 2025 at 11:49:11AM +0100, Yeoreum Yun wrote: > index 10effd4cff6b..d625f4987aa7 100644 > --- a/arch/arm64/tools/cpucaps > +++ b/arch/arm64/tools/cpucaps > @@ -59,6 +59,7 @@ HAS_TLB_RANGE > HAS_VA52 > HAS_VIRT_HOST_EXTN > HAS_WFXT > +HAS_LSUI > HAFT > HW_DBM > KVM_HVHE This file should be sorted to reduce spurious conflicts.
Hi Mark, > On Wed, Jun 11, 2025 at 11:49:11AM +0100, Yeoreum Yun wrote: > > > index 10effd4cff6b..d625f4987aa7 100644 > > --- a/arch/arm64/tools/cpucaps > > +++ b/arch/arm64/tools/cpucaps > > @@ -59,6 +59,7 @@ HAS_TLB_RANGE > > HAS_VA52 > > HAS_VIRT_HOST_EXTN > > HAS_WFXT > > +HAS_LSUI > > HAFT > > HW_DBM > > KVM_HVHE > > This file should be sorted to reduce spurious conflicts. Thanks. I'll fix this. -- Sincerely, Yeoreum Yun
© 2016 - 2025 Red Hat, Inc.