Received: by 10.223.176.5 with SMTP id f5csp687131wra; Fri, 2 Feb 2018 04:35:16 -0800 (PST) X-Google-Smtp-Source: AH8x224z4tYGRS/IKqmnefiV+hWz8walBiNLnOe8D02ETYNOGJ2youjfWpuYLEYmiJxN7PWqm2XX X-Received: by 10.101.83.195 with SMTP id z3mr31915390pgr.133.1517574915999; Fri, 02 Feb 2018 04:35:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517574915; cv=none; d=google.com; s=arc-20160816; b=kZcf3OjqK1NlRW31JORKJtsgGC3/4N6GxbOwv4X0UiC/SJqhH7Kn+SvyrVdWDtrdvd gy2/O9fl7kgqr7eBd46NF1+2DnmGSnuIN2AAqGklYvJApdCwmMaMs+qsZuRbBLMxP1wz HeuzNk2eSThzL/LK5E/cHlwZb9r+2WAygNgLgkV9ubT5Zwdi6NhKgTP5kDJGKe26NSw9 mmrIRwuxzAL2tS0oN6qic2palYdX5NpTzS/LqxgRjNMGtde42NOUD7wkbwsRqn4L8g1D dvXd6BEiAIVlgjRqMWgLDNuVQ5IY7JHoBCnwjx8r5jcdwXbebl/4Fsi0Zszw+266PyhB BcWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=qdr59jZU8dR7evBI2G1bzA7dT+kSqhBjGzIfTSnv+S8=; b=IstRPR5R9C7ogreDjmcyi/Gi/yuH8QIiKPpyM2MsYArvnEg7lLBssvXq6ekBxqO/08 q4SDypWMGyJbjegv/75gTbTUWW+tv2l83nZBVe5xWhcupT4hsDppOWnN6KGx4VzdbLBD RyAZa6mrKPl9HoPZqXN+1F50xXGA2EUR13oD1NZkx0e3wQUmgosoa/YNwCoQQCoctVCC mPK1JkrZ77yJDXDIpxChyALYm2alnfk5nD5yPL382NQZZ35wdUeZ+azIms+783xL+W2N aJmmu3wvEoohhEMoqcMuqWxD6P5IasOAj5UYKREBd1/LnTo/miNaB0alGr8xpWTqVLqv kapA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Jg/1AViX; 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 x10-v6si1725824plm.261.2018.02.02.04.35.01; Fri, 02 Feb 2018 04:35:15 -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=Jg/1AViX; 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 S1751702AbeBBMdg (ORCPT + 99 others); Fri, 2 Feb 2018 07:33:36 -0500 Received: from mail-wm0-f67.google.com ([74.125.82.67]:40568 "EHLO mail-wm0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751416AbeBBMdR (ORCPT ); Fri, 2 Feb 2018 07:33:17 -0500 Received: by mail-wm0-f67.google.com with SMTP id v123so12036712wmd.5 for ; Fri, 02 Feb 2018 04:33:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qdr59jZU8dR7evBI2G1bzA7dT+kSqhBjGzIfTSnv+S8=; b=Jg/1AViXDUQVoTBeTa4oDvlYsreZLN3pSjW5QfYjgdK4mOIkY47wtwyyyQ/5KsGceC +QU4QLatqbUeIKyiP2UsclqgFRwPzue7W3CHQOi8fFBAVfRt/UYl7sVp2v3QrrUnEuz9 sFohkH+9nKijdtatCj6CO1EuUlucTNN54jnzQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=qdr59jZU8dR7evBI2G1bzA7dT+kSqhBjGzIfTSnv+S8=; b=J1OoeKPIYQwih0oK3M+6SmDbLfsobwFMwKZvaTNgRdRDUvkR/7keH5Ar3awDokjtnE YH83tYDj7VPvo7PPRpBQlBOsxFTvEGDMjMmKnh4k/BxisG1Q90knGOoORmv/wcx55FsA a1S0J46HiqLzHQyBkgyDYwRWPO4HPv5/1+zSpEsh8cQ7fZrlBoy4iR+oci3X9fKo1FRP JsimR7DWW7LhlQCNAQ4Z6Cnl9o5oseFdorfkeqcPxFWg7R+sImbPytJdZbYd50b+qr/c cMSeM3IXWjPZCsVtHcjkPQeXMjwrsUTBfZMm6qnHJSZoO+VKHfvkzJI/wpPV2leS5fP+ 3v1A== X-Gm-Message-State: AKwxytfMFgUZmJacmCbl9ehV5ptDJ5wP0k5FI0WTS+DMiQTffzyLWknI 9XV0Xt/cHQb40g/5rWVaOJp5CA== X-Received: by 10.80.184.230 with SMTP id l93mr29670781ede.26.1517574795874; Fri, 02 Feb 2018 04:33:15 -0800 (PST) Received: from localhost (x50d2404e.cust.hiper.dk. [80.210.64.78]) by smtp.gmail.com with ESMTPSA id y5sm1722915ede.71.2018.02.02.04.33.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 02 Feb 2018 04:33:14 -0800 (PST) Date: Fri, 2 Feb 2018 13:33:14 +0100 From: Christoffer Dall To: Marc Zyngier Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, Catalin Marinas , Will Deacon , Peter Maydell , Lorenzo Pieralisi , Mark Rutland , Robin Murphy , Ard Biesheuvel , Andrew Jones , Hanjun Guo , Jayachandran C , Jon Masters , Russell King - ARM Linux Subject: Re: [PATCH v3 05/18] arm/arm64: KVM: Add PSCI_VERSION helper Message-ID: <20180202123314.GH21802@cbox> References: <20180201114657.7323-1-marc.zyngier@arm.com> <20180201114657.7323-6-marc.zyngier@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180201114657.7323-6-marc.zyngier@arm.com> User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 01, 2018 at 11:46:44AM +0000, Marc Zyngier wrote: > 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 > Signed-off-by: Marc Zyngier > --- > 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(-) > > diff --git a/include/kvm/arm_psci.h b/include/kvm/arm_psci.h > index 2042bb909474..5659343580a3 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 760e52a9640f..b3bcabe380da 100644 > --- 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 > diff --git a/virt/kvm/arm/psci.c b/virt/kvm/arm/psci.c > index b322e46fd142..999f94d6bb98 100644 > --- 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_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: > -- > 2.14.2 >