Received: by 10.223.176.5 with SMTP id f5csp955059wra; Tue, 6 Feb 2018 10:03:26 -0800 (PST) X-Google-Smtp-Source: AH8x227ux3+jeWAF2FdI3MXuBGWK73jT+KxXNkhk2vn4XhGtAfhvFpIFOVrDNgtcXRmURuLxk92U X-Received: by 10.98.224.24 with SMTP id f24mr3189044pfh.157.1517940206404; Tue, 06 Feb 2018 10:03:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517940206; cv=none; d=google.com; s=arc-20160816; b=Y/UXj0uxX14svuxdaSjnNcoqSQx8iB+2DWREwwRCvfgyHfufGxinn+kQo9rsyoXhGk StutFqQP/2bByqEjKQlEp8GAc0mMNDuz1Fwwsj8AS4z2kQ21B+j2eF3a5/6RD7qXsnfh ddqG6rN+i60TWhPO3Bxu/xOv11fYfq8j5KgUYNi24VZY/ZZ0atGzTht8xoHrm67VoNjX INdbFBqFmyBR72Wq9yJ5bF2hF+nKWART4GMU37XpiG+fpbGvhbmqsmrGZSOSZp4I6mo0 e1CMHbt5BIghbQF97vFMP08JTTT9Bnq2zFlFRky34mWTgY5YrnBdXrRrold0DY9j36Ek Uo2w== 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=XnZDhzJTyjmSgZ3b8GAyhrLq2Z8O0uZlFRlFr5RdQA0=; b=s4p98KzNbaVmTEZ2k1Gnko23KzIrGB1nvk+ZUEOPtcH5kmSircEE6meb7W5IdnXfkY xw4NS+gXtbKWE0OAjlAKQC0YU3oSlZ0GgPrTVz5F8biutLVJ35/7tlT2fa/wDqcdD41i npF231apkVcFHelyUyRaHbUiY3/IKOIAsq/qfgP+/IsATEEabU6BgIvxtzYuVddjhEQ2 Q7Kn5N4SI3IIJyOAkO0kfIU+ZJ+CsiimcApS5Vu8gzDq6F8WKzjGD8YUkYmZ3zRxXNoI 6i82R73gUZD3gJCym+0hQoRxj7UCexmI0dUs/kYTAzWgSRJAAT61FA4JXvjSAwigIJTI r03A== 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-v6si1757146plt.528.2018.02.06.10.03.10; Tue, 06 Feb 2018 10:03:26 -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 S1753019AbeBFSBR (ORCPT + 99 others); Tue, 6 Feb 2018 13:01:17 -0500 Received: from foss.arm.com ([217.140.101.70]:41008 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752738AbeBFR5B (ORCPT ); Tue, 6 Feb 2018 12:57:01 -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 417F21682; Tue, 6 Feb 2018 09:57:01 -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 941363F25C; Tue, 6 Feb 2018 09:56:58 -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 v4 05/17] arm/arm64: KVM: Add PSCI_VERSION helper Date: Tue, 6 Feb 2018 17:56:09 +0000 Message-Id: <20180206175621.929-6-marc.zyngier@arm.com> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20180206175621.929-1-marc.zyngier@arm.com> References: <20180206175621.929-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. Reviewed-by: Christoffer Dall Tested-by: Ard Biesheuvel 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