From 0d9d628d9aabad71a29b8f012885ea708ab8aad9 Mon Sep 17 00:00:00 2001 From: Yin Fengwei Date: Wed, 21 Mar 2018 16:09:15 +0800 Subject: [PATCH] DM: add option to show which virtio-blk is boot device. Now, we could use option: -s 3,virtio-blk,/XXXX_vdisk_file,b to show this virtio device is boot device for guest. Signed-off-by: Yin Fengwei Acked-by: Anthony Xu --- devicemodel/hw/pci/core.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/devicemodel/hw/pci/core.c b/devicemodel/hw/pci/core.c index 43e1db182..36f3daa6b 100644 --- a/devicemodel/hw/pci/core.c +++ b/devicemodel/hw/pci/core.c @@ -48,6 +48,7 @@ #include "pci_core.h" #include "irq.h" #include "lpc.h" +#include "sw_load.h" #define CONF1_ADDR_PORT 0x0cf8 #define CONF1_DATA_PORT 0x0cfc @@ -161,7 +162,7 @@ pci_parse_slot(char *opt) { struct businfo *bi; struct slotinfo *si; - char *emul, *config, *str, *cp; + char *emul, *config, *str, *cp, *b = NULL; int error, bnum, snum, fnum; error = -1; @@ -180,6 +181,11 @@ pci_parse_slot(char *opt) if (cp != NULL) { *cp = '\0'; config = cp + 1; + cp = strchr(config, ','); + if (cp != NULL) { + *cp = '\0'; + b = cp + 1; + } } } else { pci_parse_slot_usage(opt); @@ -227,6 +233,12 @@ pci_parse_slot(char *opt) /* saved fi param in case reboot */ si->si_funcs[fnum].fi_param_saved = config; + if (b != NULL) { + if ((strcmp("virtio-blk", emul) == 0) && (b != NULL) && + (strchr(b, 'b') != NULL)) { + vsbl_set_bdf(bnum, snum, fnum); + } + } done: if (error) free(str);