-
Notifications
You must be signed in to change notification settings - Fork 24
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
FPGA: Add CPU instruction address SPI access control #243
Conversation
secworks
commented
Jun 24, 2024
This PR is a test implementation of a solution for #234 |
The linter shows a warning:
|
Testing: works in general, blocks SPI access. |
Noticed that the frequency is down to 23.00 MHz on this branch. Now the ready_spi is blocked. |
Add logic that checks if the CPU is reading an instruction to execute from ROM or not. If instructions are read from ROM, access to the SPI from the API is granted, and signals between the SPI master and a slave are allowed. If instructions are not read from ROM, any API access is blocked. and between the SPI master and a slave are disabled. Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
e569645
to
ac8bf9f
Compare
Signed-off-by: Joachim Strömbergson <[email protected]>
It seems the condition to set spi_access_ok signal is too hard, which blocks SPI access from both FW and app address space. The condition is If the CPU is in fact waiting for a load or store to happen, we may not be in a cpu_instr. And then spi_access_ok is not set when it should be. The last commit removes the complete condition to see that SPI access is possible from SPI and APP_MODE. |
Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
As long as an access comes from the ROM prefix we should be good. Possibly that it also is a valid (i.e active) access. Since the actual access is performed by a R/W access against API registers, we now that it is a valid access. So the condition should not need to also check that it is an instruction, nor if it is a valid access. A simple prefix check should be sufficient. |
Max Frequency Info: 23.36 MHz (PASS at 18.00 MHz) |
Max Frequency Info: |
Max Frequency Info: 21.85 MHz (PASS at 18.00 MHz) |
1 similar comment
Max Frequency Info: 21.85 MHz (PASS at 18.00 MHz) |
Max Frequency Info: 22.59 MHz (PASS at 18.00 MHz) |
1 similar comment
Max Frequency Info: 22.59 MHz (PASS at 18.00 MHz) |
e51cdde
to
f308447
Compare
Add access stateful control register that toggles if access to a resources is granted based on if code is excuted from ROM or RAM. The register is used to enable or block access to SPI but potentially other HW resources. Signed-off-by: Joachim Strömbergson <[email protected]>
Use the access_ok_reg, not obsolete spi_acces_ok wire Remove now obsolete ROM_PREFIX define Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
Signed-off-by: Joachim Strömbergson <[email protected]>
f308447
to
e0a32da
Compare
FPGA (SPI): Max Frequency Info: 22.59 MHz (PASS at 18.00 MHz) |
Signed-off-by: Joachim Strömbergson <[email protected]>
New logic looks at instruction execution from a defined trampoline address to enable stateful SPI access. The access is disabled as soon as an instruction is executed from any address in RAM. Signed-off-by: Joachim Strömbergson <[email protected]>
Add testcase that checks that access control is enabled and disabled as expected. Signed-off-by: Joachim Strömbergson <[email protected]>