kata:MLCoorinator: Retrieve vc_top execution return

Create a new VectorCoreReturnInterface for the connection from the
VectorCoreDriver to MlCoordinator. Retrieve the return code and fault
from the finish IRQ handler back to MlCoordinator. It can be served as
the hook for the continuous run.

Change-Id: I6346cca0bc372e5b3a80d70b333d42ba768e822f
GitOrigin-RevId: bae4ab68418ce7ac9d4ac5ebb86bb6e55993b7cd
This commit is contained in:
Cindy Liu
2021-09-25 09:07:49 -07:00
committed by Sam Leffler
parent 7310343cf9
commit 53dc1a2031
6 changed files with 18 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import <SecurityCoordinatorInterface.camkes>;
component MlCoordinator {
provides MlCoordinatorInterface mlcoord;
provides VectorCoreReturnInterface vctop_return;
uses LoggerInterface logger;
uses SecurityCoordinatorInterface security;

View File

@@ -30,7 +30,6 @@ fn vctop_ctrl(freeze: u32, vc_reset: u32, pc_start: u32) -> u32 {
pub extern "C" fn mlcoord_execute() {
// TODO: Call into MLCoordinator when available.
// TODO: Once multiple model support is in start by name.
// TODO: Read the fault registers after execution and report any errors found.
extern "C" {
fn vctop_set_ctrl(ctrl: u32);
}
@@ -39,3 +38,10 @@ pub extern "C" fn mlcoord_execute() {
vctop_set_ctrl(vctop_ctrl(0, 0, 0));
}
}
#[no_mangle]
pub extern "C" fn vctop_return_update_result(return_code: u32, _fault: u32) {
// TODO(hcindyl): check the return code and fault registers, move the result
// from TCM to SRAM, update the input/model, and call mlcoord_execute again.
trace!("vctop execution done with code {}", return_code);
}

View File

@@ -6,4 +6,6 @@ component VectorCoreDriver {
consumes Interrupt data_fault;
provides VectorCoreInterface vctop;
uses VectorCoreReturnInterface vctop_return;
}

View File

@@ -31,6 +31,8 @@ void host_req_handle(void) {
}
void finish_handle(void) {
// TODO(hcindyl): return the real exit code and fault register value.
vctop_return_update_result(/*return_code=*/0, /*fault=*/0);
// Also need to clear the INTR_STATE (write-1-to-clear).
VCTOP_REG(INTR_STATE) = BIT(VC_TOP_INTR_STATE_FINISH_BIT);
seL4_Assert(finish_acknowledge() == 0);

View File

@@ -0,0 +1,3 @@
procedure VectorCoreReturnInterface {
void update_result(in uint32_t return_code, in uint32_t fault);
};

View File

@@ -15,6 +15,7 @@ import <global-connectors.camkes>;
import "interfaces/dataport_io.idl4";
import "interfaces/VectorCoreInterface.camkes";
import "interfaces/VectorCoreReturnInterface.camkes";
import "components/OpenTitanUARTDriver/OpenTitanUARTDriver.camkes";
import "components/DebugConsole/DebugConsole.camkes";
import "components/ProcessManager/ProcessManager.camkes";
@@ -73,6 +74,8 @@ assembly {
connection seL4HardwareMMIO vc_csr(from vc_drv.csr, to vctop.csr);
connection seL4RPCCall ml_coord_to_driver(from ml_coordinator.vctop,
to vc_drv.vctop);
connection seL4RPCCall vc_driver_to_ml_coord(from vc_drv.vctop_return,
to ml_coordinator.vctop_return);
connection seL4HardwareInterrupt vctop_host_req(from vctop.host_req,
to vc_drv.host_req);
connection seL4HardwareInterrupt vctop_finish(from vctop.finish,