From patchwork Thu Mar 6 19:32:59 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 25852 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f200.google.com (mail-ob0-f200.google.com [209.85.214.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id D052F203C3 for ; Thu, 6 Mar 2014 19:57:02 +0000 (UTC) Received: by mail-ob0-f200.google.com with SMTP id gq1sf11431392obb.7 for ; Thu, 06 Mar 2014 11:57:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=JnWDb5VbrJyzFG61LbSYV8/Q1BoxiA7kPYCMS6NyNkA=; b=NXYDDjPsubxMyAikSvxii895TCbxxsF775APeTps5ldHoQsaZCPIlkeiILj8/tm/zM 41cJv/Yqr4vCgreAy6ISGhh20cX5rJYk4ZGn2MIafI+GxMNaY22ZZUhHIacmU+l5Cfad 9GmNJQvp7MTRy1ycfPYaR3ReehtSGvSQvHu/9n2TLHfRYIBX0kvFnapavrN/pdzbg9p4 KFK9Bb0oy+MoCqntsa/muBFMwB3RWwF+KtOL3mQovgxi3JFLgYTdyin7T/xlJ2yJvqV3 +euH3a/A9ni6PLvmZl74C87OB3bKylj2HRvxioj7sXDydx8J4nPpO6GAYCJlqD/Yt9ZW 1+Dg== X-Gm-Message-State: ALoCoQnVDHk/3wGQiRKGai057tYMf/QmvEw5mfSguOBgjWzY1pQlDyNON+/eDFMNbsjc79/1h66O X-Received: by 10.182.213.5 with SMTP id no5mr4919974obc.15.1394135822379; Thu, 06 Mar 2014 11:57:02 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.103 with SMTP id k94ls859259qgd.39.gmail; Thu, 06 Mar 2014 11:57:02 -0800 (PST) X-Received: by 10.52.229.133 with SMTP id sq5mr4265vdc.45.1394135822146; Thu, 06 Mar 2014 11:57:02 -0800 (PST) Received: from mail-ve0-f179.google.com (mail-ve0-f179.google.com [209.85.128.179]) by mx.google.com with ESMTPS id b7si1465047vej.70.2014.03.06.11.57.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 06 Mar 2014 11:57:02 -0800 (PST) Received-SPF: neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.179; Received: by mail-ve0-f179.google.com with SMTP id db12so3117533veb.24 for ; Thu, 06 Mar 2014 11:57:02 -0800 (PST) X-Received: by 10.52.251.199 with SMTP id zm7mr468700vdc.21.1394135822045; Thu, 06 Mar 2014 11:57:02 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.78.9 with SMTP id i9csp63173vck; Thu, 6 Mar 2014 11:57:01 -0800 (PST) X-Received: by 10.112.13.133 with SMTP id h5mr1543699lbc.67.1394135819722; Thu, 06 Mar 2014 11:56:59 -0800 (PST) Received: from mnementh.archaic.org.uk (mnementh.archaic.org.uk. [2001:8b0:1d0::1]) by mx.google.com with ESMTPS id ka4si5776930lbc.115.2014.03.06.11.56.58 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 06 Mar 2014 11:56:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of pm215@archaic.org.uk designates 2001:8b0:1d0::1 as permitted sender) client-ip=2001:8b0:1d0::1; Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1WLe2U-0000TI-3B; Thu, 06 Mar 2014 19:33:06 +0000 From: Peter Maydell To: qemu-devel@nongnu.org Cc: patches@linaro.org, Alexander Graf , Michael Matz , Claudio Fontana , Dirk Mueller , Laurent Desnogues , kvmarm@lists.cs.columbia.edu, Richard Henderson , =?UTF-8?q?Alex=20Benn=C3=A9e?= , Christoffer Dall , Will Newton , Peter Crosthwaite , Rob Herring Subject: [PATCH v4 15/21] target-arm: Add AArch64 ELR_EL1 register. Date: Thu, 6 Mar 2014 19:32:59 +0000 Message-Id: <1394134385-1727-16-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1394134385-1727-1-git-send-email-peter.maydell@linaro.org> References: <1394134385-1727-1-git-send-email-peter.maydell@linaro.org> X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.179 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add the AArch64 ELR_EL1 register. Note that this does not live in env->cp15: for KVM migration compatibility we need to migrate it separately rather than as part of the system registers, because the KVM-to-userspace interface puts it in the struct kvm_regs rather than making them visible via the ONE_REG ioctls. Signed-off-by: Peter Maydell Reviewed-by: Peter Crosthwaite --- target-arm/cpu.h | 2 ++ target-arm/helper.c | 4 ++++ target-arm/kvm64.c | 15 ++++++++++++++- target-arm/machine.c | 7 ++++--- 4 files changed, 24 insertions(+), 4 deletions(-) diff --git a/target-arm/cpu.h b/target-arm/cpu.h index e51add2..7ef2c71 100644 --- a/target-arm/cpu.h +++ b/target-arm/cpu.h @@ -162,6 +162,8 @@ typedef struct CPUARMState { uint32_t condexec_bits; /* IT bits. cpsr[15:10,26:25]. */ uint64_t daif; /* exception masks, in the bits they are in in PSTATE */ + uint64_t elr_el1; /* AArch64 ELR_EL1 */ + /* System control coprocessor (cp15) */ struct { uint32_t c0_cpuid; diff --git a/target-arm/helper.c b/target-arm/helper.c index 8d96b5c..812fc73 100644 --- a/target-arm/helper.c +++ b/target-arm/helper.c @@ -1810,6 +1810,10 @@ static const ARMCPRegInfo v8_cp_reginfo[] = { { .name = "OSLAR_EL1", .state = ARM_CP_STATE_AA64, .opc0 = 2, .opc1 = 0, .crn = 1, .crm = 0, .opc2 = 4, .access = PL1_W, .type = ARM_CP_NOP }, + { .name = "ELR_EL1", .state = ARM_CP_STATE_AA64, + .type = ARM_CP_NO_MIGRATE, + .opc0 = 3, .opc1 = 0, .crn = 4, .crm = 0, .opc2 = 1, + .access = PL1_RW, .fieldoffset = offsetof(CPUARMState, elr_el1) }, REGINFO_SENTINEL }; diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c index 1b7ca90..ee72748 100644 --- a/target-arm/kvm64.c +++ b/target-arm/kvm64.c @@ -144,9 +144,15 @@ int kvm_arch_put_registers(CPUState *cs, int level) return ret; } + reg.id = AARCH64_CORE_REG(elr_el1); + reg.addr = (uintptr_t) &env->elr_el1; + ret = kvm_vcpu_ioctl(cs, KVM_SET_ONE_REG, ®); + if (ret) { + return ret; + } + /* TODO: * SP_EL1 - * ELR_EL1 * SPSR[] * FP state * system registers @@ -195,6 +201,13 @@ int kvm_arch_get_registers(CPUState *cs) return ret; } + reg.id = AARCH64_CORE_REG(elr_el1); + reg.addr = (uintptr_t) &env->elr_el1; + ret = kvm_vcpu_ioctl(cs, KVM_GET_ONE_REG, ®); + if (ret) { + return ret; + } + /* TODO: other registers */ return ret; } diff --git a/target-arm/machine.c b/target-arm/machine.c index fc8825e..01d8f83 100644 --- a/target-arm/machine.c +++ b/target-arm/machine.c @@ -222,9 +222,9 @@ static int cpu_post_load(void *opaque, int version_id) const VMStateDescription vmstate_arm_cpu = { .name = "cpu", - .version_id = 14, - .minimum_version_id = 14, - .minimum_version_id_old = 14, + .version_id = 15, + .minimum_version_id = 15, + .minimum_version_id_old = 15, .pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (VMStateField[]) { @@ -243,6 +243,7 @@ const VMStateDescription vmstate_arm_cpu = { VMSTATE_UINT32_ARRAY(env.banked_r14, ARMCPU, 6), VMSTATE_UINT32_ARRAY(env.usr_regs, ARMCPU, 5), VMSTATE_UINT32_ARRAY(env.fiq_regs, ARMCPU, 5), + VMSTATE_UINT64(env.elr_el1, ARMCPU), /* The length-check must come before the arrays to avoid * incoming data possibly overflowing the array. */