-
Notifications
You must be signed in to change notification settings - Fork 818
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
[pentest] Make iCache/dummy instr. enable/disable configurable #26535
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one question. Thanks @nasahlpa !
cpuctrl_csr = bitfield_field32_write( | ||
cpuctrl_csr, (bitfield_field32_t){.mask = 0x1, .index = 0}, 0); | ||
if (disable_icache) { | ||
cpuctrl_csr = bitfield_field32_write( | ||
cpuctrl_csr, (bitfield_field32_t){.mask = 0x1, .index = 0}, 0); | ||
} | ||
|
||
// Disable dummy instructions. | ||
cpuctrl_csr = bitfield_field32_write( | ||
cpuctrl_csr, (bitfield_field32_t){.mask = 0x1, .index = 2}, 0); | ||
if (disable_dummy_instr) { | ||
cpuctrl_csr = bitfield_field32_write( | ||
cpuctrl_csr, (bitfield_field32_t){.mask = 0x1, .index = 2}, 0); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reset value for this register is all 0: https://ibex-core.readthedocs.io/en/latest/03_reference/cs_registers.html#cpu-control-and-status-register-cpuctrlsts
I guess there is maybe some ROM code to enable the iCache and Dummy instructions. Or should we actually change the function here to enable it if the disable is not set? I would like to avoid that we don't set the disable (and think the cache is enabled) while it's actually disabled.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are totally right, this is a bit misleading. Yes, the iCache and dummy instructions are configured in the ROM.
In our case, the security evaluator is interested in the following:
- Test the chip without iCache and/or dummy instructions
- Test the chip with the configuration set in the ROM
So the evaluator does not necessarily know the default configuration. Hence, I'd leave it as it is (you only can disable it or keep the default config) and update the description of the function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is reasonable. Thanks for explaining!
e546e0b
to
396a98d
Compare
Previously, in all pentests, the icache as well as the dummy instructions were disabled to achieve constant timing between test runs. However, for certain tests, we want to test the default iCache and dummy instruction configuration that has been set in the ROM. Signed-off-by: Pascal Nasahl <[email protected]>
396a98d
to
6980ffc
Compare
Previously, in all pentests, the icache as well as the dummy instructions were disabled to achieve constant timing between test runs. However, for certain tests, we want to test with iCache or with dummy instructions enabled. Make this configurable in the init function of the tests.