Re: GPIO interrupt on QEMU

2023-08-04 Thread Swedha R
Thanks, I'll check it out!

On Fri, 4 Aug 2023 at 15:37, Peter Maydell  wrote:

> On Fri, 4 Aug 2023 at 10:25, Swedha R  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
>


Re: GPIO interrupt on QEMU

2023-08-04 Thread Peter Maydell
On Fri, 4 Aug 2023 at 10:25, Swedha R  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



GPIO interrupt on QEMU

2023-08-04 Thread Swedha R
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 )

This is the qemu-command we used,
qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel Image
-append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0
-device virtio-net-device,netdev=eth0 -drive
file=rootfs.ext4,if=none,format=raw,id=hd0 -device
virtio-blk-device,drive=hd0

Will you please help on it.


Re: GPIO interrupt on QEMU

2023-08-03 Thread Peter Maydell
On Thu, 3 Aug 2023 at 14:31, Swedha R  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 and cache and service it in 
> this case.
> The gpiochip has 7 lines in it.
>
> This is the qemu-command we used,
> qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel Image 
> -append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device 
> virtio-net-device,netdev=eth0 -drive 
> file=rootfs.ext4,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0

The GPIO devices in the virt board are there for specific
purposes: there is one in the non-secure world which has an
input for the "power off" key, and one in the secure world
(if enabled) which has outputs for the firmware to do
reset and power-off. You can't use them for other things.
(Linux running on the virt board and using the dtb it is
provided should automatically be able to handle the
power-off key input; UEFI/Trusted Firmware knows about the
secure-world GPIO controller already.)

thanks
-- PMM



GPIO interrupt on QEMU

2023-08-03 Thread Swedha R
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 and cache and service it in
this case.
The gpiochip has 7 lines in it.

This is the qemu-command we used,
qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel Image
-append "rootwait root=/dev/vda console=ttyAMA0" -netdev user,id=eth0
-device virtio-net-device,netdev=eth0 -drive
file=rootfs.ext4,if=none,format=raw,id=hd0 -device
virtio-blk-device,drive=hd0

Will you please help on it.


Thank you in advance
with regards
Swedha R