From d56442bed5c4080466daf4e9ee2a0c4d2576ba53 Mon Sep 17 00:00:00 2001 From: "Liu,Junming" Date: Sat, 18 Sep 2021 18:35:41 +0000 Subject: [PATCH] dm: set pass-thru dev virtual class id For pass-thru PCI dev, get the class id from the physical pci config space, then set the value in virtual config space class id. Tracked-On: #6357 Signed-off-by: Liu,Junming Acked-by: Wang, Yu1 --- devicemodel/hw/pci/passthrough.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devicemodel/hw/pci/passthrough.c b/devicemodel/hw/pci/passthrough.c index 39e6aa8ad..c3f55ddbc 100644 --- a/devicemodel/hw/pci/passthrough.c +++ b/devicemodel/hw/pci/passthrough.c @@ -561,6 +561,7 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) int vmsix_on_msi_bar_id = -1; struct acrn_pcidev pcidev = {}; uint16_t vendor = 0, device = 0; + uint8_t class = 0; ptdev = NULL; error = -EINVAL; @@ -656,8 +657,10 @@ passthru_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) */ vendor = read_config(ptdev->phys_dev, PCIR_VENDOR, 2); device = read_config(ptdev->phys_dev, PCIR_DEVICE, 2); + class = read_config(ptdev->phys_dev, PCIR_CLASS, 1); pci_set_cfgdata16(dev, PCIR_VENDOR, vendor); pci_set_cfgdata16(dev, PCIR_DEVICE, device); + pci_set_cfgdata8(dev, PCIR_CLASS, class); #if AUDIO_NHLT_HACK /* device specific handling: