lkml.org 
[lkml]   [2020]   [May]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] arm64/cpufeature: Add ID_AA64MMFR0_PARANGE_MASK
On Tue, May 12, 2020 at 11:53:43AM +0100, Mark Rutland wrote:
> >
> > /* Clamp the IPA limit to the PA size supported by the kernel */
> > ipa_max = (pa_max > PHYS_MASK_SHIFT) ? PHYS_MASK_SHIFT : pa_max;
> > @@ -411,7 +411,8 @@ int kvm_arm_setup_stage2(struct kvm *kvm, unsigned long type)
> > phys_shift = KVM_PHYS_SHIFT;
> > }
> >
> > - parange = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1) & 7;
> > + parange = id_aa64mmfr0_parange(read_sanitised_ftr_reg
> > + (SYS_ID_AA64MMFR0_EL1));
>
> Can't we add a system_ipa_range() helper, and avoid more boilerplate in
> each of these?
>
> e.g.
>
> int system_ipa_range(void)
> {
> u64 mmfr0;
> int parange;
>
> mmfr0 = read_sanitised_ftr_reg(SYS_ID_AA64MMFR0_EL1);
> parange = cpuid_feature_extract_unsigned_field(mmfr0,
> ID_AA64MMFR0_PARANGE_SHIFT);
>
> return parange;
> }

As Per MarcZ's comments, that should be system_pa_range() rather than
system_ipa_range().

Mark.

\
 
 \ /
  Last update: 2020-05-12 12:57    [W:0.038 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site