From patchwork Wed Feb 4 14:02:04 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 44351 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-we0-f200.google.com (mail-we0-f200.google.com [74.125.82.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1F4EF2029F for ; Wed, 4 Feb 2015 14:06:17 +0000 (UTC) Received: by mail-we0-f200.google.com with SMTP id m14sf1465881wev.3 for ; Wed, 04 Feb 2015 06:06:15 -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:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=DnuPbbSGNShdYXIi+60AXBcNB32QPFPqsF9PJZbQXFU=; b=iCu3oVdNOEPdTblpXSMEu6hCsGapLN5NHpnksbICN6aeaDIoGtA8/QDg2iOfKO21KO bIDGFs0HZN9uFhdWSoHhvf+DA1xfvLZ6hm4OzsIDfc5RNeCmyD+C04EJPI3CaiXcSCd9 u+lCK7RDCdz/ohHgee1QfoFaWwb8OtDkJmTA5NABR3qile0biwgGja4C4A9m+4Uijb4l K3xA02sZDA7ay9u50iY62SDNk5b33qF1pghxhGSHwz9lAtF1WtWGVi5pBSg31XLWDSPz vPFzJuGAdpEjqEeAgdkdRLYw88MWGzFCyj6U0SrmN0QY0ATiQD89m8xnepwa4Tc0uimV Aaiw== X-Gm-Message-State: ALoCoQlJHsLAIipGAGuzugZIqxlH8Um3iJVPSwCMIU8RuQNnmQKljjBZPHhXy/f+LNQCQyBlEuWl X-Received: by 10.112.30.131 with SMTP id s3mr3984883lbh.13.1423058775547; Wed, 04 Feb 2015 06:06:15 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.30.38 with SMTP id p6ls42279lah.52.gmail; Wed, 04 Feb 2015 06:06:15 -0800 (PST) X-Received: by 10.112.167.228 with SMTP id zr4mr30803949lbb.20.1423058775392; Wed, 04 Feb 2015 06:06:15 -0800 (PST) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id pk3si1419899lbc.70.2015.02.04.06.06.15 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by mail-la0-f42.google.com with SMTP id ms9so1747478lab.1 for ; Wed, 04 Feb 2015 06:06:15 -0800 (PST) X-Received: by 10.152.203.230 with SMTP id kt6mr29761826lac.38.1423058774952; Wed, 04 Feb 2015 06:06:14 -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.112.35.133 with SMTP id h5csp507548lbj; Wed, 4 Feb 2015 06:06:14 -0800 (PST) X-Received: by 10.170.212.70 with SMTP id d67mr14213989ykf.64.1423058772779; Wed, 04 Feb 2015 06:06:12 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id g197si519220ykb.19.2015.02.04.06.06.12 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 06:06:12 -0800 (PST) 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 1YJ0Zx-0007v1-NG; Wed, 04 Feb 2015 14:05:17 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0Zv-0007sx-Do for xen-devel@lists.xen.org; Wed, 04 Feb 2015 14:05:15 +0000 Received: from [85.158.143.35] by server-1.bemta-4.messagelabs.com id 00/28-03000-A1722D45; Wed, 04 Feb 2015 14:05:14 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-11.tower-21.messagelabs.com!1423058711!12449335!1 X-Originating-IP: [209.85.220.53] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.4; banners=-,-,- X-VirusChecked: Checked Received: (qmail 26569 invoked from network); 4 Feb 2015 14:05:12 -0000 Received: from mail-pa0-f53.google.com (HELO mail-pa0-f53.google.com) (209.85.220.53) by server-11.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 4 Feb 2015 14:05:12 -0000 Received: by mail-pa0-f53.google.com with SMTP id kx10so2857592pab.12 for ; Wed, 04 Feb 2015 06:05:10 -0800 (PST) X-Received: by 10.70.126.100 with SMTP id mx4mr14474632pdb.138.1423058710841; Wed, 04 Feb 2015 06:05:10 -0800 (PST) Received: from parthd-ubunutu.qualcomm.com ([202.46.23.62]) by mx.google.com with ESMTPSA id kg12sm2161881pbb.44.2015.02.04.06.05.06 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:05:09 -0800 (PST) From: parth.dixit@linaro.org To: xen-devel@lists.xen.org Date: Wed, 4 Feb 2015 19:32:04 +0530 Message-Id: <1423058539-26403-21-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> References: <1423058539-26403-1-git-send-email-parth.dixit@linaro.org> Cc: ian.campbell@citrix.com, Naresh Bhat , julien.grall@linaro.org, tim@xen.org, stefano.stabellini@citrix.com, jbeulich@suse.com, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH RFC 20/35] xen/arm: Prepare a min DT for 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: parth.dixit@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.42 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: From: Naresh Bhat This patch prepare a DT from scratch for DOM0 for ACPI-case only. Basically the DT contains minmal required informations such as DOM0 bootargs, memory and ACPI RSDP informations only. Signed-off-by: Naresh Bhat --- xen/arch/arm/domain_build.c | 67 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 66 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index de180d8..bb7f043 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -61,6 +62,9 @@ custom_param("dom0_mem", parse_dom0_mem); */ #define DOM0_FDT_EXTRA_SIZE (128 + sizeof(struct fdt_reserve_entry)) +/* Reserve DOM0 FDT size in ACPI case only */ +#define DOM0_FDT_MIN_SIZE 4096 + struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0) { if ( opt_dom0_max_vcpus == 0 ) @@ -1151,6 +1155,63 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, return res; } +/* + * Prepare a minimal DTB for DOM0 which contains + * bootargs, memory information, + * ACPI RSDP pointer. + */ +static int prepare_dtb_acpi(struct domain *d, struct kernel_info *kinfo) +{ + int new_size; + int ret; + + DPRINT("Prepare a min DTB for DOM0\n"); + + /* Allocate min size for DT */ + new_size = DOM0_FDT_MIN_SIZE; + kinfo->fdt = xmalloc_bytes(DOM0_FDT_MIN_SIZE); + + if ( kinfo->fdt == NULL ) + return -ENOMEM; + + /* Create a new empty DT for DOM0 */ + ret = fdt_create(kinfo->fdt, new_size); + if ( ret < 0 ) + goto err; + + /* Reserve the memory space for new DT */ + ret = fdt_finish_reservemap(kinfo->fdt); + if ( ret < 0 ) + goto err; + + ret = fdt_begin_node(kinfo->fdt, "/"); + if ( ret < 0 ) + goto err; + + ret = fdt_property_cell(kinfo->fdt, "#address-cells", 2); + if ( ret ) + return ret; + + ret = fdt_property_cell(kinfo->fdt, "#size-cells", 1); + if ( ret ) + return ret; + + ret = fdt_end_node(kinfo->fdt); + if ( ret < 0 ) + goto err; + + ret = fdt_finish(kinfo->fdt); + if ( ret < 0 ) + goto err; + + return 0; + + err: + printk("Device tree generation failed (%d).\n", ret); + xfree(kinfo->fdt); + return -EINVAL; +} + static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) { const void *fdt; @@ -1305,7 +1366,11 @@ int construct_dom0(struct domain *d) allocate_memory(d, &kinfo); - rc = prepare_dtb(d, &kinfo); + if (acpi_disabled) + rc = prepare_dtb(d, &kinfo); + else + rc = prepare_dtb_acpi(d, &kinfo); + if ( rc < 0 ) return rc;