Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp563511pxf; Thu, 11 Mar 2021 09:30:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJw8GRZFn/J3n/WDiBIagOs3sdm5xrpNTcwDL/uozajRmVwBrdyj6TI8G70ZFbpW+8G7Kf0h X-Received: by 2002:a17:907:2bd7:: with SMTP id gv23mr4160195ejc.351.1615483847730; Thu, 11 Mar 2021 09:30:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615483847; cv=none; d=google.com; s=arc-20160816; b=ufL6hkSI01OBhjjv0ccPJCg23s3CiEEHOlsNuRqAEzJ/ro2Vh8ML2DEyUzKlDbbBlB 24rfsq3vNXEkha+KoPClqsal7EliRVM10TLczwYEQjfYOE4zbXpgkOpyS656fe57EI4h 1iQMRqH1P04ySzrQ7kMVTeCcK7cZKgsHROULTBgtYYshvBZSpGZ0wBgbgDo4grXIBcwn 2hYUcwTu43BfFRhgZgSby5F9gOzTIXQMRYeG/xv4fD0s0uWnczYPcjCRWeCpycVhAZQp p67l563vHo9/XrZuXHez2WWrzrTi15yAzoW3CgH+323LHSNGoD+LFQn1XK0krAy36oX3 dseQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=Gz8leSZAwAU6c5gmP6MXAkIc0DUUgmf6xqFYDDqHr8g=; b=CCQGv+pela4CiAT3DPpiR6FmYsDRw3p/vGpPp49DcK1tfVe92OLd8NCXPW30vJ2SqG o0x/5w4ux/QjrMUCHj67cyKqvPF5uuXKEYCc1vA8Ff3xzNeOLQLfdhNEjUZRSbRtm8Me CIlfSmM7zflkO4OaubzyWDFKjgPCDK7aIs7cT/WAwenw4UDUUmyQob4UKaG0hdcnv5Ua fTAl4LJ9WQkDxIdO9XXs1JLMdzf+5b5eFiPAQE8DFMdk6+iTBWVxTs+WfTc6ehp0gbmV uILWbQ9F8UnHQ6KHAstHTnLI3DDjMJcfF3d/Sf5EsWnuOQgYt6JrGRTd0pUQHYM36Q+q 2uoA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L7QwP3mI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a8si2224104edq.601.2021.03.11.09.30.24; Thu, 11 Mar 2021 09:30:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=L7QwP3mI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229553AbhCKR3C (ORCPT + 99 others); Thu, 11 Mar 2021 12:29:02 -0500 Received: from mail.kernel.org ([198.145.29.99]:43496 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbhCKR3A (ORCPT ); Thu, 11 Mar 2021 12:29:00 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 39BF264F8D; Thu, 11 Mar 2021 17:28:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615483739; bh=SUeqNhY4Z+cYtXpQCYJP8i17rbPK2GdEQhebAc/M+tU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=L7QwP3mI/PxaXZL6Lzb4Uj8lOgGQvuW2ooWh1d9r7PlRtwnOnWkaL0lkxdH4Io8dM 33c0SarypvZ0j+O+tOyGFO9XW23anKOIKjMUm0OdqHWOemnYHBfhgzeDCNLJ0YpAUu i9voLaJivgCho9e8soLqDIKUvVRT4O8Y4bPmk/+ITnD8F6sHo02xfh9vqMZIERS0PP YQmJQK+2mB+cVYY8FaaD5yvGFbtgsuHPhmiG5TZXZHiXZPtKg/WQZrnhRtxiFgju/B hsId/apbJy3etztRisBSXv9NedsezIP/q9J4pUoHKQdIce0ea7xWXXr3c2OACBNw3Q bmKHEV4MQEEiA== Date: Thu, 11 Mar 2021 17:28:52 +0000 From: Will Deacon To: Quentin Perret Cc: catalin.marinas@arm.com, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, android-kvm@google.com, linux-kernel@vger.kernel.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, tabba@google.com, mark.rutland@arm.com, dbrazdil@google.com, mate.toth-pal@arm.com, seanjc@google.com, robh+dt@kernel.org, ardb@kernel.org Subject: Re: [PATCH v4 17/34] KVM: arm64: Elevate hypervisor mappings creation at EL2 Message-ID: <20210311172852.GA31378@willie-the-truck> References: <20210310175751.3320106-1-qperret@google.com> <20210310175751.3320106-18-qperret@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210310175751.3320106-18-qperret@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 10, 2021 at 05:57:34PM +0000, Quentin Perret wrote: > Previous commits have introduced infrastructure to enable the EL2 code > to manage its own stage 1 mappings. However, this was preliminary work, > and none of it is currently in use. > > Put all of this together by elevating the mapping creation at EL2 when > memory protection is enabled. In this case, the host kernel running > at EL1 still creates _temporary_ EL2 mappings, only used while > initializing the hypervisor, but frees them right after. > > As such, all calls to create_hyp_mappings() after kvm init has finished > turn into hypercalls, as the host now has no 'legal' way to modify the > hypevisor page tables directly. > > Signed-off-by: Quentin Perret > --- > arch/arm64/include/asm/kvm_mmu.h | 2 +- > arch/arm64/kvm/arm.c | 87 +++++++++++++++++++++++++++++--- > arch/arm64/kvm/mmu.c | 43 ++++++++++++++-- > 3 files changed, 120 insertions(+), 12 deletions(-) Acked-by: Will Deacon Will