On Fri, 4 Aug 2023 at 10:25, Swedha R <swedha...@gmail.com> wrote: > > Hi team, > I have arm64 up and running in Qemu, And I built kernel image, rootfs > everything via buildroot open source I cloned from git. > And I customized via make - menuconfig like enabling gpio support, libgpiod > module and in device drivers gpio chip named pl061 . > After that, I able to see gpiochip in the /dev directory inside arm running > in qemu. > I want to know , how to trigger the gpio line ( that is function for > poweroff) and it have to cach and service it in this case. > The gpiochip has 7 lines in it. How to find which line is a poweroff key , > the qemu-virt board has )
If your guest is Linux it in theory [*] should have already found the power-off key GPIO by looking in the device tree that QEMU passed it (the information is in the /gpio-keys/poweroff node). You can trigger the power-down button by using the "system_powerdown" command at the QEMU monitor (HMP) prompt. [*] The guest I have didn't power down in response to the system_powerdown command, but I might well have not compiled in all the necessary kernel options for it to work. QEMU definitely does raise the GPIO line when you use the system_powerdown command. thanks -- PMM