* [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT]
@ 2024-04-18 5:38 Anshuman Khandual
2024-04-18 5:38 ` [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 Anshuman Khandual
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Anshuman Khandual @ 2024-04-18 5:38 UTC (permalink / raw)
To: linux-arm-kernel, catalin.marinas
Cc: Anshuman Khandual, Marc Zyngier, Oliver Upton, Will Deacon,
Mark Rutland, Mark Brown, kvmarm, linux-kernel
This series replaces custom macros usage for ID_AA64PFR0_EL1_ELx_64BIT_ONLY
and ID_AA64PFR0_EL1_ELx_32BIT_64BIT fields, thus finally just dropping them
off completely. This series applies on v6.9-rc4.
Cc: Marc Zyngier <maz@kernel.org>
Cc: Oliver Upton <oliver.upton@linux.dev>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Mark Brown <broonie@kernel.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: kvmarm@lists.linux.dev
Cc: linux-kernel@vger.kernel.org
Anshuman Khandual (2):
KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1
arm64/cpufeature: Replace custom macros with fields from ID_AA64PFR0_EL1
arch/arm64/include/asm/cpufeature.h | 4 ++--
arch/arm64/include/asm/sysreg.h | 4 ----
arch/arm64/kernel/cpufeature.c | 4 ++--
arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 8 ++++----
arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 ++--
arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +-
6 files changed, 11 insertions(+), 15 deletions(-)
--
2.25.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
^ permalink raw reply [flat|nested] 8+ messages in thread* [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 2024-04-18 5:38 [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT] Anshuman Khandual @ 2024-04-18 5:38 ` Anshuman Khandual 2024-04-18 7:39 ` Marc Zyngier 2024-04-18 5:38 ` [PATCH 2/2] arm64/cpufeature: " Anshuman Khandual 2024-05-09 4:44 ` [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT] Anshuman Khandual 2 siblings, 1 reply; 8+ messages in thread From: Anshuman Khandual @ 2024-04-18 5:38 UTC (permalink / raw) To: linux-arm-kernel, catalin.marinas Cc: Anshuman Khandual, Marc Zyngier, Oliver Upton, Will Deacon, kvmarm, linux-kernel This replaces custom macros usage (i.e ID_AA64PFR0_EL1_ELx_64BIT_ONLY and ID_AA64PFR0_EL1_ELx_32BIT_64BIT) and instead directly uses register fields from ID_AA64PFR0_EL1 sysreg definition. Cc: Marc Zyngier <maz@kernel.org> Cc: Oliver Upton <oliver.upton@linux.dev> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Cc: kvmarm@lists.linux.dev Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> --- arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 8 ++++---- arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 ++-- arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h index 51f043649146..0034bfffced6 100644 --- a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h +++ b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h @@ -52,10 +52,10 @@ * Supported by KVM */ #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_EL0_IMP) | \ + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_EL1_IMP) | \ + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_EL2_IMP) | \ + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_EL3_IMP) | \ FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_RAS), ID_AA64PFR0_EL1_RAS_IMP) \ ) diff --git a/arch/arm64/kvm/hyp/nvhe/pkvm.c b/arch/arm64/kvm/hyp/nvhe/pkvm.c index 26dd9a20ad6e..58da2fec89b2 100644 --- a/arch/arm64/kvm/hyp/nvhe/pkvm.c +++ b/arch/arm64/kvm/hyp/nvhe/pkvm.c @@ -31,9 +31,9 @@ static void pvm_init_traps_aa64pfr0(struct kvm_vcpu *vcpu) /* Protected KVM does not support AArch32 guests. */ BUILD_BUG_ON(FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), - PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) != ID_AA64PFR0_EL1_ELx_64BIT_ONLY); + PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) != ID_AA64PFR0_EL1_EL0_IMP); BUILD_BUG_ON(FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), - PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) != ID_AA64PFR0_EL1_ELx_64BIT_ONLY); + PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) != ID_AA64PFR0_EL1_EL1_IMP); /* * Linux guests assume support for floating-point and Advanced SIMD. Do diff --git a/arch/arm64/kvm/hyp/nvhe/sys_regs.c b/arch/arm64/kvm/hyp/nvhe/sys_regs.c index edd969a1f36b..2860548d4250 100644 --- a/arch/arm64/kvm/hyp/nvhe/sys_regs.c +++ b/arch/arm64/kvm/hyp/nvhe/sys_regs.c @@ -276,7 +276,7 @@ static bool pvm_access_id_aarch32(struct kvm_vcpu *vcpu, * of AArch32 feature id registers. */ BUILD_BUG_ON(FIELD_GET(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), - PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) > ID_AA64PFR0_EL1_ELx_64BIT_ONLY); + PVM_ID_AA64PFR0_RESTRICT_UNSIGNED) > ID_AA64PFR0_EL1_EL1_IMP); return pvm_access_raz_wi(vcpu, p, r); } -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 2024-04-18 5:38 ` [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 Anshuman Khandual @ 2024-04-18 7:39 ` Marc Zyngier 2024-04-29 2:23 ` Anshuman Khandual 0 siblings, 1 reply; 8+ messages in thread From: Marc Zyngier @ 2024-04-18 7:39 UTC (permalink / raw) To: Anshuman Khandual Cc: linux-arm-kernel, catalin.marinas, Oliver Upton, Will Deacon, kvmarm, linux-kernel, Fuad Tabba + Fuad On Thu, 18 Apr 2024 06:38:03 +0100, Anshuman Khandual <anshuman.khandual@arm.com> wrote: > > This replaces custom macros usage (i.e ID_AA64PFR0_EL1_ELx_64BIT_ONLY and > ID_AA64PFR0_EL1_ELx_32BIT_64BIT) and instead directly uses register fields > from ID_AA64PFR0_EL1 sysreg definition. > > Cc: Marc Zyngier <maz@kernel.org> > Cc: Oliver Upton <oliver.upton@linux.dev> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will@kernel.org> > Cc: linux-arm-kernel@lists.infradead.org > Cc: kvmarm@lists.linux.dev > Cc: linux-kernel@vger.kernel.org > Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> > --- > arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 8 ++++---- > arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 ++-- > arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +- > 3 files changed, 7 insertions(+), 7 deletions(-) > > diff --git a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h > index 51f043649146..0034bfffced6 100644 > --- a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h > +++ b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h > @@ -52,10 +52,10 @@ > * Supported by KVM > */ > #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ > - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ > - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ > - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ > - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ > + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_EL0_IMP) | \ > + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_EL1_IMP) | \ > + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_EL2_IMP) | \ > + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_EL3_IMP) | \ If you are going to rework this, can we instead use something less verbose such as SYS_FIELD_GET()? There is also a series from Fuad moving things around, and maybe that's the opportunity to rework this while limiting the amount of cosmetic churn. Not to that this fixed config stuff needs to be reworked in order to match the runtime feature enforcement that the rest of KVM has adopted. Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 2024-04-18 7:39 ` Marc Zyngier @ 2024-04-29 2:23 ` Anshuman Khandual 2024-05-10 18:09 ` Mark Rutland 0 siblings, 1 reply; 8+ messages in thread From: Anshuman Khandual @ 2024-04-29 2:23 UTC (permalink / raw) To: Marc Zyngier Cc: linux-arm-kernel, catalin.marinas, Oliver Upton, Will Deacon, kvmarm, linux-kernel, Fuad Tabba On 4/18/24 13:09, Marc Zyngier wrote: > + Fuad > > On Thu, 18 Apr 2024 06:38:03 +0100, > Anshuman Khandual <anshuman.khandual@arm.com> wrote: >> >> This replaces custom macros usage (i.e ID_AA64PFR0_EL1_ELx_64BIT_ONLY and >> ID_AA64PFR0_EL1_ELx_32BIT_64BIT) and instead directly uses register fields >> from ID_AA64PFR0_EL1 sysreg definition. >> >> Cc: Marc Zyngier <maz@kernel.org> >> Cc: Oliver Upton <oliver.upton@linux.dev> >> Cc: Catalin Marinas <catalin.marinas@arm.com> >> Cc: Will Deacon <will@kernel.org> >> Cc: linux-arm-kernel@lists.infradead.org >> Cc: kvmarm@lists.linux.dev >> Cc: linux-kernel@vger.kernel.org >> Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> >> --- >> arch/arm64/kvm/hyp/include/nvhe/fixed_config.h | 8 ++++---- >> arch/arm64/kvm/hyp/nvhe/pkvm.c | 4 ++-- >> arch/arm64/kvm/hyp/nvhe/sys_regs.c | 2 +- >> 3 files changed, 7 insertions(+), 7 deletions(-) >> >> diff --git a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h >> index 51f043649146..0034bfffced6 100644 >> --- a/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h >> +++ b/arch/arm64/kvm/hyp/include/nvhe/fixed_config.h >> @@ -52,10 +52,10 @@ >> * Supported by KVM >> */ >> #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ >> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_EL0_IMP) | \ >> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_EL1_IMP) | \ >> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_EL2_IMP) | \ >> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_EL3_IMP) | \ > > If you are going to rework this, can we instead use something less > verbose such as SYS_FIELD_GET()? Just wondering, is not FIELD_PREP() and SYS_FIELD_GET() does the exact opposite thing. The earlier builds the entire register value from various constituents, where as the later extracts a single register field from a complete register value instead. Or did I just misunderstood something here. > > There is also a series from Fuad moving things around, and maybe > that's the opportunity to rework this while limiting the amount of > cosmetic churn. Not to that this fixed config stuff needs to be I guess that might be a better place to change the code instead. Because this series just replaces the derived register field from tools syreg, but will be happy to have those changes here as well in a separate pre/post patch. > reworked in order to match the runtime feature enforcement that the > rest of KVM has adopted. I am afraid, did not get the above. Could you please give some more details. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 2024-04-29 2:23 ` Anshuman Khandual @ 2024-05-10 18:09 ` Mark Rutland 2024-05-13 5:28 ` Anshuman Khandual 0 siblings, 1 reply; 8+ messages in thread From: Mark Rutland @ 2024-05-10 18:09 UTC (permalink / raw) To: Anshuman Khandual Cc: Marc Zyngier, linux-arm-kernel, catalin.marinas, Oliver Upton, Will Deacon, kvmarm, linux-kernel, Fuad Tabba On Mon, Apr 29, 2024 at 07:53:14AM +0530, Anshuman Khandual wrote: > On 4/18/24 13:09, Marc Zyngier wrote: > > On Thu, 18 Apr 2024 06:38:03 +0100, > > Anshuman Khandual <anshuman.khandual@arm.com> wrote: > >> #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ > >> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ > >> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ > >> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ > >> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ > >> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_EL0_IMP) | \ > >> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_EL1_IMP) | \ > >> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_EL2_IMP) | \ > >> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_EL3_IMP) | \ > > > > If you are going to rework this, can we instead use something less > > verbose such as SYS_FIELD_GET()? > > Just wondering, is not FIELD_PREP() and SYS_FIELD_GET() does the exact opposite thing. > The earlier builds the entire register value from various constituents, where as the > later extracts a single register field from a complete register value instead. Or did > I just misunderstood something here. He means use one of the SYS_FIELD_*() helpers, e.g. SYS_FIELD_PREP_ENUM(), with which this can be: #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL0, IMP) | \ SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL1, IMP) | \ SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL2, IMP) | \ SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL3, IMP) | \ SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, RAS, IMP) \ ) ... which is far less verbose, and much easier to read. Mark. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 2024-05-10 18:09 ` Mark Rutland @ 2024-05-13 5:28 ` Anshuman Khandual 0 siblings, 0 replies; 8+ messages in thread From: Anshuman Khandual @ 2024-05-13 5:28 UTC (permalink / raw) To: Mark Rutland Cc: Marc Zyngier, linux-arm-kernel, catalin.marinas, Oliver Upton, Will Deacon, kvmarm, linux-kernel, Fuad Tabba On 5/10/24 23:39, Mark Rutland wrote: > On Mon, Apr 29, 2024 at 07:53:14AM +0530, Anshuman Khandual wrote: >> On 4/18/24 13:09, Marc Zyngier wrote: >>> On Thu, 18 Apr 2024 06:38:03 +0100, >>> Anshuman Khandual <anshuman.khandual@arm.com> wrote: >>>> #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ >>>> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >>>> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >>>> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >>>> - FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_ELx_64BIT_ONLY) | \ >>>> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL0), ID_AA64PFR0_EL1_EL0_IMP) | \ >>>> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL1), ID_AA64PFR0_EL1_EL1_IMP) | \ >>>> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL2), ID_AA64PFR0_EL1_EL2_IMP) | \ >>>> + FIELD_PREP(ARM64_FEATURE_MASK(ID_AA64PFR0_EL1_EL3), ID_AA64PFR0_EL1_EL3_IMP) | \ >>> >>> If you are going to rework this, can we instead use something less >>> verbose such as SYS_FIELD_GET()? >> >> Just wondering, is not FIELD_PREP() and SYS_FIELD_GET() does the exact opposite thing. >> The earlier builds the entire register value from various constituents, where as the >> later extracts a single register field from a complete register value instead. Or did >> I just misunderstood something here. > > He means use one of the SYS_FIELD_*() helpers, e.g. SYS_FIELD_PREP_ENUM(), with > which this can be: > > #define PVM_ID_AA64PFR0_RESTRICT_UNSIGNED (\ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL0, IMP) | \ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL1, IMP) | \ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL2, IMP) | \ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, EL3, IMP) | \ > SYS_FIELD_PREP_ENUM(ID_AA64PFR0_EL1, RAS, IMP) \ > ) > > ... which is far less verbose, and much easier to read. Got it, this makes sense, will fold in the above changes and respin after the merge window. Thanks for the clarification. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH 2/2] arm64/cpufeature: Replace custom macros with fields from ID_AA64PFR0_EL1 2024-04-18 5:38 [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT] Anshuman Khandual 2024-04-18 5:38 ` [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 Anshuman Khandual @ 2024-04-18 5:38 ` Anshuman Khandual 2024-05-09 4:44 ` [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT] Anshuman Khandual 2 siblings, 0 replies; 8+ messages in thread From: Anshuman Khandual @ 2024-04-18 5:38 UTC (permalink / raw) To: linux-arm-kernel, catalin.marinas Cc: Anshuman Khandual, Will Deacon, Mark Rutland, Mark Brown, linux-kernel This replaces custom macros usage (i.e ID_AA64PFR0_EL1_ELx_64BIT_ONLY and ID_AA64PFR0_EL1_ELx_32BIT_64BIT) and instead directly uses register fields from ID_AA64PFR0_EL1 sysreg definition. Finally let's drop off both these custom macros as they are now redundant. Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Will Deacon <will@kernel.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Mark Brown <broonie@kernel.org> Cc: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com> --- arch/arm64/include/asm/cpufeature.h | 4 ++-- arch/arm64/include/asm/sysreg.h | 4 ---- arch/arm64/kernel/cpufeature.c | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/arch/arm64/include/asm/cpufeature.h b/arch/arm64/include/asm/cpufeature.h index 8b904a757bd3..558434267271 100644 --- a/arch/arm64/include/asm/cpufeature.h +++ b/arch/arm64/include/asm/cpufeature.h @@ -588,14 +588,14 @@ static inline bool id_aa64pfr0_32bit_el1(u64 pfr0) { u32 val = cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_EL1_EL1_SHIFT); - return val == ID_AA64PFR0_EL1_ELx_32BIT_64BIT; + return val == ID_AA64PFR0_EL1_EL1_AARCH32; } static inline bool id_aa64pfr0_32bit_el0(u64 pfr0) { u32 val = cpuid_feature_extract_unsigned_field(pfr0, ID_AA64PFR0_EL1_EL0_SHIFT); - return val == ID_AA64PFR0_EL1_ELx_32BIT_64BIT; + return val == ID_AA64PFR0_EL1_EL0_AARCH32; } static inline bool id_aa64pfr0_sve(u64 pfr0) diff --git a/arch/arm64/include/asm/sysreg.h b/arch/arm64/include/asm/sysreg.h index 9e8999592f3a..1199185a3da9 100644 --- a/arch/arm64/include/asm/sysreg.h +++ b/arch/arm64/include/asm/sysreg.h @@ -872,10 +872,6 @@ /* Position the attr at the correct index */ #define MAIR_ATTRIDX(attr, idx) ((attr) << ((idx) * 8)) -/* id_aa64pfr0 */ -#define ID_AA64PFR0_EL1_ELx_64BIT_ONLY 0x1 -#define ID_AA64PFR0_EL1_ELx_32BIT_64BIT 0x2 - /* id_aa64mmfr0 */ #define ID_AA64MMFR0_EL1_TGRAN4_SUPPORTED_MIN 0x0 #define ID_AA64MMFR0_EL1_TGRAN4_LPA2 ID_AA64MMFR0_EL1_TGRAN4_52_BIT diff --git a/arch/arm64/kernel/cpufeature.c b/arch/arm64/kernel/cpufeature.c index 56583677c1f2..c041b0958f53 100644 --- a/arch/arm64/kernel/cpufeature.c +++ b/arch/arm64/kernel/cpufeature.c @@ -285,8 +285,8 @@ static const struct arm64_ftr_bits ftr_id_aa64pfr0[] = { S_ARM64_FTR_BITS(FTR_VISIBLE, FTR_STRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_FP_SHIFT, 4, ID_AA64PFR0_EL1_FP_NI), ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_EL3_SHIFT, 4, 0), ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_EL2_SHIFT, 4, 0), - ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_EL1_SHIFT, 4, ID_AA64PFR0_EL1_ELx_64BIT_ONLY), - ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_EL0_SHIFT, 4, ID_AA64PFR0_EL1_ELx_64BIT_ONLY), + ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_EL1_SHIFT, 4, ID_AA64PFR0_EL1_EL1_IMP), + ARM64_FTR_BITS(FTR_HIDDEN, FTR_NONSTRICT, FTR_LOWER_SAFE, ID_AA64PFR0_EL1_EL0_SHIFT, 4, ID_AA64PFR0_EL1_EL0_IMP), ARM64_FTR_END, }; -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT] 2024-04-18 5:38 [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT] Anshuman Khandual 2024-04-18 5:38 ` [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 Anshuman Khandual 2024-04-18 5:38 ` [PATCH 2/2] arm64/cpufeature: " Anshuman Khandual @ 2024-05-09 4:44 ` Anshuman Khandual 2 siblings, 0 replies; 8+ messages in thread From: Anshuman Khandual @ 2024-05-09 4:44 UTC (permalink / raw) To: linux-arm-kernel, catalin.marinas, Will Deacon Cc: Marc Zyngier, Oliver Upton, Will Deacon, Mark Rutland, Mark Brown, kvmarm, linux-kernel On 4/18/24 11:08, Anshuman Khandual wrote: > This series replaces custom macros usage for ID_AA64PFR0_EL1_ELx_64BIT_ONLY > and ID_AA64PFR0_EL1_ELx_32BIT_64BIT fields, thus finally just dropping them > off completely. This series applies on v6.9-rc4. > > Cc: Marc Zyngier <maz@kernel.org> > Cc: Oliver Upton <oliver.upton@linux.dev> > Cc: Catalin Marinas <catalin.marinas@arm.com> > Cc: Will Deacon <will@kernel.org> > Cc: Mark Rutland <mark.rutland@arm.com> > Cc: Mark Brown <broonie@kernel.org> > Cc: linux-arm-kernel@lists.infradead.org > Cc: kvmarm@lists.linux.dev > Cc: linux-kernel@vger.kernel.org > > Anshuman Khandual (2): > KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 > arm64/cpufeature: Replace custom macros with fields from ID_AA64PFR0_EL1 Hello All, I am bit confused here, is there something more that needs to be done. It seems like the previous discussion thread remained some what inconclusive. Please do let me know. Thank you. - Anshuman _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2024-05-13 5:29 UTC | newest] Thread overview: 8+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-04-18 5:38 [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT] Anshuman Khandual 2024-04-18 5:38 ` [PATCH 1/2] KVM: arm64: Replace custom macros with fields from ID_AA64PFR0_EL1 Anshuman Khandual 2024-04-18 7:39 ` Marc Zyngier 2024-04-29 2:23 ` Anshuman Khandual 2024-05-10 18:09 ` Mark Rutland 2024-05-13 5:28 ` Anshuman Khandual 2024-04-18 5:38 ` [PATCH 2/2] arm64/cpufeature: " Anshuman Khandual 2024-05-09 4:44 ` [PATCH 0/2] arm64: Drop ID_AA64PFR0_EL1_ELx_[64BIT_ONLY|32BIT_64BIT] Anshuman Khandual
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).