[PATCH v3 4/5] ACRN:DM:PT: Add romfile option for rombar on GPU passthrough device


Zhao, Yakui
 

Add the option of "romfile=file_location" to specify the rom file for rombar

Signed-off-by: Zhao Yakui <yakui.zhao@...>
Acked-by: Wang Yu <yu1.wang@...>
---
devicemodel/hw/pci/passthrough.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/devicemodel/hw/pci/passthrough.c b/devicemodel/hw/pci/passthrough.c
index b294e4ca6..f04110f1c 100644
--- a/devicemodel/hw/pci/passthrough.c
+++ b/devicemodel/hw/pci/passthrough.c
@@ -708,6 +708,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
uint16_t vendor = 0, device = 0;
uint8_t class = 0;
char rom_file[256];
+ bool need_rombar = false;

ptdev = NULL;
error = -EINVAL;
@@ -740,6 +741,10 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
} else if (!strncmp(opt, "enable_ptm", 10)) {
pr_notice("<PTM>: opt=enable_ptm.\n");
enable_ptm = true;
+ } else if (!strncmp(opt, "romfile=", 8)) {
+ need_rombar = true;
+ opt += 8;
+ strcpy(rom_file, opt);
} else
pr_warn("Invalid passthru options:%s", opt);
}
@@ -820,6 +825,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
error = ACRN_PTDEV_IRQ_MSI;
}

+ ptdev->need_rombar = need_rombar;
if (class != 3) {
if (ptdev->need_rombar) {
pr_warn("Virtual PCI rom is only supported for GPU device\n");
--
2.25.1