From patchwork Sun May 17 20:03:49 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 48642 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f70.google.com (mail-wg0-f70.google.com [74.125.82.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1B86621411 for ; Sun, 17 May 2015 20:06:34 +0000 (UTC) Received: by wgwl7 with SMTP id l7sf1246140wgw.0 for ; Sun, 17 May 2015 13:06:33 -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:content-type :content-transfer-encoding:sender:errors-to:x-original-sender :x-original-authentication-results:mailing-list:list-archive; bh=+yOrVGkm+KWNqjSkz9Zzm0DGwkej3VvljUiqakjxmzs=; b=D9T5HNcq2c9fojpv6IeEnYtvojoCJzp5PuM/WhJv1Xm4w+LdKj6PWt16x9xuzXYn6h HO5txN6h4XMntrEi5ROjgLGpRz47ec15Ixf1LD7jeIm9X+ulfO8V6bQNg3BE4SBWFhp+ 2pEskL4tcF83aN7vgjIHA+DUBpOCOQubk2awacI+MQzirDjI0VYnunPCUWwiOQ5b6ykT ZKHY4Wxp/rDIMrtw+AtOuxnBP0sj5QCD6QKvRNW6gABYSbp02IlRbIWy4nB+dEl9iNY+ tWO0E0w9qJwiCCLh7l8kexc3SjyHRb2ATWvgSQyC9wvqaLN2S8JAaNS1CAnq1Zjo/LRg CV6Q== X-Gm-Message-State: ALoCoQlFJWBNkGHnuipZr8dJRUAW04WYZ6V5m1U+/PbTwv2AVZlQwZ4z50KgANNIlWPgiIUqOHmT X-Received: by 10.112.13.200 with SMTP id j8mr15278329lbc.14.1431893193415; Sun, 17 May 2015 13:06:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.81 with SMTP id v17ls780139laz.2.gmail; Sun, 17 May 2015 13:06:33 -0700 (PDT) X-Received: by 10.152.43.74 with SMTP id u10mr14739955lal.90.1431893193275; Sun, 17 May 2015 13:06:33 -0700 (PDT) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id du6si5326397lbc.117.2015.05.17.13.06.33 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 17 May 2015 13:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by labbd9 with SMTP id bd9so191524224lab.2 for ; Sun, 17 May 2015 13:06:33 -0700 (PDT) X-Received: by 10.152.206.75 with SMTP id lm11mr14516636lac.41.1431893193165; Sun, 17 May 2015 13:06:33 -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.108.230 with SMTP id hn6csp3507936lbb; Sun, 17 May 2015 13:06:32 -0700 (PDT) X-Received: by 10.140.216.143 with SMTP id m137mr26261636qhb.14.1431893191586; Sun, 17 May 2015 13:06:31 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id p74si2092726qha.68.2015.05.17.13.06.30 (version=TLSv1 cipher=RC4-SHA bits=128/128); Sun, 17 May 2015 13:06:31 -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 1Yu4ot-0002b9-7O; Sun, 17 May 2015 20:05:55 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1Yu4or-0002YL-TQ for xen-devel@lists.xen.org; Sun, 17 May 2015 20:05:54 +0000 Received: from [85.158.139.211] by server-10.bemta-5.messagelabs.com id FF/CD-02789-0A4F8555; Sun, 17 May 2015 20:05:52 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-5.tower-206.messagelabs.com!1431893151!11111392!1 X-Originating-IP: [209.85.192.176] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.13.15; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32229 invoked from network); 17 May 2015 20:05:52 -0000 Received: from mail-pd0-f176.google.com (HELO mail-pd0-f176.google.com) (209.85.192.176) by server-5.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 17 May 2015 20:05:52 -0000 Received: by pdfh10 with SMTP id h10so117358306pdf.3 for ; Sun, 17 May 2015 13:05:51 -0700 (PDT) X-Received: by 10.70.136.33 with SMTP id px1mr37704100pdb.106.1431893150988; Sun, 17 May 2015 13:05:50 -0700 (PDT) Received: from localhost.localdomain ([117.247.24.139]) by mx.google.com with ESMTPSA id j9sm7838401pdm.53.2015.05.17.13.05.47 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 17 May 2015 13:05:50 -0700 (PDT) From: Parth Dixit To: xen-devel@lists.xen.org Date: Mon, 18 May 2015 01:33:49 +0530 Message-Id: <1431893048-5214-23-git-send-email-parth.dixit@linaro.org> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> References: <1431893048-5214-1-git-send-email-parth.dixit@linaro.org> Cc: keir@xen.org, ian.campbell@citrix.com, andrew.cooper3@citrix.com, tim@xen.org, julien.grall@citrix.com, stefano.stabellini@citrix.com, jbeulich@suse.com, parth.dixit@linaro.org, christoffer.dall@linaro.org Subject: [Xen-devel] [PATCH v2 22/41] arm : acpi create min DT stub 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.43 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: Create a DT for DOM0 for ACPI-case only. DT contains minmal required informations such as DOM0 bootargs, initrd, efi description table and address of uefi memory table. Add placeholder for tables to be marked as reserved in efi table. This is requird for DT function's signature. Signed-off-by: Naresh Bhat Signed-off-by: Parth Dixit --- xen/arch/arm/domain_build.c | 75 ++++++++++++++++++++++++++++++++++++++++++++- xen/include/asm-arm/acpi.h | 10 ++++++ 2 files changed, 84 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 1e545fe..c830702 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include @@ -18,6 +19,7 @@ #include #include #include +#include #include #include @@ -61,6 +63,11 @@ custom_param("dom0_mem", parse_dom0_mem); */ #define DOM0_FDT_EXTRA_SIZE (128 + sizeof(struct fdt_reserve_entry)) +#ifdef CONFIG_ACPI +/* Reserve DOM0 FDT size in ACPI case only */ +#define DOM0_FDT_MIN_SIZE 4096 +#endif + struct vcpu *__init alloc_dom0_vcpu0(struct domain *dom0) { if ( opt_dom0_max_vcpus == 0 ) @@ -1211,7 +1218,68 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, return res; } +#ifdef CONFIG_ACPI +/* + * Prepare a minimal DTB for DOM0 which contains + * bootargs, initrd, memory information, + * EFI table. + */ +static int create_acpi_dtb(struct domain *d, struct kernel_info *kinfo, struct membank tbl_add[]) +{ + 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; + + 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; +} +#else +static int create_acpi_dtb(struct domain *d, struct kernel_info *kinfo, struct membank tbl_add[]) +{ + return -EINVAL; +} +#endif static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) { const void *fdt; @@ -1370,6 +1438,7 @@ int construct_dom0(struct domain *d) struct kernel_info kinfo = {}; struct vcpu *saved_current; int rc, i, cpu; + struct membank tbl_add[TBL_MMAX] = {}; struct vcpu *v = d->vcpu[0]; struct cpu_user_regs *regs = &v->arch.cpu_info->guest_cpu_user_regs; @@ -1403,7 +1472,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 = create_acpi_dtb(d, &kinfo, tbl_add); + if ( rc < 0 ) return rc; diff --git a/xen/include/asm-arm/acpi.h b/xen/include/asm-arm/acpi.h index 482cc5b..2df9ae0 100644 --- a/xen/include/asm-arm/acpi.h +++ b/xen/include/asm-arm/acpi.h @@ -50,6 +50,16 @@ static inline void disable_acpi(void) acpi_disabled = 1; } +/* Tables marked as reserved in efi table */ +enum EFI_MEM_RES{ + TBL_STAO, + TBL_XENV, + TBL_XSDT, + TBL_EFIT, + TBL_MMAP, + TBL_MMAX, +}; + #define ACPI_GTDT_INTR_MASK ( ACPI_GTDT_INTERRUPT_MODE | ACPI_GTDT_INTERRUPT_POLARITY ) /**