Skip to content

Commit

Permalink
Fix PCI device addr issue
Browse files Browse the repository at this point in the history
Since RPMB must be the first PCI device on PCI.bus0, set
vsock's address to 4.

Signed-off-by: Yadong Qi <yadong.qi@intel.com>
  • Loading branch information
YadongQi committed Feb 15, 2022
1 parent 9d17e8b commit 1466ece
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/guest/start.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
extern keyfile_group_t g_group[];

static const char *fixed_cmd =
" -machine type=q35,kernel_irqchip=off"
" -M q35"
" -machine kernel_irqchip=on"
" -k en-us"
" -cpu host"
" -enable-kvm"
Expand Down Expand Up @@ -550,12 +551,13 @@ int start_guest(char *name)

val = g_key_file_get_string(gkf, g->name, g->key[GLOB_VSOCK_CID], NULL);
if (val) {
cx = snprintf(p, size, " -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=%s", val);
cx = snprintf(p, size, " -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=%s,bus=pcie.0,addr=0x4", val);
} else {
cx = snprintf(p, size, " -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3");
cx = snprintf(p, size, " -device vhost-vsock-pci,id=vhost-vsock-pci0,guest-cid=3,bus=pcie.0,addr=0x4");
}
p += cx; size -= cx;


/*
* Please keep RPMB device option to be the first virtio device in QEMU command line. Since secure
* storage daemon in Andriod side communicates with /dev/vport0p1 for RPMB usage, this is a
Expand Down

0 comments on commit 1466ece

Please sign in to comment.