From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: [PATCH for 4.5] xen/arm: p2m: Correctly initialize cur_offset Date: Tue, 30 Sep 2014 15:51:56 +0100 Message-ID: <1412088716-32557-1-git-send-email-julien.grall@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: 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: by mail-wg0-f47.google.com with SMTP id x13so528597wgg.18 for ; Tue, 30 Sep 2014 07:52:55 -0700 (PDT) List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: stefano.stabellini@citrix.com, Julien Grall , tim@xen.org, ian.campbell@citrix.com List-Id: xen-devel@lists.xenproject.org {~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 -- 1.7.10.4