Received: by 10.223.185.116 with SMTP id b49csp2623917wrg; Thu, 15 Feb 2018 14:54:56 -0800 (PST) X-Google-Smtp-Source: AH8x225BxSFtTzTqG2Fo1MsVLpkycomLDeSsiKT1tZeGacUTQvHzJhHZBvlmY8rZzRz373CzNsRS X-Received: by 10.167.130.88 with SMTP id e24mr4028312pfn.169.1518735296595; Thu, 15 Feb 2018 14:54:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518735296; cv=none; d=google.com; s=arc-20160816; b=g0AkIbZSaRE4v08Y+6mfRt07tlddWMsKl8Yo4YNOuVZLMLyBcoXdGCgQz5S5rNNfCt 0LVOe+K907ZNx5ru8Tt2J0/56nf8+GSRzIbxgkuOn+Q7fMuIcQ1BUymgi1csGSHDlMN2 CvihS4b7xgXhmiIZwTT8zP9sfIo63sMUiQwtcPw6N+UwFGXpYuhnCUUpPip8ZRCe0w2i f+Xz9Op3qV4wC4ZwkFfV9q4BfTmcqzjVvh/awOYJX7iiHgXyBarSvIypeWYEDNZM7Pm8 eVs4ZkMI2QJQ++eOV8zmKTMpQA4aPIFuLuGT6aJmm/cWo91BdPZAfNQiPzbTxdbuhDiP AgVw== 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=056Jwnep2jYeZfuCSmutbT4vmFLJXQ1GmtIeJ8DHTHs=; b=NY3l4pzPSQaChWGaA5DgA9lS6rsQlK+rOnOjB9gcicXnyR8J6vW7bNR2RaYVUM0d8+ w6nLgTUl3ugmWds5sXvfBAkj+jqgwnPfJ+jpi5j2c5gRSzDPZEdpa/QpF+5W28yBjGNw oLzaoWst/NivMjd5k11o7vxxA6L5cwB1Sij71Ki2a2AhsfOTOobfGp1V01Vr1MsPI2ZS IItpfDpIMyTD2DufD6ZZ6F5tRAtehbEgNZ5e3H73b/jKqrpN2Erdz/RjH2X2ATv7WOHw xum6vzwk2I8C4EqiWYgOJzDaQ9O6ZqBm0vCGOfg1MPHF45qqrvPOUOumQFA9tf3GsM5k TQpQ== 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 d6-v6si3615752plo.489.2018.02.15.14.54.42; Thu, 15 Feb 2018 14:54:56 -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 S1164831AbeBOPdT (ORCPT + 99 others); Thu, 15 Feb 2018 10:33:19 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:56662 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1164811AbeBOPdM (ORCPT ); Thu, 15 Feb 2018 10:33:12 -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 145C6F97; Thu, 15 Feb 2018 15:33:11 +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.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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: