From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH v5 02/14] ARM: Section based HYP idmap Date: Mon, 14 Jan 2013 13:07:56 +0200 Message-ID: <20130114110756.GA10209@redhat.com> References: <20130108183811.46302.58543.stgit@ubuntu> <20130108183848.46302.77369.stgit@ubuntu> <20130114102721.GB4751@redhat.com> <20130114104952.GA4939@mudshark.cambridge.arm.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Christoffer Dall , "kvm@vger.kernel.org" , Marc Zyngier , Marcelo Tosatti , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" To: Will Deacon Return-path: Received: from mx1.redhat.com ([209.132.183.28]:14129 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756103Ab3ANLIO (ORCPT ); Mon, 14 Jan 2013 06:08:14 -0500 Content-Disposition: inline In-Reply-To: <20130114104952.GA4939@mudshark.cambridge.arm.com> Sender: kvm-owner@vger.kernel.org List-ID: On Mon, Jan 14, 2013 at 10:49:53AM +0000, Will Deacon wrote: > On Mon, Jan 14, 2013 at 10:27:21AM +0000, Gleb Natapov wrote: > > On Tue, Jan 08, 2013 at 01:38:48PM -0500, Christoffer Dall wrote: > > > Add a method (hyp_idmap_setup) to populate a hyp pgd with an > > > identity mapping of the code contained in the .hyp.idmap.text > > > section. > > > > > > Offer a method to drop this identity mapping through > > > hyp_idmap_teardown. > > > > > > Make all the above depend on CONFIG_ARM_VIRT_EXT and CONFIG_ARM_LPAE. > > > > > > Cc: Will Deacon > > > Reviewed-by: Marcelo Tosatti > > > Signed-off-by: Marc Zyngier > > > Signed-off-by: Christoffer Dall > > > --- > > > arch/arm/include/asm/idmap.h | 1 + > > > arch/arm/include/asm/pgtable-3level-hwdef.h | 1 + > > > arch/arm/kernel/vmlinux.lds.S | 6 +++ > > > arch/arm/mm/idmap.c | 54 ++++++++++++++++++++++----- > > > 4 files changed, 50 insertions(+), 12 deletions(-) > > [...] > > > > -static void identity_mapping_add(pgd_t *pgd, unsigned long addr, unsigned long end) > > > +static void identity_mapping_add(pgd_t *pgd, const char *text_start, > > > + const char *text_end, unsigned long prot) > > > { > > > - unsigned long prot, next; > > > + unsigned long addr, end; > > > + unsigned long next; > > > + > > > + addr = virt_to_phys(text_start); > > > + end = virt_to_phys(text_end); > > How does this work with phys addresses greater than 32bit (with > > LPAE)? This was the same before the patch too, but I am still > > curious. Since __virt_to_phys() returns unsigned long kernel cannot be > > put in high memory, right? > > Well, AArch32 (arch/arm/) only supports 32-bit virtual addresses by virtue > of the fact that our registers are only 32 bits wide, so we can't > identity-map physical addresses above the 4GB boundary. > Ah, of course. This is ident map so by definition it cannot map phys addresses above 4G. And since __virt_to_phys() suppose to work only on ident map it's OK to returns unsigned long. > You may want to look at the keystone patches from TI for insight about > kernels at high (>32-bit) addresses, although I've not seen any activity > around that for some time now (which is a pity, because the code-patching > stuff was in a good shape). > > Will -- Gleb.