From: Oliver Upton <oliver.upton@linux.dev>
To: Ryan Roberts <ryan.roberts@arm.com>
Cc: Marc Zyngier <maz@kernel.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will@kernel.org>, Ard Biesheuvel <ardb@kernel.org>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Anshuman Khandual <anshuman.khandual@arm.com>,
James Morse <james.morse@arm.com>,
Alexandru Elisei <alexandru.elisei@arm.com>,
linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev,
kvmarm@lists.cs.columbia.edu
Subject: Re: [PATCH v1 10/12] KVM: arm64: Rework logic to en/decode VTCR_EL2.{SL0, SL2} fields
Date: Tue, 20 Dec 2022 18:08:58 +0000 [thread overview]
Message-ID: <Y6H6OlQotzguqdLJ@google.com> (raw)
In-Reply-To: <94981e1e-4e88-caa1-222a-7ba336bcd156@arm.com>
On Tue, Dec 20, 2022 at 09:01:19AM +0000, Ryan Roberts wrote:
> On 20/12/2022 00:06, Oliver Upton wrote:
> > Hi Ryan,
> >
> > On Tue, Dec 06, 2022 at 01:59:28PM +0000, Ryan Roberts wrote:
> >> In order to support 5 level translation, FEAT_LPA2 introduces the 1-bit
> >> SL2 field within VTCR_EL2 to extend the existing 2-bit SL0 field. The
> >> SL2[0]:SL0[1:0] encodings have no simple algorithmic relationship to the
> >> start levels they represent (that I can find, at least), so replace the
> >> existing macros with functions that do lookups to encode and decode the
> >> values. These new functions no longer make hardcoded assumptions about
> >> the maximum level and instead rely on KVM_PGTABLE_FIRST_LEVEL and
> >> KVM_PGTABLE_LAST_LEVEL.
> >>
> >> This is preparatory work for enabling 52-bit IPA for 4KB and 16KB pages
> >> with FEAT_LPA2.
> >>
> >> No functional change intended.
> >>
> >> Signed-off-by: Ryan Roberts <ryan.roberts@arm.com>
> >
> > Why do we need to support 5-level paging at stage-2?
> >
> > A configuration of start_level = 0, T0SZ = 12 with 4K paging would
> > result in 16 concatenated tables at level 0, avoiding the level -1
> > lookup altogether.
>
> Yes, agreed. And that's exactly what the code does. So we could remove this
> patch from the series and everything would continue to function correctly. But I
> was trying to make things more consistent and maintainable (this now works in
> terms of KVM_PGTABLE_FIRST_LEVEL and KVM_PGTABLE_LAST_LEVEL for example).
My largest concern was the plumbing that was added for setting a start
level of -1 that is effectively dead code. I worry about it because it
can be confusing for newcomers and can be an open invitation to mess
things up later down the line.
> So happy to remove this and replace with a comment describing the limitations if
> that's your preference?
Marc, feel free to put me in line here if I'm not thinking about this
right, but adding support for an unused feature is likely less
maintainable. So, I'd prefer we drop the patch.
--
Thanks,
Oliver
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-12-20 18:10 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-06 13:59 [PATCH v1 00/12] KVM: arm64: Support FEAT_LPA2 at hyp s1 and vm s2 Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 01/12] arm64/mm: Add FEAT_LPA2 specific ID_AA64MMFR0.TGRAN[2] Ryan Roberts
2022-12-14 19:16 ` Oliver Upton
2022-12-15 0:53 ` Oliver Upton
2022-12-06 13:59 ` [PATCH v1 02/12] arm64/mm: Update tlb invalidation routines for FEAT_LPA2 Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 03/12] KVM: arm64: Add new (V)TCR_EL2 field definitions " Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 04/12] KVM: arm64: Plumbing to enable multiple pgtable formats Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 05/12] KVM: arm64: Maintain page-table format info in struct kvm_pgtable Ryan Roberts
2022-12-19 19:45 ` Oliver Upton
2022-12-06 13:59 ` [PATCH v1 06/12] KVM: arm64: Use LPA2 page-tables for stage2 if HW supports it Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 07/12] KVM: arm64: Use LPA2 page-tables for hyp stage1 " Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 08/12] KVM: arm64: Insert PS field at TCR_EL2 assembly time Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 09/12] KVM: arm64: Convert translation level parameter to s8 Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 10/12] KVM: arm64: Rework logic to en/decode VTCR_EL2.{SL0, SL2} fields Ryan Roberts
2022-12-20 0:06 ` Oliver Upton
2022-12-20 9:01 ` Ryan Roberts
2022-12-20 18:08 ` Oliver Upton [this message]
2022-12-06 13:59 ` [PATCH v1 11/12] KVM: arm64: Support upto 5 levels of translation in kvm_pgtable Ryan Roberts
2022-12-06 13:59 ` [PATCH v1 12/12] KVM: arm64: Allow guests with >48-bit IPA size on FEAT_LPA2 systems Ryan Roberts
2022-12-15 0:52 ` [PATCH v1 00/12] KVM: arm64: Support FEAT_LPA2 at hyp s1 and vm s2 Oliver Upton
2022-12-15 9:33 ` Ryan Roberts
2022-12-15 18:12 ` Oliver Upton
2022-12-20 18:28 ` Oliver Upton
2023-02-20 14:17 ` Ryan Roberts
2023-02-22 20:42 ` Oliver Upton
2023-02-23 9:53 ` Catalin Marinas
2022-12-15 9:35 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Y6H6OlQotzguqdLJ@google.com \
--to=oliver.upton@linux.dev \
--cc=alexandru.elisei@arm.com \
--cc=anshuman.khandual@arm.com \
--cc=ardb@kernel.org \
--cc=catalin.marinas@arm.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=kvmarm@lists.linux.dev \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=maz@kernel.org \
--cc=ryan.roberts@arm.com \
--cc=suzuki.poulose@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).