fastmodel: Add handler to catch DMI warnings
Catch DMI warnings from fastmodel, and abort the simulation when they happen (instead of slowing down simulation). This is controlled by an exit_on_dmi_warning flag passed to fm.setup_simulation, defaulting to false. Change-Id: I07fbc9b2579989d40d601ff0b6af9bfe719309a1 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/67235 Reviewed-by: Gabe Black <gabe.black@gmail.com> Maintainer: Gabe Black <gabe.black@gmail.com> Tested-by: kokoro <noreply+kokoro@google.com>
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -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<sg::ticks_t (*)(sg::Tag<sg::ticks_t> *)>(
|
||||
&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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user