Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jun 2020 11:46:53 +0900
From:      KIRIYAMA Kazuhiko <kiri@truefc.org>
To:        "freebsd-virtualization@freebsd.org" <virtualization@freebsd.org>
Cc:        kiri@truefc.org
Subject:   Re: Can't system_powerdown in qemu-system-aarch64 monitor
Message-ID:  <202006300246.05U2krqc073360@kx.truefc.org>
In-Reply-To: <202006190023.05J0NKcM095750@kx.truefc.org>
References:  <202006190023.05J0NKcM095750@kx.truefc.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 19 Jun 2020 09:23:20 +0900,
KIRIYAMA Kazuhiko wrote:
> 
> Hi, all
> 
> I'm wondering why system_powerdown can not be worked but
> system_reset can work on qemu-system-aarch64. I set up
> FreeBSD 13.0-CURRENT-arm64-aarch66 as follows:
> 
> root@vm:~ # uname -a
> FreeBSD vm.truefc.org 13.0-CURRENT FreeBSD 13.0-CURRENT #0 r353025: Thu Oct  3 19:38:47 JST 2019     admin@vm.truefc.org:/ds/obj/current/13.0/r353025/ds/src/current/13.0/r353025/amd64.amd64/sys/GENERIC  amd64
> root@vm:~ # qemu-system-aarch64 -version
> QEMU emulator version 4.1.0
> Copyright (c) 2003-2019 Fabrice Bellard and the QEMU Project developers
> root@vm:~ # ifconfig 
> igb0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         options=4a520b9<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,NOMAP>
>         ether 0c:c4:7a:b3:cf:d4
>         inet 36.52.212.2 netmask 0xfffffff8 broadcast 36.52.212.7
>         media: Ethernet autoselect (1000baseT <full-duplex>)
>         status: active
>         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> igb1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         options=4e523bb<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,TSO4,TSO6,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,TXCSUM_IPV6,NOMAP>
>         ether 0c:c4:7a:b3:cf:d5
>         inet 192.168.1.17 netmask 0xffffff00 broadcast 192.168.1.255
>         media: Ethernet autoselect (1000baseT <full-duplex>)
>         status: active
>         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
>         options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
>         inet6 ::1 prefixlen 128
>         inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
>         inet 127.0.0.1 netmask 0xff000000
>         groups: lo
>         nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
> vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         ether 9e:58:86:f8:e7:11
>         id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
>         maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
>         root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
>         member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
>                 ifmaxaddr 0 port 6 priority 128 path cost 2000000
>         member: igb0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
>                 ifmaxaddr 0 port 1 priority 128 path cost 20000
>         groups: bridge vm-switch viid-4c918@
>         nd6 options=1<PERFORMNUD>
> vm-local: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         ether d6:e6:99:60:b6:a5
>         id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
>         maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
>         root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
>         member: igb1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
>                 ifmaxaddr 0 port 2 priority 128 path cost 20000
>         groups: bridge vm-switch viid-f5dda@
>         nd6 options=1<PERFORMNUD>
> tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         description: vmnet-mftpkx-0-public
>         options=80000<LINKSTATE>
>         ether 58:9c:fc:10:ff:df
>         groups: tap vm-port
>         media: Ethernet autoselect
>         status: active
>         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
>         Opened by PID 1427
> root@vm:~ # ifconfig tap create
> tap1
> root@vm:~ # ifconfig tap1 mtu 9000
> root@vm:~ # ifconfig vm-local addm tap1
> root@vm:~ # ifconfig tap1 up
> root@vm:~ # ifconfig 
> igb0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         options=4a520b9<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,NOMAP>
>         ether 0c:c4:7a:b3:cf:d4
>         inet 36.52.212.2 netmask 0xfffffff8 broadcast 36.52.212.7
>         media: Ethernet autoselect (1000baseT <full-duplex>)
>         status: active
>         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> igb1: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         options=4a520b9<RXCSUM,VLAN_MTU,VLAN_HWTAGGING,JUMBO_MTU,VLAN_HWCSUM,WOL_MAGIC,VLAN_HWFILTER,VLAN_HWTSO,RXCSUM_IPV6,NOMAP>
>         ether 0c:c4:7a:b3:cf:d5
>         inet 192.168.1.17 netmask 0xffffff00 broadcast 192.168.1.255
>         media: Ethernet autoselect (1000baseT <full-duplex>)
>         status: active
>         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
>         options=680003<RXCSUM,TXCSUM,LINKSTATE,RXCSUM_IPV6,TXCSUM_IPV6>
>         inet6 ::1 prefixlen 128
>         inet6 fe80::1%lo0 prefixlen 64 scopeid 0x3
>         inet 127.0.0.1 netmask 0xff000000
>         groups: lo
>         nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
> vm-public: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         ether 9e:58:86:f8:e7:11
>         id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
>         maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
>         root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
>         member: tap0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
>                 ifmaxaddr 0 port 6 priority 128 path cost 2000000
>         member: igb0 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
>                 ifmaxaddr 0 port 1 priority 128 path cost 20000
>         groups: bridge vm-switch viid-4c918@
>         nd6 options=1<PERFORMNUD>
> vm-local: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         ether d6:e6:99:60:b6:a5
>         id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15
>         maxage 20 holdcnt 6 proto rstp maxaddr 2000 timeout 1200
>         root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0
>         member: tap1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
>                 ifmaxaddr 0 port 7 priority 128 path cost 2000000
>         member: igb1 flags=143<LEARNING,DISCOVER,AUTOEDGE,AUTOPTP>
>                 ifmaxaddr 0 port 2 priority 128 path cost 20000
>         groups: bridge vm-switch viid-f5dda@
>         nd6 options=1<PERFORMNUD>
> tap0: flags=8943<UP,BROADCAST,RUNNING,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         description: vmnet-mftpkx-0-public
>         options=80000<LINKSTATE>
>         ether 58:9c:fc:10:ff:df
>         groups: tap vm-port
>         media: Ethernet autoselect
>         status: active
>         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
>         Opened by PID 1427
> tap1: flags=8903<UP,BROADCAST,PROMISC,SIMPLEX,MULTICAST> metric 0 mtu 9000
>         options=80000<LINKSTATE>
>         ether 58:9c:fc:10:86:31
>         groups: tap
>         media: Ethernet autoselect
>         status: no carrier
>         nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
> root@vm:~ # qemu-system-aarch64 -machine virt -cpu cortex-a57 -m 8G -name tbedafc -uuid d83448d8-a537-11ea-b7ba-0cc47ab3cfd4 -device virtio-blk-device,drive=hd0 -drive if=none,format=raw,file=/vm/tbedafc/disk0.img,id=hd0 -hdc /vm/.iso/FreeBSD-13.0-CURRENT-arm64-aarch64-20200514-r361019-memstick.img -nographic -netdev tap,id=net0,ifname=tap1 -device virtio-net-device,netdev=net0,mac=58:9c:fc:0a:be:3a -serial telnet::4444,server,nowait,nodelay -monitor telnet::4445,server,nowait,nodelay -watchdog i6300esb -watchdog-action poweroff -bios /vm/.config/QEMU_EFI.fd
> WARNING: Image format was not specified for '/vm/.iso/FreeBSD-13.0-CURRENT-arm64-aarch64-20200514-r361019-memstick.img' and probing guessed raw.
>          Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
>          Specify the 'raw' format explicitly to remove the restrictions.
> 
> And then connected FreeBSD guest and confirmed PCI
> connection of 6300ESB Watchdog Timer as follows:
> 
> root@vm:~ # telnet localhost 4444
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> 
> 
> FreeBSD/arm64 (Amnesiac) (ttyu0)
> 
> login: root
> Last login: Thu Jun 18 16:55:02 on ttyu0
> FreeBSD 13.0-CURRENT (GENERIC) #0 r361019: Thu May 14 03:59:37 UTC 2020
> 
> Welcome to FreeBSD!
> 
> Release Notes, Errata: https://www.FreeBSD.org/releases/
> Security Advisories:   https://www.FreeBSD.org/security/
> FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
> FreeBSD FAQ:           https://www.FreeBSD.org/faq/
> Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
> FreeBSD Forums:        https://forums.FreeBSD.org/
> 
> Documents installed with the system are in the /usr/local/share/doc/freebsd/
> directory, or can be installed later with:  pkg install en-freebsd-doc
> For other languages, replace "en" with a language code like de or fr.
> 
> Show the version of FreeBSD installed:  freebsd-version ; uname -a
> Please include that output and any error messages when posting questions.
> Introduction to manual pages:  man man
> FreeBSD directory layout:      man hier
> 
> Edit /etc/motd.template to change this login announcement.
> root@:~ # uname -a
> FreeBSD  13.0-CURRENT FreeBSD 13.0-CURRENT #0 r361019: Thu May 14 03:59:37 UTC 2020     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm64.aarch64/sys/GENERIC  arm64
> root@:~ # pciconf -lv
> hostb0@pci0:0:0:0:      class=0x060000 rev=0x00 hdr=0x00 vendor=0x1b36 device=0x0008 subvendor=0x1af4 subdevice=0x1100
>     vendor     = 'Red Hat, Inc.'
>     device     = 'QEMU PCIe Host bridge'
>     class      = bridge
>     subclass   = HOST-PCI
> virtio_pci0@pci0:0:1:0: class=0x010000 rev=0x00 hdr=0x00 vendor=0x1af4 device=0x1001 subvendor=0x1af4 subdevice=0x0002
>     vendor     = 'Red Hat, Inc.'
>     device     = 'Virtio block device'
>     class      = mass storage
>     subclass   = SCSI
> none0@pci0:0:2:0:       class=0x088000 rev=0x00 hdr=0x00 vendor=0x8086 device=0x25ab subvendor=0x1af4 subdevice=0x1100
>     vendor     = 'Intel Corporation'
>     device     = '6300ESB Watchdog Timer'
>     class      = base peripheral
> root@:~ # 

hw.acpi.power_button_state does not set S5 but NONE:

root@:~ # sysctl -a|grep power
kern.shutdown.poweroff_delay: 5000
kern.powercycle_on_panic: 0
kern.poweroff_on_panic: 0
kern.vt.kbd_poweroff: 1
hw.acpi.power_button_state: NONE
hw.usb.disable_port_power: 0
hw.usb.power_timeout: 30
hw.usb.timings.extra_power_up_time: 20
hw.usb.timings.port_powerup_delay: 300
hw.pci.do_power_suspend: 1
hw.pci.do_power_resume: 1
hw.pci.do_power_nodriver: 0
hw.efi.poweroff: 1
root@:~ # 

And try to set S5, but could not:

root@:~ # sysctl hw.acpi.power_button_state=S5
hw.acpi.power_button_state: NONE
sysctl: hw.acpi.power_button_state=S5: value is not available
root@:~ # 

Power button seems set to acpi0:

root@:~ # grep Power /var/run/dmesg.boot 
acpi0: Power Button (fixed)
psci0: <ARM Power State Co-ordination Interface Driver> on acpi0
acpi_button0: <Power Button> on acpi0
root@:~ # 

Is there any suggetions how to set power management at
starting qemu ?

> 
> 
> Then connected to monitor and test system_powerdown but
> nothing happened but system_reset guest immediately
> rebooted:
> 
> root@vm:~ # telnet localhost 4445
> Trying 127.0.0.1...
> Connected to localhost.
> Escape character is '^]'.
> QEMU 4.1.0 monitor - type 'help' for more information
> (qemu) system_powerdown
> (qemu) watchdog_action poweroff
> (qemu) system_powerdown
> (qemu) watchdog_action shutdown
> (qemu) system_powerdown
> (qemu) system_reset
> (qemu) 
> 
> 
> What's wrong ?
> 
> With Regards
> ---
> Kazuhiko Kiriyama <kiri@truefc.org>
> _______________________________________________
> freebsd-virtualization@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-virtualization
> To unsubscribe, send any mail to "freebsd-virtualization-unsubscribe@freebsd.org"
> 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202006300246.05U2krqc073360>