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: 10251429 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C0CDC60211 for ; Thu, 1 Mar 2018 13:36:50 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AF5FF1FFE5 for ; Thu, 1 Mar 2018 13:36:50 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3B2D201BD; Thu, 1 Mar 2018 13:36:50 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 367191FFE5 for ; Thu, 1 Mar 2018 13:36:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=xmgiFRv6UljxWZ8WLK2aXPGxXfApN2amnT5m4Dp1wSo=; b=qfT2Og47xANn0eGPl7U1W8T+Yh ntJTrLtfDobWfWRXYFreHgcbXrqLd/0WD1TtBbxiYtFR7rJiq1jE/cXspj+OEAtSFxWUB1jvOxU4S FGFj/xjsdOZxiaiQB0TDHelNYrAS7CFVlehNukJoCDRZKwHzgHys4Ph8UefK0NSivTmCkuB+iIf5x txnXuGm0nV/9qKtjaVqinWWp+NXqCznkVFlfrgYOjfetKSyTRc6dtnHKsJLa7NqEsEhZjjMk8COdv dnTmLaUUXYYOK1PloSlsWuxc5AAWFR08VZLqF0u8fMnal7XiMYnpD0PhseQPoRLfVcbJzwTnpye5X gYLIP0tw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1erOO0-00006e-F1; Thu, 01 Mar 2018 13:36:40 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1erOHH-0001sV-Jz for linux-arm-kernel@bombadil.infradead.org; Thu, 01 Mar 2018 13:29:43 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=Uco9yRsCAyX2xrhlinZnEESkEh5h0LM+vQPWF5wB2iw=; b=mmtD2Wa34kjTotv+nd17hXP0q wOufaB3ExfIXKhQsRidBs1L558i1rhsOOsjVls8OC2XEfoY4VXzi+6gJRRFcvBmqLn8iX0QLnep0l v5hwvTiJ8v6/QDDphTZkVnJMH7l8wOEL4xCKx08wqu6BjO0ic7Nn3NZgKthewwp9wxEYRIu6Ub0x9 kGXJ6zbxSyTCR7HtpZvE2ap2AXV2bR4NtESC6+orJ2IgUHmtLeHjXsOK/cYJ6ElbXMcv55Em+OjDP g03gZY5JrAhv1cnDqM04A3C811OwpXL/0UsucuNbBtUnNBqJEY7okY1pDO3ilmh0ApB1mmkLhDNlc 0KW9QRmzQ==; Received: from mail-pg0-x243.google.com ([2607:f8b0:400e:c05::243]) by merlin.infradead.org with esmtps (Exim 4.89 #1 (Red Hat Linux)) id 1erNoQ-0002Ki-Sk for linux-arm-kernel@lists.infradead.org; Thu, 01 Mar 2018 12:59:55 +0000 Received: by mail-pg0-x243.google.com with SMTP id q27so2268943pgn.8 for ; Thu, 01 Mar 2018 04:59:44 -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=UCcLX2HnG1tRcv11ayCqsiMPmpcBDHOqboE3VZZjUfJx/3+CcBBg5egKEWts0/LvZq WNhGB1hb7dXd79k825ajbDmB6tRwjIMXGsTQWSAjQgUnv9tKcdzilIwe23/7BozkUdyQ A0jR98wne03yDR/RPKTtI5nSWJrBNHt5Qkeq0uamLtsGmx0sIOOCXiXwc8fYAfDf8Jb+ oznJk0zOJ+ClSgCzje+b2T1f1B27ylIijEAwPTSf2PU4qR+jm8bnrEJSNRbZu1vJ9q6L gUXvD/Qsm8Pf2ULpqVckLRisAmJB1YoFP6JsnskjvEYuaQsRPvVxZsuKykWtJm88LUlY NStA== X-Gm-Message-State: APf1xPBUdxfE3Ufo3HznYrE9sbgyqPSmnLLThqrU+CP6iSJaUWhBf/89 aHtyxBZff+UQQ4+f999z91HKnQ== X-Google-Smtp-Source: AG47ELtgfWbT6DAQoasmhgNMA4nzzDjk3XBP0b2caTBqmd+4qLYlglVuGhGjSnIeGCN9gxJmjDgOdQ== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180301_075954_957031_8E5D4637 X-CRM114-Status: GOOD ( 14.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alex Shi MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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