Skip to content

[OCP-LOCK] Enable encryption engine interacting tests on subsystem FPGA#3640

Open
GwangbaeCHOI wants to merge 1 commit into
chipsalliance:mainfrom
GwangbaeCHOI:feature/fpga_encryption_engine
Open

[OCP-LOCK] Enable encryption engine interacting tests on subsystem FPGA#3640
GwangbaeCHOI wants to merge 1 commit into
chipsalliance:mainfrom
GwangbaeCHOI:feature/fpga_encryption_engine

Conversation

@GwangbaeCHOI

Copy link
Copy Markdown
Contributor

Comment thread drivers/src/dma.rs
error_code, _: 19, 16;
ready_bit, _: 31;

#[cfg(any(feature = "fpga_realtime", feature = "fpga_subsystem"))]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

These codes are not really needed for fpga_realtime. But I found that the current fpga-subsystem tests on MCU uses fpga-realtime ROM of Caliptra, and that's why I added fpga_realtime feature here.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Confusingly, fpga_realtime in MCU == fpga_subsystem in Caliptra.

- Enable DERIVE_MEK tests (chipsalliance#3362)
- Enable CLEAR_KEY_CACHE tests
- Enable LOAD_MEK tests
- Enable UNLOAD_MEK tests
@GwangbaeCHOI
GwangbaeCHOI force-pushed the feature/fpga_encryption_engine branch from c2beaf4 to a476323 Compare April 21, 2026 12:56
}
}

fn realtime_encryption_engine_register_handler(

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This thread simulates the encryption engine similar to the thread for internal TRNG. Since we don't have exactly same RW access to registers, especially the RDY bit of CTRL register, There are additional codes to retain the RDY bit.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Should we make a change to the FPGA wrapper RTL?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we can make RDY bit sticky, it would be better

Comment thread drivers/src/dma.rs

// To maintain the RDY bit to be set
#[cfg(any(feature = "fpga_realtime", feature = "fpga_subsystem"))]
ctrl.set_ready_bit(true);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

RDY bit will remain 1 after clearing the register.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Why does this bit need special treatment on the FPGA? What would it take to eliminate this feature flagged code and simplify the firmware?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

WIthin the FPGA wrapper, CTRL register is RW. So, Caliptra can overwrite RDY bit which supposed to be read-only. If we can make RDY bit to be sticky, we won't need this code.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @GwangbaeCHOI let me see if we can make a change to the FPGA Wrapper

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@GwangbaeCHOI sounds like we can make that happen, want to wait for a new bitstream or move ahead ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I can wait. So that we won't need to update again.

Comment thread drivers/src/dma.rs

// To maintain the RDY bit to be set
#[cfg(any(feature = "fpga_realtime", feature = "fpga_subsystem"))]
ctrl.set_ready_bit(true);

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To keep RDY bit to 1 after executing a command

Comment on lines +480 to +481
pub realtime_encryption_engine_exit_flag: Arc<AtomicBool>,
pub realtime_encryption_engine_paused: Arc<AtomicBool>,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

nit: I think you can skip using Arc to wrap the AtomicBool? IIRC it should be safe to copy and share the AtomicBools across threads

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.

2 participants