From patchwork Mon May 5 08:57:11 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: PranavkumarSawargaonkar X-Patchwork-Id: 29619 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 5DB992055D for ; Mon, 5 May 2014 09:01:04 +0000 (UTC) Received: by mail-pa0-f69.google.com with SMTP id fa1sf1865304pad.8 for ; Mon, 05 May 2014 02:01:03 -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=V9g7td6aym3ItJz+tKeTcizh+5S1XVh2U82sV95ci20=; b=g++wLvEkwh6+7ouRZs1t7km0/t7WVJUbzIEiqRSqlKhNHASZ/eN0RWmctw8B65he/3 PFSDCbwXsw7Be3n4yg2REb5iqYV6Rmeie/eJbz0gH4FSedz8bBOkNwAf4lQvQSHIGJAK SZJPBj0XOokFgYluOvchLUSZ1oVrLw8vQPWQRF9upJNnSDQewUUT7mRltavx6p5JqQKk 3ehdUINS0bRaoH55AKMcxDKtamKdpZtSCsl9161uhbeYbIK0A+leFgXoleAH6OFCBryZ VnDVVEJf0IvhIfjE9fw5NDPQVplcgZmIq2KVtCDe7tMw1QmJFJNtkZW3B1jW+vkYAebg bjww== X-Gm-Message-State: ALoCoQkGBp7jK1bWorhuGCbBCTxLxWJPASXZFv6BY39HErR8yihHnr+mUALhhkQOc9xcbMkFBFFh X-Received: by 10.66.124.168 with SMTP id mj8mr16293124pab.29.1399280463383; Mon, 05 May 2014 02:01:03 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.104.234 with SMTP id a97ls381773qgf.51.gmail; Mon, 05 May 2014 02:01:03 -0700 (PDT) X-Received: by 10.220.163.3 with SMTP id y3mr27390367vcx.7.1399280463237; Mon, 05 May 2014 02:01:03 -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 sn5si1420799vdc.11.2014.05.05.02.01.03 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 02:01:03 -0700 (PDT) Received-SPF: none (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id hq16so8378157vcb.11 for ; Mon, 05 May 2014 02:01:03 -0700 (PDT) X-Received: by 10.220.69.72 with SMTP id y8mr27245213vci.21.1399280463146; Mon, 05 May 2014 02:01:03 -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.220.221.72 with SMTP id ib8csp124065vcb; Mon, 5 May 2014 02:01:02 -0700 (PDT) X-Received: by 10.224.166.9 with SMTP id k9mr43390445qay.25.1399280462077; Mon, 05 May 2014 02:01:02 -0700 (PDT) Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v9si3072583qar.105.2014.05.05.02.01.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 05 May 2014 02:01:02 -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]:56093 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhElh-0000j8-PH for patch@linaro.org; Mon, 05 May 2014 05:01:01 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46056) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhEjq-0006pU-EK for qemu-devel@nongnu.org; Mon, 05 May 2014 04:59:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WhEji-0007Aa-Ax for qemu-devel@nongnu.org; Mon, 05 May 2014 04:59:06 -0400 Received: from mail-pa0-f54.google.com ([209.85.220.54]:50777) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WhEji-0007AK-6Z for qemu-devel@nongnu.org; Mon, 05 May 2014 04:58:58 -0400 Received: by mail-pa0-f54.google.com with SMTP id lf10so9004718pab.41 for ; Mon, 05 May 2014 01:58:57 -0700 (PDT) X-Received: by 10.66.252.135 with SMTP id zs7mr69530684pac.13.1399280337204; Mon, 05 May 2014 01:58:57 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id zv3sm66118407pab.20.2014.05.05.01.58.36 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 05 May 2014 01:58:55 -0700 (PDT) From: Pranavkumar Sawargaonkar To: qemu-devel@nongnu.org Date: Mon, 5 May 2014 14:27:11 +0530 Message-Id: <1399280234-25036-4-git-send-email-pranavkumar@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1399280234-25036-1-git-send-email-pranavkumar@linaro.org> References: <1399280234-25036-1-git-send-email-pranavkumar@linaro.org> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.85.220.54 Cc: peter.maydell@linaro.org, Anup Patel , patches@apm.com, robherring2@gmail.com, kvmarm@lists.cs.columbia.edu, christoffer.dall@linaro.org, Pranavkumar Sawargaonkar Subject: [Qemu-devel] [RFC PATCH V4 3/6] target-arm: Enable KVM_ARM_VCPU_PSCI_0_2 feature when possible 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: pranavkumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: patch+caf_=patchwork-forward=linaro.org@linaro.org does not designate permitted sender hosts) 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 Latest linux kernel supports in-kernel emulation of PSCI v0.2 but to enable it we need to select KVM_ARM_VCPU_PSCI_0_2 feature using KVM_ARM_VCPU_INIT ioctl. Also, we can use KVM_ARM_VCPU_PSCI_0_2 feature for VCPU only when linux kernel has KVM_CAP_ARM_PSCI_0_2 capability. This patch updates kvm_arch_init_vcpu() to enable KVM_ARM_VCPU_PSCI_0_2 feature for VCPU when KVM ARM/ARM64 has KVM_CAP_ARM_PSCI_0_2 capability. Signed-off-by: Pranavkumar Sawargaonkar Signed-off-by: Anup Patel --- target-arm/kvm32.c | 5 ++++- target-arm/kvm64.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/target-arm/kvm32.c b/target-arm/kvm32.c index a690d99..cd9ac03 100644 --- a/target-arm/kvm32.c +++ b/target-arm/kvm32.c @@ -182,7 +182,10 @@ int kvm_arch_init_vcpu(CPUState *cs) init.target = cpu->kvm_target; memset(init.features, 0, sizeof(init.features)); if (cpu->start_powered_off) { - init.features[0] = 1 << KVM_ARM_VCPU_POWER_OFF; + init.features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF; + } + if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) { + init.features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2; } ret = kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_INIT, &init); if (ret) { diff --git a/target-arm/kvm64.c b/target-arm/kvm64.c index e115879..bc6cd74 100644 --- a/target-arm/kvm64.c +++ b/target-arm/kvm64.c @@ -90,7 +90,10 @@ int kvm_arch_init_vcpu(CPUState *cs) init.target = cpu->kvm_target; memset(init.features, 0, sizeof(init.features)); if (cpu->start_powered_off) { - init.features[0] = 1 << KVM_ARM_VCPU_POWER_OFF; + init.features[0] |= 1 << KVM_ARM_VCPU_POWER_OFF; + } + if (kvm_check_extension(cs->kvm_state, KVM_CAP_ARM_PSCI_0_2)) { + init.features[0] |= 1 << KVM_ARM_VCPU_PSCI_0_2; } ret = kvm_vcpu_ioctl(cs, KVM_ARM_VCPU_INIT, &init);