Hi Igor, Daniel and all:

https://lore.kernel.org/all/20220422135101.65796...@redhat.com/t/#r831d589f243c24334a09995620b74408847a87a0

This message discuss hotplug device to pxb bridge. At the end, Igor suggested 
enable shpc on pxb bridge:
  pxb_dev_realize_common():
     qdev_prop_set_bit(bds, PCI_BRIDGE_DEV_PROP_SHPC, true);

Howerver, I tried it and the guest can't find the device on pxb bridge. Add 
some log, QEMU use hotplug handler shpc_device_plug_cb.

QEMU command line:
-device pxb,bus_nr=96,id=pci.1,numa_node=0,bus=pci.0,addr=0x3
-device pxb,bus_nr=128,id=pci.2,numa_node=1,bus=pci.0,addr=0x4
-device pci-bridge,chassis_nr=3,id=pci.3,bus=pci.0,addr=0x5
-device pci-bridge,chassis_nr=4,id=pci.4,bus=pci.0,addr=0x6 
-device pci-bridge,chassis_nr=5,id=pci.5,bus=pci.1,addr=0x1 
-device pci-bridge,chassis_nr=6,id=pci.6,bus=pci.2,addr=0x1

Hotplug command:
{"execute":"human-monitor-command","arguments":{"command-line":"drive_add dummy 
file=/home/test/data1.img,format=qcow2,if=none,id=drive-virtio-disk1,cache=none"}}
{"execute":"device_add","arguments":{"driver":"virtio-blk-pci","scsi":"off","bus":"pci.5","addr":"0x1","drive":"drive-virtio-disk1","id":"virtio-disk1"}}

Some info in the guest:
[root@localhost ~]# lspci -tv
-+-[0000:80]---00.0-[81-82]----01.0-[82]--
 +-[0000:60]---00.0-[61-62]----01.0-[62]--
 \-[0000:00]-+-00.0  Intel Corporation 440FX - 82441FX PMC [Natoma]
             +-01.0  Intel Corporation 82371SB PIIX3 ISA [Natoma/Triton II]
             +-01.1  Intel Corporation 82371SB PIIX3 IDE [Natoma/Triton II]
             +-01.2  Intel Corporation 82371SB PIIX3 USB [Natoma/Triton II]
             +-01.3  Intel Corporation 82371AB/EB/MB PIIX4 ACPI
             +-02.0  Cirrus Logic GD 5446
             +-03.0  Red Hat, Inc. QEMU PCI Expander bridge
             +-04.0  Red Hat, Inc. QEMU PCI Expander bridge
             +-05.0-[01]--
             +-06.0-[02]--
             +-07.0  Red Hat, Inc. Virtio network device
             +-08.0  Red Hat, Inc. Virtio block device
             \-09.0  Red Hat, Inc. Virtio memory balloon
[root@localhost boot]# grep -i 'shpc' config-3.10.0-1160.83.1.el7.x86_64
CONFIG_HOTPLUG_PCI_SHPC=y
[root@localhost boot]# uname -r
3.10.0-1160.83.1.el7.x86_64

Thanks.


Reply via email to