From patchwork Tue Sep 30 14:51:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 38160 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-lb0-f200.google.com (mail-lb0-f200.google.com [209.85.217.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id BC2C220549 for ; Tue, 30 Sep 2014 14:55:18 +0000 (UTC) Received: by mail-lb0-f200.google.com with SMTP id n15sf5724255lbi.3 for ; Tue, 30 Sep 2014 07:55:17 -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: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=GX8eEdty8JuFqDmEu4IuBLdosSqR8Jim02dpfhZ1ArU=; b=DMD8v/A8WQusr86AlbggfsRuRomNYhcZngO5U39h7YP1+uDJaivIvdWEljdS9eUPco FmuBuJvgm5n91k6+OAeHRqLq15QwNwSLijPKcG4r4TLuPR4blvrMcmot3pPSRvIPlZ8q yuNZlmA+OCRofYceQ8mJYnr/OAYIyCfh+wCBFH6ezRkoHv8HfN1AdE5QRVHwOqP75BXt PGEiYIizY2C1T4ZNSosUVfIRRj+Ouw+Jchk40WOTSIZgQpYuGz8n8kd6zSQb05gppdHL 0yt1ZZzV3k5k8iqJWuvom4YgqbuOGfYwFBeMRNR6rxEnst9FsiUSch7FpkPZDQN/t9dz RMng== X-Gm-Message-State: ALoCoQmHa0BecvMyg2tQOdHW+8xkIG7V9R/1elekvTYYse7rLRvZjPnlFrDO7BK8GKS8kSltTrZc X-Received: by 10.112.162.138 with SMTP id ya10mr209293lbb.21.1412088917211; Tue, 30 Sep 2014 07:55:17 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.2.65 with SMTP id 1ls51186las.63.gmail; Tue, 30 Sep 2014 07:55:17 -0700 (PDT) X-Received: by 10.113.3.130 with SMTP id bw2mr31071411lbd.39.1412088917003; Tue, 30 Sep 2014 07:55:17 -0700 (PDT) Received: from mail-la0-f44.google.com (mail-la0-f44.google.com [209.85.215.44]) by mx.google.com with ESMTPS id b3si23041953laf.117.2014.09.30.07.55.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Sep 2014 07:55:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) client-ip=209.85.215.44; Received: by mail-la0-f44.google.com with SMTP id gi9so10036196lab.17 for ; Tue, 30 Sep 2014 07:55:16 -0700 (PDT) X-Received: by 10.152.204.231 with SMTP id lb7mr47411372lac.44.1412088916750; Tue, 30 Sep 2014 07:55:16 -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.112.130.169 with SMTP id of9csp363806lbb; Tue, 30 Sep 2014 07:55:16 -0700 (PDT) X-Received: by 10.220.206.196 with SMTP id fv4mr1326159vcb.66.1412088915671; Tue, 30 Sep 2014 07:55:15 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id cv1si7012242vdc.22.2014.09.30.07.55.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 30 Sep 2014 07:55:15 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1XYynS-0002ff-OY; Tue, 30 Sep 2014 14:52:58 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XYynQ-0002fa-Nz for xen-devel@lists.xenproject.org; Tue, 30 Sep 2014 14:52:56 +0000 Received: from [85.158.143.35:28593] by server-1.bemta-4.messagelabs.com id 0C/FA-05872-8C3CA245; Tue, 30 Sep 2014 14:52:56 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-16.tower-21.messagelabs.com!1412088775!9481008!1 X-Originating-IP: [74.125.82.47] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.12.2; banners=-,-,- X-VirusChecked: Checked Received: (qmail 31143 invoked from network); 30 Sep 2014 14:52:55 -0000 Received: from mail-wg0-f47.google.com (HELO mail-wg0-f47.google.com) (74.125.82.47) by server-16.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 30 Sep 2014 14:52:55 -0000 Received: by mail-wg0-f47.google.com with SMTP id x13so528597wgg.18 for ; Tue, 30 Sep 2014 07:52:55 -0700 (PDT) X-Received: by 10.194.110.33 with SMTP id hx1mr54253346wjb.12.1412088775396; Tue, 30 Sep 2014 07:52:55 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id mc4sm15431938wic.6.2014.09.30.07.52.54 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 30 Sep 2014 07:52:54 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 30 Sep 2014 15:51:56 +0100 Message-Id: <1412088716-32557-1-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com Subject: [Xen-devel] [PATCH for 4.5] xen/arm: p2m: Correctly initialize cur_offset 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.44 as permitted sender) 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: {~0,} only initializes the first cell of the array to ~0. The other cells are initialized to 0. Change the initialization to a loop and, at the same time, do the same for the mappings. This is fixing boot after 82985d7 "xen: arm: handle variable p2m levels in apply_p2m_changes" on platform where the root-level doesn't have concatenate table (such as the Foundation Model). --- This is a bug fix for Xen 4.5. This make Xen booting again on the Foundation Model and any platform that doesn't have concatenate table for root-level. --- xen/arch/arm/p2m.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c index 70929fc..3fa7e63 100644 --- a/xen/arch/arm/p2m.c +++ b/xen/arch/arm/p2m.c @@ -716,15 +716,21 @@ static int apply_p2m_changes(struct domain *d, { int rc, ret; struct p2m_domain *p2m = &d->arch.p2m; - lpae_t *mappings[4] = { NULL, }; + lpae_t *mappings[4]; paddr_t addr, orig_maddr = maddr; unsigned int level = 0; unsigned int cur_root_table = ~0; - unsigned int cur_offset[4] = { ~0, }; + unsigned int cur_offset[4]; unsigned int count = 0; bool_t flush = false; bool_t flush_pt; + for (level = 0; level < 4; level++) + { + mappings[level] = NULL; + cur_offset[level] = ~0; + } + /* Some IOMMU don't support coherent PT walk. When the p2m is * shared with the CPU, Xen has to make sure that the PT changes have * reached the memory