All of lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Grall <julien.grall@linaro.org>
To: xen-devel@lists.xen.org
Cc: sstabellini@kernel.org, Julien Grall <julien.grall@linaro.org>,
	andre.przywara@linaro.org
Subject: [v2 10/16] xen/arm: domain_build: Use copy_to_guest_phys_flush_dcache in dtb_load
Date: Tue, 12 Dec 2017 19:02:06 +0000	[thread overview]
Message-ID: <20171212190212.5535-11-julien.grall@linaro.org> (raw)
In-Reply-To: <20171212190212.5535-1-julien.grall@linaro.org>

The function dtb_load is dealing with IPA but uses gvirt_to_maddr to do
the translation. This is currently working fine because the stage-1 MMU
is disabled.

Rather than relying on such assumption, use the new
copy_to_guest_phys_flush_dcache. This also result to a slightly more
comprehensible code.

Signed-off-by: Julien Grall <julien.grall@linaro.org>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>

---
    Changes in v2:
        - Add Stefano's reviewed-by
---
 xen/arch/arm/domain_build.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 66fd77def6..155c952349 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1950,14 +1950,15 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo)
 #endif
 static void dtb_load(struct kernel_info *kinfo)
 {
-    void * __user dtb_virt = (void * __user)(register_t)kinfo->dtb_paddr;
     unsigned long left;
 
     printk("Loading dom0 DTB to 0x%"PRIpaddr"-0x%"PRIpaddr"\n",
            kinfo->dtb_paddr, kinfo->dtb_paddr + fdt_totalsize(kinfo->fdt));
 
-    left = raw_copy_to_guest_flush_dcache(dtb_virt, kinfo->fdt,
-                                        fdt_totalsize(kinfo->fdt));
+    left = copy_to_guest_phys_flush_dcache(kinfo->d, kinfo->dtb_paddr,
+                                           kinfo->fdt,
+                                           fdt_totalsize(kinfo->fdt));
+
     if ( left != 0 )
         panic("Unable to copy the DTB to dom0 memory (left = %lu bytes)", left);
     xfree(kinfo->fdt);
-- 
2.11.0


_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2017-12-12 19:02 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-12 19:01 [v2 00/16] xen/arm: Stage-2 handling cleanup Julien Grall
2017-12-12 19:01 ` [v2 01/16] xen/arm: raw_copy_to_guest_helper: Rename flush_dcache to flags Julien Grall
2017-12-12 19:01 ` [v2 02/16] xen/arm: raw_copy_to_guest_helper: Rework the prototype and rename it Julien Grall
2017-12-12 19:51   ` Stefano Stabellini
2017-12-12 19:01 ` [v2 03/16] xen/arm: Extend copy_to_guest to support copying from guest VA and use it Julien Grall
2017-12-12 19:54   ` Stefano Stabellini
2017-12-12 19:02 ` [v2 04/16] xen/arm: Extend copy_to_guest to support zeroing " Julien Grall
2017-12-12 19:57   ` Stefano Stabellini
2017-12-12 19:02 ` [v2 05/16] xen/arm: guest_copy: Extend the prototype to pass the vCPU Julien Grall
2017-12-12 20:00   ` Stefano Stabellini
2017-12-12 19:02 ` [v2 06/16] xen/arm: Extend copy_to_guest to support copying from/to guest physical address Julien Grall
2017-12-12 20:06   ` Stefano Stabellini
2017-12-12 19:02 ` [v2 07/16] xen/arm: Introduce copy_to_guest_phys_flush_dcache Julien Grall
2017-12-12 20:10   ` Stefano Stabellini
2017-12-12 19:02 ` [v2 08/16] xen/arm: kernel: Rework kernel_zimage_load to use the generic copy helper Julien Grall
2017-12-12 19:02 ` [v2 09/16] xen/arm: domain_build: Rework initrd_load " Julien Grall
2017-12-12 19:02 ` Julien Grall [this message]
2017-12-12 19:02 ` [v2 11/16] xen/arm: p2m: Rename p2m_flush_tlb and p2m_flush_tlb_sync Julien Grall
2017-12-12 19:02 ` [v2 12/16] xen/arm: p2m: Introduce p2m_tlb_flush_sync, export it and use it Julien Grall
2017-12-12 19:02 ` [v2 13/16] xen/arm: p2m: Fold p2m_tlb_flush into p2m_force_tlb_flush_sync Julien Grall
2017-12-12 19:02 ` [v2 14/16] xen/arm: traps: Remove the field gva from mmio_info_t Julien Grall
2017-12-12 19:02 ` [v2 15/16] xen/arm: traps: Move the definition of mmio_info_t in try_handle_mmio Julien Grall
2017-12-12 19:02 ` [v2 16/16] xen/arm: traps: Merge do_trap_instr_abort_guest and do_trap_data_abort_guest Julien Grall
2017-12-12 20:11   ` Stefano Stabellini

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=20171212190212.5535-11-julien.grall@linaro.org \
    --to=julien.grall@linaro.org \
    --cc=andre.przywara@linaro.org \
    --cc=sstabellini@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.