From patchwork Mon Sep 1 07:53:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 36334 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ob0-f199.google.com (mail-ob0-f199.google.com [209.85.214.199]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 49D0320C7F for ; Mon, 1 Sep 2014 07:54:39 +0000 (UTC) Received: by mail-ob0-f199.google.com with SMTP id wn1sf30652199obc.10 for ; Mon, 01 Sep 2014 00:54: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=N3uwrYeb2COdKrEQwXrIUkr2GgnUxkzVQDW9l4afEuk=; b=WNgFPRPzskzgNNT6sWrD1NShyjgPyQ/5wAWVq5GvF1Ou5v8/FAW4BnoguOPGZv0R6+ EOPOg8ZNOXzdM1IaFQTpxLWlUz7rEqEroJ4+GBwaYR2E/TRipwqJ8K7tdHpKHJtyfYxK VvF21svKBCSUDFeqAq2g08Vfxu6o/3qqJdYpeAVtv4L+7veYL5J2tGjx8G8BPBtjAjqi /BJhUa+CY2od2oj09IOtMDu1lzV2+vJKrg36Ef8pdjiJouHRoNsyQEKf6XN2lZb7p2ao 4VA/X6s8rXqBMfUtOB12bDllyeFGPEFsEmbbXu8cwAlgrEjj61y8y0gyaAvR7JUIcYCg 7IVA== X-Gm-Message-State: ALoCoQk/EhxAAmxFjYnlW4U8llSSnK2U7HfunUVHV64CjGBFG44kBTLFWgSLxWd9c6sXwphcMRYt X-Received: by 10.182.43.164 with SMTP id x4mr15392748obl.5.1409558078959; Mon, 01 Sep 2014 00:54:38 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.107.182 with SMTP id h51ls1837450qgf.80.gmail; Mon, 01 Sep 2014 00:54:38 -0700 (PDT) X-Received: by 10.52.61.136 with SMTP id p8mr20491256vdr.15.1409558078876; Mon, 01 Sep 2014 00:54:38 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id cu2si3671836vcb.107.2014.09.01.00.54.38 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 00:54:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.180 as permitted sender) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id lf12so5161355vcb.11 for ; Mon, 01 Sep 2014 00:54:38 -0700 (PDT) X-Received: by 10.52.4.69 with SMTP id i5mr19023057vdi.35.1409558078801; Mon, 01 Sep 2014 00:54:38 -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 uj3csp350178vcb; Mon, 1 Sep 2014 00:54:38 -0700 (PDT) X-Received: by 10.224.160.83 with SMTP id m19mr42236956qax.95.1409558078054; Mon, 01 Sep 2014 00:54:38 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [208.118.235.17]) by mx.google.com with ESMTPS id u6si27370qai.66.2014.09.01.00.54.37 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 01 Sep 2014 00:54:38 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; Received: from localhost ([::1]:52601 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XOMRh-0002Bd-QG for patch@linaro.org; Mon, 01 Sep 2014 03:54:37 -0400 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) X-Received: by 10.180.107.170 with SMTP id hd10mr19801014wib.77.1409558007971; Mon, 01 Sep 2014 00:53:27 -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 gh1sm23183323wib.18.2014.09.01.00.53.26 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 01 Sep 2014 00:53:27 -0700 (PDT) From: Ard Biesheuvel To: qemu-devel@nongnu.org, peter.maydell@linaro.org, rob.herring@linaro.org Date: Mon, 1 Sep 2014 09:53:17 +0200 Message-Id: <1409558001-12148-2-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1409558001-12148-1-git-send-email-ard.biesheuvel@linaro.org> References: <1409558001-12148-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.45 Cc: Ard Biesheuvel Subject: [Qemu-devel] [PATCH 1/5] 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.180 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 --- 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'; }