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 <yakui.zhao@intel.com>
Acked-by: Wang Yu <yu1.wang@intel.com>
This commit is contained in:
Zhao Yakui 2022-09-21 13:13:23 +08:00 committed by acrnsi-robot
parent db7be2c6f6
commit 3c01a6a0cf
1 changed files with 6 additions and 0 deletions

View File

@ -708,6 +708,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
uint16_t vendor = 0, device = 0; uint16_t vendor = 0, device = 0;
uint8_t class = 0; uint8_t class = 0;
char rom_file[256]; char rom_file[256];
bool need_rombar = false;
ptdev = NULL; ptdev = NULL;
error = -EINVAL; error = -EINVAL;
@ -740,6 +741,10 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
} else if (!strncmp(opt, "enable_ptm", 10)) { } else if (!strncmp(opt, "enable_ptm", 10)) {
pr_notice("<PTM>: opt=enable_ptm.\n"); pr_notice("<PTM>: opt=enable_ptm.\n");
enable_ptm = true; enable_ptm = true;
} else if (!strncmp(opt, "romfile=", 8)) {
need_rombar = true;
opt += 8;
strcpy(rom_file, opt);
} else } else
pr_warn("Invalid passthru options:%s", opt); 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; error = ACRN_PTDEV_IRQ_MSI;
} }
ptdev->need_rombar = need_rombar;
if (class != 3) { if (class != 3) {
if (ptdev->need_rombar) { if (ptdev->need_rombar) {
pr_warn("Virtual PCI rom is only supported for GPU device\n"); pr_warn("Virtual PCI rom is only supported for GPU device\n");