From patchwork Wed Feb 4 14:02:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Parth Dixit X-Patchwork-Id: 44353 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 732F22029F for ; Wed, 4 Feb 2015 14:06:21 +0000 (UTC) Received: by mail-wi0-f199.google.com with SMTP id r20sf2481619wiv.2 for ; Wed, 04 Feb 2015 06:06:20 -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=SX5HYNjidgMWJjLoFdftVx0Y40oj/9g4AZbdHINXwAo=; b=fKWr/hfUv3fg6p88aQtyWUN7dkZ6hkqCNlntyMJlS5X7TsmpH7N3aNGfRU/OqaaCoM BZ2N+m4VD0KpKb8gFCiHZnzkKJnyRD84Il94Y7YWQaTbEE2M+egkQH5Z/NHLaZYCeUzk t084RvhP3qsI3uKMNobepy0zRvTQdAJIVhT67gNivnUrBSgM6ZCzVTlujJLE342ps2qo p7fVyHAVyII7frPijLCKILlEjIjLjMuCAB1gsqnzGIG66YASCypuhX2Go16jb2geLHv7 0jRbZUP9KTYVIRhFlLOyyjRDfohjA9aJmiOoc2BxJ8yxbVEruDxGK7ZsFlQ/W/+EW3ms +nLw== X-Gm-Message-State: ALoCoQnlLenDoZVp9h/Chh56hXE6T22/QR9V+6ibMNBsA9QcVmOlZkQd6doCPhYkWcdoclsGa6p0 X-Received: by 10.194.86.1 with SMTP id l1mr3905769wjz.0.1423058780797; Wed, 04 Feb 2015 06:06:20 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.120.193 with SMTP id le1ls38528lab.11.gmail; Wed, 04 Feb 2015 06:06:20 -0800 (PST) X-Received: by 10.112.199.69 with SMTP id ji5mr3289659lbc.45.1423058780622; Wed, 04 Feb 2015 06:06:20 -0800 (PST) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id x10si1449424lal.31.2015.02.04.06.06.20 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 04 Feb 2015 06:06:20 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by mail-la0-f52.google.com with SMTP id gd6so460333lab.11 for ; Wed, 04 Feb 2015 06:06:20 -0800 (PST) X-Received: by 10.152.116.43 with SMTP id jt11mr30939502lab.69.1423058780525; Wed, 04 Feb 2015 06:06:20 -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 h5csp507624lbj; Wed, 4 Feb 2015 06:06:19 -0800 (PST) X-Received: by 10.53.6.198 with SMTP id cw6mr16272737vdd.57.1423058774918; Wed, 04 Feb 2015 06:06:14 -0800 (PST) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id i10si693145vdt.106.2015.02.04.06.06.14 (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 04 Feb 2015 06:06:14 -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 1YJ0a3-00082A-UN; Wed, 04 Feb 2015 14:05:23 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YJ0a1-0007zC-FK for xen-devel@lists.xen.org; Wed, 04 Feb 2015 14:05:21 +0000 Received: from [85.158.139.211] by server-6.bemta-5.messagelabs.com id 06/C9-03165-02722D45; Wed, 04 Feb 2015 14:05:20 +0000 X-Env-Sender: parth.dixit@linaro.org X-Msg-Ref: server-10.tower-206.messagelabs.com!1423058718!5831003!1 X-Originating-IP: [209.85.192.171] 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 16459 invoked from network); 4 Feb 2015 14:05:19 -0000 Received: from mail-pd0-f171.google.com (HELO mail-pd0-f171.google.com) (209.85.192.171) by server-10.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 4 Feb 2015 14:05:19 -0000 Received: by pdjy10 with SMTP id y10so878889pdj.9 for ; Wed, 04 Feb 2015 06:05:18 -0800 (PST) X-Received: by 10.66.234.40 with SMTP id ub8mr47819281pac.122.1423058718175; Wed, 04 Feb 2015 06:05:18 -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.13 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 04 Feb 2015 06:05:17 -0800 (PST) From: parth.dixit@linaro.org To: xen-devel@lists.xen.org Date: Wed, 4 Feb 2015 19:32:05 +0530 Message-Id: <1423058539-26403-22-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 21/35] xen/arm: Create memory node 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.52 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 Create a memory node for DOM0. Signed-off-by: Naresh Bhat --- xen/arch/arm/domain_build.c | 48 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index bb7f043..30bebe5 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1155,6 +1155,50 @@ static int handle_node(struct domain *d, struct kernel_info *kinfo, return res; } +static int make_memory_node_acpi(const struct domain *d, + void *fdt, + int addr_cells, + int size_cells, + const struct kernel_info *kinfo) +{ + int res, i; + int reg_size = addr_cells + size_cells; + int nr_cells = reg_size*kinfo->mem.nr_banks; + __be32 reg[nr_cells]; + __be32 *cells; + + DPRINT("Create memory node (reg size %d, nr cells %d)\n", reg_size, nr_cells); + + /* ePAPR 3.4 */ + res = fdt_begin_node(fdt, "memory"); + if ( res ) + return res; + + res = fdt_property_string(fdt, "device_type", "memory"); + if ( res ) + return res; + + cells = ®[0]; + for ( i = 0 ; i < kinfo->mem.nr_banks; i++ ) + { + u64 start = kinfo->mem.bank[i].start; + u64 size = kinfo->mem.bank[i].size; + + DPRINT(" Bank %d: %#"PRIx64"->%#"PRIx64"\n", + i, start, start + size); + + dt_set_range(&cells, fdt, start, size); + } + + res = fdt_property(fdt, "reg", reg, sizeof(reg)); + if ( res ) + return res; + + res = fdt_end_node(fdt); + + return res; +} + /* * Prepare a minimal DTB for DOM0 which contains * bootargs, memory information, @@ -1196,6 +1240,10 @@ static int prepare_dtb_acpi(struct domain *d, struct kernel_info *kinfo) if ( ret ) return ret; + ret = make_memory_node_acpi(d, kinfo->fdt, 2, 1, kinfo); + if ( ret ) + goto err; + ret = fdt_end_node(kinfo->fdt); if ( ret < 0 ) goto err;