From 3c01a6a0cf9a4837cc63c173a45add1a966929f5 Mon Sep 17 00:00:00 2001 From: Zhao Yakui Date: Wed, 21 Sep 2022 13:13:23 +0800 Subject: [PATCH] ACRN:DM:PT: Add romfile option for rombar on GPU passthrough device Add the option of "romfile=file_location" to specify the rom file for rombar Tracked-On: #8175 Signed-off-by: Zhao Yakui Acked-by: Wang Yu --- 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 f8067724d..5cc652b2d 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(": 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");