Received: by 10.223.176.5 with SMTP id f5csp2644567wra; Thu, 1 Feb 2018 03:53:52 -0800 (PST) X-Google-Smtp-Source: AH8x226PkD2+rpAD8JfsDXF598SUH/W8w5YLOaXVvsiZpvxxsEj9L8D9J6b7q1TaS2zkajB3VVVH X-Received: by 10.98.129.194 with SMTP id t185mr36386802pfd.228.1517486032026; Thu, 01 Feb 2018 03:53:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517486023; cv=none; d=google.com; s=arc-20160816; b=lPj0pj3EUiSDoz2shd1LToOrap4rMDO1c68tnIFVVmXNP4BvK1M2ZK+6LvyjNAqClj E7hvZwtL96oYwT2udkqwFj3t4HPc7rUN4LfXETocjCZizazZ57JQ9I27026Zk/lvZZd+ wyu4lyHdSwcZZOx2gQe9zhJ+Bb3JXGPzdUKFgdsmQNC40ZFuRo8fK414iNGXj/kU9MgC p3mx9GiZx/WKtFq1/47PvTIGgSw6an5nBCCAzkGBamiGLJ4EXSHgmYkjIvEuBTKJYzbW zGUN7vWJxzm5dB5foE98AThnY/bYE1+nPgFSzS/lMqOJW49zKWhbkrDYwFFkpzLL4y7T 4CIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Vww9Bz80plwbtKAHySUX9ehFBlPcoan2Pp/z8+NNDQE=; b=PYoLhZDjn3yUxbWKpYQHrF6j7Ds1/ZFCwxfR33Gs8mQfF0VvQ0wRuS3zUJmCjgk0qS x6pnVwmPy04z29+gbTGl8DBz336G6L/iU4WWIhL9O/z0q+1J1H51iF0KSTq93sDxLF/k HcB3HS/D2zloIswDO67ljhboNRMZWqnRj4pJDFdbeYSzCGPr0DLjLzViDmqZtvmHc+rT jYXJBCRK4THw6ZSE50OCvEEdPfargvfrufXIg777P7m1mWzZO8Np0Qc73gwBqfJ95oPs q0ekl8x5RszavAfwg+x8NzNiJ9aoT92O02oSqqCZdZQEYeoCv2YQMMM3mex+Z3gjWHLV 4D8Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g3-v6si3180377plb.331.2018.02.01.03.53.29; Thu, 01 Feb 2018 03:53:43 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752645AbeBALvU (ORCPT + 99 others); Thu, 1 Feb 2018 06:51:20 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:48364 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752429AbeBALrw (ORCPT ); Thu, 1 Feb 2018 06:47:52 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D1FF71529; Thu, 1 Feb 2018 03:47:51 -0800 (PST) Received: from approximate.cambridge.arm.com (approximate.cambridge.arm.com [10.1.207.62]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 1531D3F25C; Thu, 1 Feb 2018 03:47:48 -0800 (PST) From: Marc Zyngier To: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: Catalin Marinas , Will Deacon , Peter Maydell , Christoffer Dall , Lorenzo Pieralisi , Mark Rutland , Robin Murphy , Ard Biesheuvel , Andrew Jones , Hanjun Guo , Jayachandran C , Jon Masters , Russell King - ARM Linux Subject: [PATCH v3 05/18] arm/arm64: KVM: Add PSCI_VERSION helper Date: Thu, 1 Feb 2018 11:46:44 +0000 Message-Id: <20180201114657.7323-6-marc.zyngier@arm.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180201114657.7323-1-marc.zyngier@arm.com> References: <20180201114657.7323-1-marc.zyngier@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org As we're about to trigger a PSCI version explosion, it doesn't hurt to introduce a PSCI_VERSION helper that is going to be used everywhere. Signed-off-by: Marc Zyngier --- include/kvm/arm_psci.h | 6 ++++-- include/uapi/linux/psci.h | 3 +++ virt/kvm/arm/psci.c | 4 +--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/kvm/arm_psci.h b/include/kvm/arm_psci.h index 2042bb909474..5659343580a3 100644 --- a/include/kvm/arm_psci.h +++ b/include/kvm/arm_psci.h @@ -18,8 +18,10 @@ #ifndef __KVM_ARM_PSCI_H__ #define __KVM_ARM_PSCI_H__ -#define KVM_ARM_PSCI_0_1 1 -#define KVM_ARM_PSCI_0_2 2 +#include + +#define KVM_ARM_PSCI_0_1 PSCI_VERSION(0, 1) +#define KVM_ARM_PSCI_0_2 PSCI_VERSION(0, 2) int kvm_psci_version(struct kvm_vcpu *vcpu); int kvm_psci_call(struct kvm_vcpu *vcpu); diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h index 760e52a9640f..b3bcabe380da 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -88,6 +88,9 @@ (((ver) & PSCI_VERSION_MAJOR_MASK) >> PSCI_VERSION_MAJOR_SHIFT) #define PSCI_VERSION_MINOR(ver) \ ((ver) & PSCI_VERSION_MINOR_MASK) +#define PSCI_VERSION(maj, min) \ + ((((maj) << PSCI_VERSION_MAJOR_SHIFT) & PSCI_VERSION_MAJOR_MASK) | \ + ((min) & PSCI_VERSION_MINOR_MASK)) /* PSCI features decoding (>=1.0) */ #define PSCI_1_0_FEATURES_CPU_SUSPEND_PF_SHIFT 1 diff --git a/virt/kvm/arm/psci.c b/virt/kvm/arm/psci.c index b322e46fd142..999f94d6bb98 100644 --- a/virt/kvm/arm/psci.c +++ b/virt/kvm/arm/psci.c @@ -25,8 +25,6 @@ #include -#include - /* * This is an implementation of the Power State Coordination Interface * as described in ARM document number ARM DEN 0022A. @@ -222,7 +220,7 @@ static int kvm_psci_0_2_call(struct kvm_vcpu *vcpu) * Bits[31:16] = Major Version = 0 * Bits[15:0] = Minor Version = 2 */ - val = 2; + val = KVM_ARM_PSCI_0_2; break; case PSCI_0_2_FN_CPU_SUSPEND: case PSCI_0_2_FN64_CPU_SUSPEND: -- 2.14.2