Received: by 10.223.185.116 with SMTP id b49csp7394893wrg; Thu, 1 Mar 2018 05:00:54 -0800 (PST) X-Google-Smtp-Source: AG47ELuCH207ZCBs1YFhPdSohuX6SSL2NEO282B3VemvGZd8Xu4F+S3USml3BQvRuisqpgQajhgP X-Received: by 10.98.25.10 with SMTP id 10mr1861691pfz.136.1519909253991; Thu, 01 Mar 2018 05:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519909253; cv=none; d=google.com; s=arc-20160816; b=ayowBLtfeaAYEQjNOcnA3UxZ3T0AyRx4XnKE29tF+VaBBr2IIRnXnC+Oe4eCSP3J43 EFigKEym7UoSc8sQUOC0cHuF2TfDlJNVhqXSZclE1SefFvLTS/BvFaINSwASxaSZ/8R1 x6C1HjChHczPSGxlKjzSJm5hEUFVpV6+3sUM78e5odGuCQimB1Gl1WK635iVQgVbqqms M9qbY+qrQO3nmqXgrfp5F1+qRR4JyUVgBZhQxiHbFcUvwvQuUqsqfFXCKtQ6YhhDiOB1 pDcR1s+bMB9+/N4trdxYuC7jfMZmt+gdvw3nZ2NTwwoHc8/kMS86P/eORfWZ0nbiQY39 6rtw== 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:dkim-signature:arc-authentication-results; bh=Uco9yRsCAyX2xrhlinZnEESkEh5h0LM+vQPWF5wB2iw=; b=R81WhyqxqCM20evFTXnDa4L4JOjdLPKPGUg3PH6uSvujGMmTH6IjgrxntVEsk9Hu9y +5iLZbWSlb5iFLtEaPhpmXEMno0AHnF4ot5yHeANTitwZuxXUDx/d7RFdFmVTXyIkBaW 0RJLB7AG092Cy2e26o7yM80+Yh/lxLLzl0x4d4BRu3LMoEWs4BK/Nqif2Dw8peK4zhOP +H9iXnUlyHxNKfDWNLVTNhw9Z3FglEuOT/nGbymg+oylCQ+o+YSJETJaQlFtCWA0qbpl 20aEARmgkdMX2avc/miZ4XlSyG49mnEXalAbgySCx0QbQVSoVz22mJR3m6FKZ1kRDK4n GyKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JrrO13SK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i2si2454425pgq.40.2018.03.01.05.00.37; Thu, 01 Mar 2018 05:00:53 -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; dkim=pass header.i=@linaro.org header.s=google header.b=JrrO13SK; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031040AbeCAM7r (ORCPT + 99 others); Thu, 1 Mar 2018 07:59:47 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:42062 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030920AbeCAM7n (ORCPT ); Thu, 1 Mar 2018 07:59:43 -0500 Received: by mail-pg0-f65.google.com with SMTP id y8so2271933pgr.9 for ; Thu, 01 Mar 2018 04:59:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Uco9yRsCAyX2xrhlinZnEESkEh5h0LM+vQPWF5wB2iw=; b=JrrO13SKvcwBHQRGijSQbVpTUyBaiTjlMmRn1y2Jly9s2Sf4dLg5BRMnmJHbroefpB 0ZHLKaxgmP04Gfjn2ZRJ9dpcHP0If6aUUs7VPX42fm3+JymTDqOJH+MR5feJ4KfitE45 KgywRHwCYasOIWJRLFpTcjfoTJPMo9BZoXb00= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Uco9yRsCAyX2xrhlinZnEESkEh5h0LM+vQPWF5wB2iw=; b=LrgwLhX4GF8E2VL5iISaStFwKoYy9PndBdAh18kQOx87TCayMkmG5w3ZaavcnDMFUk EKXmMBh1FVX91Nu7v2Qgp8xe6PF94D9amO5ohlIdO/vNWPjyaiMKiup9i954P+0AZaWa yn3PeHcJQU6V0KoupcMm8i31liOApDZKytvgELzVku7Df8PCvZWfq1TQwheu+fNZYE1r IZrTKdAsWeKjTN20E51aVCmAREUjKpJg9SFPCqtOMjrVsqvKSZ4gwWhYNZctHTCH3bgX 3qmH3WQ2+RoVaa1w+wfoGVn6i3Bt9+q527SzHokCZfd3fptuPWE/BO6Wo49jPv7ob/BW iTVQ== X-Gm-Message-State: APf1xPAYIUUViCG3DvDbjo/omeFAMXGdl+Jp5+BhI28yCMe+OnGWkFDy BqgWhDQLWYPmf1qwugqsKulJfw== X-Received: by 10.99.140.29 with SMTP id m29mr1527259pgd.320.1519909182749; Thu, 01 Mar 2018 04:59:42 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id x4sm2289655pfb.46.2018.03.01.04.59.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 01 Mar 2018 04:59:42 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Alex Shi Subject: [PATCH 32/45] arm/arm64: KVM: Add PSCI_VERSION helper Date: Thu, 1 Mar 2018 20:54:09 +0800 Message-Id: <1519908862-11425-33-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> References: <1519908862-11425-1-git-send-email-alex.shi@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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: Alex Shi --- arch/arm/kvm/psci.c | 2 +- include/kvm/arm_psci.h | 6 ++++-- include/uapi/linux/psci.h | 3 +++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/kvm/psci.c b/arch/arm/kvm/psci.c index 18f9e9d..4adfa28 100644 --- a/arch/arm/kvm/psci.c +++ b/arch/arm/kvm/psci.c @@ -219,7 +219,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 2042bb9..5659343 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 3d7a0fc..39930ca 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 -- 2.7.4