GithubHelp home page GithubHelp logo

maquefel / virtual_gpio_basic Goto Github PK

View Code? Open in Web Editor NEW
24.0 4.0 3.0 42 KB

Virtual gpio module for using together with ivshmem qemu

License: GNU General Public License v2.0

Makefile 2.58% C 97.42%
qemu ivshmem-qemu gpio virtual interrupts pci

virtual_gpio_basic's Introduction

DESCRIPTION

PCI virtual gpio with interrupts support for using together with ivshmem qemu

See original articles for older versions:

REQUIREMENTS

  • linux kernel
  • qemu

This version is done for usage with 5.12 linux kernel and 6.0 qemu

COMPILATION

KDIR={$PATH_TO_KERNEL_SOURCE_DIRECTORY} QEMU_DIR={$PATH_TO_QEMU_SOURCES_DIRECTORY} make all

optional ARCH={$ARCH} optional CROSS_COMPILE={$CROSSCOMPILER_PREFIX}

QUICKSTART

Use https://github.com/maquefel/kernel-bisect-template/tree/virtual_gpio project for quickstart.

USAGE

I have dropped non-irq based version and switched to MSI vector usage. The modules simply won't load with error (it can be fixed easily if you really require that).

See https://github.com/qemu/qemu/blob/master/docs/specs/ivshmem-spec.txt for additional info.

WITH INTERRUPTS

host machine:
$ ./qemu/build/contrib/ivshmem-server/ivshmem-server -F -v -l 1M -n 1
$ qemu-system-x86_64 -cpu host -kernel build-linux/arch/x86/boot/bzImage -initrd initramfs.cpio.xz -nographic -append "nokaslr console=ttyS0 root=/dev/ram" -chardev socket,path=/tmp/ivshmem_socket,id=ivshmemid -device ivshmem-doorbell,chardev=ivshmemid,vectors=1 -enable-kvm

guest # lsgpio
...
GPIO chip: gpiochip4, "0000:00:04.0", 32 GPIO lines
        line  0: unnamed unused [input]
        line  1: unnamed unused [input]
        line  2: unnamed unused [input]
        line  3: unnamed unused [input]
...

guest # /usr/bin/gpio-event-mon -n gpiochip4 -o 0

host $ ./vg_get_set -p 6 -i 0 # get -p (peer id) from ivshmem-client
main:346:: write 0=1
main:349:: interrupt was enabled for 0
main:353:: interrupt was raised for 0
main:357:: rising edge interrupt was enabled for 0 and new value is high 1

guest:
No flags specified, listening on both rising and falling edges
Monitoring line 0 on gpiochip4
Initial line value: 0

GPIO EVENT at 33533945213 on line 0 (1|1) rising edge
GPIO EVENT at 39910880760 on line 0 (2|2) falling edge
GPIO EVENT at 44507121043 on line 0 (3|3) rising edge

COPYRIGHT

GPL Nikita Shubin [email protected]

virtual_gpio_basic's People

Contributors

maquefel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

virtual_gpio_basic's Issues

No rule to make target 'vg_guest_client'

When I run the compilation command: KDIR=/usr/src/linux-5.15.19/ QEMU_DIR=/home/<homedir>/Clones/qemu-7.1.0/ make all

the process fails with "No rule to make target 'vg_guest_client', needed by 'all'. Checking the Makefile shows that there is indeed no rule inside the file, and I'm not sure how create the rule, since I don't know what vg_guest_client consists of.

How can I compile this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.