From patchwork Tue Sep 10 14:48:49 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 19903 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vc0-f200.google.com (mail-vc0-f200.google.com [209.85.220.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 031FA246A4 for ; Tue, 10 Sep 2013 14:49:25 +0000 (UTC) Received: by mail-vc0-f200.google.com with SMTP id hf12sf8892435vcb.3 for ; Tue, 10 Sep 2013 07:49:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=RNDh0iQK+fphtxIbUxdOmbRRgnrstCTHmhW92jC2PwA=; b=NQARSX6GCdOlP0A47HdgSwvnYjSmJ4HcIgUiYCn0+82gKUfDrKMmH6Aht2jP+C+0nJ 6KKnxiydYNBYMBm+6yYtzDHUY/gWP2KRkg1tFtZLttPQ2LV7RwiC7QRqbQDNHUFNIsAT /sXVD57HxaaRfQ474wyK8xDaJq4BgtGP3l7SaPpnSnCVQGRKoR0qcNMcVnT8EWQxGsMJ Q8iZ4Vxm3w1EmrSNzoi91vYPzzsUnUMn45UCi4TAqHdfwHF8B+6eltJC4Z5xI0Ow26Pp +VzFAW1CFGwLO4PqMpP/e3xRCWS3pX8eIXZZCeI8wO2hENMalItLSUELKjszELaJfOJN JfIg== X-Received: by 10.236.54.68 with SMTP id h44mr8345894yhc.21.1378824565841; Tue, 10 Sep 2013 07:49:25 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.29.229 with SMTP id n5ls2213797qeh.73.gmail; Tue, 10 Sep 2013 07:49:25 -0700 (PDT) X-Received: by 10.52.34.40 with SMTP id w8mr19689793vdi.7.1378824565587; Tue, 10 Sep 2013 07:49:25 -0700 (PDT) Received: from mail-vb0-f50.google.com (mail-vb0-f50.google.com [209.85.212.50]) by mx.google.com with ESMTPS id tj1si4513810vdc.105.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:25 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.212.50 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.212.50; Received: by mail-vb0-f50.google.com with SMTP id x14so4991800vbb.23 for ; Tue, 10 Sep 2013 07:49:25 -0700 (PDT) X-Gm-Message-State: ALoCoQmJSobXRZWcU9f09ehrQYse68hsi6abjTLDFW/4dW4j031GWF+/kyJiqVr5i6TvnKB6aBmd X-Received: by 10.52.75.165 with SMTP id d5mr19733772vdw.1.1378824565449; Tue, 10 Sep 2013 07:49:25 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp4644vcz; Tue, 10 Sep 2013 07:49:23 -0700 (PDT) X-Received: by 10.14.180.73 with SMTP id i49mr4347013eem.55.1378824563289; Tue, 10 Sep 2013 07:49:23 -0700 (PDT) Received: from mail-ea0-f174.google.com (mail-ea0-f174.google.com [209.85.215.174]) by mx.google.com with ESMTPS id 41si15302179eee.197.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:23 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.215.174 is neither permitted nor denied by best guess record for domain of julien.grall@linaro.org) client-ip=209.85.215.174; Received: by mail-ea0-f174.google.com with SMTP id z15so3899367ead.19 for ; Tue, 10 Sep 2013 07:49:21 -0700 (PDT) X-Received: by 10.14.183.2 with SMTP id p2mr13718126eem.44.1378824561473; Tue, 10 Sep 2013 07:49:21 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id i1sm31911644eeg.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 10 Sep 2013 07:49:20 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Cc: stefano.stabellini@eu.citrix.com, ian.campbell@citrix.com, patches@linaro.org, andre.przywara@linaro.org, Julien Grall Subject: [PATCH v3 01/27] xen/dts: Constify device_tree_flattened Date: Tue, 10 Sep 2013 15:48:49 +0100 Message-Id: <1378824555-16564-2-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1378824555-16564-1-git-send-email-julien.grall@linaro.org> References: <1378824555-16564-1-git-send-email-julien.grall@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.212.50 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 Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The Flat Device Tree is given by the bootloader. Xen doesn't need to modify it. Signed-off-by: Julien Grall --- Changes in v3: - Fix compilation on arm64 --- xen/arch/arm/domain_build.c | 2 +- xen/arch/arm/setup.c | 12 ++++++++---- xen/common/device_tree.c | 2 +- xen/include/xen/device_tree.h | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 77e2a61..bde041e 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -475,7 +475,7 @@ static int map_devices_from_device_tree(struct domain *d) static int prepare_dtb(struct domain *d, struct kernel_info *kinfo) { - void *fdt; + const void *fdt; int new_size; int ret; paddr_t end; diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c index 4b31623..aa87fb1 100644 --- a/xen/arch/arm/setup.c +++ b/xen/arch/arm/setup.c @@ -289,6 +289,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) unsigned long dtb_pages; unsigned long boot_mfn_start, boot_mfn_end; int i = 0; + void *fdt; /* TODO: Handle non-contiguous memory bank */ if ( !early_info.mem.nr_banks ) @@ -363,8 +364,9 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) * * TODO: handle other payloads too. */ - device_tree_flattened = mfn_to_virt(alloc_boot_pages(dtb_pages, 1)); - copy_from_paddr(device_tree_flattened, dtb_paddr, dtb_size, BUFFERABLE); + fdt = mfn_to_virt(alloc_boot_pages(dtb_pages, 1)); + copy_from_paddr(fdt, dtb_paddr, dtb_size, BUFFERABLE); + device_tree_flattened = fdt; /* Add non-xenheap memory */ s = ram_start; @@ -410,6 +412,7 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) int bank; unsigned long xenheap_pages = 0; unsigned long dtb_pages; + void *fdt; total_pages = 0; for ( bank = 0 ; bank < early_info.mem.nr_banks; bank++ ) @@ -469,8 +472,9 @@ static void __init setup_mm(unsigned long dtb_paddr, size_t dtb_size) * * TODO: handle other payloads too. */ - device_tree_flattened = mfn_to_virt(alloc_boot_pages(dtb_pages, 1)); - copy_from_paddr(device_tree_flattened, dtb_paddr, dtb_size, BUFFERABLE); + fdt = mfn_to_virt(alloc_boot_pages(dtb_pages, 1)); + copy_from_paddr(fdt, dtb_paddr, dtb_size, BUFFERABLE); + device_tree_flattened = fdt; setup_frametable_mappings(ram_start, ram_end); max_page = PFN_DOWN(ram_end); diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c index c4f0f2c..a5abdaa 100644 --- a/xen/common/device_tree.c +++ b/xen/common/device_tree.c @@ -26,7 +26,7 @@ #include struct dt_early_info __initdata early_info; -void *device_tree_flattened; +const void *device_tree_flattened; dt_irq_xlate_func dt_irq_xlate; /* Host device tree */ struct dt_device_node *dt_host; diff --git a/xen/include/xen/device_tree.h b/xen/include/xen/device_tree.h index 5cc1905..2e5564e 100644 --- a/xen/include/xen/device_tree.h +++ b/xen/include/xen/device_tree.h @@ -164,7 +164,7 @@ typedef int (*device_tree_node_func)(const void *fdt, void *data); extern struct dt_early_info early_info; -extern void *device_tree_flattened; +extern const void *device_tree_flattened; size_t __init device_tree_early_init(const void *fdt);