From 182ef827c87a7779e4811414392449b3bb7ac2dc Mon Sep 17 00:00:00 2001 From: Giacomo Travaglini Date: Mon, 7 Jun 2021 16:19:17 +0100 Subject: [PATCH] cpu: Implement basic HTM capabilities in the CheckerCPU The O3CPU, which supports transactional memory (HTM), is using the inHtmTransactionalState and getHtmCheckpointPtr methods to check if we are in the middle of a transaction and return false or a nullptr if that's not the case. We need to avoid aborting simulation (panic) when those methods are called in the O3CPU + Checker simulation. This patch is providing the minimal support to re-enable O3 + Checker runs and it is not providing HTM support in the CheckerCPU (meaning, we won't be able to use the Checker in a transactional simulation) Signed-off-by: Giacomo Travaglini Change-Id: I7f71d5290c53b0402763d69f137ecaa1208253fb Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/46624 Reviewed-by: Jason Lowe-Power Reviewed-by: Richard Cooper Maintainer: Jason Lowe-Power Tested-by: kokoro --- src/cpu/checker/cpu.hh | 9 ++++----- src/cpu/checker/thread_context.hh | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/cpu/checker/cpu.hh b/src/cpu/checker/cpu.hh index 6d191741d6..b6c3747fa1 100644 --- a/src/cpu/checker/cpu.hh +++ b/src/cpu/checker/cpu.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016-2018, 2020 ARM Limited + * Copyright (c) 2011, 2016-2018, 2020-2021 Arm Limited * Copyright (c) 2013 Advanced Micro Devices, Inc. * All rights reserved * @@ -380,15 +380,14 @@ class CheckerCPU : public BaseCPU, public ExecContext bool inHtmTransactionalState() const override { - panic("not yet supported!"); - return false; + return (getHtmTransactionalDepth() > 0); } uint64_t getHtmTransactionalDepth() const override { - panic("not yet supported!"); - return 0; + assert(thread->htmTransactionStarts >= thread->htmTransactionStops); + return (thread->htmTransactionStarts - thread->htmTransactionStops); } TheISA::PCState pcState() const override { return thread->pcState(); } diff --git a/src/cpu/checker/thread_context.hh b/src/cpu/checker/thread_context.hh index 1e961c5aec..9a004889d7 100644 --- a/src/cpu/checker/thread_context.hh +++ b/src/cpu/checker/thread_context.hh @@ -497,7 +497,7 @@ class CheckerThreadContext : public ThreadContext BaseHTMCheckpointPtr& getHtmCheckpointPtr() override { - panic("function not implemented"); + return actualTC->getHtmCheckpointPtr(); } void