[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20200512105614.GC60359@C02TD0UTHF1T.local>
Date: Tue, 12 May 2020 11:56:14 +0100
From: Mark Rutland <mark.rutland@....com>
To: Anshuman Khandual <anshuman.khandual@....com>
Cc: linux-arm-kernel@...ts.infradead.org,
Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will@...nel.org>, Marc Zyngier <maz@...nel.org>,
James Morse <james.morse@....com>,
linux-kernel@...r.kernel.org, kvmarm@...ts.cs.columbia.edu
Subject: Re: [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.
Powered by blists - more mailing lists