From 98b2d7acc57b664996de528e6d32ae8abaee2b99 Mon Sep 17 00:00:00 2001 From: Adrian Herrera Date: Thu, 7 Nov 2019 12:30:08 +0000 Subject: arch-arm: AArch64 reg access HCR_EL2.E2H filter Some AArch64 system registers report UNDEFINED behaviours if accessed from EL2 or EL3 in a non-EL2 Host enabled (HCR_EL2.E2H == 0) environment. Examples of these are seen in the Generic Timer system registers, namely CNTP_CTL_EL02 or CNTKCTL_EL12. This patch provides an ISA filter for specifying the above condition. Change-Id: I240f9afdb000faf5d3c9274ba12bd4cc41fe8604 Reviewed-by: Giacomo Travaglini Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/24664 Reviewed-by: Nikos Nikoleris Maintainer: Giacomo Travaglini Tested-by: kokoro --- src/arch/arm/miscregs.hh | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/arch/arm/miscregs.hh') diff --git a/src/arch/arm/miscregs.hh b/src/arch/arm/miscregs.hh index 4f522f298..49df42e51 100644 --- a/src/arch/arm/miscregs.hh +++ b/src/arch/arm/miscregs.hh @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010-2019 ARM Limited + * Copyright (c) 2010-2020 ARM Limited * All rights reserved * * The license below extends only to copyright in the software and shall @@ -971,12 +971,18 @@ namespace ArmISA // Hypervisor mode MISCREG_HYP_RD, MISCREG_HYP_WR, + // Hypervisor mode, HCR_EL2.E2H == 1 + MISCREG_HYP_E2H_RD, + MISCREG_HYP_E2H_WR, // Monitor mode, SCR.NS == 0 MISCREG_MON_NS0_RD, MISCREG_MON_NS0_WR, // Monitor mode, SCR.NS == 1 MISCREG_MON_NS1_RD, MISCREG_MON_NS1_WR, + // Monitor mode, HCR_EL2.E2H == 1 + MISCREG_MON_E2H_RD, + MISCREG_MON_E2H_WR, NUM_MISCREG_INFOS }; @@ -1927,11 +1933,11 @@ namespace ArmISA CPSR cpsr); // Checks read access permissions to AArch64 system registers - bool canReadAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr, + bool canReadAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr, ThreadContext *tc); // Checks write access permissions to AArch64 system registers - bool canWriteAArch64SysReg(MiscRegIndex reg, SCR scr, CPSR cpsr, + bool canWriteAArch64SysReg(MiscRegIndex reg, HCR hcr, SCR scr, CPSR cpsr, ThreadContext *tc); // Uses just the scr.ns bit to pre flatten the misc regs. This is useful -- cgit v1.2.3