From patchwork Thu Jan 24 16:52:29 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 2033971 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 09065DF264 for ; Thu, 24 Jan 2013 16:55:21 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TyQ2V-000380-9n; Thu, 24 Jan 2013 16:52:35 +0000 Received: from ia-in-x0235.1e100.net ([2607:f8b0:4001:c02::235] helo=mail-ia0-x235.google.com) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1TyQ2R-00036m-HW for linux-arm-kernel@lists.infradead.org; Thu, 24 Jan 2013 16:52:32 +0000 Received: by mail-ia0-f181.google.com with SMTP id k25so4978135iah.40 for ; Thu, 24 Jan 2013 08:52:30 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-received:x-originating-ip:in-reply-to:references :date:message-id:subject:from:to:cc:content-type:x-gm-message-state; bh=hXGxZTE+7dqiaihVvxS57iSifMP6MFe7EcP3rjQQrew=; b=dE1S1ramnybXDixKLuggXEPpyAXlxCKJ6I3MPwuUNPfZbFyoqpM3iPM0VBaO+oHWO5 n9eBf+KTgNDw0ZIuMKqJrE133LemA5ABWh+vThZE26FNSwz/Z1CECQHkX/w0Y7+2sLDu mN161v8thNvgsybnSyotXwhLovxb8unw0IQfjkoUYnVShUtnjAXyKZFe1ZebX2qBHeX4 pP2cbEtrEb8PTmxINYEDhRfBYOJqMDn35ShW7+tDCf5KAlmR9FhFTUqLSGuYYes1LYyJ 2oQ4otLr3q4UhVDMPKc4JWE/19Be5JJNsVXCMz6mj90ut9NKyTFswCT4JytbY1PBcsRZ sn2A== MIME-Version: 1.0 X-Received: by 10.50.33.173 with SMTP id s13mr1928565igi.23.1359046350051; Thu, 24 Jan 2013 08:52:30 -0800 (PST) Received: by 10.64.37.70 with HTTP; Thu, 24 Jan 2013 08:52:29 -0800 (PST) X-Originating-IP: [72.80.83.148] In-Reply-To: <20130124154535.GD18233@arm.com> References: <20130116175716.29147.15348.stgit@ubuntu> <20130116175748.29147.91246.stgit@ubuntu> <20130124154535.GD18233@arm.com> Date: Thu, 24 Jan 2013 11:52:29 -0500 Message-ID: Subject: Re: [PATCH v6 04/15] KVM: ARM: Hypervisor initialization From: Christoffer Dall To: Catalin Marinas X-Gm-Message-State: ALoCoQmZBwrsvJkVcZ2aLFd/u9NenGtPQf6535iaH0PxE/kF61Wfpf/13tl3ULutc1tIYJv77WO0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130124_115231_602527_5FB5212A X-CRM114-Status: GOOD ( 17.01 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: "kvm@vger.kernel.org" , Marc Zyngier , Marcelo Tosatti , Will Deacon , "kvmarm@lists.cs.columbia.edu" , "linux-arm-kernel@lists.infradead.org" X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org On Thu, Jan 24, 2013 at 10:45 AM, Catalin Marinas wrote: > On Wed, Jan 16, 2013 at 05:57:48PM +0000, Christoffer Dall wrote: >> --- a/arch/arm/include/asm/pgtable-3level-hwdef.h >> +++ b/arch/arm/include/asm/pgtable-3level-hwdef.h >> @@ -32,6 +32,9 @@ >> #define PMD_TYPE_SECT (_AT(pmdval_t, 1) << 0) >> #define PMD_BIT4 (_AT(pmdval_t, 0)) >> #define PMD_DOMAIN(x) (_AT(pmdval_t, 0)) >> +#define PMD_APTABLE_SHIFT (61) >> +#define PMD_APTABLE (_AT(pgdval_t, 3) << PGD_APTABLE_SHIFT) >> +#define PMD_PXNTABLE (_AT(pgdval_t, 1) << 59) > > Are these used anywhere? I grep'ed but couldn't find. While I'm fine > with keeping some hardware definitions for future use, I think here you > need to qualify these bits with some suffix to PMD_APTABLE. The APTable > are just a group of bits with different meaning (no write access etc.). > If you want to keep them as group of bits, you can add a _MASK suffix. > >> +static int init_hyp_mode(void) >> +{ >> + phys_addr_t init_phys_addr; >> + int cpu; >> + int err = 0; >> + >> + /* >> + * Allocate Hyp PGD and setup Hyp identity mapping >> + */ >> + err = kvm_mmu_init(); >> + if (err) >> + goto out_err; > > The comment is a bit misleading since kvm_mmu_init() simply checks > whether hyp_pgd has been initialised. The actual initialisation is done > by the idmap code. > This should fix it, thanks: diff --git a/arch/arm/include/asm/pgtable-3level-hwdef.h b/arch/arm/include/asm/pgtable-3level-hwdef.h index 432fa12..30fb12a 100644 --- a/arch/arm/include/asm/pgtable-3level-hwdef.h +++ b/arch/arm/include/asm/pgtable-3level-hwdef.h @@ -33,7 +33,7 @@ #define PMD_BIT4 (_AT(pmdval_t, 0)) #define PMD_DOMAIN(x) (_AT(pmdval_t, 0)) #define PMD_APTABLE_SHIFT (61) -#define PMD_APTABLE (_AT(pgdval_t, 3) << PGD_APTABLE_SHIFT) +#define PMD_APTABLE_MASK (_AT(pgdval_t, 3) << PGD_APTABLE_SHIFT) #define PMD_PXNTABLE (_AT(pgdval_t, 1) << 59) /* diff --git a/arch/arm/kvm/arm.c b/arch/arm/kvm/arm.c index 2d30e3a..8354a6f 100644 --- a/arch/arm/kvm/arm.c +++ b/arch/arm/kvm/arm.c @@ -871,7 +871,7 @@ static int init_hyp_mode(void) int err = 0; /* - * Allocate Hyp PGD and setup Hyp identity mapping + * Make sure the Hyp identity map is ready for us. */ err = kvm_mmu_init(); if (err)