Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp641610pxf; Thu, 11 Mar 2021 11:11:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJz8ovvt2LMqoYRnH3kTava6Y9Z7BbnnFiesbPVdzjTEaKvViPL2AY+uu3JOF0lfdCMH3IEx X-Received: by 2002:a05:6402:32a:: with SMTP id q10mr9939124edw.15.1615489906309; Thu, 11 Mar 2021 11:11:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615489906; cv=none; d=google.com; s=arc-20160816; b=uVSCkEEv0j4Ra29jeeMHS9hYktRatOlC6W/nJtzauXDbEtHsHE+5xtrtctgbJ/SwGG CsKswlbypUkhw6/SHtDWOW+6Dy2EcZyRkeIww1JYXcuTbNHkWE4Sl5O/+CF5mbV6oiHu nUPm+eh6knZjNjDc7iWjt+OFmQ99i5jN74PVuot2NWknB+FfrDbhHP586d55qGebMljD UuBttR1KrBDuDfMYEbipgHsR6G90nH45+rnKnRcbTs/SYz0xf0fWQZHQzKIDg2T/iMx3 hMqNUO+vlyMg1BgWG5kLhiXBFIvM6jrngM5NzHEUAAm8Ss9lAXZhhH4tsVBZYJjtGMZ2 9JnQ== 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=vYhQc7mrTMXIGUhokk5O3ZGo5TI4XC+dDFJegHrF5pY=; b=R96CV1yfXmZ/qwi70CFIW1RvDWFKMnLVj8NPFu0JZWJSE8MsL0YI+AgWFxGbJCegUg 6/Fho7qhlDSlqTyAR6rkkbBAcxkPESJ0hp3k+ZRRAoFPbwgEY0+0qrXW7nyHXY4rqo8m 5v6RlYsuyMWJ3MsJ3Mp5bRe1cgOAVTtiH7YIg2rYF25dh7ghNhZpcI1x4DAsz4QkdxpR bmiWB0ypJe26QmVhmqHSXVaK/gtA3Ng3Bs+kH34VqmCVYCXrgq8H9TX7+Ll/FiP0H8HJ AlJGiYuAQzgymEWcMVh0RLvGJ47LRn5ANTF60nsLitMJCOR55K+GcafB/3VNbRWJx1o+ XV5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="TEL/EMvY"; 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 v4si2446207ejx.329.2021.03.11.11.11.24; Thu, 11 Mar 2021 11:11:46 -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="TEL/EMvY"; 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 S231145AbhCKTKI (ORCPT + 99 others); Thu, 11 Mar 2021 14:10:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:39794 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230196AbhCKTJ1 (ORCPT ); Thu, 11 Mar 2021 14:09:27 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 93B0E64E60; Thu, 11 Mar 2021 19:09:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615489766; bh=tjRqrEnr46TNCZjccx2NGAuGGxIXCeGJ/0pAUdHa0PI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=TEL/EMvYZ0+zWrD5EIuzTfjrSYY7hC23Y2j+Z8/RVD2RPw5nW9nlL9OVPhdujco5H IxG1S4eYeByD+3RC4CtWTm2v9bPW3Wp6RTwwEhrAiNVg9ByP/3LKt8qv9TQ5TVf6Rn 168ARlFFeWq63rb7WsPBEmDpUngQIhcuvG3mb/Z3ZznNYhYt5+gDPEnWHMJqgnNnU6 DbcYWMOsemicENDMIBBoIaq6WYPEw+CKiBbYO2yOeJZ7nzkg3ohIzcM+MwF6wA2NPY Cwys5Ma+XGmLRC4S6IjWhKdvD0b1cOPkjRYIdkkA/ct10QYWQmLHVz/w6VMUFp/FOf 87T98ajA+CTHg== Date: Thu, 11 Mar 2021 19:09:20 +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 31/34] KVM: arm64: Wrap the host with a stage 2 Message-ID: <20210311190919.GC31586@willie-the-truck> References: <20210310175751.3320106-1-qperret@google.com> <20210310175751.3320106-32-qperret@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210310175751.3320106-32-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:48PM +0000, Quentin Perret wrote: > When KVM runs in protected nVHE mode, make use of a stage 2 page-table > to give the hypervisor some control over the host memory accesses. The > host stage 2 is created lazily using large block mappings if possible, > and will default to page mappings in absence of a better solution. > > From this point on, memory accesses from the host to protected memory > regions (e.g. marked PROT_NONE) are fatal and lead to hyp_panic(). > > Signed-off-by: Quentin Perret > --- > arch/arm64/include/asm/kvm_asm.h | 1 + > arch/arm64/include/asm/kvm_cpufeature.h | 2 + > arch/arm64/kernel/image-vars.h | 3 + > arch/arm64/kvm/arm.c | 10 + > arch/arm64/kvm/hyp/include/nvhe/mem_protect.h | 34 +++ > arch/arm64/kvm/hyp/nvhe/Makefile | 2 +- > arch/arm64/kvm/hyp/nvhe/hyp-init.S | 1 + > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 11 + > arch/arm64/kvm/hyp/nvhe/mem_protect.c | 246 ++++++++++++++++++ > arch/arm64/kvm/hyp/nvhe/setup.c | 5 + > arch/arm64/kvm/hyp/nvhe/switch.c | 7 +- > arch/arm64/kvm/hyp/nvhe/tlb.c | 4 +- > 12 files changed, 319 insertions(+), 7 deletions(-) > create mode 100644 arch/arm64/kvm/hyp/include/nvhe/mem_protect.h > create mode 100644 arch/arm64/kvm/hyp/nvhe/mem_protect.c I like this a lot more now, thanks: Acked-by: Will Deacon Will