Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xen-dom-mgmt: improvements for dom0 initcall #65

Merged
merged 3 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions xen-dom-mgmt/src/xen-dom-mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -916,13 +916,11 @@ static int init_domain0(const struct device *d)
}

ret = xstat_getdominfo(dom0stat, 0, 1);
/* Zero means no domains, theoretically impossible */
__ASSERT_NO_MSG(ret);
if (ret < 0) {
LOG_ERR("Failed to get info for dom0 (rc=%d)", ret);
goto out;
} else if (ret == 0) {
/* Theoretically impossible */
ret = -EINVAL;
goto out;
}
#endif

Expand All @@ -940,16 +938,26 @@ static int init_domain0(const struct device *d)
#ifdef CONFIG_XSTAT
dom0->num_vcpus = dom0stat->num_vcpus;
dom0->max_mem_kb = dom0stat->cur_mem / 1024;
k_free(dom0stat);
#else
dom0->num_vcpus = 0;
dom0->max_mem_kb = 0;
#endif

xs_init_root();
xss_write("/tool/xenstored", "");
xs_initialize_xenstore(0, dom0);
ret = xs_init_root();
if (ret) {
LOG_ERR("Failed to init Xenstore root node");
goto out;
}

ret = xss_write("/tool/xenstored", "");
if (ret) {
LOG_ERR("Failed to create /tool/xenstored node, err = %d", ret);
}

ret = xs_initialize_xenstore(0, dom0);
if (ret) {
LOG_ERR("Failed to add Domain-0 xenstore entries, err = %d", ret);
}
out:
#ifdef CONFIG_XSTAT
k_free(dom0stat);
Expand Down
3 changes: 1 addition & 2 deletions xenstore-srv/src/xenstore_srv.c
Original file line number Diff line number Diff line change
Expand Up @@ -2121,8 +2121,7 @@ int xs_init_root(void)

sys_dlist_init(&root_xenstore.child_list);
sys_dnode_init(&root_xenstore.node);
set_perms_by_array(&root_xenstore, &permissions, 1);

return 0;
return set_perms_by_array(&root_xenstore, &permissions, 1);
}