linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ardb@kernel.org>
To: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>,
	 Mark Rutland <mark.rutland@arm.com>,
	Marc Zyngier <maz@kernel.org>,
	 Anshuman Khandual <anshuman.khandual@arm.com>,
	Steve Capper <steve.capper@arm.com>
Subject: Re: [RFC PATCH] arm64: mm: limit linear region to 51 bits for KVM in nVHE mode
Date: Thu, 26 Aug 2021 14:23:40 +0200	[thread overview]
Message-ID: <CAMj1kXFOAai73mJ62Rshb7iZTHKgfqU30wDQCekmMunR5AMM3g@mail.gmail.com> (raw)
In-Reply-To: <20210826121623.GB30910@arm.com>

On Thu, 26 Aug 2021 at 14:16, Catalin Marinas <catalin.marinas@arm.com> wrote:
>
> On Tue, Aug 24, 2021 at 02:56:22PM +0200, Ard Biesheuvel wrote:
> > On Tue, 24 Aug 2021 at 12:59, Will Deacon <will@kernel.org> wrote:
> > > On Tue, Aug 10, 2021 at 06:12:44PM +0200, Ard Biesheuvel wrote:
> > > > diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c
> > > > index 8490ed2917ff..542dad13e2fc 100644
> > > > --- a/arch/arm64/mm/init.c
> > > > +++ b/arch/arm64/mm/init.c
> > > > @@ -282,7 +282,21 @@ static void __init fdt_enforce_memory_region(void)
> > > >
> > > >  void __init arm64_memblock_init(void)
> > > >  {
> > > > -     const s64 linear_region_size = PAGE_END - _PAGE_OFFSET(vabits_actual);
> > > > +     s64 linear_region_size = PAGE_END - _PAGE_OFFSET(vabits_actual);
> > > > +
> > > > +     /*
> > > > +      * Corner case: 52-bit VA capable systems running KVM in nVHE mode may
> > > > +      * be limited in their ability to support a linear map that exceeds 51
> > > > +      * bits of VA space, depending on the placement of the ID map. Given
> > > > +      * that the placement of the ID map may be randomized, let's simply
> > > > +      * limit the kernel's linear map to 51 bits as well if we detect this
> > > > +      * configuration.
> > > > +      */
> > > > +     if (IS_ENABLED(CONFIG_KVM) && vabits_actual == 52 &&
> > > > +         !is_kernel_in_hyp_mode()) {
> > > > +             pr_info("Capping linear region to 51 bits for KVM in nVHE mode on LVA capable hardware.\n");
> > > > +             linear_region_size = BIT(51);
> > > > +     }
> > >
> > > Slight nit, but to avoid having to think about PAGE_END I think this would
> > > be a little clearer as:
> > >
> > >         if (IS_ENABLED(CONFIG_KVM) && !is_kernel_in_hyp_mode())
> > >                 linear_region_size = min_t(u64, linear_region_size, BIT(51));
> > >
> >
> > Fair enough.
>
> Ard, do you plan to post a new version? I can make the change myself
> locally as well.
>

If you don't mind doing so, please go ahead.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2021-08-26 12:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-10 16:12 [RFC PATCH] arm64: mm: limit linear region to 51 bits for KVM in nVHE mode Ard Biesheuvel
2021-08-24 10:59 ` Will Deacon
2021-08-24 12:56   ` Ard Biesheuvel
2021-08-26 12:16     ` Catalin Marinas
2021-08-26 12:23       ` Ard Biesheuvel [this message]
2021-08-26 13:31   ` Catalin Marinas
2021-08-26 16:34     ` Ard Biesheuvel

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=CAMj1kXFOAai73mJ62Rshb7iZTHKgfqU30wDQCekmMunR5AMM3g@mail.gmail.com \
    --to=ardb@kernel.org \
    --cc=anshuman.khandual@arm.com \
    --cc=catalin.marinas@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=maz@kernel.org \
    --cc=steve.capper@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).