From patchwork Thu Mar 1 12:54:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 130210 Delivered-To: patch@linaro.org Received: by 10.80.172.228 with SMTP id x91csp2764000edc; Thu, 1 Mar 2018 04:59:50 -0800 (PST) X-Google-Smtp-Source: AG47ELv4JCEwlTCJvGqs9YsZRXC85Y2NNAba0vfkC9gckN1xMiGaDfV0kn0xxq1Ys6OhDlucf1hb X-Received: by 2002:a17:902:7445:: with SMTP id e5-v6mr1868633plt.204.1519909190597; Thu, 01 Mar 2018 04:59:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519909190; cv=none; d=google.com; s=arc-20160816; b=N8fuwEzhWY0vnhrpdm4HGzSt0GBAV0dNVd9OkxP+eCu3OqKZPoI6WrJAGKOjRrWhfg yywYDt+uVOLIe6cUWxkwgKiKXoAfLJTZnqStvAjDFz4JGyxwsMgGqqvyv3Ah3UeJ3Vin +mJx5FZU7fSTH2hfC2bs+4lPXvEElQAZmNn2Ue13FlbHI5hD+yXo8BRqGugzm4Gdfpuz 0WrRpeFWdvde930nATby5InEuNDTZnSgi10au/atpdLkdONDeb426VDWEQdBoOZ0Iz9n y3l/NnPrZ07gb//2Hl6ioFoMJ/hAp/olOM9EmbYQKPPSgDi7QhkwefC8bHWvprlxuapR jtbA== 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 a4si2448513pgn.327.2018.03.01.04.59.50; Thu, 01 Mar 2018 04:59:50 -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 S1030922AbeCAM7r (ORCPT + 28 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(-) -- 2.7.4 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