Received: from eggs.gnu.org ([2001:4830:134:3::10]:48158) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjBsb-0003AL-7O for qemu-devel@nongnu.org; Mon, 05 Oct 2015 15:57:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZjBsX-0005E5-Vw for qemu-devel@nongnu.org; Mon, 05 Oct 2015 15:57:01 -0400 Received: from mail-io0-f178.google.com ([209.85.223.178]:33843) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZjBsX-0005Db-Rx for qemu-devel@nongnu.org; Mon, 05 Oct 2015 15:56:57 -0400 Received: by iow1 with SMTP id 1so161710954iow.1 for ; Mon, 05 Oct 2015 12:56:56 -0700 (PDT) From: Davorin Mista Date: Mon, 5 Oct 2015 12:56:33 -0700 Message-Id: <1444074993-2820-1-git-send-email-davorin.mista@aggios.com> Subject: [Qemu-devel] [PATCHv2] target-arm: Implement AArch64 OSLSR_EL1 sysreg List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Davorin Mista , peter.maydell@linaro.org, edgari@xilinx.com, alistai@xilinx.com, sorenb@xilinx.com Added oslsr_write function to OSLAR_EL1 sysreg, using a status variable in ARMCPUState struct (os_lock_status). Linux reads from this register during its suspend/resume procedure. Signed-off-by: Davorin Mista --- Changed in v2: -switched from using dummy registers to an actual register implementation -implemented write function for OSLAR_EL1 sysreg -added state variable to ARMCPUState struct Signed-off-by: Davorin Mista --- target-arm/cpu.h | 3 +++ target-arm/helper.c | 16 +++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index 5ea11a6..5aab654 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -500,6 +500,9 @@ typedef struct CPUARMState { uint32_t cregs[16]; } iwmmxt; + /* OS Lock Status: accessed via OSLAR/OSLSR registers */ + uint64_t os_lock_status; + /* For mixed endian mode. */ bool bswap_code; diff --git a/target-arm/helper.c b/target-arm/helper.c index 9d62c4c..a6fad7a 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -3147,6 +3147,13 @@ static void dcc_write(CPUARMState *env, const ARMCPRegInfo *ri, putchar(value); } +/* write to os_lock_status state variable */ +static void oslsr_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) +{ + /* only bit 1 can be modified, register is always 0b10x0 */ + raw_write(env, ri, 8 + (value & 2)); +} + static const ARMCPRegInfo debug_cp_reginfo[] = { /* DBGDRAR, DBGDSAR: always RAZ since we don't implement memory mapped * debug components. The AArch64 version of DBGDRAR is named MDRAR_EL1; @@ -3179,7 +3186,14 @@ static const ARMCPRegInfo debug_cp_reginfo[] = { /* We define a dummy WI OSLAR_EL1, because Linux writes to it. */ { .name = "OSLAR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 4, - .access = PL1_W, .type = ARM_CP_NOP }, + .access = PL1_W, .resetvalue = 10, + .fieldoffset = offsetof(CPUARMState, os_lock_status), + .writefn = oslsr_write }, + /* We define a dummy OSLSR_EL1, because Linux reads from it. */ + { .name = "OSLSR_EL1", .state = ARM_CP_STATE_BOTH, + .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 1, .opc2 = 4, + .access = PL1_R, + .fieldoffset = offsetof(CPUARMState, os_lock_status) }, /* Dummy OSDLR_EL1: 32-bit Linux will read this */ { .name = "OSDLR_EL1", .state = ARM_CP_STATE_BOTH, .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 3, .opc2 = 4, -- 2.6.0