[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH v4 01/27] xen/dts: Constify device_tree_flattened
The Flat Device Tree is given by the bootloader. Xen doesn't need to modify it. Signed-off-by: Julien Grall <julien.grall@xxxxxxxxxx> --- 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 <asm/early_printk.h> 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); -- 1.7.10.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |