From patchwork Fri Sep 5 12:24:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36844 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f70.google.com (mail-pa0-f70.google.com [209.85.220.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id A0028202A1 for ; Fri, 5 Sep 2014 12:29:45 +0000 (UTC) Received: by mail-pa0-f70.google.com with SMTP id lf10sf102096865pab.5 for ; Fri, 05 Sep 2014 05:29:38 -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:cc: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=2zP2qk6sdj8tVPJ3NfJzGnFhWMsilx6iWCQaPlVT1M4=; b=iqjcOCxZh7kRD33XwlTI1ZgdxP54XUvXjiXHgZwSYm3FNAj3mnl24O5fJ82FQcp7xH YlqeXKbWZ18j+uHAixqbNn7ajzALGjG257jEjV86ucQ60kEKwC2QhmXvXiCpwvuz0b0w nOeB8ABH3mMf45Xgb0oUlfIBbmOT3Nmmr9/aRCxemTHWRK0+V5M68l/m6sDBgIjLkI5Q 7zOjMachUm3yV1jHKCJ4BP4pI6WMu5Hk0y1aiYV4rTFO0SDypQTVZ6Z5bK6GMvrAyRea ZA+rfYb4EsQDLNkxkOqq8kIFF5T/5z8N6+Oglt3YoKFjAp/WZHMBHr8jWsCSDYF/PXNO yYbw== X-Gm-Message-State: ALoCoQlr1hTadEeEw5nWYvoeuuZQHg6dGQ0WlHtK2SdcmRE5ia4DgygiQJShosS6Uey8imbkVZLE X-Received: by 10.66.221.230 with SMTP id qh6mr6797666pac.9.1409920177809; Fri, 05 Sep 2014 05:29:37 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.16.112 with SMTP id 103ls738270qga.9.gmail; Fri, 05 Sep 2014 05:29:37 -0700 (PDT) X-Received: by 10.220.68.208 with SMTP id w16mr164002vci.79.1409920177680; Fri, 05 Sep 2014 05:29:37 -0700 (PDT) Received: from mail-vc0-f171.google.com (mail-vc0-f171.google.com [209.85.220.171]) by mx.google.com with ESMTPS id mn6si402324vcb.40.2014.09.05.05.29.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 05:29:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.171 as permitted sender) client-ip=209.85.220.171; Received: by mail-vc0-f171.google.com with SMTP id id10so12242875vcb.16 for ; Fri, 05 Sep 2014 05:29:37 -0700 (PDT) X-Received: by 10.221.64.205 with SMTP id xj13mr1413601vcb.18.1409920177596; Fri, 05 Sep 2014 05:29:37 -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.45.67 with SMTP id uj3csp75185vcb; Fri, 5 Sep 2014 05:29:37 -0700 (PDT) X-Received: by 10.229.57.138 with SMTP id c10mr17966898qch.30.1409920176988; Fri, 05 Sep 2014 05:29:36 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v104si1324942qge.99.2014.09.05.05.29.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 05 Sep 2014 05:29:36 -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]:57512 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPse0-0006HF-IF for patch@linaro.org; Fri, 05 Sep 2014 08:29:36 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54809) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPsZp-0008Ge-Tw for qemu-devel@nongnu.org; Fri, 05 Sep 2014 08:25:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPsZf-0006Pf-VN for qemu-devel@nongnu.org; Fri, 05 Sep 2014 08:25:17 -0400 Received: from mail-wi0-f179.google.com ([209.85.212.179]:41951) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPsZf-0006PA-PK for qemu-devel@nongnu.org; Fri, 05 Sep 2014 08:25:07 -0400 Received: by mail-wi0-f179.google.com with SMTP id q5so2868991wiv.6 for ; Fri, 05 Sep 2014 05:25:04 -0700 (PDT) X-Received: by 10.181.13.175 with SMTP id ez15mr3151946wid.59.1409919902247; Fri, 05 Sep 2014 05:25:02 -0700 (PDT) Received: from ards-macbook-pro.local (cag06-7-83-153-85-71.fbx.proxad.net. [83.153.85.71]) by mx.google.com with ESMTPSA id mv14sm1807558wic.20.2014.09.05.05.25.01 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 05 Sep 2014 05:25:01 -0700 (PDT) From: Ard Biesheuvel To: peter.maydell@linaro.org, christoffer.dall@linaro.org, qemu-devel@nongnu.org Date: Fri, 5 Sep 2014 14:24:52 +0200 Message-Id: <1409919897-360-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409919897-360-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409919897-360-1-git-send-email-ard.biesheuvel@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.212.179 Cc: Rob Herring , Ard Biesheuvel Subject: [Qemu-devel] [PATCH v3 1/6] target-arm: add powered off cpu state 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: ard.biesheuvel@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.171 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 From: Rob Herring Add tracking of cpu power state in order to support powering off of cores in system emuluation. The initial state is determined by the start-powered-off QOM property. Signed-off-by: Rob Herring Signed-off-by: Ard Biesheuvel Reviewed-by: Peter Maydell --- target-arm/cpu-qom.h | 2 ++ target-arm/cpu.c | 7 ++++++- target-arm/machine.c | 5 +++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h index 07f3c9e86639..eae0a7b9c908 100644 --- a/target-arm/cpu-qom.h +++ b/target-arm/cpu-qom.h @@ -98,6 +98,8 @@ typedef struct ARMCPU { /* Should CPU start in PSCI powered-off state? */ bool start_powered_off; + /* CPU currently in PSCI powered-off state */ + bool powered_off; /* [QEMU_]KVM_ARM_TARGET_* constant for this CPU, or * QEMU_KVM_ARM_TARGET_NONE if the kernel doesn't support this CPU type. diff --git a/target-arm/cpu.c b/target-arm/cpu.c index 8199f32e3267..b4c06c17cf87 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -40,7 +40,9 @@ static void arm_cpu_set_pc(CPUState *cs, vaddr value) static bool arm_cpu_has_work(CPUState *cs) { - return cs->interrupt_request & + ARMCPU *cpu = ARM_CPU(cs); + + return !cpu->powered_off && cs->interrupt_request & (CPU_INTERRUPT_FIQ | CPU_INTERRUPT_HARD | CPU_INTERRUPT_EXITTB); } @@ -91,6 +93,9 @@ static void arm_cpu_reset(CPUState *s) env->vfp.xregs[ARM_VFP_MVFR1] = cpu->mvfr1; env->vfp.xregs[ARM_VFP_MVFR2] = cpu->mvfr2; + cpu->powered_off = cpu->start_powered_off; + s->halted = cpu->start_powered_off; + if (arm_feature(env, ARM_FEATURE_IWMMXT)) { env->iwmmxt.cregs[ARM_IWMMXT_wCID] = 0x69051000 | 'Q'; } diff --git a/target-arm/machine.c b/target-arm/machine.c index 3bcc7cc833e0..63329ebd551f 100644 --- a/target-arm/machine.c +++ b/target-arm/machine.c @@ -218,8 +218,8 @@ static int cpu_post_load(void *opaque, int version_id) const VMStateDescription vmstate_arm_cpu = { .name = "cpu", - .version_id = 20, - .minimum_version_id = 20, + .version_id = 21, + .minimum_version_id = 21, .pre_save = cpu_pre_save, .post_load = cpu_post_load, .fields = (VMStateField[]) { @@ -259,6 +259,7 @@ const VMStateDescription vmstate_arm_cpu = { VMSTATE_UINT64(env.exception.vaddress, ARMCPU), VMSTATE_TIMER(gt_timer[GTIMER_PHYS], ARMCPU), VMSTATE_TIMER(gt_timer[GTIMER_VIRT], ARMCPU), + VMSTATE_BOOL(powered_off, ARMCPU), VMSTATE_END_OF_LIST() }, .subsections = (VMStateSubsection[]) {