From patchwork Fri Oct 24 11:37:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Maydell X-Patchwork-Id: 39441 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f69.google.com (mail-la0-f69.google.com [209.85.215.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2E65D24026 for ; Fri, 24 Oct 2014 11:41:20 +0000 (UTC) Received: by mail-la0-f69.google.com with SMTP id mc6sf773259lab.4 for ; Fri, 24 Oct 2014 04:41:19 -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=htmTKeQcxPprALKnj+CXo/7+2sMr5upEke/6UyqmJXg=; b=jRRTz9LAuVd/bG8Di7W5akv3oSMPRG5GB4U4Q5J+OJ0b9LBIPVBQISZqFqc3ycoNg0 4Ojitu8zn8b2Nn+VTl6xZLgppKtmcTrlXFcLbcc4GUOdmxKfcEJqIG+jpaPa6h8ARrWb +Xu+Lqeo8Vlp1mHvAXNbiGlfoFxErJ38aXGrfn2y1WJJIXrwJGCrbDdiD+FK/fhNmcjj QqGEGjzb0McCeXqaRCRNUMc4WUJS3CIS7ieEGLpL3M5ZGx3DWZ966tKdurCSGtJiKaD5 9Cwev993UWQTlHXJozVqGxMYBruHeRp27LYGbmHOgULfl/Ye3GB4lLPkhA4NLuvncJ5u eA/Q== X-Gm-Message-State: ALoCoQkX9UXJFUD3cMYLis1K9WzCf2KT5hM2CfaZNc5g2CYgCLxT1b1o/9erINyyOqVEQO/DNxCC X-Received: by 10.112.217.102 with SMTP id ox6mr356264lbc.19.1414150879035; Fri, 24 Oct 2014 04:41:19 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.11.132 with SMTP id ei4ls434789lad.109.gmail; Fri, 24 Oct 2014 04:41:18 -0700 (PDT) X-Received: by 10.112.189.10 with SMTP id ge10mr3820975lbc.23.1414150878803; Fri, 24 Oct 2014 04:41:18 -0700 (PDT) Received: from mail-la0-f51.google.com (mail-la0-f51.google.com. [209.85.215.51]) by mx.google.com with ESMTPS id kr10si6570955lac.72.2014.10.24.04.41.18 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 24 Oct 2014 04:41:18 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.51 as permitted sender) client-ip=209.85.215.51; Received: by mail-la0-f51.google.com with SMTP id ge10so2494734lab.10 for ; Fri, 24 Oct 2014 04:41:18 -0700 (PDT) X-Received: by 10.153.8.164 with SMTP id dl4mr3851214lad.29.1414150878495; Fri, 24 Oct 2014 04:41:18 -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.112.84.229 with SMTP id c5csp411521lbz; Fri, 24 Oct 2014 04:41:17 -0700 (PDT) X-Received: by 10.229.124.9 with SMTP id s9mr5079052qcr.15.1414150877346; Fri, 24 Oct 2014 04:41:17 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id n5si7334736qat.86.2014.10.24.04.41.16 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 24 Oct 2014 04:41:17 -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]:46797 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhdF6-0002w6-Jp for patch@linaro.org; Fri, 24 Oct 2014 07:41:16 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50464) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhdBe-0006bL-JV for qemu-devel@nongnu.org; Fri, 24 Oct 2014 07:37:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XhdBd-0008SN-Gn for qemu-devel@nongnu.org; Fri, 24 Oct 2014 07:37:42 -0400 Received: from mnementh.archaic.org.uk ([2001:8b0:1d0::1]:54280) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XhdBd-0008OE-9W for qemu-devel@nongnu.org; Fri, 24 Oct 2014 07:37:41 -0400 Received: from pm215 by mnementh.archaic.org.uk with local (Exim 4.80) (envelope-from ) id 1XhdBR-0007vs-UB for qemu-devel@nongnu.org; Fri, 24 Oct 2014 12:37:29 +0100 From: Peter Maydell To: qemu-devel@nongnu.org Date: Fri, 24 Oct 2014 12:37:14 +0100 Message-Id: <1414150649-30428-9-git-send-email-peter.maydell@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1414150649-30428-1-git-send-email-peter.maydell@linaro.org> References: <1414150649-30428-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 08/23] 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: 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.215.51 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 Reviewed-by: Peter Maydell Signed-off-by: Ard Biesheuvel Signed-off-by: Peter Maydell Message-id: 1412865028-17725-2-git-send-email-peter.maydell@linaro.org --- target-arm/cpu-qom.h | 2 ++ target-arm/cpu.c | 8 +++++++- target-arm/machine.c | 5 +++-- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h index 96a3da9..aeb7e1d 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 edfd586..67cd176 100644 --- a/target-arm/cpu.c +++ b/target-arm/cpu.c @@ -40,7 +40,10 @@ 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_VFIQ | CPU_INTERRUPT_VIRQ | CPU_INTERRUPT_EXITTB); @@ -93,6 +96,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 ddb7d05..5776ee0 100644 --- a/target-arm/machine.c +++ b/target-arm/machine.c @@ -222,8 +222,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[]) { @@ -263,6 +263,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[]) {