Received: by 10.192.165.156 with SMTP id m28csp234930imm; Tue, 17 Apr 2018 09:15:25 -0700 (PDT) X-Google-Smtp-Source: AIpwx48ea2oSxuPoPNmLswy4ghJS4YxyDyR/HQgXFWWuSEhqlKm/aND55dHayfh6QEQ1x64isfT4 X-Received: by 10.101.99.16 with SMTP id g16mr2283270pgv.328.1523981725489; Tue, 17 Apr 2018 09:15:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523981725; cv=none; d=google.com; s=arc-20160816; b=Ks03sRIVEwToZNDy5L5L0Bynbk3mBbVFtqHmcvFrCbpSKrQALPUbpCY1RWaWQSxOan 66tW2pxnSM9BZGnfsde+UcrlICsGuWow/GD7Y469LauXW7rih/ME0FmeCOKpJUMGHzAM JVSuiMrDKSBnOa8QBSt/MeMTuGtPCShZgWvRtweI63C3+NIGJjDvLcg8vHGlXPZ6gbZa ofGhk0/KaDjYdPTAqRXatT/4GGzgLxru76OqEjlfa1q9d4oMgeiw8LtpfWCkjcQWKIyS N7IYHZ+B1voJuDT5+CRa+mAfPfAezxRGhT6np7yGE7OVUc4tCkJSClm894KmBsITDk3W GJ0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=faFrD4ub1WtVBZQdhZt+2Ib48MtqK4Imhgoy0ItBHKo=; b=IsU0aRUr5fXa/l9R9OvnTMJ8RsM6mZp+jbg84DA0Ch6xVxIR4oQtPe9n7ZY9WKdcyq ZTTvRcL8oBGOtI8uuwZhK/lS70nhPgR24SxlWAGpKEdXMwAU+GY7t5FiigxD8QXjUg0H LnoISFtWLlkV9MB0efL/uI6HD6YAMKhco3dhUa2vq2dRS28jrFRlqAHqPcyVbHLW4v/I 3iNATxeoyYHfT2w42qScYA30MCwcfhxqg78YvtUacG6BfO5F6c7MLQ+SAwpgOoA6AkHt shW7d7F/AaWuFUdhBQhJ6zGbqPbyhwED6c3URUMWKxK1phHV+80YJKdHaqWS4G+/sSI4 EM9A== 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 y72si13204471pfi.46.2018.04.17.09.15.11; Tue, 17 Apr 2018 09:15:25 -0700 (PDT) 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 S1755973AbeDQQLE (ORCPT + 99 others); Tue, 17 Apr 2018 12:11:04 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:36584 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755944AbeDQQLB (ORCPT ); Tue, 17 Apr 2018 12:11:01 -0400 Received: from localhost (unknown [46.44.180.42]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 270FAD6A; Tue, 17 Apr 2018 16:11:01 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Christoffer Dall , Ard Biesheuvel , Marc Zyngier , Catalin Marinas , Greg Hackmann , Mark Rutland Subject: [PATCH 4.9 37/66] arm/arm64: KVM: Add PSCI_VERSION helper Date: Tue, 17 Apr 2018 17:59:10 +0200 Message-Id: <20180417155647.481213836@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180417155645.868055442@linuxfoundation.org> References: <20180417155645.868055442@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Mark Rutland 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] Tested-by: Greg Hackmann Signed-off-by: Greg Kroah-Hartman --- 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(-) --- 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_ * 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: --- 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 @@ -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