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

[sw,multitop] port hmac_enc_test to devicetables #26244

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AlexJones0
Copy link
Contributor

@AlexJones0 AlexJones0 commented Feb 11, 2025

Fix #26215

This PR ports the hmac_enc_test to use the devicetables API so that it no longer depends on Earlgrey-specific constants. The test remains passing on Earlgrey on FPGA (fpga_cw310_rom_with_fake_keys), and will compile for Darjeeling via

bazel build //sw/device/tests:hmac_enc_test_sim_dv --//hw/top=darjeeling

See the commit message for more details about replacing the isr_testutils API call.

@AlexJones0 AlexJones0 requested a review from a team as a code owner February 11, 2025 14:00
@AlexJones0 AlexJones0 requested review from HU90m, pamaury, nbdd0121 and jwnrt and removed request for a team and HU90m February 11, 2025 14:00
@AlexJones0 AlexJones0 force-pushed the dt_hmac_enc branch 2 times, most recently from 97d43ca to aae4868 Compare February 11, 2025 14:05
Comment on lines +43 to +60
// Claim the IRQ at the PLIC.
dif_rv_plic_irq_id_t plic_irq_id;
CHECK_DIF_OK(dif_rv_plic_irq_claim(&rv_plic, kPlicTarget, &plic_irq_id));

// Get the peripheral the IRQ belongs to, and the ID of the IRQ fired
peripheral_serviced = dt_plic_id_to_instance_id(plic_irq_id);
dt_hmac_irq_t irq = dt_hmac_irq_from_plic_id(kHmacDt, plic_irq_id);
irq_serviced = irq;

// Acknowledge the IRQ at the peripheral if the IRQ is of the event type.
dif_irq_type_t type;
CHECK_DIF_OK(dif_hmac_irq_get_type(&hmac, irq, &type));
if (type == kDifIrqTypeEvent) {
CHECK_DIF_OK(dif_hmac_irq_acknowledge(&hmac, irq));
}

// Complete the IRQ at the PLIC.
CHECK_DIF_OK(dif_rv_plic_irq_complete(&rv_plic, kPlicTarget, plic_irq_id));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not sure about the best thing to do, but I don't think duplicating ISR testutils is ideal.. If we do this for each IP then we will end up with a lot of verbose code.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I told @AlexJones0 to do that for now because the isr testutils are not ported to multitop yet. Also as an aside, the isr testutils as defined just don't make sense, we should probably change them.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could also keep this PR open until we have ported the testutils.

The `isr_testutils` API is not yet ported to DT, and this test only uses
a small subset of the functionality exposed by `isr_testutils_hmac_isr`.
So, for this test, we manually replace this function call with a few
lines of equivalent dt code to keep the test passing. Since we no
longer use `isr_testutils`, this drops the corresponding `isr_ctx` and
`hmac_ctx` structs in favour of simplifying the test implementation.

Signed-off-by: Alex Jones <[email protected]>
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.

[Multitop, test] chip_sw_hmac_enc
3 participants