From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xen.org
Cc: patches@linaro.org, ian.campbell@citrix.com,
Julien Grall <julien.grall@linaro.org>,
Stefano.Stabellini@eu.citrix.com
Subject: [PATCH v2 2/2] xen/arm: If the DOM0 zImage as a DTB appended replace it
Date: Thu, 30 May 2013 15:05:19 +0100 [thread overview]
Message-ID: <1369922720-10015-3-git-send-email-julien.grall@linaro.org> (raw)
In-Reply-To: <1369922720-10015-1-git-send-email-julien.grall@linaro.org>
If a DTB is appended to the DOM0 zImage, it's probably means that the linux
decompression stage will replace the DBT register value (r2 on arm32)
by the address of the appended DTB.
In this case, to avoid issue with Linux, Xen needs to load the new device tree
just after the kernel.
Signed-off-by: Julien Grall <julien.grall@linaro.org>
---
xen/arch/arm/kernel.c | 26 ++++++++++++--------------
1 file changed, 12 insertions(+), 14 deletions(-)
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index f8c8850..1d6c927 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -123,20 +123,6 @@ static int kernel_try_zimage_prepare(struct kernel_info *info,
if ( (end - start) > size )
return -EINVAL;
- /*
- * Check for an appended DTB.
- */
- if ( addr + end - start + sizeof(dtb_hdr) <= size )
- {
- copy_from_paddr(&dtb_hdr, addr + end - start,
- sizeof(dtb_hdr), DEV_SHARED);
- if (be32_to_cpu(dtb_hdr.magic) == DTB_MAGIC) {
- end += be32_to_cpu(dtb_hdr.total_size);
-
- if ( end > addr + size )
- return -EINVAL;
- }
- }
info->zimage.kernel_addr = addr;
@@ -154,6 +140,18 @@ static int kernel_try_zimage_prepare(struct kernel_info *info,
info->load = kernel_zimage_load;
info->type = KERNEL_ZIMAGE;
+ /*
+ * If there is an appended DTB, ask XEN to replace the DTB
+ * by the generate one.
+ */
+ if ( info->zimage.len + sizeof(dtb_hdr) <= size )
+ {
+ copy_from_paddr(&dtb_hdr, addr + end - start,
+ sizeof(dtb_hdr), DEV_SHARED);
+ if (be32_to_cpu(dtb_hdr.magic) == DTB_MAGIC)
+ info->dtb_paddr = info->zimage.load_addr + info->zimage.len;
+ }
+
return 0;
}
--
1.7.10.4
next prev parent reply other threads:[~2013-05-30 14:05 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-30 14:05 [PATCH v2 0/2] Rework the way to compute dom0 DTB base address Julien Grall
2013-05-30 14:05 ` [PATCH v2 1/2] xen/arm: " Julien Grall
2013-05-31 11:45 ` Ian Campbell
2013-05-31 13:28 ` Julien Grall
2013-05-31 13:45 ` Julien Grall
2013-05-31 14:14 ` Ian Campbell
2013-05-30 14:05 ` Julien Grall [this message]
2013-05-30 14:24 ` [PATCH v2 2/2] xen/arm: If the DOM0 zImage as a DTB appended replace it Ian Campbell
2013-05-30 14:47 ` Julien Grall
2013-05-30 14:52 ` Ian Campbell
2013-05-30 15:01 ` Julien Grall
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1369922720-10015-3-git-send-email-julien.grall@linaro.org \
--to=julien.grall@linaro.org \
--cc=Stefano.Stabellini@eu.citrix.com \
--cc=ian.campbell@citrix.com \
--cc=patches@linaro.org \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).