@@ -2135,6 +2135,7 @@ int construct_dom0(struct domain *d)
d->max_pages = ~0U;
kinfo.unassigned_mem = dom0_mem;
+ kinfo.d = d;
rc = kernel_probe(&kinfo);
if ( rc < 0 )
@@ -15,6 +15,8 @@
#include <xen/gunzip.h>
#include <xen/vmap.h>
+#include <asm/guest_access.h>
+
#include "kernel.h"
#define UIMAGE_MAGIC 0x27051956
@@ -157,7 +159,8 @@ static void kernel_zimage_load(struct kernel_info *info)
paddr_t load_addr = kernel_zimage_place(info);
paddr_t paddr = info->zimage.kernel_addr;
paddr_t len = info->zimage.len;
- unsigned long offs;
+ void *kernel;
+ int rc;
info->entry = load_addr;
@@ -165,29 +168,17 @@ static void kernel_zimage_load(struct kernel_info *info)
printk("Loading zImage from %"PRIpaddr" to %"PRIpaddr"-%"PRIpaddr"\n",
paddr, load_addr, load_addr + len);
- for ( offs = 0; offs < len; )
- {
- uint64_t par;
- paddr_t s, l, ma = 0;
- void *dst;
-
- s = offs & ~PAGE_MASK;
- l = min(PAGE_SIZE - s, len);
-
- par = gvirt_to_maddr(load_addr + offs, &ma, GV2M_WRITE);
- if ( par )
- {
- panic("Unable to map translate guest address");
- return;
- }
- dst = map_domain_page(maddr_to_mfn(ma));
+ kernel = ioremap_wc(paddr, len);
+ if ( !kernel )
+ panic("Unable to map the hwdom kernel");
- copy_from_paddr(dst + s, paddr + offs, l);
+ rc = copy_to_guest_phys_flush_dcache(info->d, load_addr,
+ kernel, len);
+ if ( rc != 0 )
+ panic("Unable to copy the kernel in the hwdom memory");
- unmap_domain_page(dst);
- offs += l;
- }
+ iounmap(kernel);
}
/*
@@ -15,6 +15,8 @@ struct kernel_info {
enum domain_type type;
#endif
+ struct domain *d;
+
void *fdt; /* flat device tree */
paddr_t unassigned_mem; /* RAM not (yet) assigned to a bank */
struct meminfo mem;