Skip to content
Merged
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
18 changes: 16 additions & 2 deletions src/riscv.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ static char *realloc_property(char *fdt,
return fdt;
}

static void load_dtb(char **ram_loc, char *bootargs)
static void load_dtb(char **ram_loc, vm_attr_t *attr)
{
#include "minimal_dtb.h"
char *bootargs = attr->data.system.bootargs;
char *vblk = attr->data.system.vblk_device;
char *blob = *ram_loc;
char *buf;
size_t len;
Expand All @@ -314,6 +316,18 @@ static void load_dtb(char **ram_loc, char *bootargs)
assert(!err);
}

/* remove the vblk node from soc if it is not specified */
if (!vblk) {
int subnode;
node = fdt_path_offset(blob, "/soc@F0000000");
assert(node >= 0);

subnode = fdt_subnode_offset(blob, node, "virtio@4200000");
assert(subnode >= 0);

assert(fdt_del_node(blob, subnode) == 0);
}

totalsize = fdt_totalsize(blob);
*ram_loc += totalsize;
return;
Expand Down Expand Up @@ -499,7 +513,7 @@ riscv_t *rv_create(riscv_user_t rv_attr)

uint32_t dtb_addr = attr->mem->mem_size - DTB_SIZE;
ram_loc = ((char *) attr->mem->mem_base) + dtb_addr;
load_dtb(&ram_loc, attr->data.system.bootargs);
load_dtb(&ram_loc, attr);
rv_log_info("DTB loaded");
/*
* Load optional initrd image at last 8 MiB before the dtb region to
Expand Down
Loading