diff --git a/apps/system/components/MlCoordinator/MlCoordinator.camkes b/apps/system/components/MlCoordinator/MlCoordinator.camkes index dea151b..1d7e5ef 100644 --- a/apps/system/components/MlCoordinator/MlCoordinator.camkes +++ b/apps/system/components/MlCoordinator/MlCoordinator.camkes @@ -4,6 +4,7 @@ import ; component MlCoordinator { provides MlCoordinatorInterface mlcoord; + provides VectorCoreReturnInterface vctop_return; uses LoggerInterface logger; uses SecurityCoordinatorInterface security; diff --git a/apps/system/components/MlCoordinator/kata-ml-coordinator/src/run.rs b/apps/system/components/MlCoordinator/kata-ml-coordinator/src/run.rs index 57fd0ef..c06247a 100644 --- a/apps/system/components/MlCoordinator/kata-ml-coordinator/src/run.rs +++ b/apps/system/components/MlCoordinator/kata-ml-coordinator/src/run.rs @@ -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); +} diff --git a/apps/system/components/VectorCoreDriver/VectorCoreDriver.camkes b/apps/system/components/VectorCoreDriver/VectorCoreDriver.camkes index 01ccb5b..eb24692 100644 --- a/apps/system/components/VectorCoreDriver/VectorCoreDriver.camkes +++ b/apps/system/components/VectorCoreDriver/VectorCoreDriver.camkes @@ -6,4 +6,6 @@ component VectorCoreDriver { consumes Interrupt data_fault; provides VectorCoreInterface vctop; + + uses VectorCoreReturnInterface vctop_return; } diff --git a/apps/system/components/VectorCoreDriver/src/driver.c b/apps/system/components/VectorCoreDriver/src/driver.c index 2c66f6f..d39b20d 100644 --- a/apps/system/components/VectorCoreDriver/src/driver.c +++ b/apps/system/components/VectorCoreDriver/src/driver.c @@ -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); diff --git a/apps/system/interfaces/VectorCoreReturnInterface.camkes b/apps/system/interfaces/VectorCoreReturnInterface.camkes new file mode 100644 index 0000000..b723b0c --- /dev/null +++ b/apps/system/interfaces/VectorCoreReturnInterface.camkes @@ -0,0 +1,3 @@ +procedure VectorCoreReturnInterface { + void update_result(in uint32_t return_code, in uint32_t fault); +}; diff --git a/apps/system/system.camkes b/apps/system/system.camkes index 72de0b1..4fbe98a 100644 --- a/apps/system/system.camkes +++ b/apps/system/system.camkes @@ -15,6 +15,7 @@ import ; 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,