Received: by 10.223.185.116 with SMTP id b49csp2238857wrg; Thu, 15 Feb 2018 08:34:33 -0800 (PST) X-Google-Smtp-Source: AH8x226YTsrnuRo+TAGOsTNJQQunaZ1cJ1qGhVd4Ypemxt86Sn06VTPEdBfV7pwhVtLjXux8pbcX X-Received: by 10.99.160.80 with SMTP id u16mr2610110pgn.389.1518712472939; Thu, 15 Feb 2018 08:34:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518712472; cv=none; d=google.com; s=arc-20160816; b=RlF27u6hEYDs0PiLfJ951Hzl3RtDjofGz1GOvSWTKwK+5PPTQnUtHGnNfwWPkB2pCu c5nc1KkzmzjZy0jB4a+k1W95XQtjnzjxf9PUtEN2eePM0L8t0cM1hj3ZYBY640xNnGrV gucBOinafwSC3PNYx0dNhp03vc+zTEtTiIqJfO2SrALXvlcBul/hptzm3wvQBd/Nnv8N pwlhiPvauqXcx/MQFWusnFT90uPIzXg+hf9VGripj6VTEMhYVyzy/rRxo11Mn9MVZ69w CRlaACqb6xZkv8H+sakHKgV6esbjSaetMILFm7xqpvyHZpt+ZQMpY49z8pqeFOzjw5RH xQww== 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=1B/KvN3RrHJCQsG8pKVDcVEmzfuYylXy4CTaf2FBV8M=; b=DZwpbWgLkeAmsmhixY4o9oGBvLs68kby22laBqEgp0qNRdF598ndPiyQUEP0vqa5PG 8e7qMX7Vxyz/49xM6Kk4WAmizHKnOSpWV3w5D+ohIvudkBCsAd6qfhikkq4cgjmITV07 ijvSAmppcN2p2/cVDC2hpkHrYgcMjRNZFQcpu55Q1he2ZRXB7vjCObDuYEgcAYRS8C93 EPEtjLNhjyv5ltUF6RoTTua9pzr3g9/YtlLh1/EVhjxnw+zEahNbeXb9Tq+LZPbb9t0N R/2uRsUggqE+XNaQAaa4/D+ytGBKqzOG7jSC3eoHUXRijRfYy38tcWhNoWdkZBd2jhdC Iytg== 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 l10si1628991pgf.460.2018.02.15.08.34.17; Thu, 15 Feb 2018 08:34:32 -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 S1425950AbeBOQdI (ORCPT + 99 others); Thu, 15 Feb 2018 11:33:08 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:32952 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424041AbeBOPl4 (ORCPT ); Thu, 15 Feb 2018 10:41:56 -0500 Received: from localhost (LFbn-1-12258-90.w90-92.abo.wanadoo.fr [90.92.71.90]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 3968EF91; Thu, 15 Feb 2018 15:41:55 +0000 (UTC) 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.15 074/202] [Variant 2/Spectre-v2] arm/arm64: KVM: Add PSCI_VERSION helper Date: Thu, 15 Feb 2018 16:16:14 +0100 Message-Id: <20180215151717.364509633@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180215151712.768794354@linuxfoundation.org> References: <20180215151712.768794354@linuxfoundation.org> User-Agent: quilt/0.65 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.15-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: 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: