[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [PATCH 1/9] xen/arm: introduce domain on Static Allocation
Static Allocation refers to system or sub-system(domains) for which memory areas are pre-defined by configuration using physical address ranges. Those pre-defined memory, -- Static Memory, as parts of RAM reserved in the beginning, shall never go to heap allocator or boot allocator for any use. Domains on Static Allocation is supported through static memory nodes, defined in reserved-memory node with `xen,static-memory-domain` compatible, which are specifying physical RAM as this domain's guest RAM. {address, size}-cells will be consistent with the ones defined in the parent node, reserved-memory. This patch introduces this new static memory device tree node, and also documents and parses this new attribute at boot time and stores related info in static_mem for later initialization. Signed-off-by: Penny Zheng <penny.zheng@xxxxxxx> --- v2 changes: - fix typos - consider reserved-memory binding and use phandle to refer --- docs/misc/arm/device-tree/booting.txt | 49 +++++++++++++++++++++++++++ xen/arch/arm/bootfdt.c | 12 +++++-- xen/include/asm-arm/setup.h | 2 ++ 3 files changed, 61 insertions(+), 2 deletions(-) diff --git a/docs/misc/arm/device-tree/booting.txt b/docs/misc/arm/device-tree/booting.txt index 5243bc7fd3..ba7854b2d3 100644 --- a/docs/misc/arm/device-tree/booting.txt +++ b/docs/misc/arm/device-tree/booting.txt @@ -268,3 +268,52 @@ The DTB fragment is loaded at 0xc000000 in the example above. It should follow the convention explained in docs/misc/arm/passthrough.txt. The DTB fragment will be added to the guest device tree, so that the guest kernel will be able to discover the device. + + +Static Allocation +============= + +Static Allocation refers to system or sub-system(domains) for which memory +areas are pre-defined by configuration using physical address ranges. +Those pre-defined memory, -- Static Memory, as parts of RAM reserved in the +beginning, shall never go to heap allocator or boot allocator for any use. + +Domains on Static Allocation is supported through static memory nodes, +defined in reserved-memory node with `xen,static-memory-domain` compatible, +which are specifying physical RAM as this domain's guest RAM. +#{address, size}-cells will be consistent with the ones defined in the +parent node, reserved-memory. + +On memory allocation, these pre-defiend static memory ranges shall be +firstly mapped to the fixed guest RAM address `GUEST_RAM0_BASE`. +And until it exhausts the `GUEST_RAM0_SIZE`, it will seek to `GUEST_RAM1_BASE`. +`GUEST_RAM0` may take up several pre-defined physical RAM regions. + +The dtb property should look like as follows: + + / { + reserved-memory { + #address-cells = <2>; + #size-cells = <2>; + + staticmemdomU1: static-memory@0x30000000 { + compatible = "xen,static-memory-domain"; + reg = <0x0 0x30000000 0x0 0x20000000>; + }; + }; + + chosen { + domU1 { + compatible = "xen,domain"; + #address-cells = <0x2>; + #size-cells = <0x2>; + cpus = <2>; + xen,static-mem = <&staticmemdomU1>; + + ... + }; + }; + }; + +DomU1 will have a static memory of 512MB reserved from the physical address +0x30000000 to 0x50000000. diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c index dcff512648..5b3bb75b5f 100644 --- a/xen/arch/arm/bootfdt.c +++ b/xen/arch/arm/bootfdt.c @@ -187,9 +187,17 @@ static int __init process_reserved_memory_node(const void *fdt, int node, if ( rc == -ENOSPC ) panic("Max number of supported reserved-memory regions reached."); - else if ( rc != -ENOENT ) + else if ( rc == -ENOENT ) + return 0; + else if ( rc ) return rc; - return 0; + + /* Static memory node with compatible string "xen,static-memory-domain". */ + if ( fdt_node_check_compatible(fdt, node, "xen,static-memory-domain") == 0 ) + rc = process_memory_node(fdt, node, name, depth, address_cells, + size_cells, &bootinfo.static_mem); + + return rc; } static int __init process_reserved_memory(const void *fdt, int node, diff --git a/xen/include/asm-arm/setup.h b/xen/include/asm-arm/setup.h index 5283244015..5e9f296760 100644 --- a/xen/include/asm-arm/setup.h +++ b/xen/include/asm-arm/setup.h @@ -74,6 +74,8 @@ struct bootinfo { #ifdef CONFIG_ACPI struct meminfo acpi; #endif + /* Static Memory */ + struct meminfo static_mem; }; extern struct bootinfo bootinfo; -- 2.25.1
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |