From patchwork Mon Feb 26 08:20:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alex Shi X-Patchwork-Id: 129585 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp3357928lja; Mon, 26 Feb 2018 00:25:11 -0800 (PST) X-Google-Smtp-Source: AH8x225o+RHGaMEOf1wxmspVIEu/9+lh363GcE+oiQFlMm20AIvKb+Eh0qJjxRsz+5lZIRPNXJXe X-Received: by 10.98.252.22 with SMTP id e22mr9793266pfh.235.1519633511724; Mon, 26 Feb 2018 00:25:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519633511; cv=none; d=google.com; s=arc-20160816; b=BOYBuhQ0vhVw0+tOMLdVhScLiydy3xFNRF6sC6EBACxG7V5+tBwhCAvFw2MzQoFYLF z02hnwrDZt8+Pg0i0DNCIq/TfNTnhGD7KiC/6F94kgKjcJV0JIk60yJOuW5zAGZITq1y p5ZMwK5HMvzSP5blNeW0xbWL/uhPjGjxWWUSiQAgkwTSkYdPKKpScVAt8wtpbDkc4USa JM7CHZgwiVu6Yzr806QINLHWbSUsjuwMv7NYveisom/p7+3lzjzBmDuFn5tFzAJ0yPBI JrzC0KVazOJ2Fe0UZsoaigM5S3yn6Bt3zEU+BTtGiSluVQtsbwBKwj9aG3WpkE5jolWZ /3jg== 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:to:from:dkim-signature:arc-authentication-results; bh=g9Ng8TgnacRSykLoS2YGMqnSYcIU1gnnnP+liPtKoOA=; b=t5oiC3TZYgrCX5LB7F3yYvX7iRvW1rCgeekFEalMqqKRyce6mO8xjIasUx+z3DRpJI XAvjA1kd6wTLf42ZIoLpIMEG3+uI/UW3vyUJ0gQTjYo4gIhpK+9ZHcN+7xZREejZEhjI KmTm/YK8XIQGyxS6qOqLiU7BOwNRZnwmJyDfATJsZedD3rYWYpOa+fuGmN6+vnRpxP1F GhXfsS5BouSk7fbH0iMUXcCl1a70fiP/CIldTnGLkSbVYLm+IMEHaXiQ4hCURRQYO3wx 5w447rbrjPdd4RACjq3vvfrH/NGZYkJt3qv9FuTpSnxoDNfqU1cd9xQeGjl5b8EHqIK1 /vXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Z3fkc5G6; 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 u13-v6si6387903plq.823.2018.02.26.00.25.11; Mon, 26 Feb 2018 00:25:11 -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=Z3fkc5G6; 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 S1752394AbeBZIZJ (ORCPT + 28 others); Mon, 26 Feb 2018 03:25:09 -0500 Received: from mail-pg0-f66.google.com ([74.125.83.66]:42999 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752018AbeBZIZD (ORCPT ); Mon, 26 Feb 2018 03:25:03 -0500 Received: by mail-pg0-f66.google.com with SMTP id y8so5907040pgr.9 for ; Mon, 26 Feb 2018 00:25:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=g9Ng8TgnacRSykLoS2YGMqnSYcIU1gnnnP+liPtKoOA=; b=Z3fkc5G6AaPvHMIyYUJ0hpodFa2KfJZhApW5PIzv5A0E2GlMFUogJMy96bkggOTldY 3zblREGo5hKP1TB2MCe0cXodcbJGeu97Cci3t264kY+2FyUdd/LgPZoOlnQwaTIT+Kx4 1bH5nL05InMhRtQvatSZLf8XZ+MZgspvu2Smc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=g9Ng8TgnacRSykLoS2YGMqnSYcIU1gnnnP+liPtKoOA=; b=k6PIgBlLq9ioShFf0IETNMn5ulOm8NZA20qga/l19OJZFhi0nbuT8VO2Dn9SdBfdBt uJOnL/RuDLoZcajLmeW64gWuqPYSDTU4soKUeBsbViXYRiGY5LOWghUMR4gFbFqNFzon CUPgvE9EspSPMhoP5mfHGaXp+YjeeVE3hKyN3k+BK8xHsex+lgbn29JFvJQSW3WpjlQP vW+vcNLd3nJwqDFyAsRnhiBpuCo8tOxaX/FhLxvG1ag7EzFE8Z6WDHpGYPTlyDWfSiP5 7dDT3qXZytuDwt58wEx7J4iOjQFo5gv6pKZUVO1SSi00H7wG8RnH4aph6CUrqxX6c3/Y ph/A== X-Gm-Message-State: APf1xPDNvywxjNHyYi5X5lNmSaGnqf8gude+JlG92Xs/GelFg/0vdOBX oKqwTC5TUS4+KA1MA00PtaQ7mg== X-Received: by 10.99.4.197 with SMTP id 188mr7600721pge.359.1519633503200; Mon, 26 Feb 2018 00:25:03 -0800 (PST) Received: from localhost.localdomain (176.122.172.82.16clouds.com. [176.122.172.82]) by smtp.gmail.com with ESMTPSA id o86sm1422706pfi.87.2018.02.26.00.24.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 26 Feb 2018 00:25:02 -0800 (PST) From: Alex Shi To: Marc Zyngier , Will Deacon , Ard Biesheuvel , Catalin Marinas , stable@vger.kernel.org, Christoffer Dall , Paolo Bonzini , =?utf-8?b?UmFkaW0gS3LEjW3DocWZ?= , Russell King , Mark Rutland , Lorenzo Pieralisi , linux-arm-kernel@lists.infradead.org (moderated list:KERNEL VIRTUAL MACHINE (KVM) FOR ARM), kvmarm@lists.cs.columbia.edu (open list:KERNEL VIRTUAL MACHINE (KVM) FOR ARM), kvm@vger.kernel.org (open list:KERNEL VIRTUAL MACHINE (KVM)), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 32/52] arm/arm64: KVM: Add PSCI_VERSION helper Date: Mon, 26 Feb 2018 16:20:06 +0800 Message-Id: <1519633227-29832-33-git-send-email-alex.shi@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1519633227-29832-1-git-send-email-alex.shi@linaro.org> References: <1519633227-29832-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 Conflicts: mv change form virt/kvm/arm/psci.c to arch/arm/kvm/psci.c --- 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