From patchwork Wed Sep 10 07:02:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 37181 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-pa0-f69.google.com (mail-pa0-f69.google.com [209.85.220.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E876B20491 for ; Wed, 10 Sep 2014 07:04:16 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id kx10sf23764577pab.0 for ; Wed, 10 Sep 2014 00:04:16 -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=buwh5rlDerV1VIoQ2pdVg8QibH8GlGg3U+mLeo5J8lw=; b=UFKE6SAmcRFNYPt/EtgKzzgp4GUBBYYvb9vAOSBG4zSL+Al5BIPXi4G6TlG2a67Br4 SFaqATcULMt1kbLp6vjmAcMPuL17FAeUSNSF+cdNFnuo6trMVz1KpmN6F4CHA8WGklzV 6N9pdGNElZe8FbvlhCkzNLhjSIFaC+gtr8R5YAMi1lTxI3KKCUf7+OJHh6vwvDiaQgKi 4n9EWJ3MDidL4557xpzbo5dO7ff0hJjbOqx8UAxQGLPn98ChAYMVM8PrbKy5v3ZkSL4f eCgVAsoysahwxHf9KDr1twgPhUhRUS91cwNu79ftEsGePxrijDnqWnPodeUEbYMdsg8u q5Ow== X-Gm-Message-State: ALoCoQnl6zgrBetZFf7ZHoPF1iz1D0P5/dfpAFFqp7VuB2jSR/8Mp5yOvkVKVCAiYW9dvfc4CSvr X-Received: by 10.66.66.46 with SMTP id c14mr24922896pat.21.1410332656280; Wed, 10 Sep 2014 00:04:16 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.138 with SMTP id h10ls2590540qgh.87.gmail; Wed, 10 Sep 2014 00:04:16 -0700 (PDT) X-Received: by 10.220.49.10 with SMTP id t10mr18729695vcf.34.1410332656160; Wed, 10 Sep 2014 00:04:16 -0700 (PDT) Received: from mail-vc0-f176.google.com (mail-vc0-f176.google.com [209.85.220.176]) by mx.google.com with ESMTPS id i7si3439178vcp.8.2014.09.10.00.04.16 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Sep 2014 00:04:16 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.176 as permitted sender) client-ip=209.85.220.176; Received: by mail-vc0-f176.google.com with SMTP id la4so2048167vcb.21 for ; Wed, 10 Sep 2014 00:04:16 -0700 (PDT) X-Received: by 10.52.165.129 with SMTP id yy1mr8338933vdb.57.1410332656090; Wed, 10 Sep 2014 00:04:16 -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 uj3csp394605vcb; Wed, 10 Sep 2014 00:04:15 -0700 (PDT) X-Received: by 10.229.136.133 with SMTP id r5mr24721087qct.31.1410332655307; Wed, 10 Sep 2014 00:04:15 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id z5si17886544qcg.43.2014.09.10.00.04.15 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Wed, 10 Sep 2014 00:04:15 -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]:53882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRbws-0003ym-TB for patch@linaro.org; Wed, 10 Sep 2014 03:04:14 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:45170) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRbvk-0002vC-6r for qemu-devel@nongnu.org; Wed, 10 Sep 2014 03:03:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XRbve-000587-9a for qemu-devel@nongnu.org; Wed, 10 Sep 2014 03:03:04 -0400 Received: from mail-wg0-f52.google.com ([74.125.82.52]:34957) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XRbve-000582-4S for qemu-devel@nongnu.org; Wed, 10 Sep 2014 03:02:58 -0400 Received: by mail-wg0-f52.google.com with SMTP id x13so4422674wgg.23 for ; Wed, 10 Sep 2014 00:02:57 -0700 (PDT) X-Received: by 10.180.19.10 with SMTP id a10mr34228913wie.49.1410332577224; Wed, 10 Sep 2014 00:02:57 -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 wx3sm17405444wjc.19.2014.09.10.00.02.55 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 10 Sep 2014 00:02:56 -0700 (PDT) From: Ard Biesheuvel To: peter.maydell@linaro.org, qemu-devel@nongnu.org Date: Wed, 10 Sep 2014 09:02:46 +0200 Message-Id: <1410332571-10544-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1410332571-10544-1-git-send-email-ard.biesheuvel@linaro.org> References: <1410332571-10544-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: 74.125.82.52 Cc: Rob Herring , christoffer.dall@linaro.org, Ard Biesheuvel Subject: [Qemu-devel] [PACTH v4 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.176 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 --- 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[]) {