From patchwork Wed Mar 19 15:43:38 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 26589 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f72.google.com (mail-yh0-f72.google.com [209.85.213.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1BA46203C3 for ; Wed, 19 Mar 2014 15:46:20 +0000 (UTC) Received: by mail-yh0-f72.google.com with SMTP id f10sf23175507yha.11 for ; Wed, 19 Mar 2014 08:46:19 -0700 (PDT) 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:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=4Mvl1ZuY/JwCKK0EE4xfHD9bmkWC8rrueJkoNWqED/o=; b=Fz8kUFWXTTXw4YeqyMlW60e/U4fUAaNlBSyqLRUmrxZ5JuQ1NaDdCLCMZVaPUTxonC +6fCpnrTNJSljsxWiwcwg8m9XXHhlYGtFe909+Z1WAkx5V5oUs6RISSJuGQF/QXHhPiE /yRN6D4IDQS8rRap7hH0QJ1z/qintu8jP2blbiDdZ3yXhe4/16h0WBMBrYD+BHAY9sMM oKE/3MpqFzVhiNKaQ1zeQZt7XNtiJFYdVMGsdoia32hm+GRmFYeeAAlKI2hD0AzAvOyl xo2asDKCCuixRcPWN6yqfTSXTgq4/lvxBuObNyYpxkA9lxfddFtR91a4Iv7+WavE2TJB U7cA== X-Gm-Message-State: ALoCoQkyz53Ni+Fw1zG3gTNRr1eJAE24kH2b+Rj3nZ7H0aPpHvzNJqBQNKvNCPyEqcbGpiqxZEz9 X-Received: by 10.236.83.112 with SMTP id p76mr12354059yhe.51.1395243979883; Wed, 19 Mar 2014 08:46:19 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.93.194 with SMTP id d60ls2653638qge.22.gmail; Wed, 19 Mar 2014 08:46:19 -0700 (PDT) X-Received: by 10.58.134.101 with SMTP id pj5mr643171veb.38.1395243979767; Wed, 19 Mar 2014 08:46:19 -0700 (PDT) Received: from mail-ve0-f170.google.com (mail-ve0-f170.google.com [209.85.128.170]) by mx.google.com with ESMTPS id ru8si7839532vcb.29.2014.03.19.08.46.19 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 19 Mar 2014 08:46:19 -0700 (PDT) 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 pa12so9295031veb.1 for ; Wed, 19 Mar 2014 08:46:19 -0700 (PDT) X-Received: by 10.52.243.167 with SMTP id wz7mr503541vdc.47.1395243979649; Wed, 19 Mar 2014 08:46:19 -0700 (PDT) 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.220.78.9 with SMTP id i9csp310850vck; Wed, 19 Mar 2014 08:46:18 -0700 (PDT) X-Received: by 10.140.23.148 with SMTP id 20mr10243231qgp.89.1395243978416; Wed, 19 Mar 2014 08:46:18 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id gv6si5763727qcb.44.2014.03.19.08.46.17 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 19 Mar 2014 08:46:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQIfN-0002T3-Kh; Wed, 19 Mar 2014 15:44:29 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WQIfK-0002SO-HX for xen-devel@lists.xenproject.org; Wed, 19 Mar 2014 15:44:28 +0000 Received: from [85.158.139.211:63567] by server-12.bemta-5.messagelabs.com id E1/72-03824-95BB9235; Wed, 19 Mar 2014 15:44:25 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-16.tower-206.messagelabs.com!1395243865!2044123!1 X-Originating-IP: [74.125.83.49] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 16209 invoked from network); 19 Mar 2014 15:44:25 -0000 Received: from mail-ee0-f49.google.com (HELO mail-ee0-f49.google.com) (74.125.83.49) by server-16.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 19 Mar 2014 15:44:25 -0000 Received: by mail-ee0-f49.google.com with SMTP id c41so6745510eek.8 for ; Wed, 19 Mar 2014 08:44:24 -0700 (PDT) X-Received: by 10.14.199.8 with SMTP id w8mr3960002een.94.1395243864941; Wed, 19 Mar 2014 08:44:24 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id w6sm55426496eex.9.2014.03.19.08.44.23 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Mar 2014 08:44:24 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 19 Mar 2014 15:43:38 +0000 Message-Id: <1395243819-30380-3-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1395243819-30380-1-git-send-email-julien.grall@linaro.org> References: <1395243819-30380-1-git-send-email-julien.grall@linaro.org> Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com, Fu Wei Subject: [Xen-devel] [PATCH 2/3] xen/arm: Use p2m_restore_state in construct_dom0 X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@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 List-Archive: The address translation functions used while building dom0 rely on certain EL1 state being configured. In particular they are subject to the behaviour of SCTLR_EL1.M (stage 1 MMU enabled). The Xen (and Linux) boot protocol require that the kernel be entered with the MMU disabled but they don't say anything explicitly about exception levels other than the one which is active when entering the kernels. Arguably the protocol could be said to apply to all exception levels but in any case we should cope with this and setup the EL1 state as necessary. Fu Wei discovered this when booting Xen from grub.efi over UEFI, it's not clear whether grub or UEFI is responsible for leaving stage 1 MMU enabled. Use directly the newly created function p2m_restore_state to retrieve a correct EL1 state to translate an address. Signed-off-by: Julien Grall Reported-by: Fu Wei Acked-by: Ian Campbell --- xen/arch/arm/domain_build.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index d3345bf..9eb9f75 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1021,14 +1021,7 @@ int construct_dom0(struct domain *d) return rc; /* The following loads use the domain's p2m */ - p2m_load_VTTBR(d); -#ifdef CONFIG_ARM_64 - d->arch.type = kinfo.type; - if ( is_32bit_domain(d) ) - WRITE_SYSREG(READ_SYSREG(HCR_EL2) & ~HCR_RW, HCR_EL2); - else - WRITE_SYSREG(READ_SYSREG(HCR_EL2) | HCR_RW, HCR_EL2); -#endif + p2m_restore_state(v); /* * kernel_load will determine the placement of the initrd & fdt in