Accessing the AXI-Lite via the fpga_pci_attach call...
- Dominant language
- SystemVerilog
- Stars
- 1.7k
- Forks
- 538
- PR merge metrics
- No merged PRs in 30d
Description
I am able to use the fpga_pci.h and fpga_mgmt.h libraries in my code just fine when I run the code as "sudo".
When I run it as a user, I get an error...
It is a simple AXI-LITE peek/poke command. Here is the C code that offends...
```
rc = fpga_pci_attach(slot_id, FPGA_APP_PF, APP_PF_BAR0, 0, &pci_bar_handle);
fail_on(rc, out, "Unable to attach to the AFI on slot id %d", slot_id);
```
And the error when run as a non-root user....
> "2024-04-26T21:33:40.200320Z, undefined, ERROR, peekPoke.c +128: main(): Unable to attach to the AFI on slot id 0"
I followed these instructions to run as a non-root user...
[(https://github.com/aws/aws-fpga/blob/master/sdk/README.md#using-fpga-as-non-root-user)]
[ec2-user@ip-10-20-7-111 peekPoke]$ env|grep AWS_FPGA
AWS_FPGA_SDK_GROUP=fpgauser
AWS_FPGA_ALLOW_NON_ROOT=y
AWS_FPGA_REPO_DIR=/home/ec2-user/aws-fpga
BASH_FUNC_allow_non_root()=() { [ ! -z ${AWS_FPGA_ALLOW_NON_ROOT} ]
BASH_FUNC_allow_others()=() { [ ! -z ${AWS_FPGA_SDK_OTHERS} ]
These allow me to run the "fpga-load-local-image" as a user, as well as the "fpga-set-virtual-dip-switch" command just fine. However, the code that I wrote still throw that error.
Contributor guide
Research direction
Start with sdk/README.md and the non-root setup instructions, then inspect the fpga_pci_attach call in fpga_pci.h and reproduce the AXI-Lite peek/poke outside sudo. Compare its return behavior with the commands that already work as a non-root user; done means the sample call works without sudo or the precise missing permission or setup requirement is documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- aws, c
- Domain
- embedded-iot, security
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100