【软件信息】
1、内核版本:5.10.0-60.93.0.118.oe2203.loongarch64
2、系统版本:openEuler release 22.03 LTS
3、qemu版本:qemu-6.2.0-65.oe2203
【复现步骤】
启动虚拟机
MALLOC_PERTURB_=1 /usr/libexec/qemu-kvm
-name 'avocado-vt-vm1'
-machine loongson7a
-device pcie-root-port,id=pcie-root-port-0,multifunction=on,bus=pcie.0,addr=0x1,chassis=1
-device pcie-pci-bridge,id=pcie-pci-bridge-0,addr=0x0,bus=pcie-root-port-0
-nodefaults
-device qxl-vga,bus=pcie.0,addr=0x2
-m 2048
-smp 2,maxcpus=2,cores=1,threads=1,sockets=2
-cpu 'Loongson-3A5000'
-device pcie-root-port,id=pcie-root-port-1,port=0x1,addr=0x1.0x1,bus=pcie.0,chassis=2
-device qemu-xhci,id=usb1,bus=pcie-root-port-1,addr=0x0
-device usb-tablet,id=usb-tablet1,bus=usb1.0,port=1
-device pcie-root-port,id=pcie-root-port-2,port=0x2,addr=0x1.0x2,bus=pcie.0,chassis=3
-device virtio-scsi-pci,id=virtio_scsi_pci0,bus=pcie-root-port-2,addr=0x0
-blockdev node-name=file_image1,driver=file,filename=test.qcow2
-blockdev node-name=drive_image1,driver=qcow2,file=file_image1
-device scsi-hd,id=image1,drive=drive_image1
-vnc :0
-rtc base=utc,clock=host
-boot menu=off,order=cdn,once=c,strict=off
-net none
-bios loongarch_bios.bin
-enable-kvm
-device pcie-root-port,id=pcie_extra_root_port_0,multifunction=on,bus=pcie.0,addr=0x3,chassis=4
-monitor telnet:localhost:4444,server,nowait
-serial stdio
连接 qemu monitor,进行pci设备 增加/删除 操作
[root@localhost ~]# telnet 127.0.0.1 4444
Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
QEMU 4.2.0 monitor - type 'help' for more information
(qemu)
(qemu)
(qemu) netdev_add tap,id=test-1
(qemu) device_add virtio-net-pci,netdev=test-1,bus=pcie_extra_root_port_0,id=test-2
(qemu)
(qemu) device_del test-2
(qemu) netdev_del test-1
network script /etc/qemu-ifdown failed with status 256
(qemu)
(qemu)
查看虚拟机lspci/ifconfig,用新增的网络设备ping
[root@kvm-guest ~]#
[root@kvm-guest ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@kvm-guest ~]# lspci
00:00.0 Host bridge: Loongson Technology LLC Hyper Transport Bridge Controller
00:01.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:01.1 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:01.2 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)
00:03.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
01:00.0 PCI bridge: Red Hat, Inc. Device 000e
03:00.0 USB controller: Red Hat, Inc. QEMU XHCI Host Controller (rev 01)
04:00.0 SCSI storage controller: Red Hat, Inc. Virtio SCSI (rev 01)
[root@kvm-guest ~]#
[root@kvm-guest ~]# [ 54.283890] pciehp 0000:00:03.0:pcie004: Slot(0-3): Attention button pressed
[ 54.285229] pciehp 0000:00:03.0:pcie004: Slot(0-3) Powering on due to button press
[ 54.286738] pciehp 0000:00:03.0:pcie004: Slot(0-3): Card present
[ 54.287869] pciehp 0000:00:03.0:pcie004: Slot(0-3): Link Up
[ 54.395202] pci 0000:05:00.0: BAR 4: assigned [mem 0x48e00000-0x48e03fff 64bit pref]
[ 54.396599] pci 0000:05:00.0: BAR 1: assigned [mem 0x48c00000-0x48c00fff]
[ 54.397814] pcieport 0000:00:03.0: PCI bridge to [bus 05]
[ 54.398755] pcieport 0000:00:03.0: bridge window [io 0x7000-0x7fff]
[ 54.403816] pcieport 0000:00:03.0: bridge window [mem 0x48c00000-0x48dfffff]
[ 54.407810] pcieport 0000:00:03.0: bridge window [mem 0x48e00000-0x48ffffff 64bit pref]
[ 54.414641] virtio-pci 0000:05:00.0: enabling device (0000 -> 0002)
[ 54.455641] virtio_net virtio1 enp5s0: renamed from eth0
[ 54.490894] IPv6: ADDRCONF(NETDEV_UP): enp5s0: link is not ready
[ 54.503053] IPv6: ADDRCONF(NETDEV_UP): enp5s0: link is not ready
[ 54.510791] IPv6: ADDRCONF(NETDEV_UP): enp5s0: link is not ready
[ 54.519976] IPv6: ADDRCONF(NETDEV_UP): enp5s0: link is not ready
[ 55.449578] IPv6: ADDRCONF(NETDEV_CHANGE): enp5s0: link becomes ready
[root@kvm-guest ~]# lspci
00:00.0 Host bridge: Loongson Technology LLC Hyper Transport Bridge Controller
00:01.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:01.1 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:01.2 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)
00:03.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
01:00.0 PCI bridge: Red Hat, Inc. Device 000e
03:00.0 USB controller: Red Hat, Inc. QEMU XHCI Host Controller (rev 01)
04:00.0 SCSI storage controller: Red Hat, Inc. Virtio SCSI (rev 01)
05:00.0 Ethernet controller: Red Hat, Inc. Virtio network device (rev 01)
[root@kvm-guest ~]#
[root@kvm-guest ~]# ifconfig
enp5s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.122.76 netmask 255.255.255.0 broadcast 192.168.122.255
inet6 fe80::83c1:9637:350a:8329 prefixlen 64 scopeid 0x20
ether 52:54:00:12:34:56 txqueuelen 1000 (Ethernet)
RX packets 8 bytes 905 (905.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 26 bytes 3524 (3.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
[root@kvm-guest ~]#
[root@kvm-guest ~]# ping 192.168.122.1 -c 5
PING 192.168.122.1 (192.168.122.1) 56(84) bytes of data.
64 bytes from 192.168.122.1: icmp_seq=1 ttl=64 time=0.310 ms
64 bytes from 192.168.122.1: icmp_seq=2 ttl=64 time=0.152 ms
64 bytes from 192.168.122.1: icmp_seq=3 ttl=64 time=0.188 ms
64 bytes from 192.168.122.1: icmp_seq=4 ttl=64 time=0.160 ms
64 bytes from 192.168.122.1: icmp_seq=5 ttl=64 time=0.187 ms
--- 192.168.122.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 0.152/0.199/0.310/0.058 ms
[root@kvm-guest ~]# [ 90.811356] pciehp 0000:00:03.0:pcie004: Slot(0-3): Attention button pressed
[ 90.812730] pciehp 0000:00:03.0:pcie004: Slot(0-3): Powering off due to button press
[root@kvm-guest ~]#
[root@kvm-guest ~]# lspci
00:00.0 Host bridge: Loongson Technology LLC Hyper Transport Bridge Controller
00:01.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:01.1 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:01.2 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
00:02.0 VGA compatible controller: Red Hat, Inc. QXL paravirtual graphic card (rev 04)
00:03.0 PCI bridge: Red Hat, Inc. QEMU PCIe Root port
01:00.0 PCI bridge: Red Hat, Inc. Device 000e
03:00.0 USB controller: Red Hat, Inc. QEMU XHCI Host Controller (rev 01)
04:00.0 SCSI storage controller: Red Hat, Inc. Virtio SCSI (rev 01)
[root@kvm-guest ~]# ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 8 bytes 592 (592.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 8 bytes 592 (592.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Hi ls1029, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at Here.
If you have any questions, please contact the SIG: Virt, and any of the maintainers: @Chuan , @frankyj915 , @Bin Wu , @ZhiGang , @朱科潜 , @alexchen , @imxcc , @ZhangBo , @avenLiu , @yezengruan , @黄勇
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
登录 后才可以发表评论