From patchwork Wed Jan 8 22:47:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 22988 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f72.google.com (mail-oa0-f72.google.com [209.85.219.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BA771202E2 for ; Wed, 8 Jan 2014 22:49:24 +0000 (UTC) Received: by mail-oa0-f72.google.com with SMTP id o6sf8735504oag.3 for ; Wed, 08 Jan 2014 14:49:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=zLG0yfoLPjtl7AFr3bg9Ek08f+ZEWYx+t5PMeN6m2JY=; b=Ed3hA2s+YTsJywVJ5k1tH8oAEmGU+O37yzxHTqWu2jSOcooQVWjQvo8GZZkWjr8Ckz MFvTWVgXru4M5fXsLB4AvbWSe1OiCvlOv07aB8UGugikJy09EWyhQ9Ev5j2oDPKvCEPv efTOkHLzhAWiSFU0ewp2XLPalqxu+u8YN7gUBlEbqBvP3+s8Qsz6GVOYiH2fHenRGYvD 0nyDkjrTZ58Ewbo+leXMGJcAl3EDYC3tMU6Ah9THdHlvE0L35mkmalXXK/3reSBX/xKI H7+mMK2SMdGSGqujLIoZWyL+DWHo8MngfG+tiwmiYP1BVdnzBdJ4jaA+I+qJpMfp6rzZ 3c7Q== X-Gm-Message-State: ALoCoQk7BcrOEeQ0HS9gR9oOaHGvOat08EAMng6peB9G0UA3JRaK1P8npzUhj+hAze4ry7OZGIh2 X-Received: by 10.182.219.226 with SMTP id pr2mr20635867obc.44.1389221363851; Wed, 08 Jan 2014 14:49:23 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.35.18 with SMTP id d18ls792605qej.14.gmail; Wed, 08 Jan 2014 14:49:23 -0800 (PST) X-Received: by 10.53.8.1 with SMTP id dg1mr5238610vdd.52.1389221363723; Wed, 08 Jan 2014 14:49:23 -0800 (PST) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id c14si1454505veu.28.2014.01.08.14.49.23 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 14:49:23 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.170; Received: by mail-ve0-f170.google.com with SMTP id oy12so1834432veb.1 for ; Wed, 08 Jan 2014 14:49:23 -0800 (PST) X-Received: by 10.58.69.41 with SMTP id b9mr48122128veu.5.1389221363569; Wed, 08 Jan 2014 14:49:23 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.59.13.131 with SMTP id ey3csp256995ved; Wed, 8 Jan 2014 14:49:22 -0800 (PST) X-Received: by 10.180.74.174 with SMTP id u14mr23606493wiv.45.1389221362084; Wed, 08 Jan 2014 14:49:22 -0800 (PST) Received: from casper.infradead.org (casper.infradead.org. [2001:770:15f::2]) by mx.google.com with ESMTPS id ge7si1378951wic.56.2014.01.08.14.49.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jan 2014 14:49:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:770:15f::2 as permitted sender) client-ip=2001:770:15f::2; Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W11v8-0000Ba-5I; Wed, 08 Jan 2014 22:48:18 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W11v3-0004hj-Np; Wed, 08 Jan 2014 22:48:13 +0000 Received: from mail-pb0-f43.google.com ([209.85.160.43]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W11ur-0004f6-IQ for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2014 22:48:03 +0000 Received: by mail-pb0-f43.google.com with SMTP id rq2so2174855pbb.16 for ; Wed, 08 Jan 2014 14:47:40 -0800 (PST) X-Received: by 10.68.130.169 with SMTP id of9mr144972007pbb.79.1389221260088; Wed, 08 Jan 2014 14:47:40 -0800 (PST) Received: from localhost.localdomain (c-67-169-181-221.hsd1.ca.comcast.net. [67.169.181.221]) by mx.google.com with ESMTPSA id xv2sm4920755pbb.39.2014.01.08.14.47.37 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 08 Jan 2014 14:47:39 -0800 (PST) From: Christoffer Dall To: kvm@vger.kernel.org Subject: [PATCH 1/5] arm/arm64: kvm: Use virt_to_idmap instead of virt_to_phys for idmap mappings Date: Wed, 8 Jan 2014 14:47:26 -0800 Message-Id: <1389221250-30034-2-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 1.8.5.2 In-Reply-To: <1389221250-30034-1-git-send-email-christoffer.dall@linaro.org> References: <1389221250-30034-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140108_174801_748032_9DD1FCF8 X-CRM114-Status: GOOD ( 12.63 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.160.43 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Gleb Natapov , Marc Zyngier , Catalin Marinas , Marcelo Tosatti , Santosh Shilimkar , Christoffer Dall , Paolo Bonzini , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.170 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 From: Santosh Shilimkar KVM initialisation fails on architectures implementing virt_to_idmap() because virt_to_phys() on such architectures won't fetch you the correct idmap page. So update the KVM ARM code to use the virt_to_idmap() to fix the issue. Since the KVM code is shared between arm and arm64, we create kvm_virt_to_phys() and handle the redirection in respective headers. Cc: Christoffer Dall Cc: Marc Zyngier Cc: Catalin Marinas Signed-off-by: Santosh Shilimkar Signed-off-by: Christoffer Dall --- arch/arm/include/asm/kvm_mmu.h | 1 + arch/arm/kvm/mmu.c | 8 ++++---- arch/arm64/include/asm/kvm_mmu.h | 1 + 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/kvm_mmu.h b/arch/arm/include/asm/kvm_mmu.h index 77de4a4..2d122ad 100644 --- a/arch/arm/include/asm/kvm_mmu.h +++ b/arch/arm/include/asm/kvm_mmu.h @@ -140,6 +140,7 @@ static inline void coherent_icache_guest_page(struct kvm *kvm, hva_t hva, } #define kvm_flush_dcache_to_poc(a,l) __cpuc_flush_dcache_area((a), (l)) +#define kvm_virt_to_phys(x) virt_to_idmap((unsigned long)(x)) #endif /* !__ASSEMBLY__ */ diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index 5809069..659db0e 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -916,9 +916,9 @@ int kvm_mmu_init(void) { int err; - hyp_idmap_start = virt_to_phys(__hyp_idmap_text_start); - hyp_idmap_end = virt_to_phys(__hyp_idmap_text_end); - hyp_idmap_vector = virt_to_phys(__kvm_hyp_init); + hyp_idmap_start = kvm_virt_to_phys(__hyp_idmap_text_start); + hyp_idmap_end = kvm_virt_to_phys(__hyp_idmap_text_end); + hyp_idmap_vector = kvm_virt_to_phys(__kvm_hyp_init); if ((hyp_idmap_start ^ hyp_idmap_end) & PAGE_MASK) { /* @@ -945,7 +945,7 @@ int kvm_mmu_init(void) */ kvm_flush_dcache_to_poc(init_bounce_page, len); - phys_base = virt_to_phys(init_bounce_page); + phys_base = kvm_virt_to_phys(init_bounce_page); hyp_idmap_vector += phys_base - hyp_idmap_start; hyp_idmap_start = phys_base; hyp_idmap_end = phys_base + len; diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index 680f74e..7f1f940 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -136,6 +136,7 @@ static inline void coherent_icache_guest_page(struct kvm *kvm, hva_t hva, } #define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l)) +#define kvm_virt_to_phys(x) __virt_to_phys((unsigned long)(x)) #endif /* __ASSEMBLY__ */ #endif /* __ARM64_KVM_MMU_H__ */