From 2d57c5feb758e9092fad649dc063fedef5c479c3 Mon Sep 17 00:00:00 2001 From: Conghui Chen Date: Wed, 21 Aug 2019 14:07:24 +0000 Subject: [PATCH] dm: virtio-console: add subclass Add subclass for virtio-console pci device. Without the subclass, the device may be probed by 8250_pci serial driver, and lead to segment fault in acrn-dm. This issue appears when running debian as Guest OS. But there is a potential issue, if a new serial driver, which use class and subclass same as virtio-console, the problem may still trigger. Need to fix it case by case. Tracked-On: #3615 Signed-off-by: Conghui Chen Acked-by: Yin Fengwei --- devicemodel/hw/pci/virtio/virtio_console.c | 1 + 1 file changed, 1 insertion(+) diff --git a/devicemodel/hw/pci/virtio/virtio_console.c b/devicemodel/hw/pci/virtio/virtio_console.c index 85a1d6217..202e43628 100644 --- a/devicemodel/hw/pci/virtio/virtio_console.c +++ b/devicemodel/hw/pci/virtio/virtio_console.c @@ -1136,6 +1136,7 @@ virtio_console_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts) pci_set_cfgdata16(dev, PCIR_DEVICE, VIRTIO_DEV_CONSOLE); pci_set_cfgdata16(dev, PCIR_VENDOR, VIRTIO_VENDOR); pci_set_cfgdata8(dev, PCIR_CLASS, PCIC_SIMPLECOMM); + pci_set_cfgdata8(dev, PCIR_SUBCLASS, PCIS_SIMPLECOMM_OTHER); pci_set_cfgdata16(dev, PCIR_SUBDEV_0, VIRTIO_TYPE_CONSOLE); pci_set_cfgdata16(dev, PCIR_SUBVEND_0, VIRTIO_VENDOR);