"mapping in shared page %d from domain %d",
gnt_refs[i], dev->otherend_id);
goto fail;
- } else
+ } else {
handles[i] = map[i].handle;
+ if (xen_shim_domain())
+ addrs[i] = map[i].host_addr;
+ }
}
return GNTST_okay;
if (handles[i] != INVALID_GRANT_HANDLE) {
memset(&unmap[j], 0, sizeof(unmap[j]));
gnttab_set_unmap_op(&unmap[j], (phys_addr_t)addrs[i],
- GNTMAP_host_map, handles[i]);
+ !xen_shim_domain()?GNTMAP_host_map:0,
+ handles[i]);
j++;
}
}
void **vaddr)
{
struct xenbus_map_node *node;
- int err;
+ int i, err;
void *addr;
bool leaked = false;
struct map_ring_valloc_hvm info = {
&info);
err = __xenbus_map_ring(dev, gnt_ref, nr_grefs, node->handles,
- info.phys_addrs, GNTMAP_host_map, &leaked);
+ info.phys_addrs,
+ !xen_shim_domain() ? GNTMAP_host_map : 0,
+ &leaked);
node->nr_handles = nr_grefs;
+ if (xen_shim_domain()) {
+ for (i = 0; i < nr_grefs; i++)
+ node->hvm.pages[i] = virt_to_page(info.phys_addrs[i]);
+ }
+
if (err)
goto out_free_ballooned_pages;
for (i = 0; i < nr_handles; i++)
gnttab_set_unmap_op(&unmap[i], vaddrs[i],
- GNTMAP_host_map, handles[i]);
+ !xen_shim_domain()?GNTMAP_host_map:0, handles[i]);
if (HYPERVISOR_grant_table_op(GNTTABOP_unmap_grant_ref, unmap, i))
BUG();
.unmap = xenbus_unmap_ring_vfree_hvm,
};
-void __init xenbus_ring_ops_init(void)
+void xenbus_ring_ops_init(void)
{
#ifdef CONFIG_XEN_PV
if (!xen_feature(XENFEAT_auto_translated_physmap))
static int __init xenbus_probe_initcall(void)
{
- if (!xen_domain())
+ if (!xen_domain() && !xen_shim_domain())
return -ENODEV;
if (xen_initial_domain() || xen_hvm_domain())
uint64_t v = 0;
xen_store_domain_type = XS_UNKNOWN;
- if (!xen_domain())
+ if (!xen_domain() && !xen_shim_domain())
return -ENODEV;
xenbus_ring_ops_init();
xen_store_domain_type = XS_PV;
if (xen_hvm_domain())
xen_store_domain_type = XS_HVM;
- if (xen_hvm_domain() && xen_initial_domain())
+ if ((xen_hvm_domain() && xen_initial_domain()) || xen_shim_domain())
xen_store_domain_type = XS_LOCAL;
if (xen_pv_domain() && !xen_start_info->store_evtchn)
xen_store_domain_type = XS_LOCAL;
void xenbus_deinit(void)
{
- if (!xen_domain())
+ if (!xen_domain() && !xen_shim_domain())
return;
#ifdef CONFIG_XEN_COMPAT_XENFS