From patchwork Tue Jul 8 12:13:28 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 33234 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pd0-f199.google.com (mail-pd0-f199.google.com [209.85.192.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id B101520969 for ; Tue, 8 Jul 2014 15:23:34 +0000 (UTC) Received: by mail-pd0-f199.google.com with SMTP id r10sf39609157pdi.10 for ; Tue, 08 Jul 2014 08:23:34 -0700 (PDT) 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:date :message-id:in-reply-to:references:subject:precedence:list-id :list-unsubscribe:list-archive:list-post:list-help:list-subscribe :errors-to:sender:x-original-sender :x-original-authentication-results:mailing-list; bh=duZcSBztCZwdFLzGHzDQKmKEI3oX7S0euT7JBnP/6AA=; b=JPMR8LgfltzFYAF4hrbDhvgCuAzLGt5uwX+dGuWcrE9oYLv1RENa6CwlAaWLd8dotu S9O7Y+usI8HljvMOAS2b+khta6NwwtXE/f8HOSdd7fXHIbcGHTzt1AFqJiw30pnKuI6A 8F1K7qcUCTT8KcDS9Dy8HbX2NCpPFXoMbqMwoN+k3szR7QyhE9PAnvfbHYqZKTSLL4Cr 213CBtR72ROFFZTP1iydU8Ol2arG+ou8nKpQHL2H4NCo8GxA6kWinT/O4haPHfWSb7E8 MMJ7TmmAGob88CkgBmx7TGygN2Cb7wjO/I8SYSdynvAHkDYqZGp92JBf5wMg9ga/pBzY k76A== X-Gm-Message-State: ALoCoQm7B4cLYJMfL9FJUgPAc8wzKqHZkpWCaOa7ocsms3TvOaX31j7hW6a94TTGKScoU2Qtl7XN X-Received: by 10.66.65.202 with SMTP id z10mr17443150pas.45.1404833014029; Tue, 08 Jul 2014 08:23:34 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.20.132 with SMTP id 4ls1362051qgj.12.gmail; Tue, 08 Jul 2014 08:23:33 -0700 (PDT) X-Received: by 10.220.202.69 with SMTP id fd5mr965748vcb.43.1404833013934; Tue, 08 Jul 2014 08:23:33 -0700 (PDT) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id xb10si20288655vcb.45.2014.07.08.08.23.33 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 08 Jul 2014 08:23:33 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) client-ip=209.85.220.174; Received: by mail-vc0-f174.google.com with SMTP id hy4so5631030vcb.33 for ; Tue, 08 Jul 2014 08:23:33 -0700 (PDT) X-Received: by 10.58.209.7 with SMTP id mi7mr128408vec.80.1404833013868; Tue, 08 Jul 2014 08:23:33 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp779375vcb; Tue, 8 Jul 2014 08:23:32 -0700 (PDT) X-Received: by 10.224.38.71 with SMTP id a7mr28119485qae.44.1404833012439; Tue, 08 Jul 2014 08:23:32 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id ky10si15708633qcb.19.2014.07.08.08.23.32 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 08 Jul 2014 08:23:32 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Received: from localhost ([::1]:56220 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4XEy-0006mv-1Y for patch@linaro.org; Tue, 08 Jul 2014 11:23:32 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51402) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4UHB-00035z-GY for qemu-devel@nongnu.org; Tue, 08 Jul 2014 08:13:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1X4UHA-00087V-BP for qemu-devel@nongnu.org; Tue, 08 Jul 2014 08:13:37 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:48795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1X4UHA-00086v-4v for qemu-devel@nongnu.org; Tue, 08 Jul 2014 08:13:36 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1X4UH3-0003Gk-2O for qemu-devel@nongnu.org; Tue, 08 Jul 2014 13:13:29 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Tue, 8 Jul 2014 13:13:28 +0100 Message-Id: <1404821608-12529-4-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1404821608-12529-1-git-send-email-peter.maydell@linaro.org> References: <1404821608-12529-1-git-send-email-peter.maydell@linaro.org> X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2001:8b0:1d0::1 Subject: [Qemu-devel] [PULL 3/3] target-arm: Implement vCPU reset via KVM_ARM_VCPU_INIT for 32-bit CPUs X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: peter.maydell@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.174 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 Implement kvm_arm_vcpu_init() as a simple call to arm_arm_vcpu_init() (which uses the KVM_ARM_VCPU_INIT vcpu ioctl to tell the kernel to re-initialize the vCPU), rather than via the complicated code which saves a copy of the register state on first init and then writes it back to the kernel. This is much simpler and brings the 32-bit KVM code into line with the 64-bit code. Signed-off-by: Peter Maydell Message-id: 1403802973-20841-1-git-send-email-peter.maydell@linaro.org --- target-arm/cpu-qom.h | 4 ---- target-arm/kvm32.c | 19 +++++-------------- 2 files changed, 5 insertions(+), 18 deletions(-) diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h index eaee944..ee4fbb1 100644 --- a/target-arm/cpu-qom.h +++ b/target-arm/cpu-qom.h @@ -72,10 +72,6 @@ typedef struct ARMCPU { uint64_t *cpreg_indexes; /* Values of the registers (cpreg_indexes[i]'s value is cpreg_values[i]) */ uint64_t *cpreg_values; - /* When using KVM, keeps a copy of the initial state of the VCPU, - * so that on reset we can feed the reset values back into the kernel. - */ - uint64_t *cpreg_reset_values; /* Length of the indexes, values, reset_values arrays */ int32_t cpreg_array_len; /* These are used only for migration: incoming data arrives in diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c index 068af7d..5ec4eb1 100644 --- a/target-arm/kvm32.c +++ b/target-arm/kvm32.c @@ -270,13 +270,6 @@ int kvm_arch_init_vcpu(CPUState *cs) goto out; } - /* Save a copy of the initial register values so that we can - * feed it back to the kernel on VCPU reset. - */ - cpu->cpreg_reset_values = g_memdup(cpu->cpreg_values, - cpu->cpreg_array_len * - sizeof(cpu->cpreg_values[0])); - out: g_free(rlp); return ret; @@ -518,11 +511,9 @@ int kvm_arch_get_registers(CPUState *cs) void kvm_arm_reset_vcpu(ARMCPU *cpu) { - /* Feed the kernel back its initial register state */ - memmove(cpu->cpreg_values, cpu->cpreg_reset_values, - cpu->cpreg_array_len * sizeof(cpu->cpreg_values[0])); - - if (!write_list_to_kvmstate(cpu)) { - abort(); - } + /* Re-init VCPU so that all registers are set to + * their respective reset values. + */ + kvm_arm_vcpu_init(CPU(cpu)); + write_kvmstate_to_list(cpu); }