Message ID | 20171123183210.12045-11-julien.grall@linaro.org |
---|---|
State | Superseded |
Headers | show |
Series | xen/arm: Stage-2 handling cleanup | expand |
On Thu, 23 Nov 2017, Julien Grall wrote: > 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> Yes definitely an improvement Reviewed-by: Stefano Stabellini <sstabellini@kernel.org> > --- > 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 42c2e16ef6..9245753a6b 100644 > --- a/xen/arch/arm/domain_build.c > +++ b/xen/arch/arm/domain_build.c > @@ -1948,14 +1948,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 >
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c index 42c2e16ef6..9245753a6b 100644 --- a/xen/arch/arm/domain_build.c +++ b/xen/arch/arm/domain_build.c @@ -1948,14 +1948,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);
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> --- xen/arch/arm/domain_build.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)