From patchwork Thu Apr 12 11:11:25 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Rutland X-Patchwork-Id: 133224 Delivered-To: patch@linaro.org Received: by 10.46.84.29 with SMTP id i29csp1572345ljb; Thu, 12 Apr 2018 04:13:26 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/J9BzwW6/2fIL9apF7E/WdX6l/dhdb5TI8JH7K/P933SFqh6oglLVz/uOEEjxWPanI4KuF X-Received: by 2002:a17:902:b786:: with SMTP id e6-v6mr543199pls.246.1523531606462; Thu, 12 Apr 2018 04:13:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523531606; cv=none; d=google.com; s=arc-20160816; b=kdH17xKRU9rZOPzjmuG3jnGI3yN+sBOwYm35T0n7K16ulrL6kOvbo1hY4ipah6zL7b aHA84vL0I7nxiGjVfesdLfJKY5BJwvSdtcc2QH+Gi/j7QiLn10rculFiloObL0Ocq/Il FcvbzjkEEemBwWEOCda256DgideWP0Ztsh074hGx4oD19ECI1tA7PL+rxS32q9Xq1UuU 12/f7ZyW0vMfhituw6bUpxEG5nZtvAV+egGztBunZJ30/namCGZ3UTVzFwniCzQ9zIeY X9j6DgycQYOsWXU4+QQOxR34B1Lk9xOwsDvVv6fsBydrCNOrEc/qRXWm2Kxned3FGzFg BuKw== 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=3iJU3mP3l2abBkEUbcn2WlIXX4LFqZQ7DRrRbzJlo8I=; b=f4Bjeqd68TvCdCnbowv8uKLlqgyJRKikuJEGVpnLsfSu8x8XscLM/7pcGl8O3yVJUz CxdTlsKA1zcnAtiEj8fLAZWtP845eIk4yadT83lb6SOqhY7si18PRRcTyAZznfZ1d3l5 onwZN1Ne4MyrEXMaGJdyhsxXc9sdsyt7MLaHOy0DpiKduVJfg/xUxyH426nRFNtrN33g 6KAAZt9HqJgLKFA+xn5ryAhL7v9ri65zaThdL5w2M3lw/5VRvQei0CC+Kf71U+4o3CwP uKthCFk40g46fZzV6iCSjecwONmiLEyV2CoSzV8uKMPjDkpXl5Xn26KWpN3i+ndhwKdJ Cttg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-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 v23si2494850pfk.116.2018.04.12.04.13.26; Thu, 12 Apr 2018 04:13:26 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of stable-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 stable-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752944AbeDLLNZ (ORCPT + 11 others); Thu, 12 Apr 2018 07:13:25 -0400 Received: from foss.arm.com ([217.140.101.70]:59574 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752917AbeDLLNZ (ORCPT ); Thu, 12 Apr 2018 07:13:25 -0400 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 059C480D; Thu, 12 Apr 2018 04:13:25 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 540313F24A; Thu, 12 Apr 2018 04:13:23 -0700 (PDT) From: Mark Rutland To: stable@vger.kernel.org Cc: mark.brown@linaro.org, ard.biesheuvel@linaro.org, marc.zyngier@arm.com, will.deacon@arm.com, catalin.marinas@arm.com, ghackmann@google.com, shankerd@codeaurora.org Subject: [PATCH v4.9.y 29/42] arm/arm64: KVM: Add PSCI_VERSION helper Date: Thu, 12 Apr 2018 12:11:25 +0100 Message-Id: <20180412111138.40990-30-mark.rutland@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180412111138.40990-1-mark.rutland@arm.com> References: <20180412111138.40990-1-mark.rutland@arm.com> Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Marc Zyngier commit d0a144f12a7ca8368933eae6583c096c363ec506 upstream. 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 Signed-off-by: Catalin Marinas [v4.9: account for files moved to virt/ upstream] Signed-off-by: Mark Rutland [v4.9 backport] --- arch/arm/kvm/psci.c | 4 +--- include/kvm/arm_psci.h | 6 ++++-- include/uapi/linux/psci.h | 3 +++ 3 files changed, 8 insertions(+), 5 deletions(-) -- 2.11.0 diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c index f44ecf677414..5d8ad0e6661c 100644 --- a/arch/arm/kvm/psci.c +++ b/arch/arm/kvm/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. @@ -220,7 +218,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: 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 3d7a0fc021a7..39930ca998cd 100644 --- a/include/uapi/linux/psci.h +++ b/include/uapi/linux/psci.h @@ -87,6 +87,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