Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GPIO passthrough #935

Open
wants to merge 38 commits into
base: main
Choose a base branch
from
Open

GPIO passthrough #935

wants to merge 38 commits into from

Conversation

KimGSandstrom
Copy link

@KimGSandstrom KimGSandstrom commented Dec 18, 2024

GPIO Passthrough

Checklist for things done

  • Summary of the proposed changes in the PR description
  • More detailed description in the commit message(s)
  • Commits are squashed into relevant entities - avoid a lot of minimal dev time commits in the PR
  • Contribution guidelines followed
  • Ghaf documentation updated with the commit - https://tiiuae.github.io/ghaf/
  • PR linked to architecture documentation and requirement(s) (ticket id)
  • Test procedure described (or includes tests). Select one or more:
    • Tested on Lenovo X1 x86_64
    • Tested on Jetson Orin NX or AGX aarch64
    • Tested on Polarfire riscv64
  • Author has run make-checks and it passes
  • All automatic Github Action checks pass - see actions
  • Author has added reviewers and removed PR draft status
  • Change requires full re-installation
  • Change can be updated with nixos-rebuild ... switch

Instructions for Testing

  • List all targets that this applies to:
  • Is this a new feature
    • List the test steps to verify:
  • If it is an improvement how does it impact existing functionality?

KimGSandstrom and others added 30 commits April 3, 2024 11:49
- changes concern activation and deactivation of virtualised elements
  in passthough of uarta, bpmp, gpio.
- code deactivates uarta and bpmp because bpmp kernel patches conflict
  with gpio patches. This could be fixed by remaking the bpmp patches.
The vda device is removed from the gpio-vm because it will not work
while we do not have the proper Device Tree in the VM.
startup of VM fails because the DT does not provide the vda device
gpio-vm's device tree tegra234-p3701-0000-gpio-passthrough.dtb declares
the vda device needed for passthrough.

gpio-vm goes into emergency mode because it cannot open AMA0 as a
console. Uarta passthrough is disabled because of conflicts with GPIO
passthrough. We need to disable the QEMU console. Somewhere in the code
console=ttyAMA0 is set for QEMU. It is not obvious where.
At the moment device tree overlays are not working when applied
according to template from other VM's. Posible cause is big changes
introduced in upstream. Will merge with tiiuae after this commit.
VM kernel params are
  -amend rootwait console=ttyS3
No qemu.extraArgs are set
Recent merge is partially retrenched. Newer files breaks this GPIO version
because the host dtb overlay is broken by netvm-wlan-pci-passthrough.
The changes in tiiuae git are realated to pci passthrough, optee kernel,
"machine" option for microvm/qemu and a patch provided for
netvm-wlan-pci-passthrough
GPIO guest driver in VM throws error at initialisation of shared qemu
memory.
ioremap fails:
mem_iova = ioremap(gpio_vpa, MEM_SIZE);
Guest proxy driver can passtrough low level readl and writel to host
proxy. This might (meaning: still being tested) be necessary to allow
guest to set up GPIO pins declared in guest's Device Tree.
…99608/72089e71a1f3d9f2d854711c6e16b703f1a426da
- New baseline for adding more passthrough functions
- ./simple-chardev-test.sh works in /dev/gpio-host and /dev/gpio.guest
- readl/writel execution blocked in host
- Guest kernel is not aware of pins in host (gpioinfo gives false data)
- use qemu: 8c5b0acccd3b4f47ba84d23b628ef294533e662a
- kernel: e3a4e96cd08ab8d1a31498a10f8f7320ef53bd9d/2d96cc2e8e1c4ee4a3e973023b6c398a98dc0d93
- precompiled as nix generation 233
- return value written to char buffer in write()
- return values from host seem reliable
- return value is 64 bit written at offset 2 words, 2*8 bytes
- full chain to guest does not work (qemu problem?)
- platform to fix qemu problem
- Guest kernel is not aware of pins in host (gpioinfo gives false data)
- kernel: 5b7326f7ce046a8ae6c943e238a645356f237f7b/e625198f19ab6874ea89e0a7b1c5c4dfacb38710
- precompiled as nix generation 274
  - gpio-virt commit 71192f60bd8b8f6be4d529c49b7c33529e21a1e2
  - kernel 5.10 commit fb9220ac23c9892ec6433f0e839b8f919511a927
  - qemu in ghaf is not yet updated
  - use qemu 8.1.2 patch
          in commit 95d5cdb19713369a9dceab53659628292d9ff884
  - precompiled into generation 299 (on dev system)
- added source patches:
  - kernel adfe63ef006a696e7384b9cee340f05bf7f4f1b3
    from [email protected]:KimGSandstrom/tegra_kernel-5.10.git
  - gpio-virt patch d90bd5625957fd164e4eb50803bd724fda89ba68
    from [email protected]:KimGSandstrom/gpio-virt.git
  - qemu 9.0.2 GPIO passthrough patch b077b3cb519958d091cd753f7015ffafd3bfcaee
    from [email protected]:KimGSandstrom/qemu-passthrough

  - GPIO passthrough works with provided qemu
  - [email protected] does not start up correctly
microvm@gpio-vm does still not start up correctly:
ghaf-host microvm@gpio-vm[10394]:
socat[10394] E UNIX-CLIENT: gpio-vm.sock: Connection refused
- old bug in [email protected] startup remains
  socat[12123] E UNIX-CLIENT: gpio-vm.sock: Connection refused
- kernel and qemu still work fine for GPIO passthrough.
  - GPIO passthrough is for output mode of GPIO only.
  - Manual start of qemu required
- new qemu nix build structure,
- new qemu patch,
- kernel compiled for gpio debug
- documentation corrected and added
GPIO passthrough patches for Qemu and kernel updated
- 'gpio_passthrough_src' documentation directory added where:
   - Documentation in nvidia_agx_pt_gpio.md
   - note that source tarballs contain only files changed since fork
     from stock source
   - kernel sources in
   	- gpio-kernel.tar.gz.x00
	- gpio-kernel.tar.gz.x01
        - concatenate files with 'cat *.x?? > gpio-kernel.tar.gz'
   - qemu sources in
	- gpio-virt.tar.gz
   - altenatively, patchfiles for souce against
        - l4t linux 5.10 kernel jetson_35.4.1
        - qemu 9.0.2
   - note kernel patch files for passthrough drivers are in a separate in dir
	- 0003-gpio-virt-kernel.patch
	- 0004-gpio-virt-drivers.patch
        - 0005-gpio_overlay.patch
   - qemu-gpio-guestvm.dts is device tree for qemu guest
@KimGSandstrom KimGSandstrom temporarily deployed to internal-build-workflow December 18, 2024 10:31 — with GitHub Actions Inactive
@KimGSandstrom KimGSandstrom had a problem deploying to external-build-workflow December 18, 2024 10:32 — with GitHub Actions Failure
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant