From patchwork Fri Apr 4 12:56:57 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Campbell X-Patchwork-Id: 27814 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f199.google.com (mail-qc0-f199.google.com [209.85.216.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4408520369 for ; Fri, 4 Apr 2014 12:58:52 +0000 (UTC) Received: by mail-qc0-f199.google.com with SMTP id e16sf8841618qcx.2 for ; Fri, 04 Apr 2014 05:58:51 -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:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=BflN+qg4xQyfoT8M4PdfY4Gvpy9nu+wB8yAIPZmn5ac=; b=H7RKR63XtOinJdL9VMpnk4zDE1qDOBRUHVimCUIsPMFZXaPKD7nNE41q7k77QMSYFq IcvfEsdt+oTFHOhzfh6BwJBuxSGTqU6sYvalCEkM+h5zzO/zWpm1th7Y40U94zeuBgDE f1lmaTqd9l6TdgI9wxR4aMLS87dEAA5fgWqmMp7UX9GZVm4EqBSxxdB+AAOLf/zoe6nL JEFreeAWXkCE1sn36Xm5cCU6/m3Uwjt1+pqnCdKPGqEW6/Fg7QpbPO+UBkEKohnP9+Xe U6ggbE3iF+jcycdJAtzZjJL8MEAQgPaBFTO+cm2DoMFz0ljp2KeMiQ4e5Wc0MStkur1i 0LMA== X-Gm-Message-State: ALoCoQmE1/Q3Moo79oTK4L2Zz8aB5SIbAAGeNCA98V8yh2SPWU5nx03gmG18a9X/tqqr7LiIlIbf X-Received: by 10.236.118.38 with SMTP id k26mr7555126yhh.35.1396616331798; Fri, 04 Apr 2014 05:58:51 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.48.39 with SMTP id n36ls1060235qga.19.gmail; Fri, 04 Apr 2014 05:58:51 -0700 (PDT) X-Received: by 10.220.167.2 with SMTP id o2mr8356472vcy.8.1396616331723; Fri, 04 Apr 2014 05:58:51 -0700 (PDT) Received: from mail-ve0-f171.google.com (mail-ve0-f171.google.com [209.85.128.171]) by mx.google.com with ESMTPS id be7si1757488vcb.143.2014.04.04.05.58.51 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 04 Apr 2014 05:58:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.171 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.171; Received: by mail-ve0-f171.google.com with SMTP id jy13so1422495veb.30 for ; Fri, 04 Apr 2014 05:58:51 -0700 (PDT) X-Received: by 10.58.31.136 with SMTP id a8mr5267544vei.20.1396616331643; Fri, 04 Apr 2014 05:58:51 -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.12.8 with SMTP id v8csp111905vcv; Fri, 4 Apr 2014 05:58:50 -0700 (PDT) X-Received: by 10.52.251.199 with SMTP id zm7mr11140524vdc.21.1396616329122; Fri, 04 Apr 2014 05:58:49 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id sq9si1753908vdc.197.2014.04.04.05.58.48 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 04 Apr 2014 05:58:49 -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 1WW3gD-0000NI-W8; Fri, 04 Apr 2014 12:57:09 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WW3gC-0000MX-I2 for xen-devel@lists.xen.org; Fri, 04 Apr 2014 12:57:08 +0000 Received: from [85.158.137.68:31699] by server-17.bemta-3.messagelabs.com id 9D/22-22741-32CAE335; Fri, 04 Apr 2014 12:57:07 +0000 X-Env-Sender: Ian.Campbell@citrix.com X-Msg-Ref: server-6.tower-31.messagelabs.com!1396616224!5082833!1 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 10281 invoked from network); 4 Apr 2014 12:57:05 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-6.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 4 Apr 2014 12:57:05 -0000 X-IronPort-AV: E=Sophos;i="4.97,795,1389744000"; d="scan'208";a="116786618" Received: from accessns.citrite.net (HELO FTLPEX01CL02.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 04 Apr 2014 12:57:01 +0000 Received: from norwich.cam.xci-test.com (10.80.248.129) by smtprelay.citrix.com (10.13.107.79) with Microsoft SMTP Server id 14.2.342.4; Fri, 4 Apr 2014 08:57:00 -0400 Received: from drall.uk.xensource.com ([10.80.16.71] helo=drall.uk.xensource.com.) by norwich.cam.xci-test.com with esmtp (Exim 4.72) (envelope-from ) id 1WW3g4-0000qs-5y; Fri, 04 Apr 2014 12:57:00 +0000 From: Ian Campbell To: Date: Fri, 4 Apr 2014 13:56:57 +0100 Message-ID: <1396616219-32219-1-git-send-email-ian.campbell@citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1396616194.4211.223.camel@kazak.uk.xensource.com> References: <1396616194.4211.223.camel@kazak.uk.xensource.com> MIME-Version: 1.0 X-DLP: MIA1 Cc: julien.grall@linaro.org, tim@xen.org, Ian Campbell , stefano.stabellini@eu.citrix.com Subject: [Xen-devel] [PATCH 1/3] xen: arm: refactor struct kernel_info 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: , 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: ian.campbell@citrix.com X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.171 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 kernel_order and kernel_image fields are ELF specific. Also add a few comments about what things are. Signed-off-by: Ian Campbell Acked-by: Julien Grall --- xen/arch/arm/kernel.c | 14 +++++++------- xen/arch/arm/kernel.h | 14 ++++++++------ 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c index ae86772..d1fd307 100644 --- a/xen/arch/arm/kernel.c +++ b/xen/arch/arm/kernel.c @@ -295,7 +295,7 @@ static void kernel_elf_load(struct kernel_info *info) elf_load_binary(&info->elf.elf); printk("Free temporary kernel buffer\n"); - free_xenheap_pages(info->kernel_img, info->kernel_order); + free_xenheap_pages(info->elf.kernel_img, info->elf.kernel_order); } static int kernel_try_elf_prepare(struct kernel_info *info, @@ -305,14 +305,14 @@ static int kernel_try_elf_prepare(struct kernel_info *info, memset(&info->elf.elf, 0, sizeof(info->elf.elf)); - info->kernel_order = get_order_from_bytes(size); - info->kernel_img = alloc_xenheap_pages(info->kernel_order, 0); - if ( info->kernel_img == NULL ) + info->elf.kernel_order = get_order_from_bytes(size); + info->elf.kernel_img = alloc_xenheap_pages(info->elf.kernel_order, 0); + if ( info->elf.kernel_img == NULL ) panic("Cannot allocate temporary buffer for kernel"); - copy_from_paddr(info->kernel_img, addr, size); + copy_from_paddr(info->elf.kernel_img, addr, size); - if ( (rc = elf_init(&info->elf.elf, info->kernel_img, size )) != 0 ) + if ( (rc = elf_init(&info->elf.elf, info->elf.kernel_img, size )) != 0 ) goto err; #ifdef VERBOSE elf_set_verbose(&info->elf.elf); @@ -351,7 +351,7 @@ err: printk("Xen: ELF kernel broken: %s\n", elf_check_broken(&info->elf.elf)); - free_xenheap_pages(info->kernel_img, info->kernel_order); + free_xenheap_pages(info->elf.kernel_img, info->elf.kernel_order); return rc; } diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h index ad2956b..2c27c64 100644 --- a/xen/arch/arm/kernel.h +++ b/xen/arch/arm/kernel.h @@ -18,14 +18,16 @@ struct kernel_info { paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */ struct dt_mem_info mem; - paddr_t dtb_paddr; + /* kernel entry point */ paddr_t entry; + /* boot blob load addresses */ + paddr_t dtb_paddr; paddr_t initrd_paddr; - void *kernel_img; - unsigned kernel_order; - + /* loader to use for this kernel */ + void (*load)(struct kernel_info *info); + /* loader specific state */ union { struct { paddr_t kernel_addr; @@ -36,10 +38,10 @@ struct kernel_info { struct { struct elf_binary elf; struct elf_dom_parms parms; + unsigned kernel_order; + void *kernel_img; } elf; }; - - void (*load)(struct kernel_info *info); }; int kernel_prepare(struct kernel_info *info);