* [PATCH v3 1/5] xen: Add macros MB and GB
2013-09-27 16:56 [PATCH v3 0/5] ARM: Support initrd Julien Grall
@ 2013-09-27 16:56 ` Julien Grall
2013-09-27 17:01 ` Andrew Cooper
2013-09-27 16:56 ` [PATCH v3 2/5] xen: Add macro ROUNDUP Julien Grall
` (5 subsequent siblings)
6 siblings, 1 reply; 12+ messages in thread
From: Julien Grall @ 2013-09-27 16:56 UTC (permalink / raw)
To: xen-devel
Cc: Keir Fraser, ian.campbell, patches, Julien Grall, tim,
Jan Beulich, stefano.stabellini
Signed-off-by: Julien Grall <julien.grall@linaro.org>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
---
Changes in v3:
- Add GB
- Move to common code (include/xen/config.h)
---
xen/include/asm-arm/config.h | 1 -
xen/include/xen/config.h | 3 +++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index 9e395c2..5b7b1a8 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -142,7 +142,6 @@
#define SLOT0_ENTRY_BITS 39
#define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS)
#define SLOT0_ENTRY_SIZE SLOT0(1)
-#define GB(_gb) (_AC(_gb, UL) << 30)
#define VMAP_VIRT_START GB(1)
#define VMAP_VIRT_END (VMAP_VIRT_START + GB(1) - 1)
diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
index a52298e..657c6e5 100644
--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -69,6 +69,9 @@
#define __force
#define __bitwise
+#define MB(_mb) (_AC(_mb, UL) << 20)
+#define GB(_gb) (_AC(_gb, UL) << 30)
+
#ifndef __ASSEMBLY__
int current_domain_id(void);
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/5] xen: Add macros MB and GB
2013-09-27 16:56 ` [PATCH v3 1/5] xen: Add macros MB and GB Julien Grall
@ 2013-09-27 17:01 ` Andrew Cooper
2013-09-27 17:05 ` Julien Grall
0 siblings, 1 reply; 12+ messages in thread
From: Andrew Cooper @ 2013-09-27 17:01 UTC (permalink / raw)
To: Julien Grall
Cc: Keir Fraser, ian.campbell, patches, stefano.stabellini, tim,
xen-devel, Jan Beulich
On 27/09/13 17:56, Julien Grall wrote:
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <jbeulich@suse.com>
>
> ---
> Changes in v3:
> - Add GB
> - Move to common code (include/xen/config.h)
> ---
> xen/include/asm-arm/config.h | 1 -
> xen/include/xen/config.h | 3 +++
> 2 files changed, 3 insertions(+), 1 deletion(-)
You will also need to delete GB() from xen/include/asm-x86/config.h for
this to compile.
~Andrew
>
> diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
> index 9e395c2..5b7b1a8 100644
> --- a/xen/include/asm-arm/config.h
> +++ b/xen/include/asm-arm/config.h
> @@ -142,7 +142,6 @@
> #define SLOT0_ENTRY_BITS 39
> #define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS)
> #define SLOT0_ENTRY_SIZE SLOT0(1)
> -#define GB(_gb) (_AC(_gb, UL) << 30)
>
> #define VMAP_VIRT_START GB(1)
> #define VMAP_VIRT_END (VMAP_VIRT_START + GB(1) - 1)
> diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
> index a52298e..657c6e5 100644
> --- a/xen/include/xen/config.h
> +++ b/xen/include/xen/config.h
> @@ -69,6 +69,9 @@
> #define __force
> #define __bitwise
>
> +#define MB(_mb) (_AC(_mb, UL) << 20)
> +#define GB(_gb) (_AC(_gb, UL) << 30)
> +
> #ifndef __ASSEMBLY__
>
> int current_domain_id(void);
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/5] xen: Add macros MB and GB
2013-09-27 17:01 ` Andrew Cooper
@ 2013-09-27 17:05 ` Julien Grall
2013-09-27 17:07 ` Andrew Cooper
0 siblings, 1 reply; 12+ messages in thread
From: Julien Grall @ 2013-09-27 17:05 UTC (permalink / raw)
To: Andrew Cooper
Cc: Keir Fraser, ian.campbell, patches, stefano.stabellini, tim,
xen-devel, Jan Beulich
On 09/27/2013 06:01 PM, Andrew Cooper wrote:
> On 27/09/13 17:56, Julien Grall wrote:
>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>> CC: Keir Fraser <keir@xen.org>
>> CC: Jan Beulich <jbeulich@suse.com>
>>
>> ---
>> Changes in v3:
>> - Add GB
>> - Move to common code (include/xen/config.h)
>> ---
>> xen/include/asm-arm/config.h | 1 -
>> xen/include/xen/config.h | 3 +++
>> 2 files changed, 3 insertions(+), 1 deletion(-)
>
> You will also need to delete GB() from xen/include/asm-x86/config.h for
> this to compile.
Thanks, I forget to check the compilation on x86.
I only resend this patch:
commit 466457ed4946f7e1ec45f55e6d601a75b84884e5
Author: Julien Grall <julien.grall@linaro.org>
Date: Thu Sep 26 13:26:40 2013 +0100
xen: Add macros MB and GB
Signed-off-by: Julien Grall <julien.grall@linaro.org>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
---
Changes in v4:
- Remove GB in asm-x86/config.h
Changes in v3:
- Add GB
- Move to common code (include/xen/config.h)
diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
index 9e395c2..5b7b1a8 100644
--- a/xen/include/asm-arm/config.h
+++ b/xen/include/asm-arm/config.h
@@ -142,7 +142,6 @@
#define SLOT0_ENTRY_BITS 39
#define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS)
#define SLOT0_ENTRY_SIZE SLOT0(1)
-#define GB(_gb) (_AC(_gb, UL) << 30)
#define VMAP_VIRT_START GB(1)
#define VMAP_VIRT_END (VMAP_VIRT_START + GB(1) - 1)
diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
index cc42a88..3749457 100644
--- a/xen/include/asm-x86/config.h
+++ b/xen/include/asm-x86/config.h
@@ -128,7 +128,6 @@ extern unsigned char boot_edid_info[128];
#define PML4_ADDR(_slot) \
(((_AC(_slot, UL) >> 8) * _AC(0xffff000000000000,UL)) | \
(_AC(_slot, UL) << PML4_ENTRY_BITS))
-#define GB(_gb) (_AC(_gb, UL) << 30)
/*
* Memory layout:
diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
index a52298e..657c6e5 100644
--- a/xen/include/xen/config.h
+++ b/xen/include/xen/config.h
@@ -69,6 +69,9 @@
#define __force
#define __bitwise
+#define MB(_mb) (_AC(_mb, UL) << 20)
+#define GB(_gb) (_AC(_gb, UL) << 30)
+
#ifndef __ASSEMBLY__
int current_domain_id(void);
--
Julien Grall
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/5] xen: Add macros MB and GB
2013-09-27 17:05 ` Julien Grall
@ 2013-09-27 17:07 ` Andrew Cooper
0 siblings, 0 replies; 12+ messages in thread
From: Andrew Cooper @ 2013-09-27 17:07 UTC (permalink / raw)
To: Julien Grall
Cc: Keir Fraser, ian.campbell, patches, stefano.stabellini, tim,
xen-devel, Jan Beulich
On 27/09/13 18:05, Julien Grall wrote:
> On 09/27/2013 06:01 PM, Andrew Cooper wrote:
>> On 27/09/13 17:56, Julien Grall wrote:
>>> Signed-off-by: Julien Grall <julien.grall@linaro.org>
>>> CC: Keir Fraser <keir@xen.org>
>>> CC: Jan Beulich <jbeulich@suse.com>
>>>
>>> ---
>>> Changes in v3:
>>> - Add GB
>>> - Move to common code (include/xen/config.h)
>>> ---
>>> xen/include/asm-arm/config.h | 1 -
>>> xen/include/xen/config.h | 3 +++
>>> 2 files changed, 3 insertions(+), 1 deletion(-)
>> You will also need to delete GB() from xen/include/asm-x86/config.h for
>> this to compile.
> Thanks, I forget to check the compilation on x86.
> I only resend this patch:
>
> commit 466457ed4946f7e1ec45f55e6d601a75b84884e5
> Author: Julien Grall <julien.grall@linaro.org>
> Date: Thu Sep 26 13:26:40 2013 +0100
>
> xen: Add macros MB and GB
>
> Signed-off-by: Julien Grall <julien.grall@linaro.org>
> CC: Keir Fraser <keir@xen.org>
> CC: Jan Beulich <jbeulich@suse.com>
That looks better. Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
>
> ---
> Changes in v4:
> - Remove GB in asm-x86/config.h
>
> Changes in v3:
> - Add GB
> - Move to common code (include/xen/config.h)
>
> diff --git a/xen/include/asm-arm/config.h b/xen/include/asm-arm/config.h
> index 9e395c2..5b7b1a8 100644
> --- a/xen/include/asm-arm/config.h
> +++ b/xen/include/asm-arm/config.h
> @@ -142,7 +142,6 @@
> #define SLOT0_ENTRY_BITS 39
> #define SLOT0(slot) (_AT(vaddr_t,slot) << SLOT0_ENTRY_BITS)
> #define SLOT0_ENTRY_SIZE SLOT0(1)
> -#define GB(_gb) (_AC(_gb, UL) << 30)
>
> #define VMAP_VIRT_START GB(1)
> #define VMAP_VIRT_END (VMAP_VIRT_START + GB(1) - 1)
> diff --git a/xen/include/asm-x86/config.h b/xen/include/asm-x86/config.h
> index cc42a88..3749457 100644
> --- a/xen/include/asm-x86/config.h
> +++ b/xen/include/asm-x86/config.h
> @@ -128,7 +128,6 @@ extern unsigned char boot_edid_info[128];
> #define PML4_ADDR(_slot) \
> (((_AC(_slot, UL) >> 8) * _AC(0xffff000000000000,UL)) | \
> (_AC(_slot, UL) << PML4_ENTRY_BITS))
> -#define GB(_gb) (_AC(_gb, UL) << 30)
>
> /*
> * Memory layout:
> diff --git a/xen/include/xen/config.h b/xen/include/xen/config.h
> index a52298e..657c6e5 100644
> --- a/xen/include/xen/config.h
> +++ b/xen/include/xen/config.h
> @@ -69,6 +69,9 @@
> #define __force
> #define __bitwise
>
> +#define MB(_mb) (_AC(_mb, UL) << 20)
> +#define GB(_gb) (_AC(_gb, UL) << 30)
> +
> #ifndef __ASSEMBLY__
>
> int current_domain_id(void);
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 2/5] xen: Add macro ROUNDUP
2013-09-27 16:56 [PATCH v3 0/5] ARM: Support initrd Julien Grall
2013-09-27 16:56 ` [PATCH v3 1/5] xen: Add macros MB and GB Julien Grall
@ 2013-09-27 16:56 ` Julien Grall
2013-09-27 16:56 ` [PATCH v3 3/5] xen/dts: Use ROUNDUP macro instead of the internal ALIGN Julien Grall
` (4 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2013-09-27 16:56 UTC (permalink / raw)
To: xen-devel
Cc: Keir Fraser, ian.campbell, patches, Julien Grall, tim,
Jan Beulich, stefano.stabellini
Signed-off-by: Julien Grall <julien.grall@linaro.org>
CC: Keir Fraser <keir@xen.org>
CC: Jan Beulich <jbeulich@suse.com>
---
Changes in v3:
- Move the macro in include/xen/lib.h
- Rename in ROUNDUP to avoid collision with assembly ALIGN macro
---
xen/include/xen/lib.h | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xen/include/xen/lib.h b/xen/include/xen/lib.h
index 4768b0e..5b258fd 100644
--- a/xen/include/xen/lib.h
+++ b/xen/include/xen/lib.h
@@ -63,6 +63,8 @@ do { \
#define MASK_EXTR(v, m) (((v) & (m)) / ((m) & -(m)))
#define MASK_INSR(v, m) (((v) * ((m) & -(m))) & (m))
+#define ROUNDUP(x, a) (((x) + (a) - 1) & ~((a) - 1))
+
#define reserve_bootmem(_p,_l) ((void)0)
struct domain;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 3/5] xen/dts: Use ROUNDUP macro instead of the internal ALIGN
2013-09-27 16:56 [PATCH v3 0/5] ARM: Support initrd Julien Grall
2013-09-27 16:56 ` [PATCH v3 1/5] xen: Add macros MB and GB Julien Grall
2013-09-27 16:56 ` [PATCH v3 2/5] xen: Add macro ROUNDUP Julien Grall
@ 2013-09-27 16:56 ` Julien Grall
2013-09-27 16:56 ` [PATCH v3 4/5] xen/arm: Add support to load initrd in dom0 Julien Grall
` (3 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2013-09-27 16:56 UTC (permalink / raw)
To: xen-devel; +Cc: patches, tim, ian.campbell, Julien Grall, stefano.stabellini
---
xen/common/device_tree.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index 27ee708..ea8ed56 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -65,8 +65,6 @@ static LIST_HEAD(aliases_lookup);
printk(fmt, ## __VA_ARGS__); \
} while (0)
-#define ALIGN(x, a) ((x + (a) - 1) & ~((a) - 1));
-
// #define DEBUG_DT
#ifdef DEBUG_DT
@@ -457,7 +455,7 @@ static void __init *unflatten_dt_alloc(unsigned long *mem, unsigned long size,
{
void *res;
- *mem = ALIGN(*mem, align);
+ *mem = ROUNDUP(*mem, align);
res = (void *)*mem;
*mem += size;
@@ -1442,7 +1440,7 @@ static unsigned long __init unflatten_dt_node(const void *fdt,
*p += 4;
pathp = (char *)*p;
l = allocl = strlen(pathp) + 1;
- *p = ALIGN(*p + l, 4);
+ *p = ROUNDUP(*p + l, 4);
/* version 0x10 has a more compact unit name here instead of the full
* path. we accumulate the full path size using "fpsize", we'll rebuild
@@ -1535,7 +1533,7 @@ static unsigned long __init unflatten_dt_node(const void *fdt,
noff = be32_to_cpup((__be32 *)((*p) + 4));
*p += 8;
if ( fdt_version(fdt) < 0x10 )
- *p = ALIGN(*p, sz >= 8 ? 8 : 4);
+ *p = ROUNDUP(*p, sz >= 8 ? 8 : 4);
pname = fdt_string(fdt, noff);
if ( pname == NULL )
@@ -1572,7 +1570,7 @@ static unsigned long __init unflatten_dt_node(const void *fdt,
*prev_pp = pp;
prev_pp = &pp->next;
}
- *p = ALIGN((*p) + sz, 4);
+ *p = ROUNDUP((*p) + sz, 4);
}
/* with version 0x10 we may not have the name property, recreate
* it here from the unit name if absent
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 4/5] xen/arm: Add support to load initrd in dom0
2013-09-27 16:56 [PATCH v3 0/5] ARM: Support initrd Julien Grall
` (2 preceding siblings ...)
2013-09-27 16:56 ` [PATCH v3 3/5] xen/dts: Use ROUNDUP macro instead of the internal ALIGN Julien Grall
@ 2013-09-27 16:56 ` Julien Grall
2013-09-27 16:56 ` [PATCH v3 5/5] xen/dts: Support Linux initrd DT bindings Julien Grall
` (2 subsequent siblings)
6 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2013-09-27 16:56 UTC (permalink / raw)
To: xen-devel; +Cc: patches, tim, ian.campbell, Julien Grall, stefano.stabellini
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
Changes in v3:
- s/ALIGN/ROUNDUP/
Changes in v2:
- Align the initrd and DTB length to 2MB
---
xen/arch/arm/domain_build.c | 101 +++++++++++++++++++++++++++++++++++++------
xen/arch/arm/kernel.c | 20 +++++----
xen/arch/arm/kernel.h | 2 +
3 files changed, 102 insertions(+), 21 deletions(-)
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index fb1fa56..4f91327 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -163,12 +163,16 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
*
* * remember xen,dom0-bootargs if we don't already have
* bootargs (from module #1, above).
- * * remove bootargs, xen,dom0-bootargs and xen,xen-bootargs.
+ * * remove bootargs, xen,dom0-bootargs, xen,xen-bootargs,
+ * linux,initrd-start and linux,initrd-end.
*/
if ( dt_node_path_is_equal(np, "/chosen") )
{
- if ( dt_property_name_is_equal(pp, "xen,xen-bootargs") )
+ if ( dt_property_name_is_equal(pp, "xen,xen-bootargs") ||
+ dt_property_name_is_equal(pp, "linux,initrd-start") ||
+ dt_property_name_is_equal(pp, "linux,initrd-end") )
continue;
+
if ( dt_property_name_is_equal(pp, "xen,dom0-bootargs") )
{
had_dom0_bootargs = 1;
@@ -214,12 +218,22 @@ static int write_properties(struct domain *d, struct kernel_info *kinfo,
strlen(bootargs) + 1);
if ( res )
return res;
- }
- /*
- * XXX should populate /chosen/linux,initrd-{start,end} here if we
- * have module[2]
- */
+ /*
+ * If the bootloader provides an initrd, we must create a placeholder
+ * for the initrd properties. The values will be replaced later.
+ */
+ if ( early_info.modules.module[MOD_INITRD].size )
+ {
+ res = fdt_property_cell(kinfo->fdt, "linux,initrd-start", 0);
+ if ( res )
+ return res;
+
+ res = fdt_property_cell(kinfo->fdt, "linux,initrd-end", 0);
+ if ( res )
+ return res;
+ }
+ }
return 0;
}
@@ -765,6 +779,8 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
int new_size;
int ret;
paddr_t end;
+ paddr_t initrd_len;
+ paddr_t dtb_len;
ASSERT(dt_host && (dt_host->sibling == NULL));
@@ -791,8 +807,10 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
if ( ret < 0 )
goto err;
- /* Actual new size */
- new_size = fdt_totalsize(kinfo->fdt);
+ /* Align DTB and initrd size to 2Mb. Linux only requires 4 byte alignment */
+ initrd_len = ROUNDUP(early_info.modules.module[MOD_INITRD].size, MB(2));
+ dtb_len = ROUNDUP(fdt_totalsize(kinfo->fdt), MB(2));
+ new_size = initrd_len + dtb_len;
/*
* DTB must be loaded such that it does not conflict with the
@@ -801,14 +819,14 @@ static int prepare_dtb(struct domain *d, struct kernel_info *kinfo)
* the recommendation in Documentation/arm64/booting.txt is below
* 512MB. Place at 128MB, (or, if we have less RAM, as high as
* possible) in order to satisfy both.
+ * If the bootloader provides an initrd, it will be loaded just
+ * after the DTB.
*/
end = kinfo->mem.bank[0].start + kinfo->mem.bank[0].size;
end = MIN(kinfo->mem.bank[0].start + (128<<20) + new_size, end);
- kinfo->dtb_paddr = end - new_size;
-
- /* Align the address to 2Mb. Linux only requires 4 byte alignment */
- kinfo->dtb_paddr &= ~((2 << 20) - 1);
+ kinfo->initrd_paddr = end - initrd_len;
+ kinfo->dtb_paddr = kinfo->initrd_paddr - dtb_len;
if ( kinfo->dtb_paddr < kinfo->mem.bank[0].start ||
kinfo->mem.bank[0].start + new_size > end )
@@ -841,6 +859,61 @@ static void dtb_load(struct kernel_info *kinfo)
xfree(kinfo->fdt);
}
+static void initrd_load(struct kernel_info *kinfo)
+{
+ paddr_t load_addr = kinfo->initrd_paddr;
+ paddr_t paddr = early_info.modules.module[MOD_INITRD].start;
+ paddr_t len = early_info.modules.module[MOD_INITRD].size;
+ unsigned long offs;
+ int node;
+ int res;
+
+ if ( !len )
+ return;
+
+ printk("Loading dom0 initrd from %"PRIpaddr" to 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
+ paddr, load_addr, load_addr + len);
+
+ /* Fix up linux,initrd-start and linux,initrd-end in /chosen */
+ node = fdt_path_offset(kinfo->fdt, "/chosen");
+ if ( node < 0 )
+ panic("Cannot find the /chosen node");
+
+ res = fdt_setprop_inplace_cell(kinfo->fdt, node, "linux,initrd-start",
+ load_addr);
+ if ( res )
+ panic("Cannot fix up \"linux,initrd-start\" property\n");
+
+ res = fdt_setprop_inplace_cell(kinfo->fdt, node, "linux,initrd-end",
+ load_addr + len);
+ if ( res )
+ panic("Cannot fix up \"linux,initrd-end\" property\n");
+
+ for ( offs = 0; offs < len; )
+ {
+ int rc;
+ paddr_t s, l, ma;
+ void *dst;
+
+ s = offs & ~PAGE_MASK;
+ l = min(PAGE_SIZE - s, len);
+
+ rc = gvirt_to_maddr(load_addr + offs, &ma);
+ if ( rc )
+ {
+ panic("\nUnable to translate guest address\n");
+ return;
+ }
+
+ dst = map_domain_page(ma>>PAGE_SHIFT);
+
+ copy_from_paddr(dst + s, paddr + offs, l, BUFFERABLE);
+
+ unmap_domain_page(dst);
+ offs += l;
+ }
+}
+
int construct_dom0(struct domain *d)
{
struct kernel_info kinfo = {};
@@ -877,6 +950,8 @@ int construct_dom0(struct domain *d)
p2m_load_VTTBR(d);
kernel_load(&kinfo);
+ /* initrd_load will fix up the fdt, so call it before dtb_load */
+ initrd_load(&kinfo);
dtb_load(&kinfo);
discard_initial_modules();
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 6d2c164..315d12c 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -72,15 +72,22 @@ static void kernel_zimage_check_overlap(struct kernel_info *info)
{
paddr_t zimage_start = info->zimage.load_addr;
paddr_t zimage_end = info->zimage.load_addr + info->zimage.len;
- paddr_t dtb_start = info->dtb_paddr;
- paddr_t dtb_end = info->dtb_paddr + fdt_totalsize(info->fdt);
+ paddr_t start = info->dtb_paddr;
+ paddr_t end;
- if ( (dtb_start > zimage_end) || (dtb_end < zimage_start) )
+ end = info->initrd_paddr + early_info.modules.module[MOD_INITRD].size;
+
+ /*
+ * In the dom0 memory, the initrd will be just after the DTB. So we
+ * only need to check if the zImage range will overlap the
+ * DTB-initrd range.
+ */
+ if ( (start > zimage_end) || (end < zimage_start) )
return;
panic(XENLOG_ERR "The kernel(0x%"PRIpaddr"-0x%"PRIpaddr
- ") is overlapping the DTB(0x%"PRIpaddr"-0x%"PRIpaddr")\n",
- zimage_start, zimage_end, dtb_start, dtb_end);
+ ") is overlapping the DTB-initrd(0x%"PRIpaddr"-0x%"PRIpaddr")\n",
+ zimage_start, zimage_end, start, end);
}
static void kernel_zimage_load(struct kernel_info *info)
@@ -335,9 +342,6 @@ int kernel_prepare(struct kernel_info *info)
paddr_t start, size;
- if ( early_info.modules.nr_mods > MOD_INITRD )
- panic("Cannot handle dom0 initrd yet\n");
-
if ( early_info.modules.nr_mods < MOD_KERNEL )
{
printk("No boot modules found, trying flash\n");
diff --git a/xen/arch/arm/kernel.h b/xen/arch/arm/kernel.h
index c900e74..debf590 100644
--- a/xen/arch/arm/kernel.h
+++ b/xen/arch/arm/kernel.h
@@ -21,6 +21,8 @@ struct kernel_info {
paddr_t dtb_paddr;
paddr_t entry;
+ paddr_t initrd_paddr;
+
void *kernel_img;
unsigned kernel_order;
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 5/5] xen/dts: Support Linux initrd DT bindings
2013-09-27 16:56 [PATCH v3 0/5] ARM: Support initrd Julien Grall
` (3 preceding siblings ...)
2013-09-27 16:56 ` [PATCH v3 4/5] xen/arm: Add support to load initrd in dom0 Julien Grall
@ 2013-09-27 16:56 ` Julien Grall
2013-10-03 13:14 ` xen: Add MB, GB and ROUNDUP macros to common headers (Was: Re: [PATCH v3 0/5] ARM: Support initrd) Ian Campbell
2013-10-08 15:02 ` [PATCH v3 0/5] ARM: Support initrd Ian Campbell
6 siblings, 0 replies; 12+ messages in thread
From: Julien Grall @ 2013-09-27 16:56 UTC (permalink / raw)
To: xen-devel; +Cc: patches, tim, ian.campbell, Julien Grall, stefano.stabellini
Linux uses the property linux,initrd-start and linux,initrd-end to know where
the initrd lives in memory.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
xen/common/device_tree.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/xen/common/device_tree.c b/xen/common/device_tree.c
index ea8ed56..af0fb04 100644
--- a/xen/common/device_tree.c
+++ b/xen/common/device_tree.c
@@ -380,6 +380,29 @@ static void __init process_multiboot_node(const void *fdt, int node,
early_info.modules.nr_mods = nr;
}
+static void __init process_chosen_node(const void *fdt, int node,
+ const char *name,
+ u32 address_cells, u32 size_cells)
+{
+ struct dt_mb_module *mod = &early_info.modules.module[MOD_INITRD];
+ u32 start, end;
+
+ dt_printk("Checking for initrd in /chosen\n");
+
+ start = device_tree_get_u32(fdt, node, "linux,initrd-start", 0);
+ end = device_tree_get_u32(fdt, node, "linux,initrd-end", 0);
+
+ if ( !start || !end || (start >= end) )
+ return;
+
+ dt_printk("Initrd 0x%x-0x%x\n", start, end);
+
+ mod->start = start;
+ mod->size = end - start;
+
+ early_info.modules.nr_mods = MAX(MOD_INITRD, early_info.modules.nr_mods);
+}
+
static int __init early_scan_node(const void *fdt,
int node, const char *name, int depth,
u32 address_cells, u32 size_cells,
@@ -389,6 +412,8 @@ static int __init early_scan_node(const void *fdt,
process_memory_node(fdt, node, name, address_cells, size_cells);
else if ( device_tree_node_compatible(fdt, node, "xen,multiboot-module" ) )
process_multiboot_node(fdt, node, name, address_cells, size_cells);
+ else if ( depth == 1 && device_tree_node_matches(fdt, node, "chosen") )
+ process_chosen_node(fdt, node, name, address_cells, size_cells);
return 0;
}
--
1.7.10.4
^ permalink raw reply related [flat|nested] 12+ messages in thread
* xen: Add MB, GB and ROUNDUP macros to common headers (Was: Re: [PATCH v3 0/5] ARM: Support initrd)
2013-09-27 16:56 [PATCH v3 0/5] ARM: Support initrd Julien Grall
` (4 preceding siblings ...)
2013-09-27 16:56 ` [PATCH v3 5/5] xen/dts: Support Linux initrd DT bindings Julien Grall
@ 2013-10-03 13:14 ` Ian Campbell
2013-10-03 19:49 ` Keir Fraser
2013-10-08 15:02 ` [PATCH v3 0/5] ARM: Support initrd Ian Campbell
6 siblings, 1 reply; 12+ messages in thread
From: Ian Campbell @ 2013-10-03 13:14 UTC (permalink / raw)
To: Julien Grall
Cc: Keir Fraser, stefano.stabellini, patches, tim, xen-devel,
Jan Beulich
On Fri, 2013-09-27 at 17:56 +0100, Julien Grall wrote:
> xen: Add macros MB and GB
> xen: Add macro ROUNDUP
Keir/Jan,
Any (n)ack for these two generic changes?
> xen/dts: Use ROUNDUP macro instead of the internal ALIGN
> xen/arm: Add support to load initrd in dom0
> xen/dts: Support Linux initrd DT bindings
>
> xen/arch/arm/domain_build.c | 101 ++++++++++++++++++++++++++++++++++++------
> xen/arch/arm/kernel.c | 20 +++++----
> xen/arch/arm/kernel.h | 2 +
> xen/common/device_tree.c | 35 ++++++++++++---
> xen/include/asm-arm/config.h | 1 -
> xen/include/xen/config.h | 3 ++
> xen/include/xen/lib.h | 2 +
> 7 files changed, 136 insertions(+), 28 deletions(-)
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: xen: Add MB, GB and ROUNDUP macros to common headers (Was: Re: [PATCH v3 0/5] ARM: Support initrd)
2013-10-03 13:14 ` xen: Add MB, GB and ROUNDUP macros to common headers (Was: Re: [PATCH v3 0/5] ARM: Support initrd) Ian Campbell
@ 2013-10-03 19:49 ` Keir Fraser
0 siblings, 0 replies; 12+ messages in thread
From: Keir Fraser @ 2013-10-03 19:49 UTC (permalink / raw)
To: Ian Campbell, Julien Grall
Cc: Keir Fraser, stefano.stabellini, patches, tim, xen-devel,
Jan Beulich
On 03/10/2013 14:14, "Ian Campbell" <Ian.Campbell@citrix.com> wrote:
> On Fri, 2013-09-27 at 17:56 +0100, Julien Grall wrote:
>> xen: Add macros MB and GB
>> xen: Add macro ROUNDUP
>
> Keir/Jan,
>
> Any (n)ack for these two generic changes?
Acked-by: Keir Fraser <keir@xen.org>
>
>> xen/dts: Use ROUNDUP macro instead of the internal ALIGN
>> xen/arm: Add support to load initrd in dom0
>> xen/dts: Support Linux initrd DT bindings
>>
>> xen/arch/arm/domain_build.c | 101
>> ++++++++++++++++++++++++++++++++++++------
>> xen/arch/arm/kernel.c | 20 +++++----
>> xen/arch/arm/kernel.h | 2 +
>> xen/common/device_tree.c | 35 ++++++++++++---
>> xen/include/asm-arm/config.h | 1 -
>> xen/include/xen/config.h | 3 ++
>> xen/include/xen/lib.h | 2 +
>> 7 files changed, 136 insertions(+), 28 deletions(-)
>>
>
>
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 0/5] ARM: Support initrd
2013-09-27 16:56 [PATCH v3 0/5] ARM: Support initrd Julien Grall
` (5 preceding siblings ...)
2013-10-03 13:14 ` xen: Add MB, GB and ROUNDUP macros to common headers (Was: Re: [PATCH v3 0/5] ARM: Support initrd) Ian Campbell
@ 2013-10-08 15:02 ` Ian Campbell
6 siblings, 0 replies; 12+ messages in thread
From: Ian Campbell @ 2013-10-08 15:02 UTC (permalink / raw)
To: Julien Grall; +Cc: stefano.stabellini, tim, patches, xen-devel
On Fri, 2013-09-27 at 17:56 +0100, Julien Grall wrote:
> Hi,
>
> This is the third version of this patch series. It adds support to load initrd
> in dom0 for ARM.
Keir acked the generic stuff and I've acked #3 and added your S-o-b
(after communication in real life) and pushed.
Thanks.
>
> All the changes can be found in each patch.
>
> Cheers,
>
> Julien Grall (5):
> xen: Add macros MB and GB
> xen: Add macro ROUNDUP
> xen/dts: Use ROUNDUP macro instead of the internal ALIGN
> xen/arm: Add support to load initrd in dom0
> xen/dts: Support Linux initrd DT bindings
>
> xen/arch/arm/domain_build.c | 101 ++++++++++++++++++++++++++++++++++++------
> xen/arch/arm/kernel.c | 20 +++++----
> xen/arch/arm/kernel.h | 2 +
> xen/common/device_tree.c | 35 ++++++++++++---
> xen/include/asm-arm/config.h | 1 -
> xen/include/xen/config.h | 3 ++
> xen/include/xen/lib.h | 2 +
> 7 files changed, 136 insertions(+), 28 deletions(-)
>
^ permalink raw reply [flat|nested] 12+ messages in thread