diff --git a/src/arch/arm/fastmodel/arm_fast_model.py b/src/arch/arm/fastmodel/arm_fast_model.py index 11004177c6..d2d911f5b4 100644 --- a/src/arch/arm/fastmodel/arm_fast_model.py +++ b/src/arch/arm/fastmodel/arm_fast_model.py @@ -141,7 +141,11 @@ def scx_get_min_sync_latency(arg=None): # This should be called once per simulation -def setup_simulation(sim_name, min_sync_latency=100.0 / 100000000): +def setup_simulation( + sim_name, min_sync_latency=100.0 / 100000000, exit_on_dmi_warning=False +): set_armlmd_license_file() scx_initialize(sim_name) scx_set_min_sync_latency(min_sync_latency) + if exit_on_dmi_warning: + _m5.arm_fast_model.gem5.enable_exit_on_dmi_warning_handler() diff --git a/src/arch/arm/fastmodel/fastmodel.cc b/src/arch/arm/fastmodel/fastmodel.cc index 33a0c43f87..2edf1fa0c3 100644 --- a/src/arch/arm/fastmodel/fastmodel.cc +++ b/src/arch/arm/fastmodel/fastmodel.cc @@ -37,9 +37,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include "base/logging.hh" #include "python/pybind11/pybind.hh" #include "scx/scx.h" #include "sim/init.hh" +#include "systemc/utils/report.hh" namespace gem5 { @@ -47,6 +49,21 @@ namespace gem5 namespace { +void +fastmodel_sc_report_handler( + const sc_core::sc_report &report, const sc_core::sc_actions &actions) +{ + const char *msg = report.get_msg(); + if (!msg) + return; + + panic_if( + strstr(msg, "Simulation code-translation cache failed to gain DMI") || + strstr(msg, "I-side given unusable DMI"), + "DMI warning from fastmodel, " + "aborting simulation instead of running slowly."); +} + void arm_fast_model_pybind(pybind11::module_ &m_internal) { @@ -118,6 +135,12 @@ arm_fast_model_pybind(pybind11::module_ &m_internal) static_cast *)>( &scx::scx_get_min_sync_latency)) ; + + // submodule for gem5-specific functions + auto gem5 = arm_fast_model.def_submodule("gem5"); + gem5.def("enable_exit_on_dmi_warning_handler", []() { + sc_gem5::addExtraSystemCReportHandler(fastmodel_sc_report_handler); + }); } EmbeddedPyBind embed_("arm_fast_model", &arm_fast_model_pybind);