From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x227BQXmXoM1O3BEarK7Ti7Ap6xIR5rhfQKlEtM6+Kghk+xtR/Z4s5TgELAlde3+pZqD2E358 ARC-Seal: i=1; a=rsa-sha256; t=1518708793; cv=none; d=google.com; s=arc-20160816; b=p+2Pw00W3nI5gHlVYsX47Wy0sTnY//qRzdh44XaVOrOolDj26rZ2gi3xnmA9uFRbVz JxIxjX9iVwej12gsC9cuTF6+MbdBioRcHGk98MdolXMgPYIJ37Pnfhe7N3cGP2WlsrDg LW1d3anyxdmezZJgYBFy60uJCIQMJvzFwb5r7PH+DOnCm01pbxrCiT8VMFthjwqTBgRR i74/ZWHUS7EUAGNR9kQ8Tm7O/CxNNAFsxX75T5ON/aY/5rUa7DqBMqhevqfZ2seZpIBd gV6YpOLhL59AjyKRaINiEFWsw15Uj2DyDI/m28rpyKlwUs6SaWEF4IBlaWPKHbXig6+f Bdvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=056Jwnep2jYeZfuCSmutbT4vmFLJXQ1GmtIeJ8DHTHs=; b=Pfj4xBk8uoGDqYrlkeCk9DYZTFrlrgXLXgPB0H0/ruhwOgafUHP22EjYd10/0jWij+ r35fv0M7zjmAJNil/PC48yo3xafaJvnVOIZz0S9oaDyeMDyPKS5qHHag9RpMnetypQa8 4h4VjrNbvoIxOwTnS2vkFGLzSZ35V+jB6vMkelW7etdlXKvHb8ui4lX2HgaCDzL8eD4K +UKcYYVJOf1Hqfj52WvGj7heOUmXZUVAWPqOARwJUs51eLGHWgosz6RkYfwftiwd3ovU GtZmGYpJlNrKXVcxb3dtEshoQ7EWuhtOY2ZUUSJVSI4XlDTMq8ciwjmTiM4hrffVzTXb mOJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoffer Dall , Ard Biesheuvel , Marc Zyngier , Catalin Marinas , Will Deacon Subject: [PATCH 4.14 081/195] [Variant 2/Spectre-v2] arm/arm64: KVM: Add PSCI_VERSION helper Date: Thu, 15 Feb 2018 16:16:12 +0100 Message-Id: <20180215151709.749795300@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151705.738773577@linuxfoundation.org> References: <20180215151705.738773577@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1592481591958290613?= X-GMAIL-MSGID: =?utf-8?q?1592481591958290613?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marc Zyngier Commit d0a144f12a7c 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 Signed-off-by: Will Deacon Signed-off-by: Ard Biesheuvel Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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); --- 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 --- 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_ * 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: