From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51667) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOMQh-0001GE-GG for qemu-devel@nongnu.org; Mon, 01 Sep 2014 03:53:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XOMQa-0006mq-UV for qemu-devel@nongnu.org; Mon, 01 Sep 2014 03:53:35 -0400 Received: from mail-wg0-f45.google.com ([74.125.82.45]:39192) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOMQa-0006mj-Oq for qemu-devel@nongnu.org; Mon, 01 Sep 2014 03:53:28 -0400 Received: by mail-wg0-f45.google.com with SMTP id k14so4887639wgh.4 for ; Mon, 01 Sep 2014 00:53:28 -0700 (PDT) From: Ard Biesheuvel Date: Mon, 1 Sep 2014 09:53:17 +0200 Message-Id: <1409558001-12148-2-git-send-email-ard.biesheuvel@linaro.org> In-Reply-To: <1409558001-12148-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409558001-12148-1-git-send-email-ard.biesheuvel@linaro.org> Subject: [Qemu-devel] [PATCH 1/5] target-arm: add powered off cpu state List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, peter.maydell@linaro.org, rob.herring@linaro.org Cc: Ard Biesheuvel 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 --- target-arm/cpu-qom.h | 1 + target-arm/cpu.c | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/target-arm/cpu-qom.h b/target-arm/cpu-qom.h index 07f3c9e86639..f71f6a4ccc6b 100644 --- a/target-arm/cpu-qom.h +++ b/target-arm/cpu-qom.h @@ -98,6 +98,7 @@ typedef struct ARMCPU { /* Should CPU start in PSCI powered-off state? */ bool start_powered_off; + 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'; } -- 1.8.3.2