From: Christoffer Dall Subject: Re: [Android-virt] [PATCH v4 02/10] ARM: KVM: Hypervisor identity mapping Date: Tue, 9 Aug 2011 13:23:02 +0200 Message-ID: <87DA53BA-2155-4203-B738-9C43391A1353@virtualopensystems.com> References: <20110806103821.27198.41231.stgit@localhost6.localdomain6> <20110806103910.27198.11538.stgit@localhost6.localdomain6> <4E40FBDB.1040505@redhat.com> Mime-Version: 1.0 (Apple Message framework v1244.3) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8BIT Cc: tech@virtualopensystems.com, Avi Kivity , android-virt@lists.cs.columbia.edu, kvm@vger.kernel.org To: Alexey Smirnov Return-path: Received: from mail-ey0-f174.google.com ([209.85.215.174]:49061 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752906Ab1HILXH convert rfc822-to-8bit (ORCPT ); Tue, 9 Aug 2011 07:23:07 -0400 Received: by eyx24 with SMTP id 24so3362392eyx.19 for ; Tue, 09 Aug 2011 04:23:06 -0700 (PDT) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On Aug 9, 2011, at 12:23 PM, Alexey Smirnov wrote: > Hi Christoffer, > >>> >>> These are for mapping host memory, not guest memory, right? >> >> yes (or to be exact - hypervisor memory). The point is that there are special hardware requirements for translation tables used in Hyp-mode not otherwise satisfied by the normal page tables. > > In function init_hyp_memory() you map some memory regions for vectors, > vcpu, stack, etc. using function create_hyp_mappings. Just wondering, > how do you make sure that guest will never map its own data into these > addresses? Since guest is not para-virtualized, it can use any VA it > wants, including these addresses. > > In your earlier KVM-arm paper you mentioned that such mappings were > write-protected, so whenever guest tried to access them you needed to > relocate such shared pages. Is the mechanism the same or you somehow > take advantage of virtualization extensions to avoid this problem? I take advantage of the virtualization extensions. These mappings are used only in Hyp-mode, which is only used to handle exceptions from the guest and to perform world-switches. Thus, these mappings are completely orthogonal to the 2nd stage translations used when running the VM.